From ef8d3e3354a661179efe141f1be80a6b1ade28a2 Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Sat, 5 Sep 2026 09:08:42 +0700 Subject: [PATCH] [saco] Implement/match `FUNC_10014E60`; writing the snap tail at both exits lets the merge hoist the `field_17C` load above the `IsAdded` branch --- saco/net/remoteplayer.cpp | 37 +++++++++++++++++++++++++++++++++++++ saco/net/remoteplayer.h | 6 +++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/saco/net/remoteplayer.cpp b/saco/net/remoteplayer.cpp index b9f9596..27a3746 100644 --- a/saco/net/remoteplayer.cpp +++ b/saco/net/remoteplayer.cpp @@ -23,6 +23,7 @@ typedef char CRemotePlayer_offsets[( offsetof(CRemotePlayer, field_10A) == 0x10A && offsetof(CRemotePlayer, field_10B) == 0x10B && offsetof(CRemotePlayer, field_10C) == 0x10C && + offsetof(CRemotePlayer, field_160) == 0x160 && offsetof(CRemotePlayer, field_17C) == 0x17C && offsetof(CRemotePlayer, field_188) == 0x188 && offsetof(CRemotePlayer, field_194) == 0x194 && @@ -409,6 +410,42 @@ void CRemotePlayer::FUNC_10017260(BYTE *pSync, int iTime) //---------------------------------------------------- +void CRemotePlayer::FUNC_10014E60() +{ + if(!m_pPlayerPed) return; + + MATRIX4X4 mat; + VECTOR vecMove; + + m_pPlayerPed->GetMatrix(&mat); + + if(!m_pPlayerPed->IsAdded()) { + mat.pos.X = field_17C.X; + mat.pos.Y = field_17C.Y; + m_pPlayerPed->SetMatrix(mat); + return; + } + + field_160 = FloatOffset(field_17C.X, mat.pos.X); + field_164 = FloatOffset(field_17C.Y, mat.pos.Y); + + if(field_160 <= 0.01f && field_164 <= 0.01f) return; + + if(field_160 > 2.0f || field_164 > 2.0f) { + mat.pos.X = field_17C.X; + mat.pos.Y = field_17C.Y; + m_pPlayerPed->SetMatrix(mat); + return; + } + + m_pPlayerPed->GetMoveSpeedVector(&vecMove); + if(field_160 > 0.001f) vecMove.X = (field_17C.X - mat.pos.X) * 0.1f + vecMove.X; + if(field_164 > 0.001f) vecMove.Y = (field_17C.Y - mat.pos.Y) * 0.1f + vecMove.Y; + m_pPlayerPed->SetMoveSpeedVector(vecMove); +} + +//---------------------------------------------------- + void CRemotePlayer::FUNC_10015460() { MATRIX4X4 mat; diff --git a/saco/net/remoteplayer.h b/saco/net/remoteplayer.h index da555e2..6cd0822 100644 --- a/saco/net/remoteplayer.h +++ b/saco/net/remoteplayer.h @@ -36,7 +36,10 @@ public: int field_10C; int field_110; - char _gap114[88]; + char _gap114[76]; + float field_160; + float field_164; + char _gap168[4]; float quat16C[4]; VECTOR field_17C; VECTOR field_188; @@ -91,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_10014E60(); // .text:10014E60 void FUNC_10015460(); // .text:10015460 void FUNC_10015760(BYTE *pAim); // .text:10015760 BOOL FUNC_10017130(int a1, int iSkin, int a3, VECTOR *pPos, float fRotation,