[saco] Implement/match FUNC_10014C40, the 3D position resync; the lerp factor is a mutable global so it lands in st(1) instead of an fmul operand

This commit is contained in:
ricardoofnl
2026-09-05 09:12:10 +07:00
parent ef8d3e3354
commit 8d8b9e33d4
2 changed files with 46 additions and 1 deletions
+44
View File
@@ -8,6 +8,7 @@ using namespace RakNet;
extern CNetGame* pNetGame;
extern CChatWindow *pChatWindow;
float fPosLerp = 0.1f;
int bClampVehicleTurnSpeed = 1;
//----------------------------------------------------
@@ -410,6 +411,49 @@ void CRemotePlayer::FUNC_10017260(BYTE *pSync, int iTime)
//----------------------------------------------------
void CRemotePlayer::FUNC_10014C40()
{
if(!m_pPlayerPed) return;
MATRIX4X4 mat;
VECTOR vecMove;
float fOffZ;
m_pPlayerPed->GetMatrix(&mat);
if(!m_pPlayerPed->IsAdded()) {
mat.pos.X = field_17C.X;
mat.pos.Y = field_17C.Y;
mat.pos.Z = field_17C.Z;
m_pPlayerPed->SetMatrix(mat);
return;
}
field_160 = FloatOffset(field_17C.X, mat.pos.X);
field_164 = FloatOffset(field_17C.Y, mat.pos.Y);
fOffZ = FloatOffset(field_17C.Z, mat.pos.Z);
field_168 = fOffZ;
if(field_160 <= 0.00001f && field_164 <= 0.00001f && fOffZ <= 0.00001f) return;
if(field_160 > 2.0f || field_164 > 2.0f || fOffZ > 1.0f) {
mat.pos.X = field_17C.X;
mat.pos.Y = field_17C.Y;
mat.pos.Z = field_17C.Z;
m_pPlayerPed->SetMatrix(mat);
return;
}
m_pPlayerPed->GetMoveSpeedVector(&vecMove);
float fLerp = fPosLerp;
if(field_160 > 0.00001f) vecMove.X = (field_17C.X - mat.pos.X) * fLerp + vecMove.X;
if(field_164 > 0.00001f) vecMove.Y = (field_17C.Y - mat.pos.Y) * fLerp + vecMove.Y;
if(field_168 > 0.00001f) vecMove.Z = (field_17C.Z - mat.pos.Z) * fLerp + vecMove.Z;
m_pPlayerPed->SetMoveSpeedVector(vecMove);
}
//----------------------------------------------------
void CRemotePlayer::FUNC_10014E60()
{
if(!m_pPlayerPed) return;
+2 -1
View File
@@ -39,7 +39,7 @@ public:
char _gap114[76];
float field_160;
float field_164;
char _gap168[4];
float field_168;
float quat16C[4];
VECTOR field_17C;
VECTOR field_188;
@@ -94,6 +94,7 @@ public:
void FUNC_100148F0(); // .text:100148F0
void FUNC_10014FF0(); // .text:10014FF0
void FUNC_10017260(BYTE *pSync, int iTime); // .text:10017260
void FUNC_10014C40(); // .text:10014C40
void FUNC_10014E60(); // .text:10014E60
void FUNC_10015460(); // .text:10015460
void FUNC_10015760(BYTE *pAim); // .text:10015760