From fb6fae045e2a57ad2c312e746b8a4a60a419e174 Mon Sep 17 00:00:00 2001 From: mittorn Date: Fri, 26 Oct 2018 09:17:17 +0700 Subject: [PATCH] Fix EntSelectSpawnPoint --- dlls/player.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index 193a1beb..d9c962ed 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2853,18 +2853,36 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) { TraceResult tr; if( FNullEnt( pSpot ) ) + { + ALERT( at_console, "Null spot\n"); continue; + } // only spawnpoints from current map are valid if( !FStrEq( STRING( pSpot->pev->netname ), STRING( gpGlobals->mapname ) ) ) + { + ALERT( at_console, "Spot from different map\n"); continue; + } // check if it is placed in wall UTIL_TraceHull( pSpot->pev->origin, pSpot->pev->origin , missile, human_hull, NULL, &tr ); if( tr.fStartSolid || tr.fAllSolid ) - continue; + { + if( tr.pHit ) + ALERT( at_console, "Spot solid check failed, blocked by is %s\n", STRING(tr.pHit->v.classname) ); + else + ALERT( at_console, "Spot solid check failed\n" ); + int index = ENTINDEX( tr.pHit ); + // check if is client + if( index == 0 || index > gpGlobals->maxClients ) + continue; + } // trace down to find if there is no floor UTIL_TraceHull( pSpot->pev->origin, pSpot->pev->origin - Vector( 0, 0, -200 ) , missile, human_hull, NULL, &tr ); if( tr.vecEndPos.z - pSpot->pev->origin.z < -190 ) + { + ALERT( at_console, "Spot floor check failed\n"); continue; + } goto ReturnSpot; } } @@ -2886,7 +2904,7 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) ReturnSpot: if( FNullEnt( pSpot ) ) { - ALERT( at_error, "PutClientInServer: no info_player_start on level" ); + ALERT( at_error, "PutClientInServer: no info_player_start on level\n" ); g_pLastSpawn = NULL; return INDEXENT( 0 ); }