summaryrefslogtreecommitdiffstats
path: root/src/core/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/World.cpp')
-rw-r--r--src/core/World.cpp130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 549c2cc0..2de36383 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -1788,56 +1788,35 @@ void
CWorld::RepositionOneObject(CEntity *pEntity)
{
int16 modelId = pEntity->GetModelIndex();
- if (modelId == MI_PARKINGMETER || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN ||
- modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE ||
- modelId == MI_DUMP1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
- modelId == MI_PHONESIGN || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
- modelId == MI_PARKTABLE || modelId == MI_PARKINGMETER2 || modelId == MI_TELPOLE02 ||
- modelId == MI_PARKBENCH || modelId == MI_BARRIER1 || IsTreeModel(modelId)
- ) {
+ if (IsLightThatNeedsRepositioning(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
+ modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
+ modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
+ modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||
+ modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 ||
+ modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 ||
+ modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
+ modelId == MI_PARKTABLE) {
CVector& position = pEntity->GetMatrix().GetPosition();
- CColModel* pColModel = pEntity->GetColModel();
- float fBoundingBoxMinZ = 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;
+ float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
position.z = FindGroundZFor3DCoord(position.x, position.y,
- position.z + fHeight, nil) -
- fBoundingBoxMinZ;
+ position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
+ fBoundingBoxMinZ;
pEntity->GetMatrix().UpdateRW();
pEntity->UpdateRwFrame();
- } else if(IsLightThatNeedsRepositioning(modelId)) {
- CVector position = pEntity->GetMatrix().GetPosition();
- CColModel* pColModel = pEntity->GetColModel();
- float fBoundingBoxMinZ = 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 (pColModel->numBoxes == 1)
- position = pEntity->GetMatrix() * CVector(
- (pColModel->boxes[0].min.x + pColModel->boxes[0].max.x) / 2,
- (pColModel->boxes[0].min.y + pColModel->boxes[0].max.y) / 2,
- pColModel->boxes[0].min.z);
- else if (pColModel->numSpheres > 0) {
- position.z = 1000.0f;
- for (int i = 0; i < pColModel->numSpheres; i++) {
- if (pColModel->spheres[i].center.z < position.z)
- position = pColModel->spheres[i].center;
- }
- if (position.z < 1000.0f)
- position = pEntity->GetMatrix() * position;
- }
- pEntity->GetMatrix().GetPosition().z = FindGroundZFor3DCoord(position.x, position.y, pEntity->GetMatrix().GetPosition().z + fHeight, nil) - fBoundingBoxMinZ;
- pEntity->GetMatrix().UpdateRW();
- pEntity->UpdateRwFrame();
-
- }
- if(modelId == MI_BUOY) {
+ } else if(modelId == MI_BUOY) {
+ float fWaterLevel = 0.0f;
bool bFound = true;
const CVector &position = pEntity->GetPosition();
float fGroundZ = FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, &bFound);
- CColModel *pColModel = pEntity->GetColModel();
- float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
- pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + 6.0f - 0.5f * fHeight;
+ if(CWaterLevel::GetWaterLevelNoWaves(position.x, position.y, position.z + OBJECT_REPOSITION_OFFSET_Z,
+ &fWaterLevel)) {
+ if(!bFound || fWaterLevel > fGroundZ) {
+ CColModel *pColModel = pEntity->GetColModel();
+ float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
+ pEntity->GetMatrix().GetPosition().z = 0.2f * fHeight + fWaterLevel - 0.5f * fHeight;
+ }
+ }
}
}
@@ -1927,16 +1906,7 @@ CWorld::Process(void)
for(int i = 0; i < NUMCUTSCENEOBJECTS; i++) {
CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i);
if(csObj && csObj->m_entryInfoList.first) {
- if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
- RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
- if (csObj->IsObject())
- RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepNonClippedInSeconds());
- else {
- if (!csObj->bOffscreen)
- csObj->bOffscreen = !csObj->GetIsOnScreen();
- RpAnimBlendClumpUpdateAnimations(csObj->GetClump(), CTimer::GetTimeStepInSeconds(), !csObj->bOffscreen);
- }
- }
+ csObj->UpdateAnim();
csObj->ProcessControl();
csObj->ProcessCollision();
csObj->GetMatrix().UpdateRW();
@@ -1948,26 +1918,42 @@ CWorld::Process(void)
} else {
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CEntity *movingEnt = (CEntity *)node->item;
- if(!movingEnt->bRemoveFromWorld && movingEnt->m_rwObject && RwObjectGetType(movingEnt->m_rwObject) == rpCLUMP &&
- RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
- if (movingEnt->IsObject())
- RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepNonClippedInSeconds());
- else {
- if (!movingEnt->bOffscreen)
- movingEnt->bOffscreen = !movingEnt->GetIsOnScreen();
- RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(), CTimer::GetTimeStepInSeconds(), !movingEnt->bOffscreen);
- }
- }
+ if(!movingEnt->bRemoveFromWorld)
+ movingEnt->UpdateAnim();
}
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CPhysical *movingEnt = (CPhysical *)node->item;
if(movingEnt->bRemoveFromWorld) {
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
- movingEnt->ProcessControl();
+ if(!CCutsceneMgr::IsCutsceneProcessing() || movingEnt->UpdatesInCutscene())
+ movingEnt->ProcessControl();
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
+#ifdef VIS_DISTANCE_ALPHA
+ for(int y = 0; y < NUMSECTORS_Y; y++)
+ for(int x = 0; x < NUMSECTORS_X; x++){
+ CPtrNode *node;
+ CSector *sect = CWorld::GetSector(x, y);
+ for(node = sect->m_lists[ENTITYLIST_PEDS].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ for(node = sect->m_lists[ENTITYLIST_PEDS_OVERLAP].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ for(node = sect->m_lists[ENTITYLIST_VEHICLES].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ for(node = sect->m_lists[ENTITYLIST_VEHICLES_OVERLAP].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ for(node = sect->m_lists[ENTITYLIST_OBJECTS].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ for(node = sect->m_lists[ENTITYLIST_OBJECTS_OVERLAP].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ for(node = sect->m_lists[ENTITYLIST_DUMMIES].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ for(node = sect->m_lists[ENTITYLIST_DUMMIES_OVERLAP].first; node; node = node->next)
+ ((CEntity*)node->item)->UpdateDistanceFade();
+ }
+#endif
bForceProcessControl = true;
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CPhysical *movingEnt = (CPhysical *)node->item;
@@ -2154,8 +2140,8 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
} else {
CVector pos = pEntity->GetPosition();
pos.z -= 0.5f;
- CParticleObject::AddObject(POBJECT_FIRE_HYDRANT,
- pos, true);
+ CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, pos, true);
+ CParticleObject::AddObject(POBJECT_FIRE_HYDRANT_STEAM, pos, true);
pObject->bHasBeenDamaged = true;
}
}
@@ -2310,3 +2296,17 @@ CWorld::IsWanderPathClear(CVector const& point1, CVector const& point2, float di
}
return true;
}
+
+void
+CWorld::CheckObjectsEffectedByFire(float x, float y, float z, float radius, CEntity* reason)
+{
+ int32 i = CPools::GetObjectPool()->GetSize();
+ while (i--) {
+ CObject* pObject = CPools::GetObjectPool()->GetSlot(i);
+ if (pObject) {
+ if (Abs(pObject->GetPosition().z - z) < 5.0f && Abs(pObject->GetPosition().x - x) < radius &&
+ Abs(pObject->GetPosition().y - y) < radius)
+ pObject->m_nLastWeaponToDamage = WEAPONTYPE_FLAMETHROWER;
+ }
+ }
+}