From e375c799ce4c970cd213ae3a2762562fd0d74bb9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 9 Mar 2021 09:30:27 +0100 Subject: [PATCH] - CommonLoon102's weapon fixes from NBlood: Fix bug when switching to another weapon from the spray while firing with primary fire won't switch to the new weapon. And telling Caleb not to put away his lighter if the spray is being switched to TNT. Do not put away lighter after TNT is thrown if while throwing the weapon was switched already to spray. Do not put away lighter if TNT was selected while throwing a spray can. Fix next/prev weapon --- source/games/blood/src/weapon.cpp | 91 ++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 14 deletions(-) diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index df6ca7a06..3dd797e90 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -665,7 +665,20 @@ void WeaponLower(PLAYER *pPlayer) switch (prevState) { case 1: - StartQAV(pPlayer, 7, -1, 0); + if (VanillaMode()) + { + StartQAV(pPlayer, 7, -1, 0); + } + else + { + if (pPlayer->newWeapon == 6) + { + pPlayer->weaponState = 2; + StartQAV(pPlayer, 11, -1, 0); + WeaponRaise(pPlayer); + return; + } + } break; case 2: pPlayer->weaponState = 1; @@ -674,8 +687,24 @@ void WeaponLower(PLAYER *pPlayer) case 4: pPlayer->weaponState = 1; StartQAV(pPlayer, 11, -1, 0); - pPlayer->newWeapon = 0; - WeaponLower(pPlayer); + if (VanillaMode()) + { + pPlayer->newWeapon = 0; + WeaponLower(pPlayer); + } + else + { + if (pPlayer->newWeapon == 6) + { + pPlayer->weaponState = 2; + StartQAV(pPlayer, 11, -1, 0); + return; + } + else + { + WeaponLower(pPlayer); + } + } break; case 3: if (pPlayer->newWeapon == 6) @@ -703,7 +732,20 @@ void WeaponLower(PLAYER *pPlayer) switch (prevState) { case 1: - StartQAV(pPlayer, 7, -1, 0); + if (VanillaMode()) + { + StartQAV(pPlayer, 7, -1, 0); + } + else + { + if (pPlayer->newWeapon == 7) + { + pPlayer->weaponState = 2; + StartQAV(pPlayer, 17, -1, 0); + WeaponRaise(pPlayer); + return; + } + } break; case 2: WeaponRaise(pPlayer); @@ -2061,32 +2103,44 @@ void WeaponProcess(PLAYER *pPlayer) { if (pPlayer->input.getNewWeapon() == WeaponSel_Next) { pPlayer->input.setNewWeapon(0); - pPlayer->weaponState = 0; + if (VanillaMode()) + { + pPlayer->weaponState = 0; + } pPlayer->nextWeapon = 0; int t; char weapon = WeaponFindNext(pPlayer, &t, 1); pPlayer->weaponMode[weapon] = t; - if (pPlayer->curWeapon) + if (VanillaMode()) { - WeaponLower(pPlayer); - pPlayer->nextWeapon = weapon; - return; + if (pPlayer->curWeapon) + { + WeaponLower(pPlayer); + pPlayer->nextWeapon = weapon; + return; + } } pPlayer->newWeapon = weapon; } else if (pPlayer->input.getNewWeapon() == WeaponSel_Prev) { pPlayer->input.setNewWeapon(0); - pPlayer->weaponState = 0; + if (VanillaMode()) + { + pPlayer->weaponState = 0; + } pPlayer->nextWeapon = 0; int t; char weapon = WeaponFindNext(pPlayer, &t, 0); pPlayer->weaponMode[weapon] = t; - if (pPlayer->curWeapon) + if (VanillaMode()) { - WeaponLower(pPlayer); - pPlayer->nextWeapon = weapon; - return; + if (pPlayer->curWeapon) + { + WeaponLower(pPlayer); + pPlayer->nextWeapon = weapon; + return; + } } pPlayer->newWeapon = weapon; } @@ -2122,6 +2176,15 @@ void WeaponProcess(PLAYER *pPlayer) { } pPlayer->newWeapon = weapon; } + if (!VanillaMode()) + { + if (pPlayer->nextWeapon) + { + sfxKill3DSound(pPlayer->pSprite, -1, 441); + pPlayer->newWeapon = pPlayer->nextWeapon; + pPlayer->nextWeapon = 0; + } + } if (pPlayer->weaponState == -1) { pPlayer->weaponState = 0;