K_DoIngameRespawn: In Tutorial specifically, tightly tie allowed fallback spawnpoints (if not yet crossed a checkpoint line) to relative player ID

Not literal player ID so that nothing gets messy when returning from Test Track challenge
This commit is contained in:
toaster 2025-09-11 20:38:46 +01:00
parent 39e33bd98e
commit 9bd29a87b2

View file

@ -255,7 +255,24 @@ void K_DoIngameRespawn(player_t *player)
{
UINT8 i = 0;
for (i = 0; i < numstarts; i++)
if (gametype == GT_TUTORIAL)
{
// In tutorial, spawnpoints are player ID locked.
// ...but returning from Test Track can do funny things,
// so we use relative ID instead of literal slot number.
UINT8 spos = 0;
for (; i < MAXPLAYERS; i++)
{
if (i == player-players)
break;
if (!playeringame[i])
continue;
spos++;
}
beststart = starts[spos % numstarts];
}
else for (i = 0; i < numstarts; i++)
{
UINT32 dist = UINT32_MAX;
mapthing_t *checkstart = NULL;