Add fault start mapthing 36 and prefer it for TA

Fixes KartKrew/Kart#1063
This commit is contained in:
Eidolon 2024-02-24 19:13:59 -06:00
parent db49975d67
commit f4f7c5b1eb
5 changed files with 35 additions and 3 deletions

View file

@ -871,6 +871,7 @@ extern tic_t gametic;
extern mapthing_t *playerstarts[MAXPLAYERS]; // Cooperative
extern mapthing_t *bluectfstarts[MAXPLAYERS]; // CTF
extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
extern mapthing_t *faultstart; // Kart Fault
#define TUBEWAYPOINTSEQUENCESIZE 256
#define NUMTUBEWAYPOINTSEQUENCES 256

View file

@ -2821,6 +2821,18 @@ static inline mapthing_t *G_FindTeamStartOrFallback(INT32 playernum)
return spawnpoint;
}
static inline mapthing_t *G_FindTimeAttackStartOrFallback(INT32 playernum)
{
mapthing_t *spawnpoint = NULL;
if (!(spawnpoint = faultstart)
&& !(spawnpoint = G_FindRaceStart(playernum))
&& !(spawnpoint = G_FindBattleStart(playernum)))
{
spawnpoint = G_FindTeamStart(playernum);
}
return spawnpoint;
}
mapthing_t *G_FindMapStart(INT32 playernum)
{
extern consvar_t cv_battlespawn;
@ -2839,9 +2851,14 @@ mapthing_t *G_FindMapStart(INT32 playernum)
else if (K_PodiumSequence() == true)
spawnpoint = G_FindPodiumStart(playernum);
// -- Time Attack / Battle duels --
// -- Time Attack --
// Order: Fault->Race->DM->CTF
else if (K_TimeAttackRules() == true && modeattacking != ATTACKING_NONE)
spawnpoint = G_FindTimeAttackStartOrFallback(playernum);
// -- Battle duels --
// Order: Race->DM->CTF
else if (K_TimeAttackRules() == true || ((gametyperules & GTR_BATTLESTARTS) && inDuel))
else if (((gametyperules & GTR_BATTLESTARTS) && inDuel))
spawnpoint = G_FindRaceStartOrFallback(playernum);
// -- CTF --

View file

@ -12428,6 +12428,16 @@ static boolean P_SpawnNonMobjMapThing(mapthing_t *mthing)
}
return true;
}
else if (mthing->type == 36) // Kart fault start
{
if (numfaultstarts < MAXPLAYERS)
{
faultstart = mthing;
mthing->type = 0;
numfaultstarts++;
}
return true;
}
else if (mthing->type == 750 // Slope vertex point (formerly chaos spawn)
|| (mthing->type == FLOOR_SLOPE_THING || mthing->type == CEILING_SLOPE_THING) // Slope anchors
|| (mthing->type >= 600 && mthing->type <= 611) // Special placement patterns

View file

@ -187,11 +187,13 @@ UINT8 *rejectmatrix;
// Maintain single and multi player starting spots.
INT32 numdmstarts, numcoopstarts, numredctfstarts, numbluectfstarts;
INT32 numfaultstarts;
mapthing_t *deathmatchstarts[MAX_DM_STARTS];
mapthing_t *playerstarts[MAXPLAYERS];
mapthing_t *bluectfstarts[MAXPLAYERS];
mapthing_t *redctfstarts[MAXPLAYERS];
mapthing_t *faultstart;
// Global state for PartialAddWadFile/MultiSetupWadFiles
// Might be replacable with parameters, but non-trivial when the functions are called on separate tics
@ -7744,6 +7746,8 @@ static void P_ResetSpawnpoints(void)
UINT8 i;
numdmstarts = numredctfstarts = numbluectfstarts = 0;
numfaultstarts = 0;
faultstart = NULL;
// reset the player starts
for (i = 0; i < MAXPLAYERS; i++)

View file

@ -29,7 +29,7 @@ extern unsigned char mapmd5[16];
// Player spawn spots for deathmatch.
#define MAX_DM_STARTS 64
extern mapthing_t *deathmatchstarts[MAX_DM_STARTS];
extern INT32 numdmstarts, numcoopstarts, numredctfstarts, numbluectfstarts;
extern INT32 numdmstarts, numcoopstarts, numredctfstarts, numbluectfstarts, numfaultstarts;
extern boolean levelloading;
extern UINT8 levelfadecol;