aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_get_sprite_spawns.c2
-rw-r--r--src/ft_shoot.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/src/ft_get_sprite_spawns.c b/src/ft_get_sprite_spawns.c
index d7b6677..b00ef97 100644
--- a/src/ft_get_sprite_spawns.c
+++ b/src/ft_get_sprite_spawns.c
@@ -23,6 +23,7 @@ void
y = 0;
i = 0;
+ clist->mlist.sprite_nbr[s_n] = 0;
while (clist->mlist.map[++y])
{
while (clist->mlist.map[y][++x])
@@ -54,6 +55,7 @@ void
x = 1;
y = 1;
i = 0;
+ clist->mlist.sprite_nbr[0] = 0;
while (clist->mlist.map[y])
{
while (clist->mlist.map[y][x])
diff --git a/src/ft_shoot.c b/src/ft_shoot.c
index ab820e6..73a9617 100644
--- a/src/ft_shoot.c
+++ b/src/ft_shoot.c
@@ -12,6 +12,20 @@
#include <cub3d.h>
#include <libft.h>
+#include <stdio.h>
+
+static void
+ ft_reset_sprites(t_cub *cl)
+{
+ uint16_t i;
+ uint16_t tmp;
+
+ tmp = cl->mlist.sprite_var;
+ while(++i < tmp + 1)
+ {
+ ft_bzero(cl->sprites[i], sizeof(t_sprite));
+ }
+}
static void
ft_hitscan(t_cub *cl, uint16_t hit)
@@ -35,6 +49,7 @@ static void
{
hit = 1;
cl->mlist.map[cl->rlist.sqx][cl->rlist.sqy] = '0';
+ ft_reset_sprites(cl);
ft_get_sprite_spawn(cl);
}
else if (ft_ischarset("1",