diff options
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/Entity.h | 3 | ||||
-rw-r--r-- | src/entities/Physical.cpp | 26 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/entities/Entity.h b/src/entities/Entity.h index fbf5cb3b..08d1900a 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -104,7 +104,8 @@ public: eEntityStatus GetStatus() const { return (eEntityStatus)m_status; } void SetStatus(eEntityStatus status) { m_status = status; } CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); } - bool IsStatic(void) { return bIsStatic || bIsStaticWaitingForCollision; } + bool GetIsStatic(void) const { return bIsStatic || bIsStaticWaitingForCollision; } + void SetIsStatic(bool state) { bIsStatic = state; } #ifdef COMPATIBLE_SAVES void SaveEntityFlags(uint8*& buf); void LoadEntityFlags(uint8*& buf); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index b190d03a..5483641f 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -344,7 +344,7 @@ CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) AddCollisionRecord(ent); if(!ent->IsBuilding()) // Can't this catch dummies too? ((CPhysical*)ent)->AddCollisionRecord(this); - if(ent->IsBuilding() || ent->IsStatic()) + if(ent->IsBuilding() || ent->GetIsStatic()) this->bHasHitWall = true; } return numSpheres; @@ -380,7 +380,7 @@ CPhysical::ProcessControl(void) m_nStaticFrames++; if(m_nStaticFrames > 10){ m_nStaticFrames = 10; - bIsStatic = true; + SetIsStatic(true); m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecMoveFriction = m_vecMoveSpeed; @@ -614,7 +614,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl } float speedA, speedB; - if(B->IsStatic() && !foo){ + if(B->GetIsStatic() && !foo){ if(A->bPedPhysics){ speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal); if(speedA < 0.0f){ @@ -625,7 +625,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl if(IsGlass(B->GetModelIndex())) CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false); else if(!B->bInfiniteMass){ - B->bIsStatic = false; + B->SetIsStatic(false); CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel += 2; CStats::PropertyDestroyed += CGeneral::GetRandomNumberInRange(30, 60); } @@ -637,7 +637,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl return true; } }else if(!B->bInfiniteMass) - B->bIsStatic = false; + B->SetIsStatic(false); if(B->bInfiniteMass){ impulseA = -speedA * A->m_fMass; @@ -675,7 +675,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl if(IsGlass(B->GetModelIndex())) CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false); else - B->bIsStatic = false; + B->SetIsStatic(false); int16 model = B->GetModelIndex(); if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){ CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true); @@ -699,11 +699,11 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl return true; } }else if(!B->bInfiniteMass) - B->bIsStatic = false; + B->SetIsStatic(false); } } - if(B->IsStatic()) + if(B->GetIsStatic()) return false; if(!B->bInfiniteMass && !B->m_phy_flagA08) B->AddToMovingList(); @@ -1231,7 +1231,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) canshift = true; else canshift = A->IsPed() && - B->IsObject() && B->IsStatic() && !Bobj->bHasBeenDamaged; + B->IsObject() && B->GetIsStatic() && !Bobj->bHasBeenDamaged; if(B == A || B->m_scanCode == CWorld::GetCurrentScanCode() || !B->bUsesCollision || @@ -1255,7 +1255,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) CObject *Aobj = (CObject*)A; if(Aobj->ObjectCreatedBy != TEMP_OBJECT && !Aobj->bHasBeenDamaged && - Aobj->IsStatic()){ + Aobj->GetIsStatic()){ if(Aobj->m_pCollidingEntity == B) Aobj->m_pCollidingEntity = nil; }else if(Aobj->m_pCollidingEntity != B){ @@ -1272,7 +1272,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) CObject *Bobj = (CObject*)B; if(Bobj->ObjectCreatedBy != TEMP_OBJECT && !Bobj->bHasBeenDamaged && - Bobj->IsStatic()){ + Bobj->GetIsStatic()){ if(Bobj->m_pCollidingEntity == A) Bobj->m_pCollidingEntity = nil; }else if(Bobj->m_pCollidingEntity != A){ @@ -1595,7 +1595,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) skipCollision = true; else if(Aobj->ObjectCreatedBy == TEMP_OBJECT || Aobj->bHasBeenDamaged || - !Aobj->IsStatic()){ + !Aobj->GetIsStatic()){ if(Aobj->m_pCollidingEntity == B) skipCollision = true; else if(Aobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){ @@ -1614,7 +1614,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) skipCollision = true; else if(Bobj->ObjectCreatedBy == TEMP_OBJECT || Bobj->bHasBeenDamaged || - !Bobj->IsStatic()){ + !Bobj->GetIsStatic()){ if(Bobj->m_pCollidingEntity == A) skipCollision = true; else if(Bobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){ |