diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | map/map_test.cub | 1 | ||||
-rw-r--r-- | src/ft_draw_sprite_extra.c | 6 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 14 |
4 files changed, 12 insertions, 11 deletions
@@ -240,7 +240,7 @@ re: fclean all bonus: all #--------------------------------------------------------------------------------------------------# run: all - @./${NAME} "map/map_test.cub" + @./${NAME} "map/map_one.cub" #--------------------------------------------------------------------------------------------------# .PHONY: all clean clean fclean re bonus run default #============================================== EOF ===============================================# diff --git a/map/map_test.cub b/map/map_test.cub index 53564f0..8adf8a8 100644 --- a/map/map_test.cub +++ b/map/map_test.cub @@ -13,6 +13,7 @@ S3 ./media/img/sprites/pylon.xpm S4 ./media/img/sprites/larry.xpm S5 ./media/img/sprites/linus.xpm S6 ./media/img/sprites/linus.xpm +S7 ./media/img/sprites/linus.xpm T ./media/img/sprites/spikes.xpm diff --git a/src/ft_draw_sprite_extra.c b/src/ft_draw_sprite_extra.c index da7a37b..4599ff4 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -12,6 +12,7 @@ #include <cub3d.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> void @@ -71,10 +72,11 @@ void i = -1; j = -1; ft_sort_sprites(cl, -1, -1); - while (++j < FT_TOTAL_SPRT) + while (++j < 9) { - while (cl->mlist.st_o[j] != -1 && ++i < cl->mlist.sprite_nbr[j]) + while (++i < cl->mlist.sprite_nbr[cl->mlist.st_o[j]] && cl->mlist.st_o[j] != -1 ) { + /* printf("j : %d tab : [%d]\n", j, cl->mlist.st_o[j]); */ sprite = cl->sprites[cl->mlist.st_o[j]][cl->mlist.sprite_order[ cl->mlist.st_o[j]][i]]; diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index 6ce1ff3..0f87e9f 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -34,7 +34,7 @@ float } static void - ft_init_st(t_cub *cl, int32_t *st_o) +ft_init_st(t_cub *cl, int32_t *st_o, float **dist_tab) { int8_t i; int8_t j; @@ -45,17 +45,15 @@ static void { st_o[i] = -1; } - i = 0; - while (i < FT_TOTAL_SPRT) + i = -1; + while (++i < FT_TOTAL_SPRT) { - if (cl->sprites[i]->exists == 1) + if (cl->sprites[i][0].exists == 1) { st_o[j] = i; + ft_memcpy(dist_tab[j], dist_tab[i], 4096); j++; - i++; } - else - i++; } } @@ -77,7 +75,7 @@ void int32_t tmp; i = -1; - ft_init_st(cl, cl->mlist.st_o); + ft_init_st(cl, cl->mlist.st_o, dist_tab); while (++i < FT_TOTAL_SPRT) { if (cl->mlist.st_o[i] != -1 && dist_tab[i][0] < dist_tab[i + 1][0]) |