Fix lap executors not happening, and also edit it so they act like Each Time rather than Once

Allows for simplified executor logic on Desert Palace and Chrome Gadget, possibly Egg Zeppelin too
This commit is contained in:
Sally Coolatta 2021-02-01 14:34:48 -05:00
parent 320cdf2108
commit d627da7510
7 changed files with 24 additions and 6 deletions

View file

@ -686,6 +686,7 @@ extern tic_t indirectitemcooldown;
extern tic_t hyubgone;
extern tic_t mapreset;
extern boolean thwompsactive;
extern UINT8 lastLowestLap;
extern SINT8 spbplace;
extern boolean rainbowstartavailable;

View file

@ -315,6 +315,7 @@ tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any othe
tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled
tic_t mapreset; // Map reset delay when enough players have joined an empty game
boolean thwompsactive; // Thwomps activate on lap 2
UINT8 lastLowestLap; // Last lowest lap, for activating race lap executors
SINT8 spbplace; // SPB exists, give the person behind better items
boolean rainbowstartavailable; // Boolean, keeps track of if the rainbow start was gotten

View file

@ -357,6 +357,9 @@ int LUA_PushGlobals(lua_State *L, const char *word)
} else if (fastcmp(word,"thwompsactive")) {
lua_pushboolean(L, thwompsactive);
return 1;
} else if (fastcmp(word,"lastLowestLap")) {
lua_pushinteger(L, lastLowestLap);
return 1;
} else if (fastcmp(word,"spbplace")) {
lua_pushinteger(L, spbplace);
return 1;

View file

@ -4162,6 +4162,7 @@ static void P_NetArchiveMisc(void)
WRITEINT16(save_p, nospectategrief[i]);
WRITEUINT8(save_p, thwompsactive);
WRITEUINT8(save_p, lastLowestLap);
WRITESINT8(save_p, spbplace);
WRITEUINT8(save_p, rainbowstartavailable);
@ -4295,6 +4296,7 @@ static inline boolean P_NetUnArchiveMisc(void)
nospectategrief[i] = READINT16(save_p);
thwompsactive = (boolean)READUINT8(save_p);
lastLowestLap = READUINT8(save_p);
spbplace = READSINT8(save_p);
rainbowstartavailable = (boolean)READUINT8(save_p);

View file

@ -4098,6 +4098,7 @@ boolean P_LoadLevel(boolean fromnetsave)
nospectategrief[i] = -1;
thwompsactive = false;
lastLowestLap = 0;
spbplace = -1;
// clear special respawning que

View file

@ -1836,7 +1836,6 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
|| specialtype == 336 // Dye - Once
|| specialtype == 399 // Level Load
|| specialtype == 328 // SRB2Kart Encore Load
|| specialtype == 2002 // SRB2Kart Race Lap
)
triggerline->special = 0; // Clear it out
@ -1999,6 +1998,7 @@ static void K_HandleLapIncrement(player_t *player)
{
size_t i = 0;
UINT8 nump = 0;
UINT8 lowestLap;
for (i = 0; i < MAXPLAYERS; i++)
{
@ -2082,6 +2082,8 @@ static void K_HandleLapIncrement(player_t *player)
thwompsactive = true; // Lap 2 effects
lowestLap = P_FindLowestLap();
for (i = 0; i < numlines; i++)
{
if (lines[i].special == 2002) // Race lap trigger
@ -2094,7 +2096,13 @@ static void K_HandleLapIncrement(player_t *player)
}
else
{
lap = P_FindLowestLap();
lap = lowestLap;
if (lap <= lastLowestLap)
{
// Need to be able to search for E4 linedefs
continue;
}
}
if (lines[i].flags & ML_NOCLIMB) // Need higher than or equal to
@ -2116,6 +2124,8 @@ static void K_HandleLapIncrement(player_t *player)
P_RunTriggerLinedef(&lines[i], player->mo, NULL);
}
}
lastLowestLap = lowestLap;
}
else if (player->starpostnum)
{

View file

@ -409,7 +409,7 @@ UINT8 P_FindLowestLap(void)
INT32 i;
UINT8 lowest = UINT8_MAX;
if (gametyperules & GTR_CIRCUIT)
if (!(gametyperules & GTR_CIRCUIT))
return 0;
for (i = 0; i < MAXPLAYERS; i++)
@ -417,10 +417,10 @@ UINT8 P_FindLowestLap(void)
if (!playeringame[i] || players[i].spectator)
continue;
if (lowest == 255)
lowest = players[i].laps;
else if (players[i].laps < lowest)
if (lowest == UINT8_MAX || players[i].laps < lowest)
{
lowest = players[i].laps;
}
}
CONS_Debug(DBG_GAMELOGIC, "Lowest laps found: %d\n", lowest);