remove superfluous CWorld::

This commit is contained in:
aap 2020-12-31 22:03:42 +01:00
parent 613bb72eb7
commit 14eb16d5d4

View file

@ -147,13 +147,13 @@ CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemov
} }
} }
CCarCtrl::RemoveFromInterestingVehicleList(pVehicle); CCarCtrl::RemoveFromInterestingVehicleList(pVehicle);
CWorld::Remove(pVehicle); Remove(pVehicle);
delete pVehicle; delete pVehicle;
} }
} }
CObject::DeleteAllTempObjectsInArea(pos, radius); CObject::DeleteAllTempObjectsInArea(pos, radius);
gFireManager.ExtinguishPoint(pos, radius); gFireManager.ExtinguishPoint(pos, radius);
CWorld::ExtinguishAllCarFiresInArea(pos, radius); ExtinguishAllCarFiresInArea(pos, radius);
CExplosion::RemoveAllExplosionsInArea(pos, radius); CExplosion::RemoveAllExplosionsInArea(pos, radius);
if(bRemoveProjectilesAndTidyUpShadows) { if(bRemoveProjectilesAndTidyUpShadows) {
CProjectileInfo::RemoveAllProjectiles(); CProjectileInfo::RemoveAllProjectiles();
@ -796,7 +796,7 @@ CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float
int16 *nEntitiesFound, int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, int16 *nEntitiesFound, int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings,
bool bVehicles, bool bPeds, bool bObjects, bool bDummies) bool bVehicles, bool bPeds, bool bObjects, bool bDummies)
{ {
CWorld::AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
*nEntitiesFound = 0; *nEntitiesFound = 0;
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius); const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius); const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
@ -813,42 +813,42 @@ CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float
for(int32 x = nStartX; x <= nEndX; x++) { for(int32 x = nStartX; x <= nEndX; x++) {
CSector *pSector = GetSector(x, y); CSector *pSector = GetSector(x, y);
if(bBuildings) { if(bBuildings) {
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, modelId, pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, modelId, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius,
bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bVehicles) { if(bVehicles) {
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, modelId, pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, modelId, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius,
bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bPeds) { if(bPeds) {
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly, modelId, pSector->m_lists[ENTITYLIST_PEDS], position, radius, bCheck2DOnly,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, modelId, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bObjects) { if(bObjects) {
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, modelId, pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, modelId, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius,
bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bDummies) { if(bDummies) {
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, modelId, pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
CWorld::FindObjectsOfTypeInRangeSectorList( FindObjectsOfTypeInRangeSectorList(
modelId, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, modelId, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius,
bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities); bCheck2DOnly, nEntitiesFound, maxEntitiesToFind, aEntities);
} }
@ -1070,7 +1070,7 @@ CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bC
int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles, int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles,
bool bPeds, bool bObjects, bool bDummies) bool bPeds, bool bObjects, bool bDummies)
{ {
CWorld::AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
*nCollidingEntities = 0; *nCollidingEntities = 0;
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius); const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius); const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
@ -1087,42 +1087,42 @@ CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bC
for(int32 x = nStartX; x <= nEndX; x++) { for(int32 x = nStartX; x <= nEndX; x++) {
CSector *pSector = GetSector(x, y); CSector *pSector = GetSector(x, y);
if(bBuildings) { if(bBuildings) {
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_BUILDINGS], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
} }
if(bVehicles) { if(bVehicles) {
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_VEHICLES], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
} }
if(bPeds) { if(bPeds) {
CWorld::FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, FindObjectsKindaCollidingSectorList(pSector->m_lists[ENTITYLIST_PEDS], position,
radius, bCheck2DOnly, nCollidingEntities, radius, bCheck2DOnly, nCollidingEntities,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
} }
if(bObjects) { if(bObjects) {
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_OBJECTS], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
} }
if(bDummies) { if(bDummies) {
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_DUMMIES], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
CWorld::FindObjectsKindaCollidingSectorList( FindObjectsKindaCollidingSectorList(
pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], position, radius, bCheck2DOnly,
nCollidingEntities, maxEntitiesToFind, aEntities); nCollidingEntities, maxEntitiesToFind, aEntities);
} }
@ -1156,7 +1156,7 @@ CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &v
int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles, int16 maxEntitiesToFind, CEntity **aEntities, bool bBuildings, bool bVehicles,
bool bPeds, bool bObjects, bool bDummies) bool bPeds, bool bObjects, bool bDummies)
{ {
CWorld::AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
*nIntersecting = 0; *nIntersecting = 0;
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0); const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0); const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
@ -1171,42 +1171,42 @@ CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &v
for(int32 x = nStartX; x <= nEndX; x++) { for(int32 x = nStartX; x <= nEndX; x++) {
CSector *pSector = GetSector(x, y); CSector *pSector = GetSector(x, y);
if(bBuildings) { if(bBuildings) {
CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS], FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_BUILDINGS],
vecStartPos, vecEndPos, nIntersecting, vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingCubeSectorList( FindObjectsIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], vecStartPos, vecEndPos, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], vecStartPos, vecEndPos,
nIntersecting, maxEntitiesToFind, aEntities); nIntersecting, maxEntitiesToFind, aEntities);
} }
if(bVehicles) { if(bVehicles) {
CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_VEHICLES],
vecStartPos, vecEndPos, nIntersecting, vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingCubeSectorList( FindObjectsIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos,
nIntersecting, maxEntitiesToFind, aEntities); nIntersecting, maxEntitiesToFind, aEntities);
} }
if(bPeds) { if(bPeds) {
CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS], FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS],
vecStartPos, vecEndPos, nIntersecting, vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP],
vecStartPos, vecEndPos, nIntersecting, vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
} }
if(bObjects) { if(bObjects) {
CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_OBJECTS],
vecStartPos, vecEndPos, nIntersecting, vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingCubeSectorList( FindObjectsIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
} }
if(bDummies) { if(bDummies) {
CWorld::FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES], FindObjectsIntersectingCubeSectorList(pSector->m_lists[ENTITYLIST_DUMMIES],
vecStartPos, vecEndPos, nIntersecting, vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingCubeSectorList( FindObjectsIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], vecStartPos, vecEndPos, nIntersecting, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
} }
@ -1242,7 +1242,7 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CBox &boundingBox, const
CEntity **aEntities, bool bBuildings, bool bVehicles, bool bPeds, CEntity **aEntities, bool bBuildings, bool bVehicles, bool bPeds,
bool bObjects, bool bDummies) bool bObjects, bool bDummies)
{ {
CWorld::AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
*nEntitiesFound = 0; *nEntitiesFound = 0;
const int32 nStartX = Max(GetSectorIndexX(fStartX), 0); const int32 nStartX = Max(GetSectorIndexX(fStartX), 0);
const int32 nStartY = Max(GetSectorIndexY(fStartY), 0); const int32 nStartY = Max(GetSectorIndexY(fStartY), 0);
@ -1257,42 +1257,42 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CBox &boundingBox, const
for(int32 x = nStartX; x <= nEndX; x++) { for(int32 x = nStartX; x <= nEndX; x++) {
CSector *pSector = GetSector(x, y); CSector *pSector = GetSector(x, y);
if(bBuildings) { if(bBuildings) {
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_BUILDINGS], boundingBox, matrix, position, pSector->m_lists[ENTITYLIST_BUILDINGS], boundingBox, matrix, position,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], boundingBox, matrix, position, pSector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], boundingBox, matrix, position,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bVehicles) { if(bVehicles) {
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_VEHICLES], boundingBox, matrix, position, pSector->m_lists[ENTITYLIST_VEHICLES], boundingBox, matrix, position,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], boundingBox, matrix, position, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], boundingBox, matrix, position,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bPeds) { if(bPeds) {
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_PEDS], boundingBox, matrix, position, nEntitiesFound, pSector->m_lists[ENTITYLIST_PEDS], boundingBox, matrix, position, nEntitiesFound,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], boundingBox, matrix, position, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], boundingBox, matrix, position,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bObjects) { if(bObjects) {
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_OBJECTS], boundingBox, matrix, position, nEntitiesFound, pSector->m_lists[ENTITYLIST_OBJECTS], boundingBox, matrix, position, nEntitiesFound,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], boundingBox, matrix, position, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], boundingBox, matrix, position,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
} }
if(bDummies) { if(bDummies) {
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_DUMMIES], boundingBox, matrix, position, nEntitiesFound, pSector->m_lists[ENTITYLIST_DUMMIES], boundingBox, matrix, position, nEntitiesFound,
maxEntitiesToFind, aEntities); maxEntitiesToFind, aEntities);
CWorld::FindObjectsIntersectingAngledCollisionBoxSectorList( FindObjectsIntersectingAngledCollisionBoxSectorList(
pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], boundingBox, matrix, position, pSector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], boundingBox, matrix, position,
nEntitiesFound, maxEntitiesToFind, aEntities); nEntitiesFound, maxEntitiesToFind, aEntities);
} }
@ -1327,7 +1327,7 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CV
int16 maxEntitiesToFind, CEntity **aEntities, bool bVehicles, bool bPeds, int16 maxEntitiesToFind, CEntity **aEntities, bool bVehicles, bool bPeds,
bool bObjects) bool bObjects)
{ {
CWorld::AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
*nIntersecting = 0; *nIntersecting = 0;
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0); const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0); const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
@ -1342,26 +1342,26 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CV
for(int32 x = nStartX; x <= nEndX; x++) { for(int32 x = nStartX; x <= nEndX; x++) {
CSector *pSector = GetSector(x, y); CSector *pSector = GetSector(x, y);
if(bVehicles) { if(bVehicles) {
CWorld::FindMissionEntitiesIntersectingCubeSectorList( FindMissionEntitiesIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting, pSector->m_lists[ENTITYLIST_VEHICLES], vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities, true, false); maxEntitiesToFind, aEntities, true, false);
CWorld::FindMissionEntitiesIntersectingCubeSectorList( FindMissionEntitiesIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos, pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], vecStartPos, vecEndPos,
nIntersecting, maxEntitiesToFind, aEntities, true, false); nIntersecting, maxEntitiesToFind, aEntities, true, false);
} }
if(bPeds) { if(bPeds) {
CWorld::FindMissionEntitiesIntersectingCubeSectorList( FindMissionEntitiesIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting, pSector->m_lists[ENTITYLIST_PEDS], vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities, false, true); maxEntitiesToFind, aEntities, false, true);
CWorld::FindMissionEntitiesIntersectingCubeSectorList( FindMissionEntitiesIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities, false, true); maxEntitiesToFind, aEntities, false, true);
} }
if(bObjects) { if(bObjects) {
CWorld::FindMissionEntitiesIntersectingCubeSectorList( FindMissionEntitiesIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting, pSector->m_lists[ENTITYLIST_OBJECTS], vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities, false, false); maxEntitiesToFind, aEntities, false, false);
CWorld::FindMissionEntitiesIntersectingCubeSectorList( FindMissionEntitiesIntersectingCubeSectorList(
pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting, pSector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], vecStartPos, vecEndPos, nIntersecting,
maxEntitiesToFind, aEntities, false, false); maxEntitiesToFind, aEntities, false, false);
} }
@ -1421,7 +1421,7 @@ CWorld::ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, floa
} }
} }
CCarCtrl::RemoveFromInterestingVehicleList(pVehicle); CCarCtrl::RemoveFromInterestingVehicleList(pVehicle);
CWorld::Remove(pVehicle); Remove(pVehicle);
delete pVehicle; delete pVehicle;
} }
} }
@ -1447,7 +1447,7 @@ CWorld::ClearPedsFromArea(float x1, float y1, float z1, float x2, float y2, floa
void void
CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2) CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2)
{ {
CWorld::AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
float fStartX = x1 - 10.0f; float fStartX = x1 - 10.0f;
float fStartY = y1 - 10.0f; float fStartY = y1 - 10.0f;
float fEndX = x2 + 10.0f; float fEndX = x2 + 10.0f;
@ -1464,12 +1464,12 @@ CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2)
for(int32 y = nStartY; y <= nEndY; y++) { for(int32 y = nStartY; y <= nEndY; y++) {
for(int32 x = nStartX; x <= nEndX; x++) { for(int32 x = nStartX; x <= nEndX; x++) {
CSector *pSector = GetSector(x, y); CSector *pSector = GetSector(x, y);
CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES], x1, y1, x2, CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES], x1, y1, x2,
y2, fStartX, fStartY, fEndX, fEndY); y2, fStartX, fStartY, fEndX, fEndY);
CWorld::CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], x1, CallOffChaseForAreaSectorListVehicles(pSector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], x1,
y1, x2, y2, fStartX, fStartY, fEndX, fEndY); y1, x2, y2, fStartX, fStartY, fEndX, fEndY);
CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS], x1, y1, x2, y2); CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS], x1, y1, x2, y2);
CWorld::CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], x1, y1, x2, CallOffChaseForAreaSectorListPeds(pSector->m_lists[ENTITYLIST_PEDS_OVERLAP], x1, y1, x2,
y2); y2);
} }
} }
@ -1672,27 +1672,27 @@ CWorld::ShutDown(void)
CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y);
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
#ifndef FIX_BUGS #ifndef FIX_BUGS
@ -1762,19 +1762,19 @@ CWorld::ClearForRestart(void)
CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y);
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_PEDS].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
for(CPtrNode *pNode = GetBigBuildingList(LEVEL_GENERIC).first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = GetBigBuildingList(LEVEL_GENERIC).first; pNode; pNode = pNode->next) {
CVehicle *pVehicle = (CVehicle *)pNode->item; CVehicle *pVehicle = (CVehicle *)pNode->item;
if(pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) { if(pVehicle && pVehicle->IsVehicle() && pVehicle->IsPlane()) {
CWorld::Remove(pVehicle); Remove(pVehicle);
delete pVehicle; delete pVehicle;
} }
} }
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_VEHICLES].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
} }
@ -1807,7 +1807,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
float fBoundingBoxMinZ = pColModel->boundingBox.min.z; float fBoundingBoxMinZ = pColModel->boundingBox.min.z;
float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
if (fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z; if (fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z;
position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z = FindGroundZFor3DCoord(position.x, position.y,
position.z + fHeight, nil) - position.z + fHeight, nil) -
fBoundingBoxMinZ; fBoundingBoxMinZ;
pEntity->m_matrix.UpdateRW(); pEntity->m_matrix.UpdateRW();
@ -1840,7 +1840,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
if(modelId == MI_BUOY) { if(modelId == MI_BUOY) {
bool bFound = true; bool bFound = true;
const CVector &position = pEntity->GetPosition(); const CVector &position = pEntity->GetPosition();
float fGroundZ = CWorld::FindGroundZFor3DCoord(position.x, position.y, float fGroundZ = FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound); position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound);
CColModel *pColModel = pEntity->GetColModel(); CColModel *pColModel = pEntity->GetColModel();
float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z; float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
@ -1905,17 +1905,17 @@ CWorld::RemoveStaticObjects()
CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y); CSector *pSector = GetSector(i % NUMSECTORS_X, i / NUMSECTORS_Y);
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_OBJECTS].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) { for(CPtrNode *pNode = pSector->m_lists[ENTITYLIST_DUMMIES].first; pNode; pNode = pNode->next) {
CEntity *pEntity = (CEntity *)pNode->item; CEntity *pEntity = (CEntity *)pNode->item;
CWorld::Remove(pEntity); Remove(pEntity);
delete pEntity; delete pEntity;
} }
pSector->m_lists[ENTITYLIST_BUILDINGS].Flush(); pSector->m_lists[ENTITYLIST_BUILDINGS].Flush();
@ -2119,11 +2119,11 @@ CWorld::TriggerExplosion(const CVector &position, float fRadius, float fPower, C
for(int32 y = nStartY; y <= nEndY; y++) { for(int32 y = nStartY; y <= nEndY; y++) {
for(int32 x = nStartX; x <= nEndX; x++) { for(int32 x = nStartX; x <= nEndX; x++) {
CSector *pSector = GetSector(x, y); CSector *pSector = GetSector(x, y);
CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, fRadius, TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_VEHICLES], position, fRadius,
fPower, pCreator, bProcessVehicleBombTimer); fPower, pCreator, bProcessVehicleBombTimer);
CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, fRadius, fPower, TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_PEDS], position, fRadius, fPower,
pCreator, bProcessVehicleBombTimer); pCreator, bProcessVehicleBombTimer);
CWorld::TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, fRadius, TriggerExplosionSectorList(pSector->m_lists[ENTITYLIST_OBJECTS], position, fRadius,
fPower, pCreator, bProcessVehicleBombTimer); fPower, pCreator, bProcessVehicleBombTimer);
} }
} }