mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 11:30:44 +00:00
Tweaked next/prev weapon behavior underwater
This commit is contained in:
parent
5aa27bad3b
commit
1957fc53be
1 changed files with 20 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue