mirror of
https://github.com/dashr9230/SA-MP.git
synced 2026-10-10 19:53:04 +08:00
[saco] Implement/match CWorld__ProcessLineOfSight_Hook
This commit is contained in:
+68
-2
@@ -2542,9 +2542,75 @@ NUDE CWeapon__FireInstantHit_Hook()
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
NUDE CWorld__ProcessLineOfSight_Hook()
|
||||
extern DWORD unnamed_10118990; // 0x10118990, lives in another translation unit
|
||||
|
||||
// where a synced shot came from, snapshotted by CPlayerPed::FUNC_100AFA70
|
||||
struct SHOT_SYNC_DATA
|
||||
{
|
||||
// TODO: CWorld__ProcessLineOfSight_Hook
|
||||
char _gap0[0x1C];
|
||||
VECTOR vecOffset;
|
||||
ENTITY_TYPE *pAttachedTo;
|
||||
};
|
||||
|
||||
// todo: implement sub_100A5410
|
||||
void __stdcall sub_100A5410(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint, DWORD *pHitEntity);
|
||||
|
||||
VECTOR vecShotOrigin; // 0x10150CE4
|
||||
BOOL bLineOfSightResult = 0; // 0x101517B0
|
||||
CPlayerPed *pShotSyncPlayer = 0; // 0x101517CC
|
||||
SHOT_SYNC_DATA *pShotSyncData = 0; // 0x101517D0
|
||||
|
||||
BOOL CWorld__ProcessLineOfSight_Hook(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint,
|
||||
DWORD *pHitEntity, int bCheckBuildings, int bCheckVehicles, int bCheckPeds,
|
||||
int bCheckObjects, int bCheckDummies, int bSeeThroughStuff,
|
||||
int bIgnoreSomeObjectsForCamera, int bUnk1)
|
||||
{
|
||||
// aim the ray at where the remote player actually shot from
|
||||
if(unnamed_10118990 != 2 && pShotSyncPlayer && pShotSyncPlayer != pGame->FindPlayerPed() &&
|
||||
pShotSyncData && pShotSyncData->pAttachedTo &&
|
||||
pShotSyncData->pAttachedTo->vtable != 0x863C40 &&
|
||||
pShotSyncData->pAttachedTo->mat)
|
||||
{
|
||||
if(unnamed_10118990 == 0)
|
||||
{
|
||||
FUNC_100B4D10(&vecShotOrigin, pShotSyncData->pAttachedTo->mat, &pShotSyncData->vecOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
vecShotOrigin.X = pShotSyncData->pAttachedTo->mat->pos.X + pShotSyncData->vecOffset.X;
|
||||
vecShotOrigin.Y = pShotSyncData->pAttachedTo->mat->pos.Y + pShotSyncData->vecOffset.Y;
|
||||
vecShotOrigin.Z = pShotSyncData->pAttachedTo->mat->pos.Z + pShotSyncData->vecOffset.Z;
|
||||
}
|
||||
|
||||
vecLine->X = vecShotOrigin.X - vecOrigin->X + vecShotOrigin.X;
|
||||
vecLine->Y = vecShotOrigin.Y - vecOrigin->Y + vecShotOrigin.Y;
|
||||
vecLine->Z = vecShotOrigin.Z - vecOrigin->Z + vecShotOrigin.Z;
|
||||
}
|
||||
|
||||
bLineOfSightResult = ProcessLineOfSight(vecOrigin, vecLine, colPoint, pHitEntity,
|
||||
bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies,
|
||||
bSeeThroughStuff, bIgnoreSomeObjectsForCamera, bUnk1);
|
||||
|
||||
// a remote player's shot must not collide with the local player
|
||||
if(unnamed_10118990 != 2 && pShotSyncPlayer && pShotSyncPlayer != pGame->FindPlayerPed() &&
|
||||
pShotSyncData && !pShotSyncData->pAttachedTo)
|
||||
{
|
||||
if(*pHitEntity == (DWORD)GamePool_FindPlayerPed() ||
|
||||
(IN_VEHICLE(GamePool_FindPlayerPed()) &&
|
||||
*pHitEntity == GamePool_FindPlayerPed()->pVehicle))
|
||||
{
|
||||
*pHitEntity = 0;
|
||||
colPoint->X = 0.0f;
|
||||
colPoint->Y = 0.0f;
|
||||
colPoint->Z = 0.0f;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if(pShotSyncPlayer && pShotSyncPlayer == pGame->FindPlayerPed())
|
||||
sub_100A5410(vecOrigin, vecLine, colPoint, pHitEntity);
|
||||
|
||||
return bLineOfSightResult;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ struc_13 VAR_1026C258[PLAYER_PED_SLOTS];
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
void __declspec(naked) ProcessLineOfSight(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint,
|
||||
BOOL __declspec(naked) ProcessLineOfSight(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint,
|
||||
DWORD *pHitEntity, int bCheckBuildings, int bCheckVehicles, int bCheckPeds,
|
||||
int bCheckObjects, int bCheckDummies, int bSeeThroughStuff,
|
||||
int bIgnoreSomeObjectsForCamera, int bUnk1)
|
||||
|
||||
+2
-1
@@ -9,7 +9,7 @@ struct struc_13
|
||||
DWORD field_C;
|
||||
};
|
||||
|
||||
void ProcessLineOfSight(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint,
|
||||
BOOL ProcessLineOfSight(VECTOR *vecOrigin, VECTOR *vecLine, VECTOR *colPoint,
|
||||
DWORD *pHitEntity, int bCheckBuildings, int bCheckVehicles, int bCheckPeds,
|
||||
int bCheckObjects, int bCheckDummies, int bSeeThroughStuff,
|
||||
int bIgnoreSomeObjectsForCamera, int bUnk1);
|
||||
@@ -60,6 +60,7 @@ BOOL IsFileOrDirectoryExists(char * szPath);
|
||||
DWORD unnamed_100B6100(char *szString, int nMaxLen);
|
||||
|
||||
bool FUNC_100B4B50(VECTOR *vecPos);
|
||||
void FUNC_100B4D10(VECTOR *vecOut, MATRIX4X4 *pMatrix, VECTOR *vecOffset);
|
||||
|
||||
BUILDING_TYPE * GamePool_GetBuilding();
|
||||
DUMMY_TYPE * GamePool_GetDummy();
|
||||
|
||||
Reference in New Issue
Block a user