mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 21:41:03 +00:00
Fixes for spawn farthest DM option
No longer picks a random spot on the first spawn but will account for players spawning in sequentially. No longer fails to return a spawn spot if every player is dead while respawning (instead it picks a random one).
This commit is contained in:
parent
70a165b566
commit
f2072cec95
1 changed files with 11 additions and 1 deletions
|
@ -1606,10 +1606,20 @@ void FLevelLocals::DeathMatchSpawnPlayer (int playernum)
|
||||||
if (selections < 1)
|
if (selections < 1)
|
||||||
I_Error ("No deathmatch starts");
|
I_Error ("No deathmatch starts");
|
||||||
|
|
||||||
|
bool hasSpawned = false;
|
||||||
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
||||||
|
{
|
||||||
|
if (PlayerInGame(i) && Players[i]->mo != nullptr && Players[i]->health > 0)
|
||||||
|
{
|
||||||
|
hasSpawned = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// At level start, none of the players have mobjs attached to them,
|
// At level start, none of the players have mobjs attached to them,
|
||||||
// so we always use the random deathmatch spawn. During the game,
|
// so we always use the random deathmatch spawn. During the game,
|
||||||
// though, we use whatever dmflags specifies.
|
// though, we use whatever dmflags specifies.
|
||||||
if ((dmflags & DF_SPAWN_FARTHEST) && players[playernum].mo)
|
if ((dmflags & DF_SPAWN_FARTHEST) && hasSpawned)
|
||||||
spot = SelectFarthestDeathmatchSpot (selections);
|
spot = SelectFarthestDeathmatchSpot (selections);
|
||||||
else
|
else
|
||||||
spot = SelectRandomDeathmatchSpot (playernum, selections);
|
spot = SelectRandomDeathmatchSpot (playernum, selections);
|
||||||
|
|
Loading…
Reference in a new issue