diff --git a/dlls/gamerules.cpp b/dlls/gamerules.cpp index 07a01066..30087fbb 100644 --- a/dlls/gamerules.cpp +++ b/dlls/gamerules.cpp @@ -78,16 +78,22 @@ Vector FixupSpawnPoint(Vector spawn) } return spawn; } - +extern EHANDLE g_pLastSpawn; //========================================================= //========================================================= edict_t *CGameRules::GetPlayerSpawnSpot( CBasePlayer *pPlayer ) { edict_t *pentSpawnSpot = EntSelectSpawnPoint( pPlayer ); + if( pPlayer->m_state == STATE_POINT_SELECT ) + { + pPlayer->m_state = STATE_SPAWNED; + return pentSpawnSpot; + } if( mp_coop.value ) UTIL_CleanSpawnPoint( pentSpawnSpot->v.origin, 100 ); + if( g_pLastSpawn ) pPlayer->pev->origin = VARS( pentSpawnSpot )->origin + Vector( 0, 0, 1 ); pPlayer->pev->v_angle = g_vecZero; pPlayer->pev->velocity = g_vecZero; @@ -95,7 +101,25 @@ edict_t *CGameRules::GetPlayerSpawnSpot( CBasePlayer *pPlayer ) pPlayer->pev->punchangle = g_vecZero; if( !(pPlayer->pev->flags & FL_SPECTATOR ) ) if( mp_coop_changelevel.value && !CoopRestorePlayerCoords( pPlayer, &pPlayer->pev->origin, &pPlayer->pev->angles )) - CoopGetSpawnPoint( &pPlayer->pev->origin, &pPlayer->pev->angles ); + if( !CoopGetSpawnPoint( &pPlayer->pev->origin, &pPlayer->pev->angles ) ) + { + if( pPlayer->m_state == STATE_SPAWNED && !g_pLastSpawn ) + { + hudtextparms_t params = {}; + params.fadeinTime = 0.5; + params.fadeoutTime = .5; + params.holdTime = 10; + params.channel = 1; + params.y = 100; + params.r2 = params.g2 = params.b2 = params.a2 = params.r1 = params.g1 = params.b1 = params.a1 = 255; + + + UTIL_HudMessage( pPlayer, params, "Server cannot select a spawnpoint, please fly to it manually and press attack button\n" ); + // select spawn point + pPlayer->m_state = STATE_POINT_SELECT; + + } + } pPlayer->pev->fixangle = TRUE; pPlayer->pev->origin = FixupSpawnPoint( pPlayer->pev->origin ); if( g_fSavedDuck ) diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index 801bf029..2aa198a2 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -749,6 +749,12 @@ void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer ) return; } + if( pPlayer->m_state == STATE_POINT_SELECT ) + { + if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) ) + SpawnPlayer( pPlayer ); + } + if( g_fGameOver ) { // check for button presses @@ -783,6 +789,13 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) return; } + if( pPlayer->m_state == STATE_POINT_SELECT ) + { + pPlayer->RemoveAllItems( TRUE ); + BecomeSpectator( pPlayer ); + return; + } + pPlayer->pev->weapons |= ( 1 << WEAPON_SUIT ); addDefault = TRUE; diff --git a/dlls/player.cpp b/dlls/player.cpp index ae03617c..40175de0 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2743,6 +2743,8 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) goto ReturnSpot; } } + +#if 0 // landmark may still exists when no spawn spot if( FNullEnt( pSpot ) ) { @@ -2754,11 +2756,13 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) if( FNullEnt( pSpot ) ) pSpot = UTIL_FindEntityByClassname( NULL, "info_player_start" ); +#endif ReturnSpot: if( FNullEnt( pSpot ) ) { ALERT( at_error, "PutClientInServer: no info_player_start on level" ); + g_pLastSpawn = NULL; return INDEXENT( 0 ); }