mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-11-23 22:39:39 +00:00
[saco] Implement util functions
Implements: * `WorldAddEntity(...)` * `WorldRemoveEntity(...)` * `GameDisableCheatCodes()` * `GamePool_Ped_GetAt(...)` * `GamePool_Ped_GetIndex(...)` * `GamePool_Vehicle_GetAt(...)` * `GamePool_Vehicle_GetIndex(...)` * `GamePool_Object_GetAt(...)` * Updates `InitPlayerPedPtrRecords()`
This commit is contained in:
parent
673ec195bc
commit
f398b9c82c
@ -21,4 +21,11 @@
|
||||
|
||||
#define ADDR_ENABLE_HUD 0xBA6769
|
||||
|
||||
#define ADDR_ID_FROM_ACTOR 0x4442D0
|
||||
#define ADDR_ACTOR_FROM_ID 0x404910 // Converts id to actor ptr
|
||||
#define ADDR_PED_TABLE 0xB74490 // Contains ptr to actor/ped table
|
||||
|
||||
#define ADDR_VEHICLE_FROM_ID 0x4048E0 // Converts id to vehicle ptr
|
||||
#define ADDR_VEHICLE_TABLE 0xB74494 // Contains ptr to the vehicles table
|
||||
|
||||
#define ADDR_CAMERA 0xB6F99C
|
||||
|
@ -64,6 +64,14 @@ typedef struct _PED_TYPE
|
||||
|
||||
} PED_TYPE;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
typedef struct _VEHICLE_TYPE
|
||||
{
|
||||
char _gap0;
|
||||
} VEHICLE_TYPE;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
// ---- weapon id defines ----
|
||||
|
@ -1030,6 +1030,113 @@ void ProcessLineOfSight(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint,
|
||||
_asm jmp eax
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
void __stdcall WorldAddEntity(DWORD *dwEnt)
|
||||
{
|
||||
_asm push dwEnt
|
||||
_asm mov ebx, 0x563220
|
||||
_asm call ebx
|
||||
_asm pop ebx
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
void __stdcall WorldRemoveEntity(DWORD *dwEnt)
|
||||
{
|
||||
_asm push dwEnt
|
||||
_asm mov ebx, 0x563280
|
||||
_asm call ebx
|
||||
_asm pop ebx
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
void __stdcall GameDisableCheatCodes()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
PED_TYPE * __stdcall GamePool_Ped_GetAt(int iID)
|
||||
{
|
||||
PED_TYPE *pActorRet;
|
||||
|
||||
_asm mov ebx, ADDR_PED_TABLE
|
||||
_asm mov ecx, [ebx]
|
||||
_asm push iID
|
||||
_asm mov ebx, ADDR_ACTOR_FROM_ID
|
||||
_asm call ebx
|
||||
_asm mov pActorRet, eax
|
||||
|
||||
return pActorRet;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
int __stdcall GamePool_Ped_GetIndex(PED_TYPE *pActor)
|
||||
{
|
||||
int iRetVal;
|
||||
|
||||
_asm mov ebx, ADDR_PED_TABLE
|
||||
_asm mov ecx, [ebx]
|
||||
_asm push pActor
|
||||
_asm mov ebx, ADDR_ID_FROM_ACTOR
|
||||
_asm call ebx
|
||||
_asm mov iRetVal, eax
|
||||
|
||||
return iRetVal;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
VEHICLE_TYPE * __stdcall GamePool_Vehicle_GetAt(int iID)
|
||||
{
|
||||
VEHICLE_TYPE *pVehicleRet;
|
||||
|
||||
_asm mov ebx, ADDR_VEHICLE_TABLE
|
||||
_asm mov ecx, [ebx]
|
||||
_asm push iID
|
||||
_asm mov ebx, ADDR_VEHICLE_FROM_ID
|
||||
_asm call ebx
|
||||
_asm mov pVehicleRet, eax
|
||||
|
||||
return pVehicleRet;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
DWORD __stdcall GamePool_Vehicle_GetIndex(VEHICLE_TYPE *pVehicle)
|
||||
{
|
||||
DWORD dwID=0;
|
||||
|
||||
_asm mov eax, ADDR_VEHICLE_TABLE
|
||||
_asm mov ecx, [eax]
|
||||
_asm push pVehicle
|
||||
_asm mov edx, 0x424160
|
||||
_asm call edx
|
||||
_asm mov dwID, eax
|
||||
|
||||
return dwID;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
ENTITY_TYPE * __stdcall GamePool_Object_GetAt(int iID)
|
||||
{
|
||||
ENTITY_TYPE *pObjectRet;
|
||||
|
||||
_asm mov ebx, 0xB7449C
|
||||
_asm mov ecx, [ebx]
|
||||
_asm push iID
|
||||
_asm mov ebx, 0x465040
|
||||
_asm call ebx
|
||||
_asm mov pObjectRet, eax
|
||||
|
||||
return pObjectRet;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Return the PED_TYPE * of the local player actor.
|
||||
|
||||
@ -1038,6 +1145,8 @@ PED_TYPE * __stdcall GamePool_FindPlayerPed()
|
||||
return *(PED_TYPE **)(0xB7CD98);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
void __stdcall SetRadarColor(int nIndex,DWORD dwColor)
|
||||
{
|
||||
if(nIndex < sizeof(dwUseHudColors)) {
|
||||
@ -1068,7 +1177,7 @@ void GameResetRadarColors()
|
||||
void __stdcall InitPlayerPedPtrRecords()
|
||||
{
|
||||
memset(&dwPlayerPedPtrs[0],0,sizeof(DWORD) * PLAYER_PED_SLOTS);
|
||||
memset(unnamed_1026C258, 0, sizeof(struc_96) * PLAYER_PED_SLOTS);
|
||||
memset(unnamed_1026C258, 0, sizeof(unnamed_1026C258));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
@ -8,6 +8,16 @@ void ProcessLineOfSight(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint,
|
||||
|
||||
void __stdcall SetRadarColor(int nIndex,DWORD dwColor);
|
||||
|
||||
void __stdcall WorldRemoveEntity(DWORD *dwEnt);
|
||||
void __stdcall WorldAddEntity(DWORD *dwEnt);
|
||||
|
||||
void __stdcall GameDisableCheatCodes();
|
||||
|
||||
PED_TYPE * __stdcall GamePool_Ped_GetAt(int iID);
|
||||
int __stdcall GamePool_Ped_GetIndex(PED_TYPE *pActor);
|
||||
VEHICLE_TYPE * __stdcall GamePool_Vehicle_GetAt(int iID);
|
||||
DWORD __stdcall GamePool_Vehicle_GetIndex(VEHICLE_TYPE *pVehicle);
|
||||
ENTITY_TYPE * __stdcall GamePool_Object_GetAt(int iID);
|
||||
PED_TYPE * __stdcall GamePool_FindPlayerPed();
|
||||
|
||||
DWORD __stdcall TranslateColorCodeToRGBA(int iCode);
|
||||
|
Loading…
Reference in New Issue
Block a user