diff options
author | salad <salad@saladesk.desktop> | 2020-03-25 15:44:53 +0100 |
---|---|---|
committer | salad <salad@saladesk.desktop> | 2020-03-25 15:44:53 +0100 |
commit | e9458c5d50f43a66d575478a0cbc14d8f6e42baa (patch) | |
tree | a3eab40227257544ab7a9e669f635e29c7549b2f | |
parent | fuck fuck fuck (diff) | |
download | 42-cub3d-e9458c5d50f43a66d575478a0cbc14d8f6e42baa.tar.gz 42-cub3d-e9458c5d50f43a66d575478a0cbc14d8f6e42baa.tar.bz2 42-cub3d-e9458c5d50f43a66d575478a0cbc14d8f6e42baa.tar.xz 42-cub3d-e9458c5d50f43a66d575478a0cbc14d8f6e42baa.tar.zst 42-cub3d-e9458c5d50f43a66d575478a0cbc14d8f6e42baa.zip |
what the fuck les amis
Diffstat (limited to '')
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | inc/cub3d_structs.h | 1 | ||||
-rw-r--r-- | map/map_one.cub | 8 | ||||
-rw-r--r-- | map/map_two.cub | 32 | ||||
-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 | 4 | ||||
-rw-r--r-- | src/ft_init_map.c | 1 | ||||
-rw-r--r-- | src/ft_sort_s_t.c | 32 |
9 files changed, 56 insertions, 28 deletions
@@ -243,7 +243,7 @@ re: fclean all bonus: all #--------------------------------------------------------------------------------------------------# run: all - @./${NAME} "map/map_one.cub" + @./${NAME} "map/map_two.cub" #--------------------------------------------------------------------------------------------------# .PHONY: all clean clean fclean re bonus run default #============================================== EOF ===============================================# diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h index 809963c..df3dade 100644 --- a/inc/cub3d_structs.h +++ b/inc/cub3d_structs.h @@ -199,6 +199,7 @@ typedef struct s_map uint8_t sprite_var; uint8_t weapon_var; int32_t sprite_order[8][4096]; + int32_t st_o[4096]; int32_t traps_nbr; int32_t heals_nbr; int32_t weaps_nbr[3]; diff --git a/map/map_one.cub b/map/map_one.cub index e7e5393..af41f86 100644 --- a/map/map_one.cub +++ b/map/map_one.cub @@ -10,7 +10,7 @@ C ./media/img/tex/wood_ceil.xpm F ./media/img/tex/parquet.xpm S3 ./media/img/sprites/pylon.xpm -S4 ./media/img/sprites/wood_chest.xpm +S4 ./media/img/sprites/hey.xpm T ./media/img/sprites/spikes.xpm @@ -18,10 +18,10 @@ SH 2 1111111 111111111111000001 -100000000+02340001 -10000E000T02340001 100000000002340001 -100100000+00000001 +10000E000002340001 +100000000002340001 +100100000000000001 101100000111000001 111111111111110011 1000001 100001 diff --git a/map/map_two.cub b/map/map_two.cub index 9300699..dcb0b14 100644 --- a/map/map_two.cub +++ b/map/map_two.cub @@ -1,25 +1,29 @@ -R 1280 800 +R 800 800 NO ./media/img/tex/linuz.xpm SO ./media/img/tex/linuz.xpm EA ./media/img/tex/linuz.xpm WE ./media/img/tex/linuz.xpm + + S ./media/img/sprites/pillar.xpm S3 ./media/img/sprites/pillar.xpm S4 ./media/img/sprites/pillar.xpm + + SH 5 -C ./media/img/tex/arrow1.xpm -F ./media/img/tex/arrow2.xpm +C 0,150,150 +F 0,150,150 -111111111111111111111111111111111111 -100000000000000000000000000000000001 -100000000000030000000000000000000001 -100000000000000000000000000000000001 -10000000000002020202000W000000000001 -100000000000000000000000000000000001 -100000000000040000000000000000000001 -100000000000000000000000000000000001 -100000000000000000000000000000000001 -100000000000000000000000000000000001 -111111111111111111111111111111111111 +11111111111111111111111111111 +10000000000000000000000000001 +10000000000000000000000000001 +10000023400000000000000000001 +10000023400W00000000000000001 +10000023400000000000000000001 +10000000000000000000000000001 +10000000000000000000000000001 +10000000000000000000000000001 +10000000000000000000000000001 +11111111111111111111111111111 diff --git a/minilibx_linux/Makefile.gen b/minilibx_linux/Makefile.gen index f93b892..798f98c 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 323906a..6503980 100644 --- a/src/ft_draw_sprite_extra.c +++ b/src/ft_draw_sprite_extra.c @@ -61,8 +61,8 @@ void { while (i < cl->mlist.sprite_nbr[j]) { - sprite = cl->sprites[j][cl->mlist.sprite_order[j][i]]; - sprite.current_sprite = (j == 0) ? 4 : j + 7; + sprite = cl->sprites[cl->mlist.st_o[j]][cl->mlist.sprite_order[cl->mlist.st_o[j]][i]]; + sprite.current_sprite = (cl->mlist.st_o[j] == 0) ? 4 : cl->mlist.st_o[j] + 7; sprite.spritey = sprite.s_pos_x - (cl->plist.pos_x - 0.5); sprite.spritex = sprite.s_pos_y - (cl->plist.pos_y - 0.5); ft_init_sprite(cl, &sprite); diff --git a/src/ft_init_map.c b/src/ft_init_map.c index 9ddbb47..d252f2e 100644 --- a/src/ft_init_map.c +++ b/src/ft_init_map.c @@ -66,6 +66,7 @@ int8_t mlist->topsp = 0; ft_bzero(mlist->sprite_nbr, 4096); ft_bzero(mlist->sprite_order, 4096); + ft_bzero(mlist->st_o, 4096); ft_bzero(mlist->traps_order, 512); ft_bzero(mlist->heals_order, 64); mlist->weaps_nbr[0] = 0; diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index f015abc..702d5e6 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -20,18 +20,40 @@ /*clearpilled*/ void +ft_init_st(int32_t st_o[8]) +{ + int8_t i; + + i = -1; + while (++i < 3) + st_o[i] = i; +} + +void ft_sort_s_t(t_cub *cl, float dist_tab[8][4096]) { - uint16_t i; + int16_t i; int32_t tmp; + float *tmp_i; - i = 0; - while (i < cl->mlist.sprite_var) + i = -1; + ft_init_st(cl->mlist.st_o); + tmp_i = ft_calloc(sizeof(int32_t), 4096); + while (++i < cl->mlist.sprite_var) { if (dist_tab[i][0] < dist_tab[i + 1][0]) { - i = 0; + tmp = cl->mlist.st_o[i]; + cl->mlist.st_o[i] = cl->mlist.st_o[i + 1]; + cl->mlist.st_o[i + 1] = tmp; + ft_memcpy(tmp_i, dist_tab[i], 4096); + ft_memcpy(dist_tab[i], dist_tab[i + 1], 4096); + ft_memcpy(dist_tab[i + 1], tmp_i, 4096); + i = -1; } - i++; } + i = -1; + while (++i < 3) + printf("%d\n", cl->mlist.st_o[i]); + puts("-------------------------"); } |