[saco] Implement PedPtrRecord functions

Implements:
* `InitPlayerPedPtrRecords()`
* `SetPlayerPedPtrRecord(...)`
* `GetPlayerPedPtrRecord(...)`
* `FindPlayerNumFromPedPtr(...)`
This commit is contained in:
RD42 2024-02-15 21:56:14 +08:00
parent 1a6f6c55e4
commit 3e6824e686
2 changed files with 48 additions and 0 deletions

View File

@ -4,6 +4,14 @@
#include "../main.h"
#include <sys/stat.h>
DWORD dwPlayerPedPtrs[PLAYER_PED_SLOTS];
struct struc_96
{
char _gap0[16];
};
struc_96 unnamed_1026C258[PLAYER_PED_SLOTS];
#define NUM_RADAR_COLORS 1000
DWORD dwHudColors[NUM_RADAR_COLORS] = {
@ -1044,6 +1052,42 @@ void GameResetRadarColors()
}
//-----------------------------------------------------------
void __stdcall InitPlayerPedPtrRecords()
{
memset(&dwPlayerPedPtrs[0],0,sizeof(DWORD) * PLAYER_PED_SLOTS);
memset(unnamed_1026C258, 0, sizeof(struc_96) * PLAYER_PED_SLOTS);
}
//-----------------------------------------------------------
void __stdcall SetPlayerPedPtrRecord(BYTE bytePlayer, DWORD dwPedPtr)
{
dwPlayerPedPtrs[bytePlayer] = dwPedPtr;
memset(&unnamed_1026C258[bytePlayer], 0, sizeof(struc_96));
}
//-----------------------------------------------------------
DWORD __stdcall GetPlayerPedPtrRecord(BYTE bytePlayer)
{
return dwPlayerPedPtrs[bytePlayer];
}
//-----------------------------------------------------------
BYTE __stdcall FindPlayerNumFromPedPtr(DWORD dwPedPtr)
{
BYTE x = 0;
while(x != PLAYER_PED_SLOTS)
{
if(dwPlayerPedPtrs[x] == dwPedPtr) return x;
x++;
}
return 0;
}

View File

@ -6,6 +6,10 @@ void __stdcall SetRadarColor(int nIndex,DWORD dwColor);
PED_TYPE * __stdcall GamePool_FindPlayerPed();
DWORD __stdcall TranslateColorCodeToRGBA(int iCode);
void __stdcall InitPlayerPedPtrRecords();
void __stdcall SetPlayerPedPtrRecord(BYTE bytePlayer, DWORD dwPedPtr);
DWORD __stdcall GetPlayerPedPtrRecord(BYTE bytePlayer);
BYTE __stdcall FindPlayerNumFromPedPtr(DWORD dwPedPtr);
void GameResetRadarColors();