- Exhumed: Replaced all checks for multiplayer levels with a single bool

This should make refactoring easier later.
This commit is contained in:
Christoph Oelckers 2020-09-08 18:07:52 +02:00
parent dbcbdf2bc6
commit 378846c7bd

View file

@ -708,6 +708,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
{ {
int var_48 = 0; int var_48 = 0;
int var_40; int var_40;
bool mplevel = currentLevel->levelNumber > 20;
short nPlayer = RunData[nRun].nVal; short nPlayer = RunData[nRun].nVal;
assert(nPlayer >= 0 && nPlayer < kMaxPlayers); assert(nPlayer >= 0 && nPlayer < kMaxPlayers);
@ -1485,7 +1486,7 @@ do_default:
// loc_1B3C7 // loc_1B3C7
// CHECKME - is order of evaluation correct? // CHECKME - is order of evaluation correct?
if (currentLevel->levelNumber <= 20 || (var_70 >= 25 && (var_70 <= 25 || var_70 == 50))) if (!mplevel || (var_70 >= 25 && (var_70 <= 25 || var_70 == 50)))
{ {
DestroyItemAnim(nValB); DestroyItemAnim(nValB);
mydeletesprite(nValB); mydeletesprite(nValB);
@ -1941,7 +1942,7 @@ do_default_b:
if (weapons & var_18) if (weapons & var_18)
{ {
if (currentLevel->levelNumber > 20) if (mplevel)
{ {
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx); AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
} }
@ -2003,7 +2004,7 @@ do_default_b:
if (weapons & var_18) if (weapons & var_18)
{ {
if (currentLevel->levelNumber > 20) if (mplevel)
{ {
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx); AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
} }
@ -2065,7 +2066,7 @@ do_default_b:
if (weapons & var_18) if (weapons & var_18)
{ {
if (currentLevel->levelNumber > 20) if (mplevel)
{ {
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx); AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
} }
@ -2127,7 +2128,7 @@ do_default_b:
if (weapons & var_18) if (weapons & var_18)
{ {
if (currentLevel->levelNumber > 20) if (mplevel)
{ {
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx); AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
} }
@ -2189,7 +2190,7 @@ do_default_b:
if (weapons & var_18) if (weapons & var_18)
{ {
if (currentLevel->levelNumber > 20) if (mplevel)
{ {
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx); AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
} }
@ -2251,7 +2252,7 @@ do_default_b:
if (weapons & var_18) if (weapons & var_18)
{ {
if (currentLevel->levelNumber > 20) if (mplevel)
{ {
AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx); AddAmmo(nPlayer, WeaponInfo[var_40].nAmmoType, ebx);
} }
@ -2708,7 +2709,7 @@ loc_1BD2E:
} }
else else
{ {
DoGameOverScene((currentLevel->levelNumber == 20)); DoGameOverScene(mplevel);
return; return;
} }
} }