- fixed weapon cycling in Exhumed.

The sword was checked for ammo (and failed) and wraparound was not handled.
Fixes #193
This commit is contained in:
Christoph Oelckers 2020-11-22 18:59:59 +01:00
parent 921a7a7166
commit 143dd3d2cf

View file

@ -402,16 +402,17 @@ void GameInterface::Ticker()
if (weap2 == WeaponSel_Next) if (weap2 == WeaponSel_Next)
{ {
auto newWeap = currWeap == 6 ? 0 : currWeap + 1; auto newWeap = currWeap == 6 ? 0 : currWeap + 1;
while (!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)) || (nPlayerWeapons[nLocalPlayer] & (1 << newWeap) && PlayerList[nLocalPlayer].nAmmo[newWeap] == 0)) while (newWeap != 0 && (!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)) || (nPlayerWeapons[nLocalPlayer] & (1 << newWeap) && PlayerList[nLocalPlayer].nAmmo[newWeap] == 0)))
{ {
newWeap++; newWeap++;
if (newWeap > 6) newWeap = 0;
} }
localInput.setNewWeapon(newWeap + 1); localInput.setNewWeapon(newWeap + 1);
} }
else if (weap2 == WeaponSel_Prev) else if (weap2 == WeaponSel_Prev)
{ {
auto newWeap = currWeap == 0 ? 6 : currWeap - 1; auto newWeap = currWeap == 0 ? 6 : currWeap - 1;
while (!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)) || (nPlayerWeapons[nLocalPlayer] & (1 << newWeap) && PlayerList[nLocalPlayer].nAmmo[newWeap] == 0)) while (newWeap != 0 && ((!(nPlayerWeapons[nLocalPlayer] & (1 << newWeap)) || (nPlayerWeapons[nLocalPlayer] & (1 << newWeap) && PlayerList[nLocalPlayer].nAmmo[newWeap] == 0))))
{ {
newWeap--; newWeap--;
} }