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/hexen | |
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/hexen')
-rw-r--r-- | src/hexen/g_game.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 4dcd3bd9..4df4cb86 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -451,9 +451,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) // Weapon cycling. Switch to previous or next weapon. // (Disabled when player is a pig). - - if (players[consoleplayer].morphTics == 0 && next_weapon != 0) + if (gamestate == GS_LEVEL + && players[consoleplayer].morphTics == 0 && next_weapon != 0) { + int start_i; + if (players[consoleplayer].pendingweapon == WP_NOCHANGE) { i = players[consoleplayer].readyweapon; @@ -463,9 +465,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) i = players[consoleplayer].pendingweapon; } + // Don't loop forever. + start_i = i; do { - i = (i + next_weapon) % NUMWEAPONS; - } while (!players[consoleplayer].weaponowned[i]); + i = (i + next_weapon + NUMWEAPONS) % NUMWEAPONS; + } while (i != start_i && !players[consoleplayer].weaponowned[i]); cmd->buttons |= BT_CHANGE; cmd->buttons |= i << BT_WEAPONSHIFT; |