1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 05:20:01 +00:00

remove superfluous CWorld::

This commit is contained in:
aap 2020-12-31 22:03:37 +01:00
parent 4e7c2b90f7
commit 31000fb4f0

View file

@ -144,13 +144,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();
@ -781,7 +781,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);
@ -791,44 +791,44 @@ CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1); const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
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 = CWorld::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);
} }
@ -1052,7 +1052,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);
@ -1062,44 +1062,44 @@ CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bC
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1); const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
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 = CWorld::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);
} }
@ -1133,7 +1133,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(CWorld::GetSectorIndexX(vecStartPos.x), 0); const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0); const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
@ -1141,44 +1141,44 @@ CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &v
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
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 = CWorld::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);
} }
@ -1214,7 +1214,7 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, co
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(CWorld::GetSectorIndexX(fStartX), 0); const int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0); const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
@ -1222,44 +1222,44 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, co
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1); const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
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 = CWorld::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);
} }
@ -1294,7 +1294,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(CWorld::GetSectorIndexX(vecStartPos.x), 0); const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0); const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
@ -1302,28 +1302,28 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CV
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
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 = CWorld::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);
} }
@ -1383,7 +1383,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;
} }
} }
@ -1409,7 +1409,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;
@ -1420,13 +1420,13 @@ CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2)
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1); const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
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 = CWorld::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);
} }
} }
@ -1629,27 +1629,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
@ -1722,19 +1722,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;
} }
} }
@ -1765,7 +1765,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
modelId == MI_PARKTABLE) { modelId == MI_PARKTABLE) {
CVector &position = pEntity->GetMatrix().GetPosition(); CVector &position = pEntity->GetMatrix().GetPosition();
float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z; float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y, position.z = FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) - position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
fBoundingBoxMinZ; fBoundingBoxMinZ;
pEntity->m_matrix.UpdateRW(); pEntity->m_matrix.UpdateRW();
@ -1774,7 +1774,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
float fWaterLevel = 0.0f; float fWaterLevel = 0.0f;
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);
if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z, if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z,
&fWaterLevel)) { &fWaterLevel)) {
@ -1822,17 +1822,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();
@ -2026,12 +2026,12 @@ CWorld::TriggerExplosion(const CVector &position, float fRadius, float fPower, C
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1); const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
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 = CWorld::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);
} }
} }