From 03b2f5b5a50fa4ab99b4fb2499c9d77a27dfbc28 Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Sat, 5 Sep 2026 08:35:06 +0700 Subject: [PATCH] [saco] Implement/match `FUNC_10015460`; the turn-speed clamp is gated by an initialised global and `_gap16C` is the synced quaternion --- saco/game/util.h | 2 ++ saco/net/remoteplayer.cpp | 40 ++++++++++++++++++++++++++++++++++++++- saco/net/remoteplayer.h | 3 ++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/saco/game/util.h b/saco/game/util.h index 53c6fa9..0a9dcdc 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -113,6 +113,8 @@ void FUNC_100B52B0(MATRIX4X4 *pMatrix, float *pQuatOut); // .text:100B52B0 void FUNC_100B5480(float *pQuatOut, float *pQuatFrom, float *pQuatTo, float fT); // .text:100B5480 void FUNC_100B6A80(float *pQuat, MATRIX4X4 *pMatrix); // .text:100B6A80 void __stdcall FUNC_100B6900(VECTOR *pFront, VECTOR *pOut); // .text:100B6900 +void FUNC_100B5470(float *pQuat, MATRIX4X4 *pMatrix); // .text:100B5470 +void FUNC_100B5500(float *pQuat); // .text:100B5500 void FUNC_100B5210(int a1, void *a2); // .text:100B5210, __cdecl: the caller's // stack cleanup is folded into the next call's argument setup diff --git a/saco/net/remoteplayer.cpp b/saco/net/remoteplayer.cpp index 23ce370..b10a28b 100644 --- a/saco/net/remoteplayer.cpp +++ b/saco/net/remoteplayer.cpp @@ -8,6 +8,8 @@ using namespace RakNet; extern CNetGame* pNetGame; extern CChatWindow *pChatWindow; +int bClampVehicleTurnSpeed = 1; + //---------------------------------------------------- // layout locks: a negative array size fails the build if any offset moves @@ -212,7 +214,7 @@ void CRemotePlayer::FUNC_100150D0(VECTOR *pPos, VECTOR *pMoveSpeed) void CRemotePlayer::FUNC_100155E0(int a1, VECTOR *pPos, VECTOR *pMoveSpeed) { - FUNC_100B5210(a1, &_gap16C); + FUNC_100B5210(a1, quat16C); field_194 = *pPos; field_1A0 = *pMoveSpeed; field_1E1->SetMoveSpeedVector(*pMoveSpeed); @@ -407,6 +409,42 @@ void CRemotePlayer::FUNC_10017260(BYTE *pSync, int iTime) //---------------------------------------------------- +void CRemotePlayer::FUNC_10015460() +{ + MATRIX4X4 mat; + float quatCur[4]; + float quatBlend[4]; + VECTOR vecTurn; + + vecTurn.X = 0.0f; + vecTurn.Y = 0.0f; + vecTurn.Z = 0.0f; + + if(!field_1E1) return; + + if(bClampVehicleTurnSpeed) { + field_1E1->GetTurnSpeedVector(&vecTurn); + + if(vecTurn.X > 0.02f) vecTurn.X = 0.02f; + else if(vecTurn.X < -0.02f) vecTurn.X = -0.02f; + if(vecTurn.Y > 0.02f) vecTurn.Y = 0.02f; + else if(vecTurn.Y < -0.02f) vecTurn.Y = -0.02f; + if(vecTurn.Z > 0.02f) vecTurn.Z = 0.02f; + else if(vecTurn.Z < -0.02f) vecTurn.Z = -0.02f; + + field_1E1->SetTurnSpeedVector(vecTurn); + } + + field_1E1->GetMatrix(&mat); + FUNC_100B5210((int)&mat, quatCur); + FUNC_100B5480(quatBlend, quat16C, quatCur, 0.75f); + FUNC_100B5500(quatBlend); + FUNC_100B5470(quatBlend, &mat); + field_1E1->SetMatrix(mat); +} + +//---------------------------------------------------- + void CRemotePlayer::FUNC_10015760(BYTE *pAim) { if(!m_pPlayerPed) return; diff --git a/saco/net/remoteplayer.h b/saco/net/remoteplayer.h index df6d4c8..63ec727 100644 --- a/saco/net/remoteplayer.h +++ b/saco/net/remoteplayer.h @@ -37,7 +37,7 @@ public: int field_110; char _gap114[88]; - char _gap16C[16]; + float quat16C[4]; VECTOR field_17C; VECTOR field_188; VECTOR field_194; @@ -86,6 +86,7 @@ public: void FUNC_100148F0(); // .text:100148F0 void FUNC_10014FF0(); // .text:10014FF0 void FUNC_10017260(BYTE *pSync, int iTime); // .text:10017260 + 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, DWORD dwColor, BYTE byteStyle); // .text:10017130