mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
K_DoIngameRespawn: Index into previously-picked array, rather than branching for every single available spawnpoint
This commit is contained in:
parent
05c475052d
commit
39e33bd98e
1 changed files with 4 additions and 8 deletions
|
|
@ -238,14 +238,17 @@ void K_DoIngameRespawn(player_t *player)
|
||||||
UINT32 bestdist = UINT32_MAX;
|
UINT32 bestdist = UINT32_MAX;
|
||||||
mapthing_t *beststart = NULL;
|
mapthing_t *beststart = NULL;
|
||||||
UINT8 numstarts = 0;
|
UINT8 numstarts = 0;
|
||||||
|
mapthing_t **starts;
|
||||||
|
|
||||||
if (gametyperules & GTR_BATTLESTARTS)
|
if (gametyperules & GTR_BATTLESTARTS)
|
||||||
{
|
{
|
||||||
numstarts = numdmstarts;
|
numstarts = numdmstarts;
|
||||||
|
starts = deathmatchstarts;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
numstarts = numcoopstarts;
|
numstarts = numcoopstarts;
|
||||||
|
starts = playerstarts;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numstarts > 0)
|
if (numstarts > 0)
|
||||||
|
|
@ -257,14 +260,7 @@ void K_DoIngameRespawn(player_t *player)
|
||||||
UINT32 dist = UINT32_MAX;
|
UINT32 dist = UINT32_MAX;
|
||||||
mapthing_t *checkstart = NULL;
|
mapthing_t *checkstart = NULL;
|
||||||
|
|
||||||
if (gametyperules & GTR_BATTLESTARTS)
|
checkstart = starts[i];
|
||||||
{
|
|
||||||
checkstart = deathmatchstarts[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
checkstart = playerstarts[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
dist = (UINT32)P_AproxDistance((player->mo->x >> FRACBITS) - checkstart->x,
|
dist = (UINT32)P_AproxDistance((player->mo->x >> FRACBITS) - checkstart->x,
|
||||||
(player->mo->y >> FRACBITS) - checkstart->y);
|
(player->mo->y >> FRACBITS) - checkstart->y);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue