summaryrefslogtreecommitdiffstats
path: root/src/core/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/World.cpp61
1 files changed, 33 insertions, 28 deletions
diff --git a/src/core/World.cpp b/src/core/World.cpp
index da1c58b2..9e2c4345 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -65,7 +65,7 @@ CWorld::Initialise()
void
CWorld::Add(CEntity *ent)
{
- if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, true);
+ if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, TRUE);
if(ent->bIsBIGBuilding)
ms_bigBuildingsList[ent->m_level].InsertItem(ent);
@@ -80,7 +80,7 @@ CWorld::Add(CEntity *ent)
void
CWorld::Remove(CEntity *ent)
{
- if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, false);
+ if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, FALSE);
if(ent->bIsBIGBuilding)
ms_bigBuildingsList[ent->m_level].RemoveItem(ent);
@@ -367,7 +367,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
} else if(e->bUsesCollision)
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
- if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, dist,
+ if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, mindist,
ignoreSeeThrough, ignoreShootThrough))
entity = e;
if(carTyres && ((CVehicle*)e)->SetUpWheelColModel(&tyreCol) && CCollision::ProcessLineOfSight(line, e->GetMatrix(), tyreCol, tyreColPoint, tyreDist, false, ignoreShootThrough)){
@@ -466,7 +466,7 @@ CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CCol
e->m_scanCode = GetCurrentScanCode();
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
- if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, dist,
+ if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, mindist,
ignoreSeeThrough, false, poly))
entity = e;
}
@@ -1486,7 +1486,7 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1
CColModel *pColModel = pVehicle->GetColModel();
bool bInsideSphere = false;
for(int32 i = 0; i < pColModel->numSpheres; i++) {
- CVector pos = pVehicle->m_matrix * pColModel->spheres[i].center;
+ CVector pos = pVehicle->GetMatrix() * pColModel->spheres[i].center;
float fRadius = pColModel->spheres[i].radius;
if(pos.x + fRadius > x1 && pos.x - fRadius < x2 && pos.y + fRadius > y1 &&
pos.y - fRadius < y2)
@@ -1801,7 +1801,7 @@ CWorld::RepositionOneObject(CEntity *pEntity)
position.z = FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
fBoundingBoxMinZ;
- pEntity->m_matrix.UpdateRW();
+ pEntity->GetMatrix().UpdateRW();
pEntity->UpdateRwFrame();
} else if(modelId == MI_BUOY) {
float fWaterLevel = 0.0f;
@@ -1906,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();
@@ -1927,26 +1918,40 @@ 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(); }
}
}
+ 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();
+ }
bForceProcessControl = true;
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CPhysical *movingEnt = (CPhysical *)node->item;
@@ -2192,7 +2197,7 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
PEDPIECE_TORSO, direction);
if(pPed->m_nPedState != PED_DIE)
pPed->SetFall(2000,
- (AnimationId)(direction + ANIM_KO_SKID_FRONT), 0);
+ (AnimationId)(direction + ANIM_STD_HIGHIMPACT_FRONT), 0);
if(pCreator && pCreator->IsPed()) {
eEventType eventType = EVENT_SHOOT_PED;
if(pPed->m_nPedType == PEDTYPE_COP) eventType = EVENT_SHOOT_COP;