From 1957fc53be0f23bbd875859c7d71bb481f15b286 Mon Sep 17 00:00:00 2001 From: carnivoroussociety <38839485+carnivoroussociety@users.noreply.github.com> Date: Fri, 13 Aug 2021 22:39:16 +1000 Subject: [PATCH] Tweaked next/prev weapon behavior underwater --- source/games/blood/src/weapon.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 298f3e657..7f1078e08 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -2091,6 +2091,7 @@ void WeaponProcess(PLAYER *pPlayer) { return; break; } + const int prevNewWeaponVal = pPlayer->input.getNewWeapon(); // used to fix scroll issue for banned weapons if (VanillaMode()) { if (pPlayer->nextWeapon) @@ -2202,6 +2203,25 @@ 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 + { + const bool next = prevNewWeaponVal == WeaponSel_Next, prev = prevNewWeaponVal == WeaponSel_Prev; + if ((next || prev) && !VanillaMode() && !DemoRecordStatus()) // 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); + if (!BannedUnderwater(tmpPlayer.curWeapon)) // if new weapon is not a banned weapon, set to new current weapon + { + pPlayer->newWeapon = tmpPlayer.curWeapon; + pPlayer->weaponMode[pPlayer->newWeapon] = 0; + break; + } + } + } + } if (pPlayer->newWeapon == 6) { if (pPlayer->curWeapon == 6)