Setter for bIsStatic (became virtual in SA)

This commit is contained in:
Sergeanur 2020-10-18 16:40:06 +03:00
parent 23220d799c
commit b91f6a4550
15 changed files with 62 additions and 61 deletions

View File

@ -165,7 +165,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = vehicleMatrix;
pVehicle->PlaceOnRoadProperly();
pVehicle->bIsStatic = false;
pVehicle->SetIsStatic(false);
pVehicle->m_matrix.UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle);

View File

@ -3577,7 +3577,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->bIsStatic = false;
car->SetIsStatic(false);
/* Again weird usage of virtual functions. */
if (car->IsBoat()) {
car->Teleport(pos);
@ -9184,14 +9184,14 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
script_assert(pObject);
if (ScriptParams[1]) {
if (pObject->bIsStatic) {
pObject->bIsStatic = false;
if (pObject->GetIsStatic()) {
pObject->SetIsStatic(false);
pObject->AddToMovingList();
}
}
else {
if (!pObject->bIsStatic) {
pObject->bIsStatic = true;
if (!pObject->GetIsStatic()) {
pObject->SetIsStatic(true);
pObject->RemoveFromMovingList();
}
}

View File

@ -75,7 +75,7 @@ CWorld::Add(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList();
if(!ent->GetIsStatic()) ((CPhysical *)ent)->AddToMovingList();
}
void
@ -90,7 +90,7 @@ CWorld::Remove(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
if(!ent->GetIsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
}
void
@ -1960,7 +1960,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
bForceProcessControl = true;
@ -1971,7 +1971,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
}
@ -2124,13 +2124,13 @@ 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->IsStatic()) {
if(pEntity->GetIsStatic()) {
if(pEntity->IsObject()) {
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
if (IsGlass(pObject->GetModelIndex())) {
CGlass::WindowRespondsToExplosion(pObject, position);
} else {
pObject->bIsStatic = false;
pObject->SetIsStatic(false);
pObject->AddToMovingList();
int16 modelId = pEntity->GetModelIndex();
if(modelId != MI_FIRE_HYDRANT ||
@ -2148,18 +2148,18 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
}
}
}
if(pEntity->IsStatic()) {
if(pEntity->GetIsStatic()) {
float fDamageMultiplier =
(fRadius - fMagnitude) * 2.0f / fRadius;
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
pObject->ObjectDamage(fDamage);
}
} else {
pEntity->bIsStatic = false;
pEntity->SetIsStatic(false);
pEntity->AddToMovingList();
}
}
if(!pEntity->IsStatic()) {
if(!pEntity->GetIsStatic()) {
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
CVector vecForceDir =
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /

View File

@ -97,7 +97,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; }
bool GetIsStatic(void) const { return bIsStatic; }
void SetIsStatic(bool state) { bIsStatic = state; }
#ifdef COMPATIBLE_SAVES
void SaveEntityFlags(uint8*& buf);
void LoadEntityFlags(uint8*& buf);

View File

@ -341,7 +341,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;
@ -377,7 +377,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;
@ -556,7 +556,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
massFactorB = B->bIsHeavy ? 2.0f : 1.0f;
float speedA, speedB;
if(B->IsStatic()){
if(B->GetIsStatic()){
if(A->bPedPhysics){
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
if(speedA < 0.0f){
@ -567,7 +567,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);
}else{
if(IsGlass(B->GetModelIndex()))
CGlass::WindowRespondsToSoftCollision(B, impulseA);
@ -576,7 +576,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;
@ -614,7 +614,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);
@ -635,11 +635,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->AddToMovingList();
@ -1074,7 +1074,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
canshift = true;
else
canshift = A->IsPed() &&
B->IsObject() && B->bIsStatic && !Bobj->bHasBeenDamaged;
B->IsObject() && B->GetIsStatic() && !Bobj->bHasBeenDamaged;
if(B == A ||
B->m_scanCode == CWorld::GetCurrentScanCode() ||
!B->bUsesCollision ||
@ -1098,7 +1098,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){
@ -1115,7 +1115,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){
@ -1433,7 +1433,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{
@ -1452,7 +1452,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{

View File

@ -91,7 +91,7 @@ CObject::ProcessControl(void)
CPhysical::ProcessControl();
if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
bIsInWater = true;
bIsStatic = false;
SetIsStatic(false);
ApplyMoveForce(impulse);
ApplyTurnForce(impulse, point);
float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
@ -182,7 +182,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_COMPLETELY:
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -194,7 +194,7 @@ CObject::ObjectDamage(float amount)
else {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -203,7 +203,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -226,7 +226,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -249,7 +249,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -274,7 +274,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -314,7 +314,7 @@ CObject::Init(void)
CObjectData::SetObjectData(GetModelIndex(), *this);
m_nEndOfLifeTime = 0;
ObjectCreatedBy = GAME_OBJECT;
bIsStatic = true;
SetIsStatic(true);
bIsPickup = false;
bPickupObjWithMessage = false;
bOutOfStock = false;

View File

@ -14606,11 +14606,11 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (!collidingEnt->IsBuilding())
((CPhysical*)collidingEnt)->AddCollisionRecord(this);
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->IsStatic())) {
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic())) {
bHasHitWall = true;
}
}
if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
if (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic()) {
if (bWasStanding) {
CVector sphereNormal;
@ -15956,7 +15956,7 @@ CPed::SeekCar(void)
} else {
m_fRotationCur = m_fRotationDest;
if (!bVehEnterDoorIsBlocked) {
vehToSeek->bIsStatic = false;
vehToSeek->SetIsStatic(false);
if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
SetSolicit(1000);
} else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) {
@ -16637,7 +16637,7 @@ CPed::SpawnFlyingComponent(int pedNode, int8 direction)
obj->m_fElasticity = 0.03f;
obj->m_fBuoyancy = m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
obj->m_nSpecialCollisionResponseCases = COLLRESPONSE_SMALLBOX;

View File

@ -972,7 +972,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (IsGlass(obj->GetModelIndex())) {
obj->bIsVisible = false;
} else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
obj->bTouchingWater = true;
obj->AddToMovingList();

View File

@ -1208,7 +1208,7 @@ CRenderer::IsEntityCullZoneVisible(CEntity *ent)
return !(ped->m_pCurSurface && ped->m_pCurSurface->bZoneCulled2);
case ENTITY_TYPE_OBJECT:
obj = (CObject*)ent;
if(!obj->IsStatic())
if(!obj->GetIsStatic())
return true;
return !(obj->m_pCurSurface && obj->m_pCurSurface->bZoneCulled2);
default: break;

View File

@ -2192,8 +2192,8 @@ CAutomobile::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
}
// move body cast
if(phys->IsStatic()){
phys->bIsStatic = false;
if(phys->GetIsStatic()){
phys->SetIsStatic(false);
phys->m_nStaticFrames = 0;
phys->ApplyMoveForce(m_vecMoveSpeed / Sqrt(speed));
phys->AddToMovingList();
@ -4385,7 +4385,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
obj->bUseVehicleColours = true;
obj->m_colour1 = m_currentColour1;

View File

@ -664,7 +664,7 @@ CBoat::BlowUpCar(CEntity *culprit)
obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
// life time

View File

@ -58,7 +58,7 @@ void CCarGenerator::DoInternalProcessing()
return;
if (CModelInfo::IsBoatModel(m_nModelIndex)){
CBoat* pBoat = new CBoat(m_nModelIndex, PARKED_VEHICLE);
pBoat->bIsStatic = false;
pBoat->SetIsStatic(false);
pBoat->bEngineOn = false;
CVector pos = m_vecPos;
if (pos.z <= -100.0f)
@ -101,7 +101,7 @@ void CCarGenerator::DoInternalProcessing()
if (((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex))->m_vehicleType != VEHICLE_TYPE_BIKE)
pCar = new CAutomobile(m_nModelIndex, PARKED_VEHICLE);
pCar->bIsStatic = false;
pCar->SetIsStatic(false);
pCar->bEngineOn = false;
pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel();
pCar->SetPosition(pos);

View File

@ -726,7 +726,7 @@ CHeli::SpawnFlyingComponent(int32 component)
obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
// life time

View File

@ -185,11 +185,11 @@ void CBulletInfo::Update(void)
if (pHitEntity->IsObject()) {
CObject* pObject = (CObject*)pHitEntity;
if (!pObject->bInfiniteMass) {
if (pObject->IsStatic() && pObject->m_fUprootLimit <= 0.0f) {
pObject->bIsStatic = false;
if (pObject->GetIsStatic() && pObject->m_fUprootLimit <= 0.0f) {
pObject->SetIsStatic(false);
pObject->AddToMovingList();
}
if (!pObject->IsStatic())
if (!pObject->GetIsStatic())
pObject->ApplyMoveForce(-BULLET_HIT_FORCE * point.normal);
}
}

View File

@ -1057,13 +1057,13 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( !victimObject->bInfiniteMass )
{
if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f )
if ( victimObject->GetIsStatic() && victimObject->m_fUprootLimit <= 0.0f )
{
victimObject->bIsStatic = false;
victimObject->SetIsStatic(false);
victimObject->AddToMovingList();
}
if ( !victimObject->IsStatic())
if ( !victimObject->GetIsStatic())
{
CVector moveForce = point->normal*-4.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@ -1316,13 +1316,13 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( !victimObject->bInfiniteMass )
{
if ( victimObject->IsStatic() && victimObject->m_fUprootLimit <= 0.0f )
if ( victimObject->GetIsStatic() && victimObject->m_fUprootLimit <= 0.0f )
{
victimObject->bIsStatic = false;
victimObject->SetIsStatic(false);
victimObject->AddToMovingList();
}
if ( !victimObject->IsStatic())
if ( !victimObject->GetIsStatic())
{
CVector moveForce = point.normal*-5.0f;
victimObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
@ -2258,9 +2258,9 @@ 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->IsStatic())
if ( object->GetIsStatic())
{
object->bIsStatic = false;
object->SetIsStatic(false);
object->AddToMovingList();
}
}