From 0be0184c79a83662b95313eb09256e6f3edb0b89 Mon Sep 17 00:00:00 2001 From: mittorn Date: Sun, 2 Oct 2016 15:07:55 +0000 Subject: [PATCH] Spawnpoint check --- dlls/player.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index 095128b7..bb5fe68a 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2605,7 +2605,7 @@ USES AND SETS GLOBAL g_pLastSpawn */ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) { - CBaseEntity *pSpot; + CBaseEntity *pSpot = NULL; edict_t *player; player = pPlayer->edict(); @@ -2674,15 +2674,22 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) } // If startspot is set, (re)spawn there. - if( FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) ) + if( mp_coop.value || FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) ) { - pSpot = UTIL_FindEntityByClassname( NULL, "info_player_start" ); - if( !FNullEnt( pSpot ) ) - goto ReturnSpot; + pSpot = NULL; + while( pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_start" ) ) + { + TraceResult tr; + UTIL_TraceHull( pSpot->pev->origin, pSpot->pev->origin , missile, 1, NULL, &tr ); + if( !tr.fStartSolid && !tr.fAllSolid && !FNullEnt( pSpot ) ) + goto ReturnSpot; + } } - else + // landmark may still exists when no spawn spot + if( FNullEnt( pSpot ) ) { pSpot = UTIL_FindEntityByTargetname( NULL, STRING( gpGlobals->startspot ) ); + if( !FNullEnt( pSpot ) ) goto ReturnSpot; }