[HL25] Backport changes to multiplayer spawn selection logic
This commit is contained in:
parent
df5605d5a3
commit
b61c0beadf
1 changed files with 15 additions and 1 deletions
|
@ -2817,6 +2817,8 @@ edict_t* EntSelectSpawnPoint(CBaseEntity* pPlayer)
|
|||
CBaseEntity* pSpot;
|
||||
edict_t* player;
|
||||
|
||||
int nNumRandomSpawnsToTry = 10;
|
||||
|
||||
player = pPlayer->edict();
|
||||
|
||||
// choose a info_player_deathmatch point
|
||||
|
@ -2831,9 +2833,21 @@ edict_t* EntSelectSpawnPoint(CBaseEntity* pPlayer)
|
|||
}
|
||||
else if (g_pGameRules->IsDeathmatch())
|
||||
{
|
||||
if (NULL == g_pLastSpawn)
|
||||
{
|
||||
int nNumSpawnPoints = 0;
|
||||
CBaseEntity* pEnt = UTIL_FindEntityByClassname(NULL, "info_player_deathmatch");
|
||||
while (NULL != pEnt)
|
||||
{
|
||||
nNumSpawnPoints++;
|
||||
pEnt = UTIL_FindEntityByClassname(pEnt, "info_player_deathmatch");
|
||||
}
|
||||
nNumRandomSpawnsToTry = nNumSpawnPoints;
|
||||
}
|
||||
|
||||
pSpot = g_pLastSpawn;
|
||||
// Randomize the start spot
|
||||
for (int i = RANDOM_LONG(1, 5); i > 0; i--)
|
||||
for (int i = RANDOM_LONG(1, nNumRandomSpawnsToTry - 1); i > 0; i--)
|
||||
pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_deathmatch");
|
||||
if (FNullEnt(pSpot)) // skip over the null point
|
||||
pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_deathmatch");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue