summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-10-18 16:15:49 +0200
committerSergeanur <s.anureev@yandex.ua>2020-10-18 16:15:49 +0200
commit0d20f1c364e23ff68c26b77632f0fb80c0e54799 (patch)
treed22ab7f9ce5c336c3a112aaeff8bcb5a7e2db672
parentAttractor obj. fixes (diff)
parentlil fix (diff)
downloadre3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar
re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.gz
re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.bz2
re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.lz
re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.xz
re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.tar.zst
re3-0d20f1c364e23ff68c26b77632f0fb80c0e54799.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioLogic.cpp30
-rw-r--r--src/control/Pickups.cpp21
-rw-r--r--src/control/RoadBlocks.cpp2
-rw-r--r--src/control/Script.cpp12
-rw-r--r--src/core/Cam.cpp2
-rw-r--r--src/core/World.cpp18
-rw-r--r--src/entities/Entity.h3
-rw-r--r--src/entities/Physical.cpp26
-rw-r--r--src/math/Vector.h8
-rw-r--r--src/objects/Object.cpp16
-rw-r--r--src/peds/CivilianPed.cpp2
-rw-r--r--src/peds/Ped.cpp6
-rw-r--r--src/peds/Population.cpp2
-rw-r--r--src/render/Glass.cpp4
-rw-r--r--src/render/SpecialFX.cpp35
-rw-r--r--src/vehicles/Automobile.cpp6
-rw-r--r--src/vehicles/Boat.cpp2
-rw-r--r--src/vehicles/Heli.cpp2
-rw-r--r--src/weapons/BulletInfo.cpp4
-rw-r--r--src/weapons/Weapon.cpp16
20 files changed, 125 insertions, 92 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 9a8dda28..6ea93f6d 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -1,4 +1,4 @@
-#include "common.h"
+#include "common.h"
#include "AudioManager.h"
#include "audio_enums.h"
@@ -993,7 +993,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
int32 emittingVol;
uint32 freq;
- float modificator;
+ float multiplier;
int sampleFreq;
float velocity;
@@ -1016,9 +1016,9 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
freq = 6050 * emittingVol / 30 + 16000;
} else {
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
- modificator = m_sQueueSample.m_fDistance / 190.f;
+ multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
- freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4);
+ freq = (sampleFreq * multiplier) + ((3 * sampleFreq) / 4);
}
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
@@ -1046,7 +1046,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
float relativeVelocity;
int32 emittingVol;
- float modificator;
+ float multiplier;
int freq;
float velChange;
@@ -1066,9 +1066,13 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
- modificator = m_sQueueSample.m_fDistance / 6.f;
+#ifdef FIX_BUGS
+ multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
+#else
+ multiplier = (m_sQueueSample.m_fDistance / 3.0f) * 0.5f;
+#endif
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
- m_sQueueSample.m_nFrequency = freq + freq * modificator;
+ m_sQueueSample.m_nFrequency = freq + freq * multiplier;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@@ -4923,17 +4927,25 @@ cAudioManager::ProcessFires(int32)
void
cAudioManager::ProcessWaterCannon(int32)
{
- const float SOUND_INTENSITY = 900.0f;
+ const float SOUND_INTENSITY = 30.0f;
for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
if (CWaterCannons::aCannons[i].m_nId) {
m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
- if (distSquared < SOUND_INTENSITY) {
+ if (distSquared < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
+#ifdef FIX_BUGS
+ m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
+#else
m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
+#endif
if (m_sQueueSample.m_nVolume != 0) {
+#ifdef FIX_BUGS
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+#else
+ m_sQueueSample.m_fSoundIntensity = SQR(SOUND_INTENSITY);
+#endif
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = 15591;
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 7a9808f6..490be370 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -122,11 +122,11 @@ CPickup::GiveUsAPickUpObject(int32 handle)
{
CObject *object;
- if (handle <= 0) object = new CObject(m_eModelIndex, false);
- else {
+ if (handle >= 0) {
CPools::MakeSureSlotInObjectPoolIsEmpty(handle);
- object = new(handle) CObject(m_eModelIndex, false);
- }
+ object = new (handle) CObject(m_eModelIndex, false);
+ } else
+ object = new CObject(m_eModelIndex, false);
if (object == nil) return nil;
object->ObjectCreatedBy = MISSION_OBJECT;
@@ -729,7 +729,7 @@ CPickups::Update()
#ifdef CAMERA_PICKUP
if ( bPickUpcamActivated ) // taken from PS2
{
- float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D();
+ float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
float mult;
if ( dist < 10.0f )
mult = 1.0f - (dist / 10.0f );
@@ -745,8 +745,7 @@ CPickups::Update()
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
}
- if ( FindPlayerVehicle() != pPlayerVehicle
- || (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
+ if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
{
TheCamera.RestoreWithJumpCut();
@@ -836,7 +835,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
CObject *object = (CObject*)entity;
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
- float dist = (TheCamera.GetPosition() - pos).Magnitude();
+ float dist = Distance2D(pos, TheCamera.GetPosition());
const float MAXDIST = 12.0f;
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
@@ -879,7 +878,7 @@ void
CPickups::DoMineEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
- float dist = (TheCamera.GetPosition() - pos).Magnitude();
+ float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f;
if (dist < MAXDIST) {
@@ -898,7 +897,7 @@ void
CPickups::DoMoneyEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
- float dist = (TheCamera.GetPosition() - pos).Magnitude();
+ float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f;
if (dist < MAXDIST) {
@@ -917,7 +916,7 @@ void
CPickups::DoCollectableEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
- float dist = (TheCamera.GetPosition() - pos).Magnitude();
+ float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 14.0f;
if (dist < MAXDIST) {
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index e7831b82..dee2cbe3 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -236,7 +236,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
tmp.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = tmp;
pVehicle->PlaceOnRoadProperly();
- pVehicle->bIsStatic = false;
+ pVehicle->SetIsStatic(false);
pVehicle->m_matrix.UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 1cef2a46..a2ab5f0b 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1704,7 +1704,7 @@ static void PossiblyWakeThisEntity(CPhysical* pEntity, bool ifColLoaded = false)
return;
if (!ifColLoaded || CColStore::HasCollisionLoaded(pEntity->GetPosition())) {
pEntity->bIsStaticWaitingForCollision = false;
- if (!pEntity->IsStatic())
+ if (!pEntity->GetIsStatic())
pEntity->AddToMovingList();
}
}
@@ -3973,7 +3973,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);
@@ -9649,13 +9649,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
script_assert(pObject);
if (ScriptParams[1]) {
if (pObject->bIsStatic) {
- pObject->bIsStatic = false;
+ pObject->SetIsStatic(false);
pObject->AddToMovingList();
}
}
else {
if (!pObject->bIsStatic) {
- pObject->bIsStatic = true;
+ pObject->SetIsStatic(true);
pObject->RemoveFromMovingList();
}
}
@@ -13727,7 +13727,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
pVehicle->bDontLoadCollision = true;
if (pVehicle->bIsStaticWaitingForCollision) {
pVehicle->bIsStaticWaitingForCollision = false;
- if (!pVehicle->IsStatic())
+ if (!pVehicle->GetIsStatic())
pVehicle->AddToMovingList();
}
}
@@ -13750,7 +13750,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
pPed->bDontLoadCollision = true;
if (pPed->bIsStaticWaitingForCollision) {
pPed->bIsStaticWaitingForCollision = false;
- if (!pPed->IsStatic())
+ if (!pPed->GetIsStatic())
pPed->AddToMovingList();
}
}
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index b996e77f..7af652ad 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -4247,7 +4247,7 @@ CCam::GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, C
CWorld::FindObjectsInRange(TargetCoors, 30.0f, true, &NumObjects, 15, Objects, false, false, false, true, true);
float NearestDist = 10000.0f;
for(i = 0; i < NumObjects; i++){
- if(Objects[i]->IsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
+ if(Objects[i]->GetIsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
float Dist = (Objects[i]->GetPosition() - TargetCoors).Magnitude2D();
if(Abs(ARRESTCAM_LAMP_BEST_DIST - Dist) < NearestDist){
CVector TestStart = Objects[i]->GetColModel()->boundingBox.max;
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 6d5e8a81..14c06a81 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -79,7 +79,7 @@ CWorld::Add(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList();
+ if(!ent->GetIsStatic()) ((CPhysical *)ent)->AddToMovingList();
}
void
@@ -94,7 +94,7 @@ CWorld::Remove(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
+ if(!ent->GetIsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
}
void
@@ -1962,7 +1962,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
bForceProcessControl = true;
@@ -1973,7 +1973,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
}
@@ -2133,13 +2133,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 ||
@@ -2157,18 +2157,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 /
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){
diff --git a/src/math/Vector.h b/src/math/Vector.h
index 7ee01149..082b296f 100644
--- a/src/math/Vector.h
+++ b/src/math/Vector.h
@@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
return (v2 - v1).Magnitude();
}
+inline float
+Distance2D(const CVector &v1, const CVector &v2)
+{
+ float x = v2.x - v1.x;
+ float y = v2.y - v1.y;
+ return Sqrt(x*x + y*y);
+}
+
class CMatrix;
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index 9a9eaa73..8b78bdbd 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -98,7 +98,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());
@@ -197,7 +197,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);
@@ -209,7 +209,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);
@@ -218,7 +218,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);
@@ -241,7 +241,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);
@@ -264,7 +264,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);
@@ -289,7 +289,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);
@@ -329,7 +329,7 @@ CObject::Init(void)
CObjectData::SetObjectData(GetModelIndex(), *this);
m_nEndOfLifeTime = 0;
ObjectCreatedBy = GAME_OBJECT;
- bIsStatic = true;
+ SetIsStatic(true);
bIsPickup = false;
bPickupObjWithMessage = false;
bOutOfStock = false;
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index 1950c4b3..74a7c9ba 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -425,7 +425,7 @@ void CCivilianPed::FindNearbyAttractorsSectorList(CPtrList& list, float& minDist
{
for (CPtrNode* pNode = list.first; pNode != nil; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item;
- if (pEntity->IsObject() && (!pEntity->IsStatic() || ((CObject*)pEntity)->bHasBeenDamaged))
+ if (pEntity->IsObject() && (!pEntity->GetIsStatic() || ((CObject*)pEntity)->bHasBeenDamaged))
continue;
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 469cdf4c..3f573171 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -16428,11 +16428,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;
float normalLength;
@@ -18414,7 +18414,7 @@ CPed::SeekCar(void)
{
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) {
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 94533f4a..d52c8c7c 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -945,7 +945,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (IsGlass(obj->GetModelIndex()) && !mi->m_isArtistGlass) {
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();
diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp
index c52d49bd..aabb6e52 100644
--- a/src/render/Glass.cpp
+++ b/src/render/Glass.cpp
@@ -393,9 +393,9 @@ void
CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity)
{
#ifdef FIX_BUGS
- if ( NumGlassEntities < NUM_GLASSPANES )
+ if ( NumGlassEntities < NUM_GLASSENTITIES )
#else
- if ( NumGlassEntities < NUM_GLASSPANES-1 )
+ if ( NumGlassEntities < NUM_GLASSENTITIES-1 )
#endif
{
apEntitiesToBeRendered[NumGlassEntities++] = entity;
diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp
index fa8379f0..08dfda35 100644
--- a/src/render/SpecialFX.cpp
+++ b/src/render/SpecialFX.cpp
@@ -209,7 +209,7 @@ CMotionBlurStreaks::Update(void)
{
int i;
for(i = 0; i < NUMMBLURSTREAKS; i++)
- if(aStreaks[i].m_id)
+ if(aStreaks[i].m_id != 0)
aStreaks[i].Update();
}
@@ -230,7 +230,7 @@ CMotionBlurStreaks::RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVecto
}
}
// Find free slot
- for(i = 0; aStreaks[i].m_id; i++)
+ for(i = 0; aStreaks[i].m_id != 0; i++)
if(i == NUMMBLURSTREAKS-1)
return;
// Create a new streak
@@ -251,7 +251,7 @@ CMotionBlurStreaks::Render(void)
bool setRenderStates = false;
int i;
for(i = 0; i < NUMMBLURSTREAKS; i++)
- if(aStreaks[i].m_id){
+ if(aStreaks[i].m_id != 0){
if(!setRenderStates){
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@@ -328,7 +328,7 @@ void CBulletTraces::Render(void)
RwIm3DVertexSetPos(&TraceVertices[4], sup.x + width.x, sup.y + width.y, sup.z + width.z);
RwIm3DVertexSetPos(&TraceVertices[5], sup.x - width.x, sup.y - width.y, sup.z - width.z);
LittleTest();
- if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) {
+ if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, rwIM3D_VERTEXUV)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DEnd();
}
@@ -851,6 +851,22 @@ CBrightLights::Render(void)
TempBufferIndicesStored += 12*3;
break;
+ case BRIGHTLIGHT_FRONT_BIG:
+ case BRIGHTLIGHT_REAR_BIG:
+ for (j = 0; j < 8; j++) {
+ pos = BigCarHeadLightsSide[j] * aBrightLights[i].m_side +
+ BigCarHeadLightsUp[j] * aBrightLights[i].m_up +
+ BigCarHeadLightsFront[j] * aBrightLights[i].m_front +
+ aBrightLights[i].m_pos;
+ RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored + j], r, g, b, a);
+ RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored + j], pos.x, pos.y, pos.z);
+ }
+ for (j = 0; j < 12 * 3; j++)
+ TempBufferRenderIndexList[TempBufferIndicesStored + j] = CubeIndices[j] + TempBufferVerticesStored;
+ TempBufferVerticesStored += 8;
+ TempBufferIndicesStored += 12 * 3;
+ break;
+
case BRIGHTLIGHT_FRONT_TALL:
case BRIGHTLIGHT_REAR_TALL:
for(j = 0; j < 8; j++){
@@ -869,8 +885,8 @@ CBrightLights::Render(void)
case BRIGHTLIGHT_SIREN:
for(j = 0; j < 6; j++){
- pos = SirenLightsSide[j]*aBrightLights[i].m_side +
- SirenLightsUp[j]*aBrightLights[i].m_up +
+ pos = SirenLightsSide[j] * TheCamera.GetRight() +
+ SirenLightsUp[j] * TheCamera.GetUp() +
aBrightLights[i].m_pos;
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+j], r, g, b, a);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+j], pos.x, pos.y, pos.z);
@@ -1067,11 +1083,8 @@ CMoneyMessage::Render()
CFont::SetPropOn();
CFont::SetBackgroundOff();
- float fScaleY = fDistY / 100.0f;
- if (fScaleY > MAX_SCALE) fScaleY = MAX_SCALE;
-
- float fScaleX = fDistX / 100.0f;
- if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE;
+ float fScaleY = Min(fDistY / 100.0f, MAX_SCALE);
+ float fScaleX = Min(fDistX / 100.0f, MAX_SCALE);
CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here?
CFont::SetCentreOn();
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 1316985d..395f3917 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -1,4 +1,4 @@
-#include "common.h"
+#include "common.h"
#include "main.h"
#include "General.h"
@@ -4635,7 +4635,6 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
case ANIM_CAR_ROLLDOOR_LOW:
ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f);
break;
- break;
case ANIM_CAR_GETOUT_LHS:
case ANIM_CAR_GETOUT_LOW_LHS:
case ANIM_CAR_GETOUT_RHS:
@@ -4649,6 +4648,7 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
case ANIM_CAR_PULLOUT_RHS:
case ANIM_CAR_PULLOUT_LOW_RHS:
OpenDoor(component, door, 1.0f);
+ break;
case ANIM_COACH_OPEN_L:
case ANIM_COACH_OPEN_R:
ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f);
@@ -5349,7 +5349,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;
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 8c9dd241..d727b1bc 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -893,7 +893,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
diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp
index 2c2fb33c..d6a237e5 100644
--- a/src/vehicles/Heli.cpp
+++ b/src/vehicles/Heli.cpp
@@ -671,7 +671,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
diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp
index 375a2ca9..13032300 100644
--- a/src/weapons/BulletInfo.cpp
+++ b/src/weapons/BulletInfo.cpp
@@ -205,13 +205,13 @@ void CBulletInfo::Update(void)
if (pHitEntity->IsObject()) {
CObject *pHitObject = (CObject*)pHitEntity;
if ( !pHitObject->bInfiniteMass && pHitObject->m_fCollisionDamageMultiplier < 99.9f) {
- bool notStatic = !pHitObject->IsStatic();
+ bool notStatic = !pHitObject->GetIsStatic();
if (notStatic && pHitObject->m_fUprootLimit <= 0.0f) {
pHitObject->bIsStatic = false;
pHitObject->AddToMovingList();
}
- notStatic = !pHitObject->IsStatic();
+ notStatic = !pHitObject->GetIsStatic();
if (!notStatic) {
CVector moveForce = point.normal * -BULLET_HIT_FORCE;
pHitObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 48f90897..5d9686b5 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -1526,14 +1526,14 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( !victimObject->bInfiniteMass && victimObject->m_fCollisionDamageMultiplier < 99.9f)
{
- bool notStatic = !victimObject->IsStatic();
+ bool notStatic = !victimObject->GetIsStatic();
if (notStatic && victimObject->m_fUprootLimit <= 0.0f)
{
- victimObject->bIsStatic = false;
+ victimObject->SetIsStatic(false);
victimObject->AddToMovingList();
}
- notStatic = !victimObject->IsStatic();
+ notStatic = !victimObject->GetIsStatic();
if (!notStatic)
{
CVector moveForce = point->normal * -4.0f;
@@ -1922,14 +1922,14 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( !victimObject->bInfiniteMass )
{
- bool notStatic = !victimObject->IsStatic();
+ bool notStatic = !victimObject->GetIsStatic();
if ( notStatic && victimObject->m_fUprootLimit <= 0.0f )
{
- victimObject->bIsStatic = false;
+ victimObject->SetIsStatic(false);
victimObject->AddToMovingList();
}
- notStatic = !victimObject->IsStatic();
+ notStatic = !victimObject->GetIsStatic();
if ( !notStatic )
{
CVector moveForce = point.normal*-5.0f;
@@ -3149,9 +3149,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();
}
}