diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-16 19:41:26 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-16 19:41:26 +0100 |
commit | a8c9c04ec24a71f076891bdc1c26860db7c5c9c3 (patch) | |
tree | a5dc6905f6987c4d5fcd27276f7fc338f2af8f0b /src/ft_key_loop.c | |
parent | Cleaner memdels (diff) | |
parent | Merge branch 'master' into back-to-pthread (diff) | |
download | 42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.gz 42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.bz2 42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.xz 42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.tar.zst 42-cub3d-a8c9c04ec24a71f076891bdc1c26860db7c5c9c3.zip |
Merge branch 'back-to-pthread'
Diffstat (limited to 'src/ft_key_loop.c')
-rw-r--r-- | src/ft_key_loop.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c index c16655e..74ff775 100644 --- a/src/ft_key_loop.c +++ b/src/ft_key_loop.c @@ -82,20 +82,23 @@ 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++; } - if (cl->key_input[0] != -1) - ft_draw_scene(cl); + ft_draw_scene(cl); return (0); } |