aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_key_events.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 22:13:50 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-19 22:13:50 +0100
commitcccc0c25b903599c081e3216b4fad1b3c7507b28 (patch)
treecf3292367f16eebe5f1c6cf7445978f095e4eb8f /src/ft_key_events.c
parentThe og OOP (diff)
download42-cub3d-cccc0c25b903599c081e3216b4fad1b3c7507b28.tar.gz
42-cub3d-cccc0c25b903599c081e3216b4fad1b3c7507b28.tar.bz2
42-cub3d-cccc0c25b903599c081e3216b4fad1b3c7507b28.tar.xz
42-cub3d-cccc0c25b903599c081e3216b4fad1b3c7507b28.tar.zst
42-cub3d-cccc0c25b903599c081e3216b4fad1b3c7507b28.zip
SoundsGoodMan
Diffstat (limited to 'src/ft_key_events.c')
-rw-r--r--src/ft_key_events.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index edacc42..52ef477 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -10,7 +10,6 @@
/* */
/* ************************************************************************** */
-#include <libft.h>
#include <cub3d.h>
#include <stdlib.h>
#include <stdint.h>
@@ -38,6 +37,12 @@ int
return (ft_f1_key(clist));
else if (keycode == FT_SPC_KEY && clist->plist.handles_weapon > -1)
return (ft_space_key(clist));
+ else if (keycode == FT_ONE_KEY && clist->plist.fire == 0
+ && clist->plist.has_weapon[0] == 1 && clist->plist.handles_weapon != 0)
+ return (ft_switch_weap_one(clist));
+ else if (keycode == FT_TWO_KEY && clist->plist.fire == 0
+ && clist->plist.has_weapon[1] == 1 && clist->plist.handles_weapon != 2)
+ return (ft_switch_weap_two(clist));
ft_insert_key(keycode, clist);
return (0);
}