@@ -16,6 +16,44 @@ extern CGameSA* pGame;
1616unsigned long CEntitySA::FUNC_CClumpModelInfo__GetFrameFromId;
1717unsigned long CEntitySA::FUNC_RwFrameGetLTM;
1818
19+ void CEntitySAInterface::TransformFromObjectSpace (CVector& outPosn, CVector const & offset)
20+ {
21+ ((void (__thiscall*)(CEntitySAInterface*, CVector&, CVector const &))0x533560 )(this , outPosn, offset);
22+ }
23+ 24+ CVector* CEntitySAInterface::GetBoundCentre (CVector* pOutCentre)
25+ {
26+ return ((CVector * (__thiscall*)(CEntitySAInterface*, CVector*))0x534250 )(this , pOutCentre);
27+ }
28+ 29+ CRect* CEntitySAInterface::GetBoundRect_ (CRect* pRect)
30+ {
31+ CColModelSAInterface* colModel = CModelInfoSAInterface::GetModelInfo (m_nModelIndex)->pColModel ;
32+ CVector vecMin = colModel->boundingBox .vecMin ;
33+ CVector vecMax = colModel->boundingBox .vecMax ;
34+ CRect rect;
35+ CVector point;
36+ TransformFromObjectSpace (point, vecMin);
37+ rect.StretchToPoint (point.fX , point.fY );
38+ TransformFromObjectSpace (point, vecMax);
39+ rect.StretchToPoint (point.fX , point.fY );
40+ float maxX = vecMax.fX ;
41+ vecMax.fX = vecMin.fX ;
42+ vecMin.fX = maxX;
43+ TransformFromObjectSpace (point, vecMin);
44+ rect.StretchToPoint (point.fX , point.fY );
45+ TransformFromObjectSpace (point, vecMax);
46+ rect.StretchToPoint (point.fX , point.fY );
47+ *pRect = rect;
48+ pRect->FixIncorrectTopLeft (); // Fix #1613: custom map collision crashes in CPhysical class (infinite loop)
49+ return pRect;
50+ }
51+ 52+ void CEntitySAInterface::StaticSetHooks ()
53+ {
54+ HookInstall (0x534120 , &CEntitySAInterface::GetBoundRect_);
55+ }
56+ 1957CEntitySA::CEntitySA ()
2058{
2159 // Set these variables to a constant state
0 commit comments