aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_key_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-15 15:09:59 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-15 15:09:59 +0100
commit163bed0c8988ff020b746bf96dc01dd2058dc4f9 (patch)
tree724090f6319cc6d0336eb2a5b501bd032599d295 /src/ft_key_loop.c
parentok (diff)
download42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.gz
42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.bz2
42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.xz
42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.tar.zst
42-cub3d-163bed0c8988ff020b746bf96dc01dd2058dc4f9.zip
Footsteps are bav
Diffstat (limited to '')
-rw-r--r--src/ft_key_loop.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c
index 5b6fee4..df97380 100644
--- a/src/ft_key_loop.c
+++ b/src/ft_key_loop.c
@@ -82,15 +82,19 @@ int
while (i < 5 && cl->key_input[i] != -1 && cl->key_input[i] <= 5)
{
cl->key_ptr[cl->key_input[i]](cl);
- ft_collision(old_y, old_x, cl->key_input[i], cl);
- if (cl->mlist.isnlvl)
+ if (cl->key_input[i] >= 0 && cl->key_input[i] <= 3)
{
- if ((uint32_t)cl->plist.pos_x == cl->mlist.nlx &&
- (uint32_t)cl->plist.pos_y == cl->mlist.nly)
+ ft_sfx_footstep(cl);
+ ft_collision(old_y, old_x, cl->key_input[i], cl);
+ if (cl->mlist.isnlvl)
{
- ft_sfx_new_level(cl);
- return ((ft_warp_level(cl->mlist.nlevel_path, cl) < 0) ?
- (ft_exit(FT_RET_FAILED_STRUCTS, cl)) : (0));
+ if ((uint32_t)cl->plist.pos_x == cl->mlist.nlx &&
+ (uint32_t)cl->plist.pos_y == cl->mlist.nly)
+ {
+ ft_sfx_new_level(cl);
+ return ((ft_warp_level(cl->mlist.nlevel_path, cl) < 0) ?
+ (ft_exit(FT_RET_FAILED_STRUCTS, cl)) : (0));
+ }
}
}
i++;