From c3d03f21da7ca21bfac690ce9d9439ec8e8808aa Mon Sep 17 00:00:00 2001 From: carnivoroussociety <38839485+carnivoroussociety@users.noreply.github.com> Date: Sat, 14 Aug 2021 01:55:24 +1000 Subject: [PATCH] Cleaned underwater next/prev weapon fix --- source/games/blood/src/weapon.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 7f1078e08..a2d5fc950 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -2091,7 +2091,7 @@ void WeaponProcess(PLAYER *pPlayer) { return; break; } - const int prevNewWeaponVal = pPlayer->input.getNewWeapon(); // used to fix scroll issue for banned weapons + const int prevNewWeaponVal = pPlayer->input.getNewWeapon(); // used to fix scroll issue for banned weapons if (VanillaMode()) { if (pPlayer->nextWeapon) @@ -2203,16 +2203,15 @@ void WeaponProcess(PLAYER *pPlayer) { } if (pPlayer->newWeapon) { - if (pPlayer->isUnderwater && BannedUnderwater(pPlayer->newWeapon) && !checkFired6or7(pPlayer)) // skip banned weapons when underwater and using next/prev weapon key inputs + if (pPlayer->isUnderwater && BannedUnderwater(pPlayer->newWeapon) && !checkFired6or7(pPlayer) && !VanillaMode() && !DemoRecordStatus()) // skip banned weapons when underwater and using next/prev weapon key inputs { - const bool next = prevNewWeaponVal == WeaponSel_Next, prev = prevNewWeaponVal == WeaponSel_Prev; - if ((next || prev) && !VanillaMode() && !DemoRecordStatus()) // if player switched weapons + if (prevNewWeaponVal == WeaponSel_Next || prevNewWeaponVal == WeaponSel_Prev) // if player switched weapons { PLAYER tmpPlayer = *pPlayer; tmpPlayer.curWeapon = pPlayer->newWeapon; // set current banned weapon to curweapon so WeaponFindNext() can find the next weapon for (int i = 0; i < 3; i++) // attempt twice to find a new weapon { - tmpPlayer.curWeapon = WeaponFindNext(&tmpPlayer, NULL, next ? 1 : 0); + tmpPlayer.curWeapon = WeaponFindNext(&tmpPlayer, NULL, (char)(prevNewWeaponVal == WeaponSel_Next)); if (!BannedUnderwater(tmpPlayer.curWeapon)) // if new weapon is not a banned weapon, set to new current weapon { pPlayer->newWeapon = tmpPlayer.curWeapon;