summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/EventList.h2
-rw-r--r--src/core/General.h16
-rw-r--r--src/core/Messages.cpp1
-rw-r--r--src/core/Messages.h1
-rw-r--r--src/core/Pad.cpp68
-rw-r--r--src/core/Pad.h15
-rw-r--r--src/core/World.cpp153
-rw-r--r--src/core/World.h3
8 files changed, 214 insertions, 45 deletions
diff --git a/src/core/EventList.h b/src/core/EventList.h
index d0fc0847..9f5756be 100644
--- a/src/core/EventList.h
+++ b/src/core/EventList.h
@@ -63,3 +63,5 @@ public:
static bool FindClosestEvent(eEventType type, CVector posn, int32 *event);
static void ReportCrimeForEvent(eEventType type, int32, bool);
};
+
+extern CEvent *gaEvent; \ No newline at end of file
diff --git a/src/core/General.h b/src/core/General.h
index 64613478..7c0c9562 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -36,6 +36,22 @@ public:
}
}
+ static float LimitAngle(float angle)
+ {
+ float result = angle;
+
+ while (result >= 180.0f) {
+ result -= 2 * 180.0f;
+ }
+
+ while (result < -180.0f) {
+ result += 2 * 180.0f;
+ }
+
+ return result;
+ }
+
+
static float LimitRadianAngle(float angle)
{
float result;
diff --git a/src/core/Messages.cpp b/src/core/Messages.cpp
index 7fc23593..aedcb0b9 100644
--- a/src/core/Messages.cpp
+++ b/src/core/Messages.cpp
@@ -9,6 +9,7 @@ WRAPPER char CMessages::WideStringCompare(wchar* str1, wchar* str2, unsigned sho
WRAPPER void CMessages::InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst) { EAXJMP(0x52A1A0); }
WRAPPER void CMessages::InsertPlayerControlKeysInString(wchar* src) { EAXJMP(0x52A490); }
WRAPPER int CMessages::GetWideStringLength(wchar* src) { EAXJMP(0x529490); }
+WRAPPER void CMessages::AddMessage(wchar*, uint32, uint16) { EAXJMP(0x529900); }
tPreviousBrief *CMessages::PreviousBriefs = (tPreviousBrief *)0x713C08;
tMessage *CMessages::BriefMessages = (tMessage *)0x8786E0;
diff --git a/src/core/Messages.h b/src/core/Messages.h
index 69cf117c..e1f4ced1 100644
--- a/src/core/Messages.h
+++ b/src/core/Messages.h
@@ -41,4 +41,5 @@ public:
static void InsertNumberInString(wchar* src, int n1, int n2, int n3, int n4, int n5, int n6, wchar* dst);
static void InsertPlayerControlKeysInString(wchar* src);
static int GetWideStringLength(wchar *src);
+ static void AddMessage(wchar*, uint32, uint16);
};
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 9c5e1c8a..1db50493 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -155,7 +155,7 @@ void CPad::Clear(bool bResetPlayerControls)
ShakeDur = 0;
if ( bResetPlayerControls )
- DisablePlayerControls = false;
+ DisablePlayerControls = PLAYERCONTROL_ENABLED;
bApplyBrakes = false;
@@ -659,7 +659,7 @@ CPad *CPad::GetPad(int32 pad)
int16 CPad::GetSteeringLeftRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -692,7 +692,7 @@ int16 CPad::GetSteeringLeftRight(void)
int16 CPad::GetSteeringUpDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -725,7 +725,7 @@ int16 CPad::GetSteeringUpDown(void)
int16 CPad::GetCarGunUpDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -752,7 +752,7 @@ int16 CPad::GetCarGunUpDown(void)
int16 CPad::GetCarGunLeftRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -779,7 +779,7 @@ int16 CPad::GetCarGunLeftRight(void)
int16 CPad::GetPedWalkLeftRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -813,7 +813,7 @@ int16 CPad::GetPedWalkLeftRight(void)
int16 CPad::GetPedWalkUpDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -876,7 +876,7 @@ int16 CPad::GetAnalogueUpDown(void)
bool CPad::GetLookLeft(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.LeftShoulder2 && !NewState.RightShoulder2);
@@ -884,7 +884,7 @@ bool CPad::GetLookLeft(void)
bool CPad::GetLookRight(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && !NewState.LeftShoulder2);
@@ -893,7 +893,7 @@ bool CPad::GetLookRight(void)
bool CPad::GetLookBehindForCar(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && NewState.LeftShoulder2);
@@ -901,7 +901,7 @@ bool CPad::GetLookBehindForCar(void)
bool CPad::GetLookBehindForPed(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!NewState.RightShock;
@@ -909,7 +909,7 @@ bool CPad::GetLookBehindForPed(void)
bool CPad::GetHorn(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -948,7 +948,7 @@ bool CPad::GetHorn(void)
bool CPad::HornJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -988,7 +988,7 @@ bool CPad::HornJustDown(void)
bool CPad::GetCarGunFired(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1015,7 +1015,7 @@ bool CPad::GetCarGunFired(void)
bool CPad::CarGunJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1042,7 +1042,7 @@ bool CPad::CarGunJustDown(void)
int16 CPad::GetHandBrake(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -1075,7 +1075,7 @@ int16 CPad::GetHandBrake(void)
int16 CPad::GetBrake(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -1113,7 +1113,7 @@ int16 CPad::GetBrake(void)
bool CPad::GetExitVehicle(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1140,7 +1140,7 @@ bool CPad::GetExitVehicle(void)
bool CPad::ExitVehicleJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1167,7 +1167,7 @@ bool CPad::ExitVehicleJustDown(void)
int32 CPad::GetWeapon(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1200,7 +1200,7 @@ int32 CPad::GetWeapon(void)
bool CPad::WeaponJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1233,7 +1233,7 @@ bool CPad::WeaponJustDown(void)
int16 CPad::GetAccelerate(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return 0;
switch ( Mode )
@@ -1319,7 +1319,7 @@ bool CPad::CycleCameraModeDownJustDown(void)
bool CPad::ChangeStationJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1359,7 +1359,7 @@ bool CPad::ChangeStationJustDown(void)
bool CPad::CycleWeaponLeftJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
@@ -1367,7 +1367,7 @@ bool CPad::CycleWeaponLeftJustDown(void)
bool CPad::CycleWeaponRightJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
@@ -1375,7 +1375,7 @@ bool CPad::CycleWeaponRightJustDown(void)
bool CPad::GetTarget(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1402,7 +1402,7 @@ bool CPad::GetTarget(void)
bool CPad::TargetJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1429,7 +1429,7 @@ bool CPad::TargetJustDown(void)
bool CPad::JumpJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.Square && !OldState.Square);
@@ -1437,7 +1437,7 @@ bool CPad::JumpJustDown(void)
bool CPad::GetSprint(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1464,7 +1464,7 @@ bool CPad::GetSprint(void)
bool CPad::ShiftTargetLeftJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2);
@@ -1472,7 +1472,7 @@ bool CPad::ShiftTargetLeftJustDown(void)
bool CPad::ShiftTargetRightJustDown(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
return !!(NewState.RightShoulder2 && !OldState.RightShoulder2);
@@ -1592,7 +1592,7 @@ bool CPad::GetAnaloguePadRightJustUp(void)
bool CPad::ForceCameraBehindPlayer(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1625,7 +1625,7 @@ bool CPad::ForceCameraBehindPlayer(void)
bool CPad::SniperZoomIn(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
@@ -1652,7 +1652,7 @@ bool CPad::SniperZoomIn(void)
bool CPad::SniperZoomOut(void)
{
- if ( DisablePlayerControls )
+ if ( ArePlayerControlsDisabled() )
return false;
switch ( Mode )
diff --git a/src/core/Pad.h b/src/core/Pad.h
index 30a9980b..f853a8cd 100644
--- a/src/core/Pad.h
+++ b/src/core/Pad.h
@@ -51,6 +51,17 @@ enum Key
};
*/
+enum {
+ PLAYERCONTROL_ENABLED = 0,
+ PLAYERCONTROL_DISABLED_1 = 1,
+ PLAYERCONTROL_DISABLED_2 = 2,
+ PLAYERCONTROL_DISABLED_4 = 4,
+ PLAYERCONTROL_DISABLED_8 = 8,
+ PLAYERCONTROL_DISABLED_10 = 16,
+ PLAYERCONTROL_DISABLED_20 = 32,
+ PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls
+ PLAYERCONTROL_DISABLED_80 = 128,
+};
class CControllerState
{
@@ -188,7 +199,7 @@ public:
uint8 ShakeFreq;
int8 bHornHistory[5];
uint8 iCurrHornHistory;
- bool DisablePlayerControls;
+ uint8 DisablePlayerControls;
int8 bApplyBrakes;
char _unk[12]; //int32 unk[3];
char _pad0[3];
@@ -362,6 +373,8 @@ public:
int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; }
int32 GetRightShoulder1(void) { return NewState.RightShoulder1; }
int32 GetRightShoulder2(void) { return NewState.RightShoulder2; }
+
+ bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; }
};
VALIDATE_SIZE(CPad, 0xFC);
diff --git a/src/core/World.cpp b/src/core/World.cpp
index a31f87a7..a9ec1f2a 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -11,11 +11,13 @@
#include "Garages.h"
#include "TempColModels.h"
#include "World.h"
+#include "ModelIndices.h"
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
+CColPoint &CWorld::ms_testSpherePoint = *(CColPoint*)0x6E64C0;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
CPlayerInfo *CWorld::Players = (CPlayerInfo *)0x9412F0;
@@ -617,29 +619,158 @@ CWorld::FindObjectsInRange(CVector &centre, float distance, bool ignoreZ, short
for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY);
if (checkBuildings) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
}
if (checkVehicles) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
}
if (checkPeds) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
}
if (checkObjects) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
}
if (checkDummies) {
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, ignoreZ, nextObject, lastObject, objects);
- CWorld::FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, ignoreZ, nextObject, lastObject, objects);
+ FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
}
}
}
}
+CEntity*
+CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity* entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
+{
+ CEntity* foundE = nil;
+
+ int minX = GetSectorIndexX(centre.x - distance);
+ if (minX <= 0)
+ minX = 0;
+
+ int minY = GetSectorIndexY(centre.y - distance);
+ if (minY <= 0)
+ minY = 0;
+
+ int maxX = GetSectorIndexX(centre.x + distance);
+ if (maxX >= 100)
+ maxX = 100;
+
+ int maxY = GetSectorIndexY(centre.y + distance);
+ if (maxY >= 100)
+ maxY = 100;
+
+ AdvanceCurrentScanCode();
+
+ for (int curY = minY; curY <= maxY; curY++) {
+ for (int curX = minX; curX <= maxX; curX++) {
+ CSector* sector = GetSector(curX, curY);
+ if (checkBuildings) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+ }
+ if (checkVehicles) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+ }
+ if (checkPeds) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+ }
+ if (checkObjects) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, entityToIgnore, ignoreSomeObjects);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, entityToIgnore, ignoreSomeObjects);
+ if (foundE)
+ return foundE;
+ }
+ if (checkDummies) {
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+
+ foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, entityToIgnore, false);
+ if (foundE)
+ return foundE;
+ }
+ }
+ }
+ return foundE;
+}
+
+CEntity*
+CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float radius, CEntity *entityToIgnore, bool ignoreSomeObjects)
+{
+ static CColModel sphereCol;
+
+ sphereCol.boundingSphere.center.x = 0.0f;
+ sphereCol.boundingSphere.center.y = 0.0f;
+ sphereCol.boundingSphere.center.z = 0.0f;
+ sphereCol.boundingSphere.radius = radius;
+ sphereCol.boundingBox.min.x = -radius;
+ sphereCol.boundingBox.min.y = -radius;
+ sphereCol.boundingBox.min.z = -radius;
+ sphereCol.boundingBox.max.x = radius;
+ sphereCol.boundingBox.max.y = radius;
+ sphereCol.boundingBox.max.z = radius;
+ sphereCol.numSpheres = 1;
+ sphereCol.spheres = &sphereCol.boundingSphere;
+ sphereCol.numLines = 0;
+ sphereCol.numBoxes = 0;
+ sphereCol.numTriangles = 0;
+ sphereCol.ownsCollisionVolumes = false;
+
+ CMatrix sphereMat;
+ sphereMat.SetTranslate(spherePos);
+
+ for(CPtrNode *node=list.first; node; node = node->next) {
+ CEntity *e = (CEntity*)node->item;
+
+ if (e->m_scanCode != GetCurrentScanCode()) {
+ e->m_scanCode = GetCurrentScanCode();
+
+ if (e != entityToIgnore && e->bUsesCollision && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
+ CVector diff = spherePos - e->GetPosition();
+ float distance = diff.Magnitude();
+
+ if (e->GetBoundRadius() + radius > distance) {
+ CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel();
+ int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(),
+ *eCol, &ms_testSpherePoint, nil, nil);
+
+ if (collidedSpheres != 0 ||
+ (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR &&
+ e->m_modelIndex != MI_DODO && radius + eCol->boundingBox.max.x > distance)) {
+ return e;
+ }
+ }
+ }
+ }
+ }
+
+ return nil;
+}
+
float
CWorld::FindGroundZForCoord(float x, float y)
{
@@ -790,6 +921,8 @@ STARTPATCHES
InjectHook(0x4B2200, CWorld::FindObjectsInRange, PATCH_JUMP);
InjectHook(0x4B2540, CWorld::FindObjectsInRangeSectorList, PATCH_JUMP);
+ InjectHook(0x4B4AC0, CWorld::TestSphereAgainstSectorList, PATCH_JUMP);
+ InjectHook(0x4B4710, CWorld::TestSphereAgainstWorld, PATCH_JUMP);
InjectHook(0x4B3A80, CWorld::FindGroundZForCoord, PATCH_JUMP);
InjectHook(0x4B3AE0, CWorld::FindGroundZFor3DCoord, PATCH_JUMP);
InjectHook(0x4B3B50, CWorld::FindRoofZFor3DCoord, PATCH_JUMP);
diff --git a/src/core/World.h b/src/core/World.h
index d6063d70..a8650d93 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -56,6 +56,7 @@ class CWorld
static CPtrList &ms_listMovingEntityPtrs;
static CSector (*ms_aSectors)[NUMSECTORS_X]; // [NUMSECTORS_Y][NUMSECTORS_X];
static uint16 &ms_nCurrentScanCode;
+ static CColPoint &ms_testSpherePoint;
public:
static uint8 &PlayerInFocus;
@@ -94,6 +95,8 @@ public:
static bool GetIsLineOfSightSectorClear(CSector &sector, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
static bool GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
+ static CEntity* TestSphereAgainstWorld(CVector, float, CEntity*, bool, bool, bool, bool, bool, bool);
+ static CEntity* TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
static float FindGroundZForCoord(float x, float y);