diff --git a/game/client/prediction.cpp b/game/client/prediction.cpp index c8b76e0f5d..ab1b807436 100644 --- a/game/client/prediction.cpp +++ b/game/client/prediction.cpp @@ -776,8 +776,8 @@ void CPrediction::StartCommand( C_BasePlayer *player, CUserCmd *cmd ) C_BaseEntity::SetPredictionRandomSeed( cmd ); C_BaseEntity::SetPredictionPlayer( player ); - InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); - InterpolationContexts[BEFORE_MOVEMENT].m_vecAbsOrigin = player->GetAbsOrigin(); + InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); + InterpolationContexts[BEFORE_MOVEMENT].m_vecLocalOrigin = player->GetLocalOrigin(); #endif } @@ -852,29 +852,29 @@ void CPrediction::StartInterpolatingPlayer( C_BasePlayer *player ) // Let's interpolate the local player, this is similar to lag compensation, // except it isn't since local player is always predicted. (except if user didn't want to for some reasons) - InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); - InterpolationContexts[AFTER_MOVEMENT].m_vecAbsOrigin = player->GetAbsOrigin(); + InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); + InterpolationContexts[AFTER_MOVEMENT].m_vecLocalOrigin = player->GetLocalOrigin(); auto pCmd = player->m_pCurrentCommand; - Vector vecNewAbsOrigin = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecAbsOrigin, - InterpolationContexts[AFTER_MOVEMENT].m_vecAbsOrigin, - pCmd->interpolated_amount ); - Vector vecNewViewOffset = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset, - InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset, - pCmd->interpolated_amount ); + Vector vecNewLocalOrigin = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecLocalOrigin, + InterpolationContexts[AFTER_MOVEMENT].m_vecLocalOrigin, + pCmd->interpolated_amount ); + Vector vecNewViewOffset = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset, + InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset, + pCmd->interpolated_amount ); - player->SetAbsOrigin( vecNewAbsOrigin ); + player->SetLocalOrigin( vecNewLocalOrigin ); player->SetViewOffset( vecNewViewOffset ); #endif } -void CPrediction::FinishInterpolatingPlayer( C_BasePlayer *player ) +void CPrediction::FinishInterpolatingPlayer( C_BasePlayer* player ) { #if !defined( NO_ENTITY_PREDICTION ) VPROF( "CPrediction::FinishInterpolatingPlayer" ); - player->SetAbsOrigin( InterpolationContexts[AFTER_MOVEMENT].m_vecAbsOrigin ); + player->SetLocalOrigin( InterpolationContexts[AFTER_MOVEMENT].m_vecLocalOrigin ); player->SetViewOffset( InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset ); #endif } diff --git a/game/client/prediction.h b/game/client/prediction.h index 004ae1a00b..107509d2c6 100644 --- a/game/client/prediction.h +++ b/game/client/prediction.h @@ -193,7 +193,7 @@ private: struct InterpolationContext { - Vector m_vecAbsOrigin; + Vector m_vecLocalOrigin; Vector m_vecViewOffset; } InterpolationContexts[INTERPOLATION_CONTEXT_MAX]; }; diff --git a/game/server/player_command.cpp b/game/server/player_command.cpp index 95078a7323..f322ed6e6b 100644 --- a/game/server/player_command.cpp +++ b/game/server/player_command.cpp @@ -56,10 +56,10 @@ void CPlayerMove::StartCommand( CBasePlayer *player, CUserCmd *cmd ) CBaseEntity::SetPredictionRandomSeed( cmd ); CBaseEntity::SetPredictionPlayer( player ); - InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); - InterpolationContexts[BEFORE_MOVEMENT].m_vecAbsOrigin = player->GetAbsOrigin(); + InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); + InterpolationContexts[BEFORE_MOVEMENT].m_vecLocalOrigin = player->GetLocalOrigin(); -#if defined (HL2_DLL) +#if defined( HL2_DLL ) // pull out backchannel data and move this out int i; @@ -305,27 +305,27 @@ void CPlayerMove::StartInterpolatingPlayer( CBasePlayer *player ) // Let's interpolate the local player, this is similar to lag compensation, // except it isn't since local player is always predicted. (except if user didn't want to for some reasons) - InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); - InterpolationContexts[AFTER_MOVEMENT].m_vecAbsOrigin = player->GetAbsOrigin(); + InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset = player->GetViewOffset(); + InterpolationContexts[AFTER_MOVEMENT].m_vecLocalOrigin = player->GetLocalOrigin(); auto pCmd = player->m_pCurrentCommand; - Vector vecNewAbsOrigin = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecAbsOrigin, - InterpolationContexts[AFTER_MOVEMENT].m_vecAbsOrigin, - pCmd->interpolated_amount ); - Vector vecNewViewOffset = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset, - InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset, - pCmd->interpolated_amount ); + Vector vecNewLocalOrigin = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecLocalOrigin, + InterpolationContexts[AFTER_MOVEMENT].m_vecLocalOrigin, + pCmd->interpolated_amount ); + Vector vecNewViewOffset = VectorLerp( InterpolationContexts[BEFORE_MOVEMENT].m_vecViewOffset, + InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset, + pCmd->interpolated_amount ); - player->SetAbsOrigin( vecNewAbsOrigin ); + player->SetLocalOrigin( vecNewLocalOrigin ); player->SetViewOffset( vecNewViewOffset ); } -void CPlayerMove::FinishInterpolatingPlayer( CBasePlayer *player ) +void CPlayerMove::FinishInterpolatingPlayer( CBasePlayer* player ) { VPROF( "CPlayerMove::FinishInterpolatingPlayer" ); - player->SetAbsOrigin( InterpolationContexts[AFTER_MOVEMENT].m_vecAbsOrigin ); + player->SetLocalOrigin( InterpolationContexts[AFTER_MOVEMENT].m_vecLocalOrigin ); player->SetViewOffset( InterpolationContexts[AFTER_MOVEMENT].m_vecViewOffset ); } diff --git a/game/server/player_command.h b/game/server/player_command.h index ca4c2dedfb..c5eb1549ef 100644 --- a/game/server/player_command.h +++ b/game/server/player_command.h @@ -65,7 +65,7 @@ protected: struct InterpolationContext { - Vector m_vecAbsOrigin; + Vector m_vecLocalOrigin; Vector m_vecViewOffset; } InterpolationContexts[INTERPOLATION_CONTEXT_MAX]; };