- moved more varialbles into FLevelLocals.

This commit is contained in:
Christoph Oelckers 2017-03-17 12:49:43 +01:00
commit f864a09faa
11 changed files with 59 additions and 82 deletions

View file

@ -1546,12 +1546,12 @@ static FPlayerStart *SelectFarthestDeathmatchSpot (size_t selections)
for (i = 0; i < selections; i++)
{
double distance = PlayersRangeFromSpot (&deathmatchstarts[i]);
double distance = PlayersRangeFromSpot (&level.deathmatchstarts[i]);
if (distance > bestdistance)
{
bestdistance = distance;
bestspot = &deathmatchstarts[i];
bestspot = &level.deathmatchstarts[i];
}
}
@ -1566,20 +1566,20 @@ static FPlayerStart *SelectRandomDeathmatchSpot (int playernum, unsigned int sel
for (j = 0; j < 20; j++)
{
i = pr_dmspawn() % selections;
if (G_CheckSpot (playernum, &deathmatchstarts[i]) )
if (G_CheckSpot (playernum, &level.deathmatchstarts[i]) )
{
return &deathmatchstarts[i];
return &level.deathmatchstarts[i];
}
}
// [RH] return a spot anyway, since we allow telefragging when a player spawns
return &deathmatchstarts[i];
return &level.deathmatchstarts[i];
}
DEFINE_ACTION_FUNCTION(DObject, G_PickDeathmatchStart)
{
PARAM_PROLOGUE;
unsigned int selections = deathmatchstarts.Size();
unsigned int selections = level.deathmatchstarts.Size();
DVector3 pos;
int angle;
if (selections == 0)
@ -1590,8 +1590,8 @@ DEFINE_ACTION_FUNCTION(DObject, G_PickDeathmatchStart)
else
{
unsigned int i = pr_dmspawn() % selections;
angle = deathmatchstarts[i].angle;
pos = deathmatchstarts[i].pos;
angle = level.deathmatchstarts[i].angle;
pos = level.deathmatchstarts[i].pos;
}
if (numret > 1)
@ -1611,7 +1611,7 @@ void G_DeathMatchSpawnPlayer (int playernum)
unsigned int selections;
FPlayerStart *spot;
selections = deathmatchstarts.Size ();
selections = level.deathmatchstarts.Size ();
// [RH] We can get by with just 1 deathmatch start
if (selections < 1)
I_Error ("No deathmatch starts");
@ -1635,10 +1635,10 @@ void G_DeathMatchSpawnPlayer (int playernum)
spot = SelectRandomDeathmatchSpot(playernum, selections);
if (spot == NULL)
{ // We have a player 1 start, right?
spot = &playerstarts[0];
spot = &level.playerstarts[0];
if (spot->type == 0)
{ // Fine, whatever.
spot = &deathmatchstarts[0];
spot = &level.deathmatchstarts[0];
}
}
}
@ -1653,13 +1653,13 @@ void G_DeathMatchSpawnPlayer (int playernum)
//
FPlayerStart *G_PickPlayerStart(int playernum, int flags)
{
if (AllPlayerStarts.Size() == 0) // No starts to pick
if (level.AllPlayerStarts.Size() == 0) // No starts to pick
{
return NULL;
}
if ((level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) || (flags & PPS_FORCERANDOM) ||
playerstarts[playernum].type == 0)
level.playerstarts[playernum].type == 0)
{
if (!(flags & PPS_NOBLOCKINGCHECK))
{
@ -1667,11 +1667,11 @@ FPlayerStart *G_PickPlayerStart(int playernum, int flags)
unsigned int i;
// Find all unblocked player starts.
for (i = 0; i < AllPlayerStarts.Size(); ++i)
for (i = 0; i < level.AllPlayerStarts.Size(); ++i)
{
if (G_CheckSpot(playernum, &AllPlayerStarts[i]))
if (G_CheckSpot(playernum, &level.AllPlayerStarts[i]))
{
good_starts.Push(&AllPlayerStarts[i]);
good_starts.Push(&level.AllPlayerStarts[i]);
}
}
if (good_starts.Size() > 0)
@ -1680,9 +1680,9 @@ FPlayerStart *G_PickPlayerStart(int playernum, int flags)
}
}
// Pick a spot at random, whether it's open or not.
return &AllPlayerStarts[pr_pspawn(AllPlayerStarts.Size())];
return &level.AllPlayerStarts[pr_pspawn(level.AllPlayerStarts.Size())];
}
return &playerstarts[playernum];
return &level.playerstarts[playernum];
}
DEFINE_ACTION_FUNCTION(DObject, G_PickPlayerStart)
@ -1782,10 +1782,10 @@ void G_DoReborn (int playernum, bool freshbot)
}
if (!(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) &&
playerstarts[playernum].type != 0 &&
G_CheckSpot (playernum, &playerstarts[playernum]))
level.playerstarts[playernum].type != 0 &&
G_CheckSpot (playernum, &level.playerstarts[playernum]))
{
AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum);
AActor *mo = P_SpawnPlayer(&level.playerstarts[playernum], playernum);
if (mo != NULL) P_PlayerStartStomp(mo, true);
}
else