From 5baa271d749e974f5c95e8d8bbbc9bb84fb53978 Mon Sep 17 00:00:00 2001 From: ricardoofnl Date: Sat, 5 Sep 2026 09:31:29 +0700 Subject: [PATCH] [saco] Match `FUNC_10004280`; `GetAt` is called twice and the pool bound check folds into `GetSlotState` --- saco/net/localplayer.cpp | 16 ++++++++++++++++ saco/net/localplayer.h | 1 + 2 files changed, 17 insertions(+) diff --git a/saco/net/localplayer.cpp b/saco/net/localplayer.cpp index 5775bf1..1c36fec 100644 --- a/saco/net/localplayer.cpp +++ b/saco/net/localplayer.cpp @@ -571,3 +571,19 @@ void CLocalPlayer::FUNC_100041C0(BOOL bSpectating) field_314 = 0; field_310 = -1; } + +//---------------------------------------------------- + +// picks a player to spectate; state 32 is not a spectatable one +void CLocalPlayer::FUNC_10004280(PLAYERID playerId) +{ + CPlayerPool *pPlayerPool = pNetGame->GetPlayerPool(); + + if(pPlayerPool && pPlayerPool->GetSlotState(playerId) && pPlayerPool->GetAt(playerId)->field_10A + && pPlayerPool->GetAt(playerId)->field_10A != 32) + { + field_30F = 1; + field_310 = playerId; + field_314 = 0; + } +} diff --git a/saco/net/localplayer.h b/saco/net/localplayer.h index b4a1088..85511e6 100644 --- a/saco/net/localplayer.h +++ b/saco/net/localplayer.h @@ -151,6 +151,7 @@ public: BOOL FUNC_10003A60(void *a2, void *a3, unsigned int a4); // .text:10003A60 void FUNC_10004080(); // .text:10004080 void FUNC_10004230(WORD a1); // .text:10004230 + void FUNC_10004280(PLAYERID playerId); // .text:10004280 void FUNC_10003F50(); // .text:10003F50 void FUNC_100041C0(BOOL bSpectating); // .text:100041C0