aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_init_lists.c3
-rw-r--r--src/ft_suffer_animation.c5
-rw-r--r--src/ft_warp_level.c23
3 files changed, 29 insertions, 2 deletions
diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c
index 4eccf01..b876e8d 100644
--- a/src/ft_init_lists.c
+++ b/src/ft_init_lists.c
@@ -50,10 +50,10 @@ t_player
plist.dir_y = 0;
plist.plane_x = 0;
plist.plane_y = 0.66;
- plist.life = 100;
plist.has_weapon[0] = 0;
plist.has_weapon[1] = 0;
plist.handles_weapon = -1;
+ plist.life = 100;
plist.fire = 0;
return (plist);
}
@@ -109,5 +109,6 @@ int8_t
if (ft_init_win(&clist->wlist) < 0)
return (-1);
ft_sprintf(clist->fps_count, "fps: 60");
+ clist->isdead = 0;
return (0);
}
diff --git a/src/ft_suffer_animation.c b/src/ft_suffer_animation.c
index 7229769..9ee7882 100644
--- a/src/ft_suffer_animation.c
+++ b/src/ft_suffer_animation.c
@@ -39,6 +39,7 @@ void
cl->plist.life -= FT_TRAP_DAMAGE_AMOUNT;
if (cl->plist.life <= 0)
{
+ cl->isdead = 1;
ft_sfx_death(cl);
ft_death_screen(cl);
}
@@ -74,10 +75,14 @@ void
cl->plist.life -= FT_TRAP_DAMAGE_AMOUNT;
if (cl->plist.life <= 0)
{
+ cl->isdead = 1;
ft_sfx_death(cl);
ft_death_screen(cl);
}
else
+ {
ft_sfx_trap(cl);
+ ft_sfx_pain(cl);
+ }
cl->doicast = 0;
}
diff --git a/src/ft_warp_level.c b/src/ft_warp_level.c
index 6962a1d..4618766 100644
--- a/src/ft_warp_level.c
+++ b/src/ft_warp_level.c
@@ -42,11 +42,32 @@ static void
}
static void
+ ft_player_keepings(t_cub *cl)
+{
+ int8_t tmp_life;
+ uint8_t tmp_has[2];
+ int8_t tmp_handles;
+
+ tmp_life = cl->plist.life;
+ tmp_has[0] = cl->plist.has_weapon[0];
+ tmp_has[1] = cl->plist.has_weapon[1];
+ tmp_handles = cl->plist.handles_weapon;
+ cl->plist = ft_init_player();
+ if (!cl->isdead)
+ cl->plist.life = tmp_life;
+ else
+ cl->isdead = 0;
+ cl->plist.has_weapon[0] = tmp_has[0];
+ cl->plist.has_weapon[1] = tmp_has[1];
+ cl->plist.handles_weapon = tmp_handles;
+}
+
+static void
ft_del_some(t_cub *cl)
{
int8_t i;
- cl->plist = ft_init_player();
+ ft_player_keepings(cl);
cl->f_rgb = ft_init_rgb();
cl->c_rgb = ft_init_rgb();
cl->rlist = ft_init_s_ray();