From 74e95f3f2b632798d08be675f7fd7abb53303239 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 15 Oct 2011 17:39:33 +0000 Subject: Add weapon cycling keys for Hexen. Subversion-branch: /branches/v2-branch Subversion-revision: 2431 --- src/hexen/g_game.c | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 5dcfb478..b1d9e6b1 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -144,6 +144,8 @@ static int *weapon_keys[] = &key_weapon4, }; +static int next_weapon = 0; + #define SLOWTURNTICS 6 #define NUMKEYS 256 @@ -457,18 +459,44 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) dclicks = 0; // clear double clicks if hit use button } - for (i=0; ibuttons |= BT_CHANGE; + cmd->buttons |= i << BT_WEAPONSHIFT; + } + else + { + for (i=0; ibuttons |= BT_CHANGE; - cmd->buttons |= i<buttons |= BT_CHANGE; + cmd->buttons |= i<data2); } + if (ev->type == ev_keydown && ev->data1 == key_prevweapon) + { + next_weapon = -1; + } + else if (ev->type == ev_keydown && ev->data1 == key_nextweapon) + { + next_weapon = 1; + } + switch (ev->type) { case ev_keydown: -- cgit v1.2.3