summaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/Entity.cpp2
-rw-r--r--src/entities/Entity.h2
-rw-r--r--src/entities/Physical.cpp14
3 files changed, 11 insertions, 7 deletions
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 6c7a628e..e3ecf50f 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -74,6 +74,8 @@ CEntity::CEntity(void)
bDistanceFade = false;
m_flagE2 = false;
+ bIsStaticWaitingForCollision = false;
+
m_scanCode = 0;
m_modelIndex = -1;
m_rwObject = nil;
diff --git a/src/entities/Entity.h b/src/entities/Entity.h
index 0534de27..e85e40f7 100644
--- a/src/entities/Entity.h
+++ b/src/entities/Entity.h
@@ -84,6 +84,7 @@ public:
// flagsE
uint32 m_flagE2 : 1;
// TODO(MIAMI)
+ uint32 bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them
uint16 m_scanCode;
uint16 m_randomSeed;
@@ -98,6 +99,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 || bIsStaticWaitingForCollision; }
#ifdef COMPATIBLE_SAVES
void SaveEntityFlags(uint8*& buf);
void LoadEntityFlags(uint8*& buf);
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index 3f1ec325..17a39070 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{