diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_init_sprites.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/ft_init_sprites.c b/src/ft_init_sprites.c index 2099089..1a23c26 100644 --- a/src/ft_init_sprites.c +++ b/src/ft_init_sprites.c @@ -16,19 +16,38 @@ #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); return (0); } |