aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_convert_keycode.c1
-rw-r--r--src/ft_find_item.c5
-rw-r--r--src/ft_key_events.c3
-rw-r--r--src/ft_switch_weapons.c8
-rw-r--r--src/ft_tex_weap_init.c2
5 files changed, 17 insertions, 2 deletions
diff --git a/src/ft_convert_keycode.c b/src/ft_convert_keycode.c
index 22e6169..01d315c 100644
--- a/src/ft_convert_keycode.c
+++ b/src/ft_convert_keycode.c
@@ -35,5 +35,6 @@ int32_t
keycode = (tmp_code == FT_SPC_KEY) ? (FT_SPC_KEY) : (keycode);
keycode = (tmp_code == FT_ONE_KEY) ? (FT_ONE_KEY) : (keycode);
keycode = (tmp_code == FT_TWO_KEY) ? (FT_TWO_KEY) : (keycode);
+ keycode = (tmp_code == FT_THREE_KEY) ? (FT_THREE_KEY) : (keycode);
return (keycode);
}
diff --git a/src/ft_find_item.c b/src/ft_find_item.c
index c95fa0a..caeb3f4 100644
--- a/src/ft_find_item.c
+++ b/src/ft_find_item.c
@@ -45,8 +45,9 @@ static void
cl->weaps[weap_id][0].s_pos_x = 0;
cl->weaps[weap_id][0].s_pos_y = 0;
pl->has_weapon[weap_id] = 1;
- pl->handles_weapon = (weap_id == 1) ? (2) : (weap_id);
- pl->handles_weapon = (weap_id == 2) ? (4) : (weap_id);
+ pl->handles_weapon = (weap_id == 0) ? (0) : (pl->handles_weapon);
+ pl->handles_weapon = (weap_id == 1) ? (2) : (pl->handles_weapon);
+ pl->handles_weapon = (weap_id == 2) ? (4) : (pl->handles_weapon);
if (weap_id == 0)
cl->sfx[6].sfx_play(cl->sfx);
else if (weap_id == 1)
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index 52ef477..8ea5b90 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -43,6 +43,9 @@ int
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));
+ else if (keycode == FT_THREE_KEY && clist->plist.fire == 0
+ && clist->plist.has_weapon[2] == 1 && clist->plist.handles_weapon != 4)
+ return (ft_switch_weap_three(clist));
ft_insert_key(keycode, clist);
return (0);
}
diff --git a/src/ft_switch_weapons.c b/src/ft_switch_weapons.c
index 186f7be..c936ed6 100644
--- a/src/ft_switch_weapons.c
+++ b/src/ft_switch_weapons.c
@@ -28,3 +28,11 @@ int8_t
cl->plist.handles_weapon = 2;
return (0);
}
+
+int8_t
+ ft_switch_weap_three(t_cub *cl)
+{
+ cl->sfx[10].sfx_play(cl->sfx);
+ cl->plist.handles_weapon = 4;
+ return (0);
+}
diff --git a/src/ft_tex_weap_init.c b/src/ft_tex_weap_init.c
index ab8ed53..3425fb4 100644
--- a/src/ft_tex_weap_init.c
+++ b/src/ft_tex_weap_init.c
@@ -20,6 +20,8 @@
** 1: weapon one fire
** 2: weapon two
** 3: weapon two fire
+** 4: weapon three
+** 5: weapon three fire
*/
void