aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-28 16:46:40 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-28 16:46:40 +0100
commitb3aecb150f55ebc9dde7c1b09559d1566e9e92a6 (patch)
treefec17255ec594ddfb6f98121d987ada32461db06
parentnormed (diff)
download42-cub3d-b3aecb150f55ebc9dde7c1b09559d1566e9e92a6.tar.gz
42-cub3d-b3aecb150f55ebc9dde7c1b09559d1566e9e92a6.tar.bz2
42-cub3d-b3aecb150f55ebc9dde7c1b09559d1566e9e92a6.tar.xz
42-cub3d-b3aecb150f55ebc9dde7c1b09559d1566e9e92a6.tar.zst
42-cub3d-b3aecb150f55ebc9dde7c1b09559d1566e9e92a6.zip
All in sprites
-rw-r--r--Makefile14
-rw-r--r--inc/cub3d_defines.h2
-rw-r--r--inc/cub3d_structs.h7
-rw-r--r--minilibx_linux/Makefile.gen2
-rw-r--r--minilibx_linux/test/Makefile.gen2
-rw-r--r--src/ft_del_sprites_lists.c7
-rw-r--r--src/ft_draw_sprite_extra.c6
-rw-r--r--src/ft_find_item.c11
-rw-r--r--src/ft_get_spawns.c6
-rw-r--r--src/ft_get_sprite_spawns.c13
-rw-r--r--src/ft_init_lists.c2
-rw-r--r--src/ft_init_map.c7
-rw-r--r--src/ft_init_sprites.c8
-rw-r--r--src/ft_raycasting.c4
-rw-r--r--src/ft_warp_level.c2
15 files changed, 46 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index e408802..1c6c696 100644
--- a/Makefile
+++ b/Makefile
@@ -103,17 +103,17 @@ SRCS_NAME += ft_death_screen.c
SRCS_NAME += ft_death_hooks.c
SRCS_NAME += ft_init_sprites.c
SRCS_NAME += ft_get_fps_count.c
-SRCS_NAME += ft_get_heal_spawn.c
-SRCS_NAME += ft_draw_heals.c
-SRCS_NAME += ft_draw_heals_extra.c
+# SRCS_NAME += ft_get_heal_spawn.c
+# SRCS_NAME += ft_draw_heals.c
+# SRCS_NAME += ft_draw_heals_extra.c
SRCS_NAME += ft_find_item.c
SRCS_NAME += ft_tex_weap_init.c
-SRCS_NAME += ft_get_weapon_spawn.c
-SRCS_NAME += ft_draw_weapons.c
-SRCS_NAME += ft_draw_weapons_extra.c
+# SRCS_NAME += ft_get_weapon_spawn.c
+# SRCS_NAME += ft_draw_weapons.c
+# SRCS_NAME += ft_draw_weapons_extra.c
SRCS_NAME += ft_draw_handweap.c
SRCS_NAME += ft_switch_weapons.c
-SRCS_NAME += ft_init_weaps.c
+# SRCS_NAME += ft_init_weaps.c
SRCS_NAME += ft_check_missing_defines.c
SRCS_NAME += ft_check_missing_sfx.c
SRCS_NAME += ft_del_tex.c
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index 7b4d1b8..3cee49a 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -303,6 +303,6 @@ enum
*/
# define FT_PARSE_END_RET 25
-# define FT_TOTAL_SPRT 9
+# define FT_TOTAL_SPRT 13
# endif
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index 639710f..5af18a4 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -205,13 +205,8 @@ typedef struct s_map
size_t mapl_len;
int16_t sprite_nbr[FT_TOTAL_SPRT];
uint8_t sprite_var;
- uint8_t weapon_var;
int32_t sprite_order[FT_TOTAL_SPRT][4096];
int32_t st_o[FT_TOTAL_SPRT + 1];
- int32_t heals_nbr;
- int32_t weaps_nbr[3];
- int32_t heals_order[64];
- int32_t weaps_order[3][1];
size_t line_chk;
size_t map_start;
uint8_t isspawn;
@@ -274,8 +269,6 @@ typedef struct s_cub
struct s_img tweap[6];
struct s_img tnum[12];
struct s_sprite **sprites;
- struct s_sprite heals[64];
- struct s_sprite **weaps;
struct s_sfx sfx[13];
} t_cub;
diff --git a/minilibx_linux/Makefile.gen b/minilibx_linux/Makefile.gen
index e5e2ce0..5e2b3c1 100644
--- a/minilibx_linux/Makefile.gen
+++ b/minilibx_linux/Makefile.gen
@@ -1,5 +1,5 @@
INC=/usr/include
-HT=Linux
+HT=x86_64
DOCP=do_cp
##
## Makefile for MiniLibX in /home/boulon/work/c/raytraceur/minilibx
diff --git a/minilibx_linux/test/Makefile.gen b/minilibx_linux/test/Makefile.gen
index 7c67f50..c13f70c 100644
--- a/minilibx_linux/test/Makefile.gen
+++ b/minilibx_linux/test/Makefile.gen
@@ -1,5 +1,5 @@
INC=/usr/include
-HT=Linux
+HT=x86_64
DOCP=do_cp
diff --git a/src/ft_del_sprites_lists.c b/src/ft_del_sprites_lists.c
index 613ac82..6a1a662 100644
--- a/src/ft_del_sprites_lists.c
+++ b/src/ft_del_sprites_lists.c
@@ -26,11 +26,4 @@ void
i++;
}
ft_memdel((void*)&clist->sprites);
- i = 0;
- while (i < 3)
- {
- ft_memdel((void*)&clist->weaps[i]);
- i++;
- }
- ft_memdel((void*)&clist->weaps);
}
diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c
index 57b0b86..c64d2c1 100644
--- a/src/ft_draw_sprite_extra.c
+++ b/src/ft_draw_sprite_extra.c
@@ -58,6 +58,10 @@ static int8_t
return (st_o + 7);
else if (st_o == 8)
return (15);
+ else if (st_o == 9)
+ return (17);
+ else if (st_o >= 10)
+ return (st_o + 8);
return (0);
}
@@ -71,7 +75,7 @@ void
i = -1;
j = -1;
ft_sort_sprites(cl, -1, -1);
- while (++j < 9)
+ while (++j < FT_TOTAL_SPRT)
{
while (++i < cl->mlist.sprite_nbr[cl->mlist.st_o[j]] && cl->mlist.st_o[j] != -1 )
{
diff --git a/src/ft_find_item.c b/src/ft_find_item.c
index 59b4a4f..2d6f272 100644
--- a/src/ft_find_item.c
+++ b/src/ft_find_item.c
@@ -22,7 +22,8 @@ static uint16_t
id = 0;
while (id <= 64)
{
- if (cl->heals[id].s_pos_y == pos_y && cl->heals[id].s_pos_x == pos_x)
+ if (cl->sprites[9][id].s_pos_y == pos_y &&
+ cl->sprites[9][id].s_pos_x == pos_x)
return (id);
id++;
}
@@ -55,8 +56,8 @@ static void
else if (map_char == '#')
weap_id = 2;
cl->mlist.map[(uint64_t)pl->pos_y][(uint64_t)pl->pos_x] = '0';
- cl->weaps[weap_id][0].s_pos_x = 0;
- cl->weaps[weap_id][0].s_pos_y = 0;
+ cl->sprites[10 + weap_id][0].s_pos_x = 0;
+ cl->sprites[10 + weap_id][0].s_pos_y = 0;
pl->has_weapon[weap_id] = 1;
pl->handles_weapon = (weap_id == 0) ? (0) : (pl->handles_weapon);
pl->handles_weapon = (weap_id == 1) ? (2) : (pl->handles_weapon);
@@ -86,8 +87,8 @@ void
ml->map[(uint64_t)pl->pos_y][(uint64_t)pl->pos_x] = '0';
id = ft_fetch_heals_id((uint64_t)pl->pos_y,
(uint64_t)pl->pos_x, cl);
- cl->heals[id].s_pos_x = 0;
- cl->heals[id].s_pos_y = 0;
+ cl->sprites[9][id].s_pos_x = 0;
+ cl->sprites[9][id].s_pos_y = 0;
cl->sfx[5].sfx_play(cl->sfx);
}
ft_weapon_check(map_char, pl, cl);
diff --git a/src/ft_get_spawns.c b/src/ft_get_spawns.c
index 9bd7040..0caedf3 100644
--- a/src/ft_get_spawns.c
+++ b/src/ft_get_spawns.c
@@ -20,7 +20,7 @@ void
ft_get_player_spawn(&cl->plist, cl);
ft_get_sprite_spawn(cl);
/* ft_get_trap_spawn(cl); */
- ft_get_heal_spawn(cl);
- if (cl->isdead == 0)
- ft_get_weapon_spawn(cl);
+ /* ft_get_heal_spawn(cl); */
+ /* if (cl->isdead == 0) */
+ /* ft_get_weapon_spawn(cl); */
}
diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c
index 0dc0f7a..0d20664 100644
--- a/src/ft_get_sprite_spawns.c
+++ b/src/ft_get_sprite_spawns.c
@@ -52,8 +52,19 @@ static void
static int8_t
ft_other_next_sprite(t_cub *cl, int s_n)
{
- if (s_n == 7)
+ if (s_n + 1 == 8)
return (ft_get_next_sprite(cl, 8, 'T', 0));
+ if (s_n + 1 == 9)
+ return (ft_get_next_sprite(cl, 9, '+', 0));
+ if (cl->isdead == 0)
+ {
+ if (s_n + 1 == 10)
+ return (ft_get_next_sprite(cl, 10, '!', 0));
+ if (s_n + 1 == 11)
+ return (ft_get_next_sprite(cl, 11, '@', 0));
+ if (s_n + 1 == 12)
+ return (ft_get_next_sprite(cl, 12, '#', 0));
+ }
return (0);
}
diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c
index 942b9a4..25b8eb6 100644
--- a/src/ft_init_lists.c
+++ b/src/ft_init_lists.c
@@ -115,8 +115,6 @@ int8_t
return (-1);
if (ft_init_sprites(&clist->sprites) < 0)
return (-1);
- if (ft_init_weaps(&clist->weaps) < 0)
- return (-1);
ft_sprintf(clist->fps_count, "fps: 60");
clist->isdead = 0;
clist->moves = 0;
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index 1859afe..a7f82f5 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -64,18 +64,12 @@ int8_t
mlist->nlx = 0;
mlist->nly = 0;
mlist->sprite_var = 0;
- mlist->weapon_var = 0;
mlist->topsp = 0;
ft_bzero(mlist->sprite_nbr, FT_TOTAL_SPRT);
i = -1;
while (++i < FT_TOTAL_SPRT)
ft_bzero(mlist->sprite_order[i], 4096);
ft_bzero(mlist->st_o, FT_TOTAL_SPRT + 1);
- ft_bzero(mlist->heals_order, 64);
- mlist->weaps_nbr[0] = 0;
- mlist->weaps_nbr[1] = 0;
- mlist->weaps_nbr[2] = 0;
- ft_bzero(mlist->weaps_order, 1);
return (0);
}
@@ -102,6 +96,5 @@ int8_t
mlist->isskybox = 0;
mlist->istraps = 0;
mlist->isheals = 0;
- mlist->heals_nbr = 0;
return (ft_init_map_norme(mlist));
}
diff --git a/src/ft_init_sprites.c b/src/ft_init_sprites.c
index 1a23c26..ee9506f 100644
--- a/src/ft_init_sprites.c
+++ b/src/ft_init_sprites.c
@@ -49,5 +49,13 @@ int8_t
}
if (!(*((*sprites) + 8) = (t_sprite*)ft_calloc(512, sizeof(t_sprite))))
return (-1);
+ if (!(*((*sprites) + 9) = (t_sprite*)ft_calloc(64, sizeof(t_sprite))))
+ return (-1);
+ i = 9;
+ while (++i < 13)
+ {
+ if (!(*((*sprites) + i) = (t_sprite*)ft_calloc(4, sizeof(t_sprite))))
+ return (-1);
+ }
return (0);
}
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index 0a1acac..f9a0e45 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -107,9 +107,9 @@ void
pthread_join(tid[0], 0x0);
pthread_join(tid[1], 0x0);
ft_calc_sprite(cl);
- ft_calc_heal(cl);
+ /* ft_calc_heal(cl); */
/* ft_calc_trap(cl); */
- ft_calc_weaps(cl);
+ /* ft_calc_weaps(cl); */
if (cl->plist.handles_weapon > -1)
ft_draw_handweap(cl);
ft_del_tabs(cl);
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 90bd9f7..f9fac3e 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -60,8 +60,6 @@ static int8_t
ft_del_sprites_lists(cl);
if (ft_init_sprites(&cl->sprites) < 0)
return (-1);
- if (ft_init_weaps(&cl->weaps) < 0)
- return (-1);
if (ft_init_map(&cl->mlist) < 0)
return (-1);
i = 0;