Replace battlecapsules || bossinfo.valid checks with K_Cooperative

This commit is contained in:
James R 2023-03-08 00:01:19 -08:00
parent 7669ae7bde
commit 85a101cbd7
5 changed files with 23 additions and 8 deletions

View file

@ -95,8 +95,6 @@ void K_CheckBumpers(void)
UINT8 nobumpers = 0; UINT8 nobumpers = 0;
UINT8 eliminated = 0; UINT8 eliminated = 0;
const boolean singleplayer = (battlecapsules || bossinfo.valid);
if (!(gametyperules & GTR_BUMPERS)) if (!(gametyperules & GTR_BUMPERS))
return; return;
@ -124,7 +122,7 @@ void K_CheckBumpers(void)
} }
} }
if (singleplayer if (K_Cooperative()
? nobumpers > 0 && nobumpers >= numingame ? nobumpers > 0 && nobumpers >= numingame
: eliminated >= numingame - 1) : eliminated >= numingame - 1)
{ {
@ -135,7 +133,7 @@ void K_CheckBumpers(void)
if (players[i].spectator) if (players[i].spectator)
continue; continue;
if (singleplayer) if (K_Cooperative())
players[i].pflags |= PF_NOCONTEST; players[i].pflags |= PF_NOCONTEST;
P_DoPlayerExit(&players[i]); P_DoPlayerExit(&players[i]);

View file

@ -5,8 +5,8 @@
#include "core/static_vec.hpp" #include "core/static_vec.hpp"
#include "k_battle.h" #include "k_battle.h"
#include "k_boss.h"
#include "k_hud.h" #include "k_hud.h"
#include "k_kart.h"
#include "k_objects.h" #include "k_objects.h"
#include "m_fixed.h" #include "m_fixed.h"
#include "p_local.h" #include "p_local.h"
@ -314,7 +314,7 @@ bool is_player_tracking_target(player_t *player = stplyr)
return false; return false;
} }
if (battlecapsules || bossinfo.valid) if (K_Cooperative())
{ {
return false; return false;
} }

View file

@ -11577,7 +11577,7 @@ UINT32 K_PointLimitForGametype(void)
return cv_pointlimit.value; return cv_pointlimit.value;
} }
if (battlecapsules || bossinfo.valid) if (K_Cooperative())
{ {
return 0; return 0;
} }
@ -11601,4 +11601,19 @@ UINT32 K_PointLimitForGametype(void)
return ptsCap; return ptsCap;
} }
boolean K_Cooperative(void)
{
if (battlecapsules)
{
return true;
}
if (bossinfo.valid)
{
return true;
}
return false;
}
//} //}

View file

@ -208,6 +208,8 @@ void K_EggmanTransfer(player_t *source, player_t *victim);
tic_t K_TimeLimitForGametype(void); tic_t K_TimeLimitForGametype(void);
UINT32 K_PointLimitForGametype(void); UINT32 K_PointLimitForGametype(void);
boolean K_Cooperative(void);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif

View file

@ -1382,7 +1382,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
P_PlayDeathSound(target); P_PlayDeathSound(target);
} }
if (battlecapsules || bossinfo.valid) if (K_Cooperative())
{ {
target->player->pflags |= (PF_NOCONTEST|PF_ELIMINATED); target->player->pflags |= (PF_NOCONTEST|PF_ELIMINATED);
} }