From 5443357df1dddd32b9cef57cde77782b0d808138 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:03:19 +0800 Subject: [PATCH] [saco] Rename and match `CGame::sub_100A00C0()` * Rename `unnamed_10150340` to `bUsedPlayerSlots` * Update CGame constructor * Rename `CGame::sub_100A00C0()` to `CGame::FindFirstFreePlayerPedSlot()` * Update `CGame::sub_100A00F0()` --- saco/game/game.cpp | 24 ++++++++++++------------ saco/game/game.h | 2 ++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/saco/game/game.cpp b/saco/game/game.cpp index 19827a0..59d555b 100644 --- a/saco/game/game.cpp +++ b/saco/game/game.cpp @@ -19,7 +19,7 @@ DWORD dwDummyActiveMouseState; unsigned char *szGameTextMessage; HWND hWindowHandle; -int unnamed_10150340[210]; +BOOL bUsedPlayerSlots[PLAYER_PED_SLOTS]; IDirectInputDevice8 *pDirectInputMouse; BYTE unnamed_10150688; @@ -46,7 +46,7 @@ CGame::CGame() field_65 = 0; field_69 = FALSE; field_6D = 0; - memset(unnamed_10150340, 0, sizeof(unnamed_10150340)); + memset(bUsedPlayerSlots, 0, sizeof(bUsedPlayerSlots)); memset(field_6E, 0, sizeof(field_6E)); field_55 = 0; field_59 = 1; @@ -86,25 +86,27 @@ void CGame::sub_100A0090(int a1, int a2) Sleep(1000 / a2 - a1 - 1); } -BYTE CGame::sub_100A00C0() +//----------------------------------------------------------- + +BYTE CGame::FindFirstFreePlayerPedSlot() { - BYTE result = 2; - while(result != 210) - { - if(!unnamed_10150340[result]) - return result; - result++; + BYTE x=2; + while(x!=PLAYER_PED_SLOTS) { + if(bUsedPlayerSlots[x] != TRUE) return x; + x++; } return 0; } +//----------------------------------------------------------- + BYTE CGame::sub_100A00F0() { BYTE result = 0; BYTE v1 = 2; while(v1 != 210) { - if(unnamed_10150340[v1] == 1) + if(bUsedPlayerSlots[v1] == 1) { result++; } @@ -113,8 +115,6 @@ BYTE CGame::sub_100A00F0() return result; } - - //----------------------------------------------------------- int CGame::GetWeaponModelIDFromWeapon(int iWeaponID) diff --git a/saco/game/game.h b/saco/game/game.h index 289ee4d..3cc2ad0 100644 --- a/saco/game/game.h +++ b/saco/game/game.h @@ -43,6 +43,8 @@ private: public: + BYTE FindFirstFreePlayerPedSlot(); + int GetWeaponModelIDFromWeapon(int iWeaponID); BOOL IsKeyPressed(int iKeyIdentifier); float FindGroundZForCoord(float x, float y, float z);