diff options
Diffstat (limited to '')
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 1 | ||||
-rw-r--r-- | map/map_test.cub | 27 | ||||
-rw-r--r-- | minilibx_linux/Makefile.gen | 2 | ||||
-rw-r--r-- | minilibx_linux/test/Makefile.gen | 2 | ||||
-rw-r--r-- | src/ft_draw_sprite_extra.c | 2 | ||||
-rw-r--r-- | src/ft_get_sprite_spawns.c | 2 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 23 |
8 files changed, 51 insertions, 10 deletions
@@ -240,7 +240,7 @@ re: fclean all bonus: all #--------------------------------------------------------------------------------------------------# run: all - @./${NAME} "map/map_one.cub" + @./${NAME} "map/map_test.cub" #--------------------------------------------------------------------------------------------------# .PHONY: all clean clean fclean re bonus run default #============================================== EOF ===============================================# diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index b3cd636..639710f 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -108,6 +108,7 @@ typedef struct s_sprite uint64_t s_pos_y; double spritex; double spritey; + int8_t exists; int32_t spriteheight; int32_t spritewidth; int32_t drawstartx; diff --git a/map/map_test.cub b/map/map_test.cub new file mode 100644 index 0000000..53564f0 --- /dev/null +++ b/map/map_test.cub @@ -0,0 +1,27 @@ +R 800 600 + +NO ./media/img/tex/wood_wall_1_small.xpm +SO ./media/img/tex/wood_wall_1_small.xpm +EA ./media/img/tex/wood_wall_1_small.xpm +WE ./media/img/tex/wood_wall_1_small.xpm + +C ./media/img/tex/wood_ceil_small.xpm +F ./media/img/tex/parquet_small.xpm + +S ./media/img/sprites/pillar.xpm +S3 ./media/img/sprites/pylon.xpm +S4 ./media/img/sprites/larry.xpm +S5 ./media/img/sprites/linus.xpm +S6 ./media/img/sprites/linus.xpm + +T ./media/img/sprites/spikes.xpm + +SH 2 + +1111111111111111111 +1000000000000000001 +10000023456000T0001 +100E0023456000T0001 +10000023456000T0001 +1000000000000000001 +1111111111111111111 diff --git a/minilibx_linux/Makefile.gen b/minilibx_linux/Makefile.gen index 5e2b3c1..e5e2ce0 100644 --- a/minilibx_linux/Makefile.gen +++ b/minilibx_linux/Makefile.gen @@ -1,5 +1,5 @@ INC=/usr/include -HT=x86_64 +HT=Linux 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 c13f70c..7c67f50 100644 --- a/minilibx_linux/test/Makefile.gen +++ b/minilibx_linux/test/Makefile.gen @@ -1,5 +1,5 @@ INC=/usr/include -HT=x86_64 +HT=Linux DOCP=do_cp diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index 5133231..287d46f 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -73,7 +73,7 @@ void ft_sort_sprites(cl, -1, -1); while (++j < FT_TOTAL_SPRT) { - while (++i < cl->mlist.sprite_nbr[j]) + while (++i < cl->mlist.sprite_nbr[j]) { sprite = cl->sprites[cl->mlist.st_o[j]][cl->mlist.sprite_order[ diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c index 047523a..0dc0f7a 100644 --- a/src/ft_get_sprite_spawns.c +++ b/src/ft_get_sprite_spawns.c @@ -73,6 +73,7 @@ int8_t if (clist->mlist.map[y][x] == c) { clist->mlist.sprite_nbr[s_n]++; + clist->sprites[s_n][i].exists = 1; clist->sprites[s_n][i].s_pos_x = x; clist->sprites[s_n][i].s_pos_y = y; i++; @@ -105,6 +106,7 @@ void if (ft_ischarset("2", clist->mlist.map[y][x])) { clist->mlist.sprite_nbr[0]++; + clist->sprites[0][i].exists = 1; clist->sprites[0][i].s_pos_x = x; clist->sprites[0][i].s_pos_y = y; i++; diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index 8b70fe5..8b05f07 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -34,16 +34,28 @@ float } static void - ft_init_st(int32_t *st_o) + ft_init_st(t_cub *cl, int32_t *st_o) { int8_t i; + int8_t j; i = 0; + j = 0; while (i < FT_TOTAL_SPRT) { - st_o[i] = i; - i++; + if (cl->sprites[i][0].exists == 1) + { + st_o[j] = i; + j++; + i++; + } + else + i++; } + i = -1; + ft_printf("------------------------------\n"); + while (++i < FT_TOTAL_SPRT + 1) + ft_printf("%d\n", cl->mlist.st_o[i]); } static void @@ -64,11 +76,10 @@ void int32_t tmp; i = -1; - ft_init_st(cl->mlist.st_o); + ft_init_st(cl, cl->mlist.st_o); while (++i < FT_TOTAL_SPRT) { - if (dist_tab[i][0] - && dist_tab[i][0] < dist_tab[i + 1][0]) + if (dist_tab[i][0] < dist_tab[i + 1][0]) { tmp = cl->mlist.st_o[i]; cl->mlist.st_o[i] = cl->mlist.st_o[i + 1]; |