K_PlayerIsEmptyHandedInSpecial

Replaces the simple condition in K_HandleLapIncrement for successful player exit
Essentially means you can get EMPTY HANDED? for crossing the finish line before the player with the emerald does
This commit is contained in:
toaster 2024-03-30 16:15:35 +00:00
parent 385988eeed
commit c3112ea0c8
3 changed files with 63 additions and 1 deletions

View file

@ -161,6 +161,53 @@ mobj_t *K_GetPossibleSpecialTarget(void)
return specialstageinfo.ufo; return specialstageinfo.ufo;
} }
/*--------------------------------------------------
boolean K_PlayerIsEmptyHandedInSpecial(void)
See header file for description.
--------------------------------------------------*/
boolean K_PlayerIsEmptyHandedInSpecial(player_t *player)
{
if (specialstageinfo.valid == false)
return false; // Not Sealed Star
if (!(specialstageinfo.ufo == NULL || P_MobjWasRemoved(specialstageinfo.ufo)))
return true; // UFO exists
thinker_t *think;
mobj_t *thing;
player_t *orbitplayer = NULL;
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
{
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
thing = (mobj_t *)think;
if (thing->type != MT_EMERALD)
continue;
// emerald_award(thing)
if (!thing->tracer || P_MobjWasRemoved(thing->tracer))
continue;
if (thing->tracer->type != MT_PLAYER || !thing->tracer->player)
continue;
orbitplayer = thing->tracer->player;
if (orbitplayer->exiting && !(orbitplayer->pflags & PF_NOCONTEST))
{
// Another player has successfully taken the emerald to the end
return false;
}
// The emerald is being carried, but not by you
return (orbitplayer != player);
}
// EMERALD DELETED!?
return true;
}
/*-------------------------------------------------- /*--------------------------------------------------
void K_FadeOutSpecialMusic(UINT32 distance) void K_FadeOutSpecialMusic(UINT32 distance)

View file

@ -68,6 +68,21 @@ void K_TickSpecialStage(void);
mobj_t *K_GetPossibleSpecialTarget(void); mobj_t *K_GetPossibleSpecialTarget(void);
/*--------------------------------------------------
boolean K_PlayerIsEmptyHandedInSpecial(player_t *player)
Gets whether the player has failed a Sealed
Star via finishing without an Emerald
Input Arguments:-
player - Player to check for
Return:-
Should player fail or not
--------------------------------------------------*/
boolean K_PlayerIsEmptyHandedInSpecial(player_t *player);
/*-------------------------------------------------- /*--------------------------------------------------
void K_FadeOutSpecialMusic(UINT32 distance) void K_FadeOutSpecialMusic(UINT32 distance)

View file

@ -1997,7 +1997,7 @@ static void K_HandleLapIncrement(player_t *player)
if (specialstageinfo.valid == true) if (specialstageinfo.valid == true)
{ {
// Don't permit a win just by sneaking ahead of the UFO/emerald. // Don't permit a win just by sneaking ahead of the UFO/emerald.
if (!(specialstageinfo.ufo == NULL || P_MobjWasRemoved(specialstageinfo.ufo))) if (K_PlayerIsEmptyHandedInSpecial(player))
{ {
applyflags |= PF_NOCONTEST; applyflags |= PF_NOCONTEST;