From 18647ad6d5768858ff0a18476a109e6a0dc47bbc Mon Sep 17 00:00:00 2001 From: Kamay Xutax Date: Fri, 6 Sep 2024 00:37:25 +0200 Subject: [PATCH] Use local functions instead of absolute for prediction and server --- game/client/prediction.cpp | 6 +++--- game/server/player_command.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/game/client/prediction.cpp b/game/client/prediction.cpp index ab1b807436..6c1043bf13 100644 --- a/game/client/prediction.cpp +++ b/game/client/prediction.cpp @@ -625,14 +625,14 @@ void CPrediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper * move->m_bFirstRunOfFunctions = IsFirstTimePredicted(); move->m_bGameCodeMovedPlayer = false; - if ( player->GetPreviouslyPredictedOrigin() != player->GetNetworkOrigin() ) + if ( player->GetPreviouslyPredictedOrigin() != player->GetLocalOrigin() ) { move->m_bGameCodeMovedPlayer = true; } move->m_nPlayerHandle = player->GetClientHandle(); move->m_vecVelocity = player->GetAbsVelocity(); - move->SetAbsOrigin( player->GetNetworkOrigin() ); + move->SetAbsOrigin( player->GetLocalOrigin() ); move->m_vecOldAngles = move->m_vecAngles; move->m_nOldButtons = player->m_Local.m_nOldButtons; move->m_flClientMaxSpeed = player->m_flMaxspeed; @@ -678,7 +678,7 @@ void CPrediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper * // Copy constraint information if ( player->m_hConstraintEntity ) - move->m_vecConstraintCenter = player->m_hConstraintEntity->GetAbsOrigin(); + move->m_vecConstraintCenter = player->m_hConstraintEntity->GetLocalOrigin(); else move->m_vecConstraintCenter = player->m_vecConstraintCenter; diff --git a/game/server/player_command.cpp b/game/server/player_command.cpp index f322ed6e6b..2f9cd7560f 100644 --- a/game/server/player_command.cpp +++ b/game/server/player_command.cpp @@ -146,7 +146,7 @@ void CPlayerMove::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *p // Allow sound, etc. to be created by movement code move->m_bFirstRunOfFunctions = true; move->m_bGameCodeMovedPlayer = false; - if ( player->GetPreviouslyPredictedOrigin() != player->GetAbsOrigin() ) + if ( player->GetPreviouslyPredictedOrigin() != player->GetLocalOrigin() ) { move->m_bGameCodeMovedPlayer = true; } @@ -189,15 +189,15 @@ void CPlayerMove::SetupMove( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper *p move->m_nOldButtons = player->m_Local.m_nOldButtons; move->m_vecAngles = player->pl.v_angle; - move->m_vecVelocity = player->GetAbsVelocity(); + move->m_vecVelocity = player->GetLocalVelocity(); move->m_nPlayerHandle = player; - move->SetAbsOrigin( player->GetAbsOrigin() ); + move->SetAbsOrigin( player->GetLocalOrigin() ); // Copy constraint information if ( player->m_hConstraintEntity.Get() ) - move->m_vecConstraintCenter = player->m_hConstraintEntity.Get()->GetAbsOrigin(); + move->m_vecConstraintCenter = player->m_hConstraintEntity.Get()->GetLocalOrigin(); else move->m_vecConstraintCenter = player->m_vecConstraintCenter; move->m_flConstraintRadius = player->m_flConstraintRadius; @@ -218,8 +218,8 @@ void CPlayerMove::FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *mo // NOTE: Don't copy this. the movement code modifies its local copy but is not expecting to be authoritative //player->m_flMaxspeed = move->m_flClientMaxSpeed; - player->SetAbsOrigin( move->GetAbsOrigin() ); - player->SetAbsVelocity( move->m_vecVelocity ); + player->SetLocalOrigin( move->GetAbsOrigin() ); + player->SetLocalVelocity( move->m_vecVelocity ); player->SetPreviouslyPredictedOrigin( move->GetAbsOrigin() ); player->m_Local.m_nOldButtons = move->m_nButtons;