From c2deca67c0b2b7ab00bf0331583dcb63f4d6a17f Mon Sep 17 00:00:00 2001 From: mittorn Date: Mon, 3 Oct 2016 15:36:30 +0000 Subject: [PATCH] Save spawn on trigger_changelevel use --- dlls/triggers.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index e7c8cb10..96a4744e 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -1648,7 +1648,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) m_uTouchCount |= 1 << ( ENTINDEX( pActivator->edict() ) - 1); // Keep first toucher coords to save correct spawn angles - if( !m_fSpawnSaved ) + if( !m_fSpawnSaved && pActivator->IsPlayer() ) { m_vecSpawnOrigin = pActivator->pev->origin; m_vecSpawnAngles = pActivator->pev->angles; @@ -1737,11 +1737,25 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) }*/ } - l_SavedCoords.triggerangles = m_vecSpawnAngles; - l_SavedCoords.triggerorigin = m_vecSpawnOrigin; - l_SavedCoords.valid = true; + if( m_fSpawnSaved ) + { + l_SavedCoords.triggerangles = m_vecSpawnAngles; + l_SavedCoords.triggerorigin = m_vecSpawnOrigin; + l_SavedCoords.valid = true; + } ALERT( at_console, "^2CHANGELEVEL:^7 %d %d %d\n", count2, count1, (int)m_fIsBack); } + else + { + // Get current player's coordinated + if( pActivator && pActivator->IsPlayer() ) + { + l_SavedCoords.triggerangles = pActivator->pev->angles; + l_SavedCoords.triggerorigin = pActivator->pev->origin; + l_SavedCoords.valid = true; + } + + } CoopSaveTrain( pActivator, &l_SavedCoords ); g_SavedCoords = l_SavedCoords;