From 0c65e210a29f18112a82a6fb80ea137d18dba38c Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Sat, 5 Sep 2026 10:43:56 +0700 Subject: [PATCH] [saco] Implement/match `FUNC_100B58A0`, `FUNC_100B5830` and `FUNC_100B5480`; the D3DX slerp staging quaternions are declared output-first so the later ones land lower on the frame --- saco/game/util.cpp | 71 ++++++++++++++++++++++++++++++++++++++++++++++ saco/game/util.h | 1 + 2 files changed, 72 insertions(+) diff --git a/saco/game/util.cpp b/saco/game/util.cpp index 19742df..0fe9e56 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -1970,3 +1970,74 @@ void FUNC_100B5500(float *pQuat) pQuat[2] = qOut.y; pQuat[3] = qOut.z; } + +//----------------------------------------------------------- + +void FUNC_100B58A0(DWORD dwFrame, VECTOR *vecOut, int *a3) +{ + DWORD dwFunc = (iGtaVersion != GTASA_VERSION_USA10) ? 0x7EBAC0 : 0x7EBA80; + + _asm push a3 + _asm push vecOut + _asm push dwFrame + _asm mov edx, dwFunc + _asm call edx + _asm pop edx + _asm pop edx + _asm pop edx +} + +//----------------------------------------------------------- + +VECTOR VAR_1026DF90; +VECTOR VAR_1026DF9C; +float VAR_1026CF7C; + +void FUNC_100B5830(int a1, int nIndex, float *pfOut) +{ + VAR_1026DF9C = VAR_10117400[nIndex]; + + DWORD dwFunc = (iGtaVersion != GTASA_VERSION_USA10) ? 0x7F2760 : 0x7F2720; + + _asm lea eax, VAR_1026DF90 + _asm push eax + _asm lea eax, VAR_1026CF7C + _asm push eax + _asm lea eax, VAR_1026DF9C + _asm push eax + _asm push a1 + _asm mov edx, dwFunc + _asm call edx + _asm pop edx + _asm pop edx + _asm pop edx + _asm pop edx + + *pfOut = VAR_1026CF7C; +} + +//----------------------------------------------------------- + +void FUNC_100B5480(float *pQuatOut, float *pQuatFrom, float *pQuatTo, float fT) +{ + D3DXQUATERNION qOut; + D3DXQUATERNION q1; + D3DXQUATERNION q2; + + q1.w = pQuatFrom[0]; + q1.x = pQuatFrom[1]; + q1.y = pQuatFrom[2]; + q1.z = pQuatFrom[3]; + + q2.w = pQuatTo[0]; + q2.x = pQuatTo[1]; + q2.y = pQuatTo[2]; + q2.z = pQuatTo[3]; + + D3DXQuaternionSlerp(&qOut, &q1, &q2, fT); + + pQuatOut[0] = qOut.w; + pQuatOut[1] = qOut.x; + pQuatOut[2] = qOut.y; + pQuatOut[3] = qOut.z; +} diff --git a/saco/game/util.h b/saco/game/util.h index 5e820f1..0af6428 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -167,6 +167,7 @@ void FUNC_100B5420(float *pQuat, MATRIX4X4 *pMatrix); // .text:100B5420 void FUNC_100B57E0(int a1, int nIndex, int a3, int a4); // .text:100B57E0 void FUNC_100B5790(int a1, int nIndex, int a3); // .text:100B5790 void FUNC_100B5740(int a1, int a2); // .text:100B5740 +void FUNC_100B5830(int a1, int nIndex, float *pfOut); // .text:100B5830 void FUNC_100B5210(int a1, void *a2); // .text:100B5210, __cdecl: the caller's // stack cleanup is folded into the next call's argument setup