[saco] Implement/match CCollision__BuildCacheOfCameraCollision_Hook

This commit is contained in:
ricardoofnl
2026-08-30 13:43:07 +07:00
parent 90115c3135
commit 9b134f0932
4 changed files with 60 additions and 2 deletions
+55 -2
View File
@@ -13,6 +13,8 @@ extern CObjectPool *unnamed_1014FFAC; // 0x1014FFAC, lives in another translatio
extern DWORD dwGraphicsLoop; // Used for the external dll game loop.
extern CObjectPool *unnamed_1014FFAC; // second object pool, see .text:100A5090
#define NUDE void _declspec(naked)
//-----------------------------------------------------------
@@ -1838,9 +1840,60 @@ NUDE CEventDamage__AffectsPed_Hook()
//-----------------------------------------------------------
NUDE CCollision__BuildCacheOfCameraCollision_Hook()
// the game hands two 20 byte blocks (a position plus two more floats) to
// CCollision::BuildCacheOfCameraCollision
typedef struct _CAMCOL_POINT
{
// TODO: CCollision__BuildCacheOfCameraCollision_Hook
VECTOR vecPos;
float field_C;
float field_10;
} CAMCOL_POINT;
CAMCOL_POINT _camColStart;
CAMCOL_POINT _camColEnd;
BYTE _byteCamColResult;
BYTE CCollision__BuildCacheOfCameraCollision_Hook(CAMCOL_POINT *pStart, CAMCOL_POINT *pEnd)
{
_camColStart = *pStart;
_camColEnd = *pEnd;
_byteCamColResult = 0;
__asm
{
push pEnd
push pStart
// call original CCollision::BuildCacheOfCameraCollision
mov edx, 0x41AC40
call edx
mov _byteCamColResult, al
pop edx
pop edx
}
// gta only caches collision inside the map bounds, so samp entities placed
// outside of them have to be checked by hand
if (pEnd->vecPos.X > 3000.0f || pEnd->vecPos.X < -3000.0f ||
pEnd->vecPos.Y > 3000.0f || pEnd->vecPos.Y < -3000.0f)
{
if (pNetGame && !_byteCamColResult &&
pNetGame->GetObjectPool()->FUNC_10012DE0(&_camColStart.vecPos, &_camColEnd.vecPos))
_byteCamColResult = 1;
if (unnamed_1014FFAC && !_byteCamColResult &&
unnamed_1014FFAC->FUNC_10012DE0(&_camColStart.vecPos, &_camColEnd.vecPos))
_byteCamColResult = 1;
if (pNetGame && !pNetGame->GetField232() && !_byteCamColResult &&
pNetGame->GetVehiclePool()->FUNC_1001EE20(&_camColStart.vecPos, &_camColEnd.vecPos))
_byteCamColResult = 1;
}
return _byteCamColResult;
}
//-----------------------------------------------------------
+1
View File
@@ -77,6 +77,7 @@ public:
DWORD GetTime();
int GetGameState() { return m_iGameState; };
char GetField232() { return field_232; };
BOOL GetWalkStyle() { return field_3D5->bUseCJWalk; };
struc_41 * GetSettings() { return field_3D5; };
+2
View File
@@ -8,6 +8,8 @@ private:
int field_4[MAX_OBJECTS];
int field_FA4[MAX_OBJECTS];
public:
char FUNC_10012DE0(VECTOR *vecStart, VECTOR *vecEnd); // .text:10012DE0
CObjectPool();
void FUNC_10012B90(); // .text:10012B90
+2
View File
@@ -27,6 +27,8 @@ public:
int FUNC_10001120(unsigned short a1); // .text:10001120
char FUNC_1001EE20(VECTOR *vecStart, VECTOR *vecEnd); // .text:1001EE20
CVehiclePool();
};