summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-05-06 18:32:57 +0200
committerSergeanur <s.anureev@yandex.ua>2020-05-06 18:32:57 +0200
commit6ad66fb2d78360053febb3369a7ec448ffec73fd (patch)
tree6c0f21a5f8ecc2cb7facd55f3944b65c1c3a6d0e /src
parentCSphere and CBox for CColModel (diff)
parentMerge pull request #517 from Nick007J/master (diff)
downloadre3-6ad66fb2d78360053febb3369a7ec448ffec73fd.tar
re3-6ad66fb2d78360053febb3369a7ec448ffec73fd.tar.gz
re3-6ad66fb2d78360053febb3369a7ec448ffec73fd.tar.bz2
re3-6ad66fb2d78360053febb3369a7ec448ffec73fd.tar.lz
re3-6ad66fb2d78360053febb3369a7ec448ffec73fd.tar.xz
re3-6ad66fb2d78360053febb3369a7ec448ffec73fd.tar.zst
re3-6ad66fb2d78360053febb3369a7ec448ffec73fd.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/World.cpp14
-rw-r--r--src/entities/Entity.h1
-rw-r--r--src/entities/Physical.cpp14
-rw-r--r--src/peds/Ped.cpp4
-rw-r--r--src/vehicles/Automobile.cpp2
-rw-r--r--src/weapons/BulletInfo.cpp4
-rw-r--r--src/weapons/Weapon.cpp10
7 files changed, 25 insertions, 24 deletions
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 37ad6221..29505481 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -75,7 +75,7 @@ CWorld::Add(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->bIsStatic) ((CPhysical *)ent)->AddToMovingList();
+ if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList();
}
void
@@ -90,7 +90,7 @@ CWorld::Remove(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->bIsStatic) ((CPhysical *)ent)->RemoveFromMovingList();
+ if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
}
void
@@ -1953,7 +1953,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->bIsStatic) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
bForceProcessControl = true;
@@ -1964,7 +1964,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->bIsStatic) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
}
@@ -2117,7 +2117,7 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
CObject *pObject = (CObject *)pEntity;
CVehicle *pVehicle = (CVehicle *)pEntity;
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
- if(pEntity->bIsStatic) {
+ if(pEntity->IsStatic()) {
if(pEntity->IsObject()) {
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
if (IsGlass(pObject->GetModelIndex())) {
@@ -2141,7 +2141,7 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
}
}
}
- if(pEntity->bIsStatic) {
+ if(pEntity->IsStatic()) {
float fDamageMultiplier =
(fRadius - fMagnitude) * 2.0f / fRadius;
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
@@ -2152,7 +2152,7 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
pEntity->AddToMovingList();
}
}
- if(!pEntity->bIsStatic) {
+ if(!pEntity->IsStatic()) {
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
CVector vecForceDir =
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index 0534de27..aecb1bc0 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -98,6 +98,7 @@ 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; }
#ifdef COMPATIBLE_SAVES
void SaveEntityFlags(uint8*& buf);
void LoadEntityFlags(uint8*& buf);
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index fe270645..bbe69167 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -324,7 +324,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->bIsStatic)
+ if(ent->IsBuilding() || ent->IsStatic())
this->bHasHitWall = true;
}
return numSpheres;
@@ -539,7 +539,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
timestepB = B->bIsHeavy ? 2.0f : 1.0f;
float speedA, speedB;
- if(B->bIsStatic){
+ if(B->IsStatic()){
if(A->bPedPhysics){
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
if(speedA < 0.0f){
@@ -622,7 +622,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
}
}
- if(B->bIsStatic)
+ if(B->IsStatic())
return false;
if(!B->bInfiniteMass)
B->AddToMovingList();
@@ -1079,7 +1079,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
CObject *Aobj = (CObject*)A;
if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
!Aobj->bHasBeenDamaged &&
- Aobj->bIsStatic){
+ Aobj->IsStatic()){
if(Aobj->m_pCollidingEntity == B)
Aobj->m_pCollidingEntity = nil;
}else if(Aobj->m_pCollidingEntity != B){
@@ -1096,7 +1096,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
CObject *Bobj = (CObject*)B;
if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
!Bobj->bHasBeenDamaged &&
- Bobj->bIsStatic){
+ Bobj->IsStatic()){
if(Bobj->m_pCollidingEntity == A)
Bobj->m_pCollidingEntity = nil;
}else if(Bobj->m_pCollidingEntity != A){
@@ -1414,7 +1414,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true;
else if(Aobj->ObjectCreatedBy == TEMP_OBJECT ||
Aobj->bHasBeenDamaged ||
- !Aobj->bIsStatic){
+ !Aobj->IsStatic()){
if(Aobj->m_pCollidingEntity == B)
skipCollision = true;
else{
@@ -1433,7 +1433,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true;
else if(Bobj->ObjectCreatedBy == TEMP_OBJECT ||
Bobj->bHasBeenDamaged ||
- !Bobj->bIsStatic){
+ !Bobj->IsStatic()){
if(Bobj->m_pCollidingEntity == A)
skipCollision = true;
else{
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 0a0a807d..042596de 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -14853,11 +14853,11 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (!collidingEnt->IsBuilding())
((CPhysical*)collidingEnt)->AddCollisionRecord(this);
- if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->bIsStatic)) {
+ if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->IsStatic())) {
bHasHitWall = true;
}
}
- if (collidingEnt->IsBuilding() || collidingEnt->bIsStatic) {
+ if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
if (bWasStanding) {
CVector sphereNormal;
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 8b267c09..4f0029ef 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -2190,7 +2190,7 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
}
// move body cast
- if(phys->bIsStatic){
+ if(phys->IsStatic()){
phys->bIsStatic = false;
phys->m_nStaticFrames = 0;
phys->ApplyMoveForce(m_vecMoveSpeed / Sqrt(speed));
diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp
index b7270f4b..83b6471e 100644
--- a/src/weapons/BulletInfo.cpp
+++ b/src/weapons/BulletInfo.cpp
@@ -156,11 +156,11 @@ void CBulletInfo::Update(void)
if (pHitEntity->IsObject()) {
CObject* pObject = (CObject*)pHitEntity;
if (!pObject->bInfiniteMass) {
- if (pObject->bIsStatic && pObject->m_fUprootLimit <= 0.0f) {
+ if (pObject->IsStatic() && pObject->m_fUprootLimit <= 0.0f) {
pObject->bIsStatic = false;
pObject->AddToMovingList();
}
- if (!pObject->bIsStatic)
+ if (!pObject->IsStatic())
pObject->ApplyMoveForce(-BULLET_HIT_FORCE * point.normal);
}
}
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index e9b917de..17ce64c0 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -1047,13 +1047,13 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( !victimObject->bInfiniteMass )
{
- if ( victimObject->bIsStatic && victimObject->m_fUprootLimit <= 0.0f )
+ if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f )
{
victimObject->bIsStatic = false;
victimObject->AddToMovingList();
}
- if ( !victimObject->bIsStatic )
+ if ( !victimObject->IsStatic())
{
CVector moveForce = point->normal*-4.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@@ -1296,13 +1296,13 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( !victimObject->bInfiniteMass )
{
- if ( victimObject->bIsStatic && victimObject->m_fUprootLimit <= 0.0f )
+ if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f )
{
victimObject->bIsStatic = false;
victimObject->AddToMovingList();
}
- if ( !victimObject->bIsStatic )
+ if ( !victimObject->IsStatic())
{
CVector moveForce = point.normal*-5.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@@ -2232,7 +2232,7 @@ CWeapon::BlowUpExplosiveThings(CEntity *thing)
object->m_vecMoveSpeed.x += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
object->m_vecMoveSpeed.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
- if ( object->bIsStatic )
+ if ( object->IsStatic())
{
object->bIsStatic = false;
object->AddToMovingList();