diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-29 17:38:46 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-29 17:38:46 +0200 |
commit | a07392fc219afc45000201d2f495694ad9b82763 (patch) | |
tree | 0eb3f2b9003ad7ceae4692242e46de56e55053b0 /src/ft_init_sprites.c | |
parent | Removed skybox shit (diff) | |
parent | Norm (diff) | |
download | 42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.gz 42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.bz2 42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.xz 42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.tar.zst 42-cub3d-a07392fc219afc45000201d2f495694ad9b82763.zip |
Merge branch 'fix-details'
Diffstat (limited to 'src/ft_init_sprites.c')
-rw-r--r-- | src/ft_init_sprites.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/src/ft_init_sprites.c b/src/ft_init_sprites.c index 2099089..ee9506f 100644 --- a/src/ft_init_sprites.c +++ b/src/ft_init_sprites.c @@ -16,19 +16,46 @@ #include <stdlib.h> #include <stdint.h> +/* +** cl->sprite[] index summary +** -------------------------- +** 0: sprite 2 - tlist[4] - 4096 +** 1: sprite 3 - tlist[8] - 4096 +** 2: sprite 4 - tlist[9] - 4096 +** 3: sprite 5 - tlist[10] - 4096 +** 4: sprite 6 - tlist[11] - 4096 +** 5: sprite 7 - tlist[12] - 4096 +** 6: sprite 8 - tlist[13] - 4096 +** 7: sprite 9 - tlist[14] - 4096 +** 8: trap - tlist[15] - 512 +** 9: heal - tlist[17] - 64 +** 10: weapon one - tlist[18] - 4 +** 11: weapon two - tlist[19] - 4 +** 12: weapon three - tlist[20] - 4 +*/ + int8_t ft_init_sprites(t_sprite ***sprites) { - uint8_t i; + int8_t i; - if (!(*sprites = (t_sprite**)ft_calloc(8, sizeof(t_sprite*)))) + if (!(*sprites = (t_sprite**)ft_calloc(FT_TOTAL_SPRT, sizeof(t_sprite*)))) return (-1); - i = 0; - while (i < 8) + i = -1; + while (++i < 8) { if (!(*((*sprites) + i) = (t_sprite*)ft_calloc(4096, sizeof(t_sprite)))) return (-1); - i++; + } + 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); } |