diff options
author | Fabian Greffrath | 2015-01-20 06:58:34 +0100 |
---|---|---|
committer | Fabian Greffrath | 2015-01-20 06:58:34 +0100 |
commit | d0bb59a02c17dddef40f8f84364792aaf9c75771 (patch) | |
tree | 31ac43528c5f32f072ddbfa728e372b856aee419 /src/strife | |
parent | ad816c1bc28ab81ddb892ff878f65969bddd9764 (diff) | |
parent | e1f905cd3c481d561f2faf8c80e800cffe4d2035 (diff) | |
download | chocolate-doom-d0bb59a02c17dddef40f8f84364792aaf9c75771.tar.gz chocolate-doom-d0bb59a02c17dddef40f8f84364792aaf9c75771.tar.bz2 chocolate-doom-d0bb59a02c17dddef40f8f84364792aaf9c75771.zip |
Merge branch 'master' of https://github.com/chocolate-doom/chocolate-doom into hexndemo
Diffstat (limited to 'src/strife')
-rw-r--r-- | src/strife/g_game.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/strife/g_game.c b/src/strife/g_game.c index 8d074a1f..e0c0ae27 100644 --- a/src/strife/g_game.c +++ b/src/strife/g_game.c @@ -289,7 +289,7 @@ static boolean WeaponSelectable(weapontype_t weapon) static int G_NextWeapon(int direction) { weapontype_t weapon; - int i; + int start_i, i; // Find index in the table. @@ -311,12 +311,12 @@ static int G_NextWeapon(int direction) } // Switch weapon. - + start_i = i; do { i += direction; i = (i + arrlen(weapon_order_table)) % arrlen(weapon_order_table); - } while (!WeaponSelectable(weapon_order_table[i].weapon)); + } while (i != start_i && !WeaponSelectable(weapon_order_table[i].weapon)); return weapon_order_table[i].weapon_num; } @@ -511,12 +511,11 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic) // next_weapon variable is set to change weapons when // we generate a ticcmd. Choose a new weapon. - if (next_weapon != 0) + if (gamestate == GS_LEVEL && next_weapon != 0) { i = G_NextWeapon(next_weapon); cmd->buttons |= BT_CHANGE; cmd->buttons |= i << BT_WEAPONSHIFT; - next_weapon = 0; } else { @@ -535,6 +534,8 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic) } } + next_weapon = 0; + // mouse if (mousebuttons[mousebforward]) { |