diff options
Diffstat (limited to '')
-rw-r--r-- | src/animation/AnimBlendAssociation.h | 2 | ||||
-rw-r--r-- | src/animation/AnimManager.cpp | 2 | ||||
-rw-r--r-- | src/control/Phones.cpp (renamed from src/control/PhoneInfo.cpp) | 4 | ||||
-rw-r--r-- | src/control/Phones.h (renamed from src/control/PhoneInfo.h) | 0 | ||||
-rw-r--r-- | src/control/Replay.cpp | 6 | ||||
-rw-r--r-- | src/control/Replay.h | 4 | ||||
-rw-r--r-- | src/control/Script.cpp | 151 | ||||
-rw-r--r-- | src/control/Script.h | 16 | ||||
-rw-r--r-- | src/core/Camera.cpp (renamed from src/Camera.cpp) | 2 | ||||
-rw-r--r-- | src/core/Camera.h (renamed from src/Camera.h) | 0 | ||||
-rw-r--r-- | src/core/CdStream.cpp (renamed from src/CdStream.cpp) | 0 | ||||
-rw-r--r-- | src/core/CdStream.h (renamed from src/CdStream.h) | 0 | ||||
-rw-r--r-- | src/core/Clock.cpp (renamed from src/Clock.cpp) | 0 | ||||
-rw-r--r-- | src/core/Clock.h (renamed from src/Clock.h) | 0 | ||||
-rw-r--r-- | src/core/Collision.cpp (renamed from src/Collision.cpp) | 2 | ||||
-rw-r--r-- | src/core/Collision.h (renamed from src/Collision.h) | 0 | ||||
-rw-r--r-- | src/core/ControllerConfig.cpp (renamed from src/ControllerConfig.cpp) | 0 | ||||
-rw-r--r-- | src/core/ControllerConfig.h (renamed from src/ControllerConfig.h) | 0 | ||||
-rw-r--r-- | src/core/CutsceneMgr.cpp (renamed from src/CutsceneMgr.cpp) | 0 | ||||
-rw-r--r-- | src/core/CutsceneMgr.h (renamed from src/CutsceneMgr.h) | 0 | ||||
-rw-r--r-- | src/core/Directory.cpp (renamed from src/Directory.cpp) | 0 | ||||
-rw-r--r-- | src/core/Directory.h (renamed from src/Directory.h) | 0 | ||||
-rw-r--r-- | src/core/FileLoader.cpp (renamed from src/FileLoader.cpp) | 2 | ||||
-rw-r--r-- | src/core/FileLoader.h (renamed from src/FileLoader.h) | 0 | ||||
-rw-r--r-- | src/core/FileMgr.cpp (renamed from src/FileMgr.cpp) | 0 | ||||
-rw-r--r-- | src/core/FileMgr.h (renamed from src/FileMgr.h) | 0 | ||||
-rw-r--r-- | src/core/Fire.cpp (renamed from src/Fire.cpp) | 0 | ||||
-rw-r--r-- | src/core/Fire.h (renamed from src/Fire.h) | 0 | ||||
-rw-r--r-- | src/core/Frontend.cpp (renamed from src/Frontend.cpp) | 0 | ||||
-rw-r--r-- | src/core/Frontend.h (renamed from src/Frontend.h) | 0 | ||||
-rw-r--r-- | src/core/Game.cpp (renamed from src/Game.cpp) | 0 | ||||
-rw-r--r-- | src/core/Game.h (renamed from src/Game.h) | 0 | ||||
-rw-r--r-- | src/core/General.h (renamed from src/General.h) | 0 | ||||
-rw-r--r-- | src/core/Lists.cpp (renamed from src/Lists.cpp) | 0 | ||||
-rw-r--r-- | src/core/Lists.h (renamed from src/Lists.h) | 0 | ||||
-rw-r--r-- | src/core/MenuScreens.h (renamed from src/MenuScreens.h) | 0 | ||||
-rw-r--r-- | src/core/Messages.cpp (renamed from src/Messages.cpp) | 0 | ||||
-rw-r--r-- | src/core/Messages.h (renamed from src/Messages.h) | 0 | ||||
-rw-r--r-- | src/core/NodeName.cpp (renamed from src/NodeName.cpp) | 0 | ||||
-rw-r--r-- | src/core/NodeName.h (renamed from src/NodeName.h) | 0 | ||||
-rw-r--r-- | src/core/PCSave.cpp (renamed from src/PCSave.cpp) | 0 | ||||
-rw-r--r-- | src/core/PCSave.h (renamed from src/PCSave.h) | 0 | ||||
-rw-r--r-- | src/core/Pad.cpp (renamed from src/Pad.cpp) | 0 | ||||
-rw-r--r-- | src/core/Pad.h (renamed from src/Pad.h) | 128 | ||||
-rw-r--r-- | src/core/Placeable.cpp (renamed from src/Placeable.cpp) | 0 | ||||
-rw-r--r-- | src/core/Placeable.h (renamed from src/Placeable.h) | 0 | ||||
-rw-r--r-- | src/core/PlayerInfo.cpp (renamed from src/entities/PlayerInfo.cpp) | 0 | ||||
-rw-r--r-- | src/core/PlayerInfo.h (renamed from src/entities/PlayerInfo.h) | 0 | ||||
-rw-r--r-- | src/core/PlayerSkin.cpp (renamed from src/entities/PlayerSkin.cpp) | 0 | ||||
-rw-r--r-- | src/core/PlayerSkin.h (renamed from src/entities/PlayerSkin.h) | 0 | ||||
-rw-r--r-- | src/core/Pools.cpp (renamed from src/Pools.cpp) | 0 | ||||
-rw-r--r-- | src/core/Pools.h (renamed from src/Pools.h) | 0 | ||||
-rw-r--r-- | src/core/Radar.cpp (renamed from src/Radar.cpp) | 0 | ||||
-rw-r--r-- | src/core/Radar.h (renamed from src/Radar.h) | 0 | ||||
-rw-r--r-- | src/core/References.cpp (renamed from src/References.cpp) | 0 | ||||
-rw-r--r-- | src/core/References.h (renamed from src/References.h) | 0 | ||||
-rw-r--r-- | src/core/RwClumpRead.cpp (renamed from src/RwClumpRead.cpp) | 0 | ||||
-rw-r--r-- | src/core/RwHelper.cpp (renamed from src/RwHelper.cpp) | 0 | ||||
-rw-r--r-- | src/core/RwHelper.h (renamed from src/RwHelper.h) | 0 | ||||
-rw-r--r-- | src/core/RwMatFX.cpp (renamed from src/RwMatFX.cpp) | 0 | ||||
-rw-r--r-- | src/core/RwTexRead.cpp (renamed from src/RwTexRead.cpp) | 0 | ||||
-rw-r--r-- | src/core/Stats.cpp (renamed from src/Stats.cpp) | 0 | ||||
-rw-r--r-- | src/core/Stats.h (renamed from src/Stats.h) | 0 | ||||
-rw-r--r-- | src/core/Streaming.cpp (renamed from src/Streaming.cpp) | 2 | ||||
-rw-r--r-- | src/core/Streaming.h (renamed from src/Streaming.h) | 0 | ||||
-rw-r--r-- | src/core/SurfaceTable.cpp (renamed from src/SurfaceTable.cpp) | 0 | ||||
-rw-r--r-- | src/core/SurfaceTable.h (renamed from src/SurfaceTable.h) | 0 | ||||
-rw-r--r-- | src/core/TempColModels.cpp (renamed from src/TempColModels.cpp) | 0 | ||||
-rw-r--r-- | src/core/TempColModels.h (renamed from src/TempColModels.h) | 0 | ||||
-rw-r--r-- | src/core/Text.cpp (renamed from src/Text.cpp) | 0 | ||||
-rw-r--r-- | src/core/Text.h (renamed from src/Text.h) | 0 | ||||
-rw-r--r-- | src/core/Timer.cpp (renamed from src/Timer.cpp) | 0 | ||||
-rw-r--r-- | src/core/Timer.h (renamed from src/Timer.h) | 19 | ||||
-rw-r--r-- | src/core/TxdStore.cpp (renamed from src/TxdStore.cpp) | 0 | ||||
-rw-r--r-- | src/core/TxdStore.h (renamed from src/TxdStore.h) | 0 | ||||
-rw-r--r-- | src/core/User.cpp (renamed from src/User.cpp) | 0 | ||||
-rw-r--r-- | src/core/User.h (renamed from src/User.h) | 0 | ||||
-rw-r--r-- | src/core/Wanted.cpp (renamed from src/Wanted.cpp) | 0 | ||||
-rw-r--r-- | src/core/Wanted.h (renamed from src/Wanted.h) | 0 | ||||
-rw-r--r-- | src/core/World.cpp (renamed from src/World.cpp) | 0 | ||||
-rw-r--r-- | src/core/World.h (renamed from src/World.h) | 0 | ||||
-rw-r--r-- | src/core/ZoneCull.cpp (renamed from src/CullZones.cpp) | 2 | ||||
-rw-r--r-- | src/core/ZoneCull.h (renamed from src/CullZones.h) | 0 | ||||
-rw-r--r-- | src/core/Zones.cpp (renamed from src/Zones.cpp) | 0 | ||||
-rw-r--r-- | src/core/Zones.h (renamed from src/Zones.h) | 0 | ||||
-rw-r--r-- | src/core/common.h (renamed from src/common.h) | 0 | ||||
-rw-r--r-- | src/core/config.h (renamed from src/config.h) | 0 | ||||
-rw-r--r-- | src/core/debugmenu_public.h (renamed from src/debugmenu_public.h) | 0 | ||||
-rw-r--r-- | src/core/main.cpp (renamed from src/main.cpp) | 2 | ||||
-rw-r--r-- | src/core/main.h (renamed from src/main.h) | 0 | ||||
-rw-r--r-- | src/core/patcher.cpp (renamed from src/patcher.cpp) | 0 | ||||
-rw-r--r-- | src/core/patcher.h (renamed from src/patcher.h) | 0 | ||||
-rw-r--r-- | src/core/re3.cpp (renamed from src/re3.cpp) | 0 | ||||
-rw-r--r-- | src/core/rw.cpp (renamed from src/rw.cpp) | 0 | ||||
-rw-r--r-- | src/core/templates.h (renamed from src/templates.h) | 0 | ||||
-rw-r--r-- | src/entities/Physical.cpp | 65 | ||||
-rw-r--r-- | src/entities/Physical.h | 8 | ||||
-rw-r--r-- | src/math/Vector.h | 10 | ||||
-rw-r--r-- | src/modelinfo/MloInstance.cpp (renamed from src/MloInstance.cpp) | 0 | ||||
-rw-r--r-- | src/modelinfo/MloInstance.h (renamed from src/MloInstance.h) | 0 | ||||
-rw-r--r-- | src/objects/CutsceneHead.cpp (renamed from src/entities/CutsceneHead.cpp) | 0 | ||||
-rw-r--r-- | src/objects/CutsceneHead.h (renamed from src/entities/CutsceneHead.h) | 0 | ||||
-rw-r--r-- | src/objects/CutsceneObject.cpp (renamed from src/entities/CutsceneObject.cpp) | 0 | ||||
-rw-r--r-- | src/objects/CutsceneObject.h (renamed from src/entities/CutsceneObject.h) | 0 | ||||
-rw-r--r-- | src/objects/DummyObject.cpp (renamed from src/entities/DummyObject.cpp) | 0 | ||||
-rw-r--r-- | src/objects/DummyObject.h (renamed from src/entities/DummyObject.h) | 0 | ||||
-rw-r--r-- | src/objects/Object.cpp (renamed from src/entities/Object.cpp) | 0 | ||||
-rw-r--r-- | src/objects/Object.h (renamed from src/entities/Object.h) | 0 | ||||
-rw-r--r-- | src/objects/ObjectData.cpp (renamed from src/control/ObjectData.cpp) | 0 | ||||
-rw-r--r-- | src/objects/ObjectData.h (renamed from src/control/ObjectData.h) | 0 | ||||
-rw-r--r-- | src/objects/ParticleObject.cpp (renamed from src/ParticleObject.cpp) | 0 | ||||
-rw-r--r-- | src/objects/ParticleObject.h (renamed from src/ParticleObject.h) | 0 | ||||
-rw-r--r-- | src/objects/Projectile.cpp (renamed from src/entities/Projectile.cpp) | 0 | ||||
-rw-r--r-- | src/objects/Projectile.h (renamed from src/entities/Projectile.h) | 0 | ||||
-rw-r--r-- | src/peds/CivilianPed.cpp (renamed from src/entities/CivilianPed.cpp) | 0 | ||||
-rw-r--r-- | src/peds/CivilianPed.h (renamed from src/entities/CivilianPed.h) | 0 | ||||
-rw-r--r-- | src/peds/CopPed.cpp (renamed from src/entities/CopPed.cpp) | 0 | ||||
-rw-r--r-- | src/peds/CopPed.h (renamed from src/entities/CopPed.h) | 0 | ||||
-rw-r--r-- | src/peds/DummyPed.h (renamed from src/entities/DummyPed.h) | 0 | ||||
-rw-r--r-- | src/peds/EmergencyPed.cpp (renamed from src/entities/EmergencyPed.cpp) | 0 | ||||
-rw-r--r-- | src/peds/EmergencyPed.h (renamed from src/entities/EmergencyPed.h) | 0 | ||||
-rw-r--r-- | src/peds/Ped.cpp (renamed from src/entities/Ped.cpp) | 36 | ||||
-rw-r--r-- | src/peds/Ped.h (renamed from src/entities/Ped.h) | 10 | ||||
-rw-r--r-- | src/peds/PedIK.cpp (renamed from src/entities/PedIK.cpp) | 0 | ||||
-rw-r--r-- | src/peds/PedIK.h (renamed from src/entities/PedIK.h) | 0 | ||||
-rw-r--r-- | src/peds/PedPlacement.cpp (renamed from src/control/PedPlacement.cpp) | 0 | ||||
-rw-r--r-- | src/peds/PedPlacement.h (renamed from src/control/PedPlacement.h) | 0 | ||||
-rw-r--r-- | src/peds/PedStats.cpp (renamed from src/control/PedStats.cpp) | 0 | ||||
-rw-r--r-- | src/peds/PedStats.h (renamed from src/control/PedStats.h) | 0 | ||||
-rw-r--r-- | src/peds/PedType.cpp (renamed from src/control/PedType.cpp) | 0 | ||||
-rw-r--r-- | src/peds/PedType.h (renamed from src/control/PedType.h) | 0 | ||||
-rw-r--r-- | src/peds/PlayerPed.cpp (renamed from src/entities/PlayerPed.cpp) | 0 | ||||
-rw-r--r-- | src/peds/PlayerPed.h (renamed from src/entities/PlayerPed.h) | 0 | ||||
-rw-r--r-- | src/render/Hud.cpp | 44 | ||||
-rw-r--r-- | src/render/Lights.cpp | 2 | ||||
-rw-r--r-- | src/render/Particle.h | 2 | ||||
-rw-r--r-- | src/render/Timecycle.cpp (renamed from src/Timecycle.cpp) | 2 | ||||
-rw-r--r-- | src/render/Timecycle.h (renamed from src/Timecycle.h) | 0 | ||||
-rw-r--r-- | src/render/Weather.cpp (renamed from src/Weather.cpp) | 0 | ||||
-rw-r--r-- | src/render/Weather.h (renamed from src/Weather.h) | 0 | ||||
-rw-r--r-- | src/vehicles/Automobile.cpp (renamed from src/entities/Automobile.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/Automobile.h (renamed from src/entities/Automobile.h) | 7 | ||||
-rw-r--r-- | src/vehicles/Boat.cpp (renamed from src/entities/Boat.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/Boat.h (renamed from src/entities/Boat.h) | 0 | ||||
-rw-r--r-- | src/vehicles/DamageManager.cpp (renamed from src/DamageManager.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/DamageManager.h (renamed from src/DamageManager.h) | 0 | ||||
-rw-r--r-- | src/vehicles/HandlingMgr.cpp (renamed from src/control/HandlingMgr.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/HandlingMgr.h (renamed from src/control/HandlingMgr.h) | 0 | ||||
-rw-r--r-- | src/vehicles/Heli.cpp (renamed from src/entities/Heli.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/Heli.h (renamed from src/entities/Heli.h) | 0 | ||||
-rw-r--r-- | src/vehicles/Plane.cpp (renamed from src/entities/Plane.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/Plane.h (renamed from src/entities/Plane.h) | 0 | ||||
-rw-r--r-- | src/vehicles/Train.cpp (renamed from src/entities/Train.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/Train.h (renamed from src/entities/Train.h) | 0 | ||||
-rw-r--r-- | src/vehicles/Transmission.cpp (renamed from src/control/Transmission.cpp) | 0 | ||||
-rw-r--r-- | src/vehicles/Transmission.h (renamed from src/control/Transmission.h) | 0 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp (renamed from src/entities/Vehicle.cpp) | 2 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h (renamed from src/entities/Vehicle.h) | 7 |
158 files changed, 366 insertions, 173 deletions
diff --git a/src/animation/AnimBlendAssociation.h b/src/animation/AnimBlendAssociation.h index d846a4d3..a7e127f7 100644 --- a/src/animation/AnimBlendAssociation.h +++ b/src/animation/AnimBlendAssociation.h @@ -77,7 +77,7 @@ public: void UpdateTime(float timeDelta, float relSpeed); bool UpdateBlend(float timeDelta); - float GetTimeLeft() { return hierarchy->totalLength - currentTime; } + inline float GetTimeLeft() { return hierarchy->totalLength - currentTime; } static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) { return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link)); diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp index 73fc4d94..6ad63e49 100644 --- a/src/animation/AnimManager.cpp +++ b/src/animation/AnimManager.cpp @@ -752,7 +752,7 @@ CAnimManager::LoadAnimFiles(void) AnimAssocDefinition *def = &CAnimManager::ms_aAnimAssocDefinitions[i]; group->CreateAssociations(def->blockName, clump, def->animNames, def->numAnims); for(j = 0; j < group->numAssociations; j++) - group->GetAnimation(def->animDescs[j].animId)->flags |= def->animDescs[j].flags; + group->GetAnimation(j)->flags |= def->animDescs[j].flags; RpClumpDestroy(clump); } } diff --git a/src/control/PhoneInfo.cpp b/src/control/Phones.cpp index dbb7acc5..fa4f83e5 100644 --- a/src/control/PhoneInfo.cpp +++ b/src/control/Phones.cpp @@ -1,6 +1,6 @@ #include "common.h" #include "patcher.h" -#include "PhoneInfo.h" +#include "Phones.h" WRAPPER void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F570); } -WRAPPER void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F470); }
\ No newline at end of file +WRAPPER void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x42F470); } diff --git a/src/control/PhoneInfo.h b/src/control/Phones.h index a29043ed..a29043ed 100644 --- a/src/control/PhoneInfo.h +++ b/src/control/Phones.h diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index e166e6b5..06995663 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -16,7 +16,7 @@ #include "ModelInfo.h" #include "Object.h" #include "Pad.h" -#include "PhoneInfo.h" +#include "Phones.h" #include "Pickups.h" #include "Plane.h" #include "Pools.h" @@ -638,7 +638,7 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) if (vehicle->IsCar()){ CAutomobile* car = (CAutomobile*)vehicle; for (int i = 0; i < 4; i++){ - vp->wheel_susp_dist[i] = 50.0f * car->m_aWheelDist[i]; + vp->wheel_susp_dist[i] = 50.0f * car->m_aSuspensionSpringRatio[i]; vp->wheel_rotation[i] = 128.0f / M_PI * car->m_aWheelRotation[i]; } vp->door_angles[0] = 127.0f / M_PI * car->Doors[2].m_fAngle; @@ -683,7 +683,7 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI if (vehicle->IsCar()) { CAutomobile* car = (CAutomobile*)vehicle; for (int i = 0; i < 4; i++) { - car->m_aWheelDist[i] = vp->wheel_susp_dist[i] / 50.0f; + car->m_aSuspensionSpringRatio[i] = vp->wheel_susp_dist[i] / 50.0f; car->m_aWheelRotation[i] = vp->wheel_rotation[i] * M_PI / 128.0f; } car->Doors[2].m_fAngle = car->Doors[2].m_fPreviousAngle = vp->door_angles[0] * M_PI / 127.0f; diff --git a/src/control/Replay.h b/src/control/Replay.h index e6885f59..cd8d9a45 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -262,8 +262,8 @@ public: static void StreamAllNecessaryCarsAndPeds(void); static bool ShouldStandardCameraBeProcessed(void); - inline static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; } - inline static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; } + static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; } + static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; } private: static void RecordThisFrame(void); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index e7f64541..5e7f4936 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -129,6 +129,10 @@ void CMissionCleanup::Process() } } +/* NB: CUpsideDownCarCheck is not used by actual script at all + * It has a weird usage: AreAnyCarsUpsideDown would fail any mission + * just like death or arrest. */ + void CUpsideDownCarCheck::Init() { for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ @@ -137,16 +141,140 @@ void CUpsideDownCarCheck::Init() } } +bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id) +{ + CVehicle* v = CPools::GetVehiclePool()->GetAt(id); + return v->GetUp().z <= -0.97f && + v->GetMoveSpeed().Magnitude() < 0.01f && + v->GetTurnSpeed().Magnitude() < 0.02f; +} + +void CUpsideDownCarCheck::UpdateTimers() +{ + uint32 timeStep = CTimer::GetTimeStepInMilliseconds(); + for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ + CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex); + if (v){ + if (IsCarUpsideDown(m_sCars[i].m_nVehicleIndex)) + m_sCars[i].m_nUpsideDownTimer += timeStep; + else + m_sCars[i].m_nUpsideDownTimer = 0; + }else{ + m_sCars[i].m_nVehicleIndex = -1; + m_sCars[i].m_nUpsideDownTimer = 0; + } + } +} + +bool CUpsideDownCarCheck::AreAnyCarsUpsideDown() +{ + for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ + if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > 1000) + return true; + } + return false; +} + +void CUpsideDownCarCheck::AddCarToCheck(int32 id) +{ + uint16 index = 0; + while (index < MAX_UPSIDEDOWN_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0) + index++; + if (index >= MAX_UPSIDEDOWN_CAR_CHECKS) + return; + m_sCars[index].m_nVehicleIndex = id; + m_sCars[index].m_nUpsideDownTimer = 0; +} + +void CUpsideDownCarCheck::RemoveCarFromCheck(int32 id) +{ + for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ + if (m_sCars[i].m_nVehicleIndex == id){ + m_sCars[i].m_nVehicleIndex = -1; + m_sCars[i].m_nUpsideDownTimer = 0; + } + } +} + +bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id) +{ + for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){ + if (m_sCars[i].m_nVehicleIndex == id) + return m_sCars[i].m_nUpsideDownTimer > 1000; + } + return false; +} + +void CStuckCarCheckEntry::Reset() +{ + m_nVehicleIndex = -1; + m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f); + m_nLastCheck = -1; + m_fRadius = 0.0f; + m_nStuckTime = 0; + m_bStuck = false; +} + void CStuckCarCheck::Init() { for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++) { - m_sCars[i].m_nVehicleIndex = -1; - m_sCars[i].m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f); - m_sCars[i].m_nStartTime = -1; - m_sCars[i].m_fDistance = 0.0f; - m_sCars[i].m_nStuckTime = 0; - m_sCars[i].m_bStuck = false; + m_sCars[i].Reset(); + } +} + +void CStuckCarCheck::Process() +{ + uint32 timer = CTimer::GetTimeInMilliseconds(); + for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++){ + if (m_sCars[i].m_nVehicleIndex < 0) + continue; + if (timer <= m_sCars[i].m_nStuckTime + m_sCars[i].m_nLastCheck) + continue; + CVehicle* pv = CPools::GetVehiclePool()->GetAt(m_sCars[i].m_nVehicleIndex); + if (!pv){ + m_sCars[i].Reset(); + continue; + } + float distance = (pv->GetPosition() - m_sCars[i].m_vecPos).Magnitude(); + m_sCars[i].m_bStuck = distance < m_sCars[i].m_fRadius; + m_sCars[i].m_vecPos = pv->GetPosition(); + m_sCars[i].m_nLastCheck = timer; + } +} + +void CStuckCarCheck::AddCarToCheck(int32 id, float radius, uint32 time) +{ + CVehicle* pv = CPools::GetVehiclePool()->GetAt(id); + if (!pv) + return; + int index = 0; + while (index < MAX_STUCK_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0) + index++; + /* Would be nice to return if index >= MAX_STUCK_CAR_CHECKS... */ + m_sCars[index].m_nVehicleIndex = id; + m_sCars[index].m_vecPos = pv->GetPosition(); + m_sCars[index].m_nLastCheck = CTimer::GetTimeInMilliseconds(); + m_sCars[index].m_fRadius = radius; + m_sCars[index].m_nStuckTime = time; + m_sCars[index].m_bStuck = false; +} + +void CStuckCarCheck::RemoveCarFromCheck(int32 id) +{ + for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++){ + if (m_sCars[i].m_nVehicleIndex == id){ + m_sCars[i].Reset(); + } + } +} + +bool CStuckCarCheck::HasCarBeenStuckForAWhile(int32 id) +{ + for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++){ + if (m_sCars[i].m_nVehicleIndex == id) + return m_sCars[i].m_bStuck; } + return false; } WRAPPER void CTheScripts::CleanUpThisVehicle(CVehicle*) { EAXJMP(0x4548D0); } @@ -160,4 +288,15 @@ InjectHook(0x437AE0, &CMissionCleanup::Init, PATCH_JUMP); InjectHook(0x437BA0, &CMissionCleanup::AddEntityToList, PATCH_JUMP); InjectHook(0x437BD0, &CMissionCleanup::RemoveEntityFromList, PATCH_JUMP); InjectHook(0x437C10, &CMissionCleanup::Process, PATCH_JUMP); +InjectHook(0x437DC0, &CUpsideDownCarCheck::Init, PATCH_JUMP); +InjectHook(0x437EE0, &CUpsideDownCarCheck::UpdateTimers, PATCH_JUMP); +InjectHook(0x437F80, &CUpsideDownCarCheck::AreAnyCarsUpsideDown, PATCH_JUMP); +InjectHook(0x437FB0, &CUpsideDownCarCheck::AddCarToCheck, PATCH_JUMP); +InjectHook(0x437FE0, &CUpsideDownCarCheck::RemoveCarFromCheck, PATCH_JUMP); +InjectHook(0x438010, &CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile, PATCH_JUMP); +InjectHook(0x438050, &CStuckCarCheck::Init, PATCH_JUMP); +InjectHook(0x4380A0, &CStuckCarCheck::Process, PATCH_JUMP); +InjectHook(0x4381C0, &CStuckCarCheck::AddCarToCheck, PATCH_JUMP); +InjectHook(0x438240, &CStuckCarCheck::RemoveCarFromCheck, PATCH_JUMP); +InjectHook(0x4382A0, &CStuckCarCheck::HasCarBeenStuckForAWhile, PATCH_JUMP); ENDPATCHES
\ No newline at end of file diff --git a/src/control/Script.h b/src/control/Script.h index 7b62a1b0..42e41c70 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -101,16 +101,24 @@ class CUpsideDownCarCheck public: void Init(); + bool IsCarUpsideDown(int32); + void UpdateTimers(); + bool AreAnyCarsUpsideDown(); + void AddCarToCheck(int32); + void RemoveCarFromCheck(int32); + bool HasCarBeenUpsideDownForAWhile(int32); }; struct CStuckCarCheckEntry { int32 m_nVehicleIndex; CVector m_vecPos; - int32 m_nStartTime; - float m_fDistance; + int32 m_nLastCheck; + float m_fRadius; uint32 m_nStuckTime; bool m_bStuck; + + inline void Reset(); }; class CStuckCarCheck @@ -119,6 +127,10 @@ class CStuckCarCheck public: void Init(); + void Process(); + void AddCarToCheck(int32, float, uint32); + void RemoveCarFromCheck(int32); + bool HasCarBeenStuckForAWhile(int32); }; class CTheScripts diff --git a/src/Camera.cpp b/src/core/Camera.cpp index 735ff4a2..58e65d24 100644 --- a/src/Camera.cpp +++ b/src/core/Camera.cpp @@ -8,7 +8,7 @@ #include "PlayerPed.h" #include "Pad.h" #include "General.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "SurfaceTable.h" #include "MBlur.h" #include "Camera.h" diff --git a/src/Camera.h b/src/core/Camera.h index db5fff46..db5fff46 100644 --- a/src/Camera.h +++ b/src/core/Camera.h diff --git a/src/CdStream.cpp b/src/core/CdStream.cpp index 255e46bb..255e46bb 100644 --- a/src/CdStream.cpp +++ b/src/core/CdStream.cpp diff --git a/src/CdStream.h b/src/core/CdStream.h index 55507aa8..55507aa8 100644 --- a/src/CdStream.h +++ b/src/core/CdStream.h diff --git a/src/Clock.cpp b/src/core/Clock.cpp index 707b0e57..707b0e57 100644 --- a/src/Clock.cpp +++ b/src/core/Clock.cpp diff --git a/src/Clock.h b/src/core/Clock.h index e11b2293..e11b2293 100644 --- a/src/Clock.h +++ b/src/core/Clock.h diff --git a/src/Collision.cpp b/src/core/Collision.cpp index 62b27eff..d15ccca5 100644 --- a/src/Collision.cpp +++ b/src/core/Collision.cpp @@ -5,7 +5,7 @@ #include "Game.h" #include "Zones.h" #include "General.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "World.h" #include "Entity.h" #include "Train.h" diff --git a/src/Collision.h b/src/core/Collision.h index 5a9058d3..5a9058d3 100644 --- a/src/Collision.h +++ b/src/core/Collision.h diff --git a/src/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index d7567ac4..d7567ac4 100644 --- a/src/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp diff --git a/src/ControllerConfig.h b/src/core/ControllerConfig.h index 581efe05..581efe05 100644 --- a/src/ControllerConfig.h +++ b/src/core/ControllerConfig.h diff --git a/src/CutsceneMgr.cpp b/src/core/CutsceneMgr.cpp index 744ef53d..744ef53d 100644 --- a/src/CutsceneMgr.cpp +++ b/src/core/CutsceneMgr.cpp diff --git a/src/CutsceneMgr.h b/src/core/CutsceneMgr.h index 89f6ab8d..89f6ab8d 100644 --- a/src/CutsceneMgr.h +++ b/src/core/CutsceneMgr.h diff --git a/src/Directory.cpp b/src/core/Directory.cpp index 3e0d5382..3e0d5382 100644 --- a/src/Directory.cpp +++ b/src/core/Directory.cpp diff --git a/src/Directory.h b/src/core/Directory.h index 06e6bba4..06e6bba4 100644 --- a/src/Directory.h +++ b/src/core/Directory.h diff --git a/src/FileLoader.cpp b/src/core/FileLoader.cpp index d87964ac..fdc3b9d7 100644 --- a/src/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -21,7 +21,7 @@ #include "DummyObject.h" #include "World.h" #include "Zones.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "CdStream.h" #include "FileLoader.h" diff --git a/src/FileLoader.h b/src/core/FileLoader.h index f9121ace..f9121ace 100644 --- a/src/FileLoader.h +++ b/src/core/FileLoader.h diff --git a/src/FileMgr.cpp b/src/core/FileMgr.cpp index 954fcdef..954fcdef 100644 --- a/src/FileMgr.cpp +++ b/src/core/FileMgr.cpp diff --git a/src/FileMgr.h b/src/core/FileMgr.h index bab86e38..bab86e38 100644 --- a/src/FileMgr.h +++ b/src/core/FileMgr.h diff --git a/src/Fire.cpp b/src/core/Fire.cpp index 05d72199..05d72199 100644 --- a/src/Fire.cpp +++ b/src/core/Fire.cpp diff --git a/src/Fire.h b/src/core/Fire.h index c7f83fd8..c7f83fd8 100644 --- a/src/Fire.h +++ b/src/core/Fire.h diff --git a/src/Frontend.cpp b/src/core/Frontend.cpp index fdb2420b..fdb2420b 100644 --- a/src/Frontend.cpp +++ b/src/core/Frontend.cpp diff --git a/src/Frontend.h b/src/core/Frontend.h index 9b9377da..9b9377da 100644 --- a/src/Frontend.h +++ b/src/core/Frontend.h diff --git a/src/Game.cpp b/src/core/Game.cpp index cbd55c48..cbd55c48 100644 --- a/src/Game.cpp +++ b/src/core/Game.cpp diff --git a/src/Game.h b/src/core/Game.h index 3bc3e633..3bc3e633 100644 --- a/src/Game.h +++ b/src/core/Game.h diff --git a/src/General.h b/src/core/General.h index cae1caa0..cae1caa0 100644 --- a/src/General.h +++ b/src/core/General.h diff --git a/src/Lists.cpp b/src/core/Lists.cpp index 448a0ff1..448a0ff1 100644 --- a/src/Lists.cpp +++ b/src/core/Lists.cpp diff --git a/src/Lists.h b/src/core/Lists.h index 7572e882..7572e882 100644 --- a/src/Lists.h +++ b/src/core/Lists.h diff --git a/src/MenuScreens.h b/src/core/MenuScreens.h index 2da81f1d..2da81f1d 100644 --- a/src/MenuScreens.h +++ b/src/core/MenuScreens.h diff --git a/src/Messages.cpp b/src/core/Messages.cpp index 7fc23593..7fc23593 100644 --- a/src/Messages.cpp +++ b/src/core/Messages.cpp diff --git a/src/Messages.h b/src/core/Messages.h index 69cf117c..69cf117c 100644 --- a/src/Messages.h +++ b/src/core/Messages.h diff --git a/src/NodeName.cpp b/src/core/NodeName.cpp index 2aea3c83..2aea3c83 100644 --- a/src/NodeName.cpp +++ b/src/core/NodeName.cpp diff --git a/src/NodeName.h b/src/core/NodeName.h index 1a3e057b..1a3e057b 100644 --- a/src/NodeName.h +++ b/src/core/NodeName.h diff --git a/src/PCSave.cpp b/src/core/PCSave.cpp index 628e1218..628e1218 100644 --- a/src/PCSave.cpp +++ b/src/core/PCSave.cpp diff --git a/src/PCSave.h b/src/core/PCSave.h index 696e158a..696e158a 100644 --- a/src/PCSave.h +++ b/src/core/PCSave.h diff --git a/src/Pad.cpp b/src/core/Pad.cpp index 002e7180..002e7180 100644 --- a/src/Pad.cpp +++ b/src/core/Pad.cpp diff --git a/src/Pad.h b/src/core/Pad.h index e06aa9a6..30cdb8df 100644 --- a/src/Pad.h +++ b/src/core/Pad.h @@ -288,80 +288,80 @@ public: static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize); // mouse - inline bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } + bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } // keyboard - inline bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } - inline bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } - inline bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } - inline bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } - inline bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); } - inline bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); } - inline bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); } - inline bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); } - inline bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); } - inline bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); } - inline bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); } - inline bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); } - inline bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); } - inline bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); } - inline bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); } - inline bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); } - inline bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); } - inline bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); } - inline bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); } - inline bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); } - inline bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown - inline bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); } - inline bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); } - inline bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); } - inline bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); } - inline bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); } - inline bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); } - inline bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); } - inline bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); } - inline bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); } - inline bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); } - inline bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); } - inline bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); } - inline bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); } - inline bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); } - inline bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); } - inline bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); } - inline bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); } - inline bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); } - inline bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); } - inline bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); } - inline bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); } - inline bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); } - inline bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); } - inline bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); } - inline bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); } + bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } + bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } + bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } + bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } + bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); } + bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); } + bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); } + bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); } + bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); } + bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); } + bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); } + bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); } + bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); } + bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); } + bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); } + bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); } + bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); } + bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); } + bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); } + bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); } + bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown + bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); } + bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); } + bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); } + bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); } + bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); } + bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); } + bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); } + bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); } + bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); } + bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); } + bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); } + bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); } + bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); } + bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); } + bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); } + bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); } + bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); } + bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); } + bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); } + bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); } + bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); } + bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); } + bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); } + bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); } + bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); } // pad - inline bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); } - inline bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); } - inline bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); } - inline bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); } - inline bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); } - inline bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); } - inline bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); } - inline bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); } - inline bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); } - inline bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } - inline bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } - inline bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } + bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); } + bool GetCircleJustDown() { return !!(NewState.Circle && !OldState.Circle); } + bool GetCrossJustDown() { return !!(NewState.Cross && !OldState.Cross); } + bool GetSquareJustDown() { return !!(NewState.Square && !OldState.Square); } + bool GetDPadUpJustDown() { return !!(NewState.DPadUp && !OldState.DPadUp); } + bool GetDPadDownJustDown() { return !!(NewState.DPadDown && !OldState.DPadDown); } + bool GetDPadLeftJustDown() { return !!(NewState.DPadLeft && !OldState.DPadLeft); } + bool GetDPadRightJustDown() { return !!(NewState.DPadRight && !OldState.DPadRight); } + bool GetLeftShoulder1JustDown() { return !!(NewState.LeftShoulder1 && !OldState.LeftShoulder1); } + bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } + bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } + bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } - inline int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; } - inline int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; } - inline int32 GetRightShoulder1(void) { return NewState.RightShoulder1; } - inline int32 GetRightShoulder2(void) { return NewState.RightShoulder2; } + int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; } + int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; } + int32 GetRightShoulder1(void) { return NewState.RightShoulder1; } + int32 GetRightShoulder2(void) { return NewState.RightShoulder2; } }; VALIDATE_SIZE(CPad, 0xFC); #define IsButtonJustDown(pad, btn) \ (!(pad)->OldState.btn && (pad)->NewState.btn) -void LittleTest(void);
\ No newline at end of file +void LittleTest(void); diff --git a/src/Placeable.cpp b/src/core/Placeable.cpp index b4b2a37b..b4b2a37b 100644 --- a/src/Placeable.cpp +++ b/src/core/Placeable.cpp diff --git a/src/Placeable.h b/src/core/Placeable.h index 868ca9e7..868ca9e7 100644 --- a/src/Placeable.h +++ b/src/core/Placeable.h diff --git a/src/entities/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 59efe2ae..59efe2ae 100644 --- a/src/entities/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp diff --git a/src/entities/PlayerInfo.h b/src/core/PlayerInfo.h index e2b42fe7..e2b42fe7 100644 --- a/src/entities/PlayerInfo.h +++ b/src/core/PlayerInfo.h diff --git a/src/entities/PlayerSkin.cpp b/src/core/PlayerSkin.cpp index 1c9ca2c6..1c9ca2c6 100644 --- a/src/entities/PlayerSkin.cpp +++ b/src/core/PlayerSkin.cpp diff --git a/src/entities/PlayerSkin.h b/src/core/PlayerSkin.h index 61e09cdf..61e09cdf 100644 --- a/src/entities/PlayerSkin.h +++ b/src/core/PlayerSkin.h diff --git a/src/Pools.cpp b/src/core/Pools.cpp index f7f93292..f7f93292 100644 --- a/src/Pools.cpp +++ b/src/core/Pools.cpp diff --git a/src/Pools.h b/src/core/Pools.h index 3496064c..3496064c 100644 --- a/src/Pools.h +++ b/src/core/Pools.h diff --git a/src/Radar.cpp b/src/core/Radar.cpp index a071b96b..a071b96b 100644 --- a/src/Radar.cpp +++ b/src/core/Radar.cpp diff --git a/src/Radar.h b/src/core/Radar.h index e5396a50..e5396a50 100644 --- a/src/Radar.h +++ b/src/core/Radar.h diff --git a/src/References.cpp b/src/core/References.cpp index e87f0fd5..e87f0fd5 100644 --- a/src/References.cpp +++ b/src/core/References.cpp diff --git a/src/References.h b/src/core/References.h index 6476e243..6476e243 100644 --- a/src/References.h +++ b/src/core/References.h diff --git a/src/RwClumpRead.cpp b/src/core/RwClumpRead.cpp index c9f027e7..c9f027e7 100644 --- a/src/RwClumpRead.cpp +++ b/src/core/RwClumpRead.cpp diff --git a/src/RwHelper.cpp b/src/core/RwHelper.cpp index 8dade266..8dade266 100644 --- a/src/RwHelper.cpp +++ b/src/core/RwHelper.cpp diff --git a/src/RwHelper.h b/src/core/RwHelper.h index ef20467d..ef20467d 100644 --- a/src/RwHelper.h +++ b/src/core/RwHelper.h diff --git a/src/RwMatFX.cpp b/src/core/RwMatFX.cpp index 5fd00c54..5fd00c54 100644 --- a/src/RwMatFX.cpp +++ b/src/core/RwMatFX.cpp diff --git a/src/RwTexRead.cpp b/src/core/RwTexRead.cpp index a1a7050a..a1a7050a 100644 --- a/src/RwTexRead.cpp +++ b/src/core/RwTexRead.cpp diff --git a/src/Stats.cpp b/src/core/Stats.cpp index 921586bb..921586bb 100644 --- a/src/Stats.cpp +++ b/src/core/Stats.cpp diff --git a/src/Stats.h b/src/core/Stats.h index a5670020..a5670020 100644 --- a/src/Stats.h +++ b/src/core/Stats.h diff --git a/src/Streaming.cpp b/src/core/Streaming.cpp index 08fd80f0..f8ab19d4 100644 --- a/src/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -16,7 +16,7 @@ #include "FileMgr.h" #include "FileLoader.h" #include "Zones.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "Radar.h" #include "Camera.h" #include "Record.h" diff --git a/src/Streaming.h b/src/core/Streaming.h index 212a6d71..212a6d71 100644 --- a/src/Streaming.h +++ b/src/core/Streaming.h diff --git a/src/SurfaceTable.cpp b/src/core/SurfaceTable.cpp index 2ba884b1..2ba884b1 100644 --- a/src/SurfaceTable.cpp +++ b/src/core/SurfaceTable.cpp diff --git a/src/SurfaceTable.h b/src/core/SurfaceTable.h index e1882e69..e1882e69 100644 --- a/src/SurfaceTable.h +++ b/src/core/SurfaceTable.h diff --git a/src/TempColModels.cpp b/src/core/TempColModels.cpp index a323d7c9..a323d7c9 100644 --- a/src/TempColModels.cpp +++ b/src/core/TempColModels.cpp diff --git a/src/TempColModels.h b/src/core/TempColModels.h index 8ac74428..8ac74428 100644 --- a/src/TempColModels.h +++ b/src/core/TempColModels.h diff --git a/src/Text.cpp b/src/core/Text.cpp index d7d63467..d7d63467 100644 --- a/src/Text.cpp +++ b/src/core/Text.cpp diff --git a/src/Text.h b/src/core/Text.h index 2592e6b8..2592e6b8 100644 --- a/src/Text.h +++ b/src/core/Text.h diff --git a/src/Timer.cpp b/src/core/Timer.cpp index 543f582b..543f582b 100644 --- a/src/Timer.cpp +++ b/src/core/Timer.cpp diff --git a/src/Timer.h b/src/core/Timer.h index 75d4048c..9e6d447e 100644 --- a/src/Timer.h +++ b/src/core/Timer.h @@ -14,21 +14,24 @@ class CTimer static bool &m_CodePause; public: static float GetTimeStep(void) { return ms_fTimeStep; } - static inline void SetTimeStep(float ts) { ms_fTimeStep = ts; } + static void SetTimeStep(float ts) { ms_fTimeStep = ts; } + static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; } + static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; } static float GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; } - static inline void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; } + static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; } + static void SetTimeStepNonClipped(float ts) { ms_fTimeStepNonClipped = ts; } static uint32 GetFrameCounter(void) { return m_FrameCounter; } - static inline void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; } + static void SetFrameCounter(uint32 fc) { m_FrameCounter = fc; } static uint32 GetTimeInMilliseconds(void) { return m_snTimeInMilliseconds; } - static inline void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; } + static void SetTimeInMilliseconds(uint32 t) { m_snTimeInMilliseconds = t; } static uint32 GetTimeInMillisecondsNonClipped(void) { return m_snTimeInMillisecondsNonClipped; } - static inline void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; } + static void SetTimeInMillisecondsNonClipped(uint32 t) { m_snTimeInMillisecondsNonClipped = t; } static uint32 GetTimeInMillisecondsPauseMode(void) { return m_snTimeInMillisecondsPauseMode; } - static inline void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; } + static void SetTimeInMillisecondsPauseMode(uint32 t) { m_snTimeInMillisecondsPauseMode = t; } static uint32 GetPreviousTimeInMilliseconds(void) { return m_snPreviousTimeInMilliseconds; } - static inline void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; } + static void SetPreviousTimeInMilliseconds(uint32 t) { m_snPreviousTimeInMilliseconds = t; } static float GetTimeScale(void) { return ms_fTimeScale; } - static inline void SetTimeScale(float ts) { ms_fTimeScale = ts; } + static void SetTimeScale(float ts) { ms_fTimeScale = ts; } static bool GetIsPaused() { return m_UserPause || m_CodePause; } static bool GetIsUserPaused() { return m_UserPause; } diff --git a/src/TxdStore.cpp b/src/core/TxdStore.cpp index 5085c7e4..5085c7e4 100644 --- a/src/TxdStore.cpp +++ b/src/core/TxdStore.cpp diff --git a/src/TxdStore.h b/src/core/TxdStore.h index a9e57d31..a9e57d31 100644 --- a/src/TxdStore.h +++ b/src/core/TxdStore.h diff --git a/src/User.cpp b/src/core/User.cpp index c9cb97cc..c9cb97cc 100644 --- a/src/User.cpp +++ b/src/core/User.cpp diff --git a/src/User.h b/src/core/User.h index 8b744c7e..8b744c7e 100644 --- a/src/User.h +++ b/src/core/User.h diff --git a/src/Wanted.cpp b/src/core/Wanted.cpp index 21853308..21853308 100644 --- a/src/Wanted.cpp +++ b/src/core/Wanted.cpp diff --git a/src/Wanted.h b/src/core/Wanted.h index d14bb905..d14bb905 100644 --- a/src/Wanted.h +++ b/src/core/Wanted.h diff --git a/src/World.cpp b/src/core/World.cpp index 538e15c5..538e15c5 100644 --- a/src/World.cpp +++ b/src/core/World.cpp diff --git a/src/World.h b/src/core/World.h index 3b7090da..3b7090da 100644 --- a/src/World.h +++ b/src/core/World.h diff --git a/src/CullZones.cpp b/src/core/ZoneCull.cpp index 6155ae57..90155bcf 100644 --- a/src/CullZones.cpp +++ b/src/core/ZoneCull.cpp @@ -8,7 +8,7 @@ #include "Camera.h" #include "World.h" #include "FileMgr.h" -#include "CullZones.h" +#include "ZoneCull.h" int32 &CCullZones::NumCullZones = *(int*)0x8F2564; CCullZone *CCullZones::aZones = (CCullZone*)0x864750; // [NUMCULLZONES]; diff --git a/src/CullZones.h b/src/core/ZoneCull.h index 5b04b4f9..5b04b4f9 100644 --- a/src/CullZones.h +++ b/src/core/ZoneCull.h diff --git a/src/Zones.cpp b/src/core/Zones.cpp index 363fc3d9..363fc3d9 100644 --- a/src/Zones.cpp +++ b/src/core/Zones.cpp diff --git a/src/Zones.h b/src/core/Zones.h index bf3957de..bf3957de 100644 --- a/src/Zones.h +++ b/src/core/Zones.h diff --git a/src/common.h b/src/core/common.h index 79626acb..79626acb 100644 --- a/src/common.h +++ b/src/core/common.h diff --git a/src/config.h b/src/core/config.h index 8cb02190..8cb02190 100644 --- a/src/config.h +++ b/src/core/config.h diff --git a/src/debugmenu_public.h b/src/core/debugmenu_public.h index 778e7afe..778e7afe 100644 --- a/src/debugmenu_public.h +++ b/src/core/debugmenu_public.h diff --git a/src/main.cpp b/src/core/main.cpp index 2835f396..e7f42780 100644 --- a/src/main.cpp +++ b/src/core/main.cpp @@ -40,7 +40,7 @@ #include "CutsceneMgr.h" #include "Lights.h" #include "Credits.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "Timecycle.h" #include "TxdStore.h" #include "FileMgr.h" diff --git a/src/main.h b/src/core/main.h index bdb0e008..bdb0e008 100644 --- a/src/main.h +++ b/src/core/main.h diff --git a/src/patcher.cpp b/src/core/patcher.cpp index 5fdbdf8b..5fdbdf8b 100644 --- a/src/patcher.cpp +++ b/src/core/patcher.cpp diff --git a/src/patcher.h b/src/core/patcher.h index 87a6bea4..87a6bea4 100644 --- a/src/patcher.h +++ b/src/core/patcher.h diff --git a/src/re3.cpp b/src/core/re3.cpp index 9dc39d46..9dc39d46 100644 --- a/src/re3.cpp +++ b/src/core/re3.cpp diff --git a/src/rw.cpp b/src/core/rw.cpp index 52bcf5bb..52bcf5bb 100644 --- a/src/rw.cpp +++ b/src/core/rw.cpp diff --git a/src/templates.h b/src/core/templates.h index ef2db33a..ef2db33a 100644 --- a/src/templates.h +++ b/src/core/templates.h diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 14891cd9..d6a82658 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -304,6 +304,22 @@ CPhysical::RemoveRefsToEntity(CEntity *ent) } } +void +CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos) +{ + CVector worldPos = other->GetMatrix() * localPos; + float step = 0.9f * CTimer::GetTimeStep(); + CVector pos = other->m_vecMoveSpeed*step + worldPos; + + CWorld::Remove(phys); + phys->GetMatrix() = other->GetMatrix(); + phys->GetPosition() = pos; + phys->m_vecMoveSpeed = other->m_vecMoveSpeed; + phys->GetMatrix().UpdateRW(); + phys->UpdateRwFrame(); + CWorld::Add(phys); +} + int32 CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) { @@ -346,7 +362,7 @@ CPhysical::ProcessControl(void) IsPed() && !bPedPhysics){ m_vecMoveSpeedAvg = (m_vecMoveSpeedAvg + m_vecMoveSpeed)/2.0f; m_vecTurnSpeedAvg = (m_vecTurnSpeedAvg + m_vecTurnSpeed)/2.0f; - float step = CTimer::GetTimeStep() * 0.003; + float step = CTimer::GetTimeStep() * 0.003f; if(m_vecMoveSpeedAvg.MagnitudeSqr() < step*step && m_vecTurnSpeedAvg.MagnitudeSqr() < step*step){ m_nStaticFrames++; @@ -434,15 +450,38 @@ CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass); } -void -CPhysical::ApplySpringCollision(float f1, CVector &v, CVector &p, float f2, float f3) +bool +CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias) { - if(1.0f - f2 <= 0.0f) - return; + float compression = 1.0f - springRatio; + if(compression > 0.0f){ + float step = min(CTimer::GetTimeStep(), 3.0f); + float impulse = -0.008f*m_fMass*step * springConst * compression * bias*2.0f; + ApplyMoveForce(springDir*impulse); + ApplyTurnForce(springDir*impulse, point); + } + return true; +} + +// What exactly is speed? +bool +CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed) +{ + float speedA = DotProduct(speed, springDir); + float speedB = DotProduct(GetSpeed(point), springDir); float step = min(CTimer::GetTimeStep(), 3.0f); - float strength = -0.008f*m_fMass*2.0f*step * f1 * (1.0f-f2) * f3; - ApplyMoveForce(v*strength); - ApplyTurnForce(v*strength, p); + float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f; + + // what is this? + float a = m_fTurnMass / ((point.MagnitudeSqr() + 1.0f) * 2.0f * m_fMass); + a = min(a, 1.0f); + float b = fabs(impulse / (speedB * m_fMass)); + if(a < b) + impulse *= a/b; + + ApplyMoveForce(springDir*impulse); + ApplyTurnForce(springDir*impulse, point); + return true; } void @@ -1858,10 +1897,10 @@ CPhysical::ProcessCollision(void) CVehicle *veh = (CVehicle*)this; if(veh->m_vehType == VEHICLE_TYPE_CAR){ CAutomobile *car = (CAutomobile*)this; - car->m_aWheelDist[0] = 1.0f; - car->m_aWheelDist[1] = 1.0f; - car->m_aWheelDist[2] = 1.0f; - car->m_aWheelDist[3] = 1.0f; + car->m_aSuspensionSpringRatio[0] = 1.0f; + car->m_aSuspensionSpringRatio[1] = 1.0f; + car->m_aSuspensionSpringRatio[2] = 1.0f; + car->m_aSuspensionSpringRatio[3] = 1.0f; }else if(veh->m_vehType == VEHICLE_TYPE_BIKE){ assert(0 && "TODO - but unused"); } @@ -1909,6 +1948,7 @@ STARTPATCHES InjectHook(0x4970C0, &CPhysical::AddCollisionRecord_Treadable, PATCH_JUMP); InjectHook(0x497240, &CPhysical::GetHasCollidedWith, PATCH_JUMP); InjectHook(0x49F820, &CPhysical::RemoveRefsToEntity, PATCH_JUMP); + InjectHook(0x49F890, &CPhysical::PlacePhysicalRelativeToOtherPhysical, PATCH_JUMP); #define F3 float, float, float InjectHook(0x495B10, &CPhysical::ApplyMoveSpeed, PATCH_JUMP); @@ -1918,6 +1958,7 @@ STARTPATCHES InjectHook(0x495D90, (void (CPhysical::*)(F3))&CPhysical::ApplyFrictionMoveForce, PATCH_JUMP); InjectHook(0x495E10, (void (CPhysical::*)(F3, F3))&CPhysical::ApplyFrictionTurnForce, PATCH_JUMP); InjectHook(0x499890, &CPhysical::ApplySpringCollision, PATCH_JUMP); + InjectHook(0x499990, &CPhysical::ApplySpringDampening, PATCH_JUMP); InjectHook(0x495B50, &CPhysical::ApplyGravity, PATCH_JUMP); InjectHook(0x495B80, (void (CPhysical::*)(void))&CPhysical::ApplyFriction, PATCH_JUMP); InjectHook(0x495C20, &CPhysical::ApplyAirResistance, PATCH_JUMP); diff --git a/src/entities/Physical.h b/src/entities/Physical.h index 0f517cf3..81d3d649 100644 --- a/src/entities/Physical.h +++ b/src/entities/Physical.h @@ -81,6 +81,7 @@ public: void AddCollisionRecord_Treadable(CEntity *ent); bool GetHasCollidedWith(CEntity *ent); void RemoveRefsToEntity(CEntity *ent); + static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos); float GetDistanceSq(void) { return m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); } // get speed of point p relative to entity center @@ -104,6 +105,9 @@ public: bIsInSafePosition = false; } + const CVector &GetMoveSpeed() { return m_vecMoveSpeed; } + const CVector &GetTurnSpeed() { return m_vecTurnSpeed; } + void ApplyMoveSpeed(void); void ApplyTurnSpeed(void); // Force actually means Impulse here @@ -117,7 +121,9 @@ public: void ApplyFrictionMoveForce(const CVector &j) { ApplyFrictionMoveForce(j.x, j.y, j.z); } void ApplyFrictionTurnForce(float jx, float jy, float jz, float rx, float ry, float rz); void ApplyFrictionTurnForce(const CVector &j, const CVector &p) { ApplyFrictionTurnForce(j.x, j.y, j.z, p.x, p.y, p.z); } - void ApplySpringCollision(float f1, CVector &v, CVector &p, float f2, float f3); + // springRatio: 1.0 fully extended, 0.0 fully compressed + bool ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias); + bool ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed); void ApplyGravity(void); void ApplyFriction(void); void ApplyAirResistance(void); diff --git a/src/math/Vector.h b/src/math/Vector.h index 2c431d0d..b49f00f2 100644 --- a/src/math/Vector.h +++ b/src/math/Vector.h @@ -38,35 +38,35 @@ public: x = 1.0f; } - inline const CVector &operator+=(CVector const &right) { + const CVector &operator+=(CVector const &right) { x += right.x; y += right.y; z += right.z; return *this; } - inline const CVector &operator-=(CVector const &right) { + const CVector &operator-=(CVector const &right) { x -= right.x; y -= right.y; z -= right.z; return *this; } - inline const CVector &operator*=(float right) { + const CVector &operator*=(float right) { x *= right; y *= right; z *= right; return *this; } - inline const CVector &operator/=(float right) { + const CVector &operator/=(float right) { x /= right; y /= right; z /= right; return *this; } - inline CVector operator-() const { + CVector operator-() const { return CVector(-x, -y, -z); } diff --git a/src/MloInstance.cpp b/src/modelinfo/MloInstance.cpp index dbd83727..dbd83727 100644 --- a/src/MloInstance.cpp +++ b/src/modelinfo/MloInstance.cpp diff --git a/src/MloInstance.h b/src/modelinfo/MloInstance.h index 00afc379..00afc379 100644 --- a/src/MloInstance.h +++ b/src/modelinfo/MloInstance.h diff --git a/src/entities/CutsceneHead.cpp b/src/objects/CutsceneHead.cpp index a9c47777..a9c47777 100644 --- a/src/entities/CutsceneHead.cpp +++ b/src/objects/CutsceneHead.cpp diff --git a/src/entities/CutsceneHead.h b/src/objects/CutsceneHead.h index de4f011f..de4f011f 100644 --- a/src/entities/CutsceneHead.h +++ b/src/objects/CutsceneHead.h diff --git a/src/entities/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp index ede5be5b..ede5be5b 100644 --- a/src/entities/CutsceneObject.cpp +++ b/src/objects/CutsceneObject.cpp diff --git a/src/entities/CutsceneObject.h b/src/objects/CutsceneObject.h index 9360651e..9360651e 100644 --- a/src/entities/CutsceneObject.h +++ b/src/objects/CutsceneObject.h diff --git a/src/entities/DummyObject.cpp b/src/objects/DummyObject.cpp index 1e4b2ae0..1e4b2ae0 100644 --- a/src/entities/DummyObject.cpp +++ b/src/objects/DummyObject.cpp diff --git a/src/entities/DummyObject.h b/src/objects/DummyObject.h index 10554bdd..10554bdd 100644 --- a/src/entities/DummyObject.h +++ b/src/objects/DummyObject.h diff --git a/src/entities/Object.cpp b/src/objects/Object.cpp index 6712d77b..6712d77b 100644 --- a/src/entities/Object.cpp +++ b/src/objects/Object.cpp diff --git a/src/entities/Object.h b/src/objects/Object.h index de4c8e05..de4c8e05 100644 --- a/src/entities/Object.h +++ b/src/objects/Object.h diff --git a/src/control/ObjectData.cpp b/src/objects/ObjectData.cpp index ef5bcc5e..ef5bcc5e 100644 --- a/src/control/ObjectData.cpp +++ b/src/objects/ObjectData.cpp diff --git a/src/control/ObjectData.h b/src/objects/ObjectData.h index e3a5c1bd..e3a5c1bd 100644 --- a/src/control/ObjectData.h +++ b/src/objects/ObjectData.h diff --git a/src/ParticleObject.cpp b/src/objects/ParticleObject.cpp index cf6e84bf..cf6e84bf 100644 --- a/src/ParticleObject.cpp +++ b/src/objects/ParticleObject.cpp diff --git a/src/ParticleObject.h b/src/objects/ParticleObject.h index def7b7de..def7b7de 100644 --- a/src/ParticleObject.h +++ b/src/objects/ParticleObject.h diff --git a/src/entities/Projectile.cpp b/src/objects/Projectile.cpp index e21323de..e21323de 100644 --- a/src/entities/Projectile.cpp +++ b/src/objects/Projectile.cpp diff --git a/src/entities/Projectile.h b/src/objects/Projectile.h index a8e826b6..a8e826b6 100644 --- a/src/entities/Projectile.h +++ b/src/objects/Projectile.h diff --git a/src/entities/CivilianPed.cpp b/src/peds/CivilianPed.cpp index a4881e71..a4881e71 100644 --- a/src/entities/CivilianPed.cpp +++ b/src/peds/CivilianPed.cpp diff --git a/src/entities/CivilianPed.h b/src/peds/CivilianPed.h index 8d004ad7..8d004ad7 100644 --- a/src/entities/CivilianPed.h +++ b/src/peds/CivilianPed.h diff --git a/src/entities/CopPed.cpp b/src/peds/CopPed.cpp index 041185ee..041185ee 100644 --- a/src/entities/CopPed.cpp +++ b/src/peds/CopPed.cpp diff --git a/src/entities/CopPed.h b/src/peds/CopPed.h index b938dfc2..b938dfc2 100644 --- a/src/entities/CopPed.h +++ b/src/peds/CopPed.h diff --git a/src/entities/DummyPed.h b/src/peds/DummyPed.h index af633dc4..af633dc4 100644 --- a/src/entities/DummyPed.h +++ b/src/peds/DummyPed.h diff --git a/src/entities/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp index 7b847896..7b847896 100644 --- a/src/entities/EmergencyPed.cpp +++ b/src/peds/EmergencyPed.cpp diff --git a/src/entities/EmergencyPed.h b/src/peds/EmergencyPed.h index fa07f3ee..fa07f3ee 100644 --- a/src/entities/EmergencyPed.h +++ b/src/peds/EmergencyPed.h diff --git a/src/entities/Ped.cpp b/src/peds/Ped.cpp index 2cc8e4c4..e4cc848e 100644 --- a/src/entities/Ped.cpp +++ b/src/peds/Ped.cpp @@ -17,7 +17,7 @@ #include "PedPlacement.h" #include "Shadows.h" #include "Weather.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "Population.h" #include "Renderer.h" #include "Lights.h" @@ -559,11 +559,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround) if (currentPedState == PED_DEAD) { foundDead = 1; if (!deadPed) - deadPed = (CPed*)currentPed; + deadPed = currentPed; } else if (!currentPed->IsPedHeadAbovePos(-0.6f)) { foundOnTheFloor = 1; if (!pedOnTheFloor) - pedOnTheFloor = (CPed*)currentPed; + pedOnTheFloor = currentPed; } } } else if ((distance >= 0.8f || angleDiff >= DEGTORAD(75.0f)) @@ -574,11 +574,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround) if (angleDiff < DEGTORAD(75.0f)) { foundBelow = 1; if (!pedBelow) - pedBelow = (CPed*)currentPed; + pedBelow = currentPed; } } else { foundBelow = 1; - pedBelow = (CPed*)currentPed; + pedBelow = currentPed; break; } } @@ -599,7 +599,7 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround) } if (pedOnGround) - * pedOnGround = (CPed*)currentPed; + * pedOnGround = currentPed; return stateToReturn; } @@ -1371,7 +1371,7 @@ CPed::RestartNonPartialAnims(void) { CAnimBlendAssociation *assoc; - for (assoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)m_rwObject); !assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) { + for (assoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)m_rwObject); assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) { if (!assoc->IsPartial()) assoc->flags |= ASSOC_RUNNING; } @@ -1681,7 +1681,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) float pedZSpeedOnExit = m_vecMoveSpeed.z - 0.008f * CTimer::GetTimeStep(); // If we're not in ground at next step, apply animation - if (neededPos.z + pedZSpeedOnExit > autoZPos.z) { + if (neededPos.z + pedZSpeedOnExit >= autoZPos.z) { m_vecMoveSpeed.z = pedZSpeedOnExit; ApplyMoveSpeed(); // Removing below line breaks the animation @@ -1743,9 +1743,9 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) neededPos -= timeUntilStateChange * m_vecOffsetSeek; } - if (limitedAngle >= PI + m_fRotationCur) { + if (limitedAngle > PI + m_fRotationCur) { limitedAngle -= 2 * PI; - } else if (limitedAngle <= m_fRotationCur - PI) { + } else if (limitedAngle < m_fRotationCur - PI) { limitedAngle += 2 * PI; } m_fRotationCur -= (m_fRotationCur - limitedAngle) * (1.0f - timeUntilStateChange); @@ -2377,7 +2377,7 @@ CPed::SetLeader(CEntity *leader) m_leader = (CPed*)leader; if(m_leader) - m_leader->RegisterReference((CEntity **)m_leader); + m_leader->RegisterReference((CEntity **)&m_leader); } void @@ -2459,9 +2459,9 @@ CPed::SetObjective(eObjective newObj, void *entity) m_ped_flagD20 = false; m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); m_pedInObjective = (CPed*)entity; - m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); + m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); m_pLookTarget = (CEntity*)entity; - m_pLookTarget->RegisterReference((CEntity**)m_pLookTarget); + m_pLookTarget->RegisterReference((CEntity**)&m_pLookTarget); return; case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE: case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS: @@ -2469,17 +2469,17 @@ CPed::SetObjective(eObjective newObj, void *entity) case OBJECTIVE_FIGHT_CHAR: m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); m_pedInObjective = (CPed*)entity; - m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); + m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); return; case OBJECTIVE_FOLLOW_PED_IN_FORMATION: m_pedInObjective = (CPed*)entity; - m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); + m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); m_pedFormation = 1; return; case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_FLEE_CAR: m_carInObjective = (CVehicle*)entity; - m_carInObjective->RegisterReference((CEntity **)m_carInObjective); + m_carInObjective->RegisterReference((CEntity **)&m_carInObjective); if (!m_carInObjective->bIsBus || m_leaveCarTimer) return; break; @@ -2497,9 +2497,9 @@ CPed::SetObjective(eObjective newObj, void *entity) case OBJECTIVE_SOLICIT: case OBJECTIVE_BUY_ICE_CREAM: m_carInObjective = (CVehicle*)entity; - m_carInObjective->RegisterReference((CEntity**)m_carInObjective); + m_carInObjective->RegisterReference((CEntity**)&m_carInObjective); m_pSeekTarget = m_carInObjective; - m_pSeekTarget->RegisterReference((CEntity**)m_pSeekTarget); + m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget); m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); if (newObj == OBJECTIVE_SOLICIT) { m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000; diff --git a/src/entities/Ped.h b/src/peds/Ped.h index c6d61df4..0493eeee 100644 --- a/src/entities/Ped.h +++ b/src/peds/Ped.h @@ -524,11 +524,11 @@ public: void SetPedStats(ePedStats); bool IsGangMember(void); - inline bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; } - inline CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; } - inline CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } - inline RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } - inline static uint8 GetVehEnterExitFlag(eVehEnter vehEnter) { + bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; } + CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; } + CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } + RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } + static uint8 GetVehEnterExitFlag(eVehEnter vehEnter) { switch (vehEnter) { case VEHICLE_ENTER_FRONT_RIGHT: return 4; diff --git a/src/entities/PedIK.cpp b/src/peds/PedIK.cpp index b9baf49c..b9baf49c 100644 --- a/src/entities/PedIK.cpp +++ b/src/peds/PedIK.cpp diff --git a/src/entities/PedIK.h b/src/peds/PedIK.h index e17d52eb..e17d52eb 100644 --- a/src/entities/PedIK.h +++ b/src/peds/PedIK.h diff --git a/src/control/PedPlacement.cpp b/src/peds/PedPlacement.cpp index e9a3f7d9..e9a3f7d9 100644 --- a/src/control/PedPlacement.cpp +++ b/src/peds/PedPlacement.cpp diff --git a/src/control/PedPlacement.h b/src/peds/PedPlacement.h index 4bd48b62..4bd48b62 100644 --- a/src/control/PedPlacement.h +++ b/src/peds/PedPlacement.h diff --git a/src/control/PedStats.cpp b/src/peds/PedStats.cpp index f6508580..f6508580 100644 --- a/src/control/PedStats.cpp +++ b/src/peds/PedStats.cpp diff --git a/src/control/PedStats.h b/src/peds/PedStats.h index ce92d4da..ce92d4da 100644 --- a/src/control/PedStats.h +++ b/src/peds/PedStats.h diff --git a/src/control/PedType.cpp b/src/peds/PedType.cpp index 66eb49a1..66eb49a1 100644 --- a/src/control/PedType.cpp +++ b/src/peds/PedType.cpp diff --git a/src/control/PedType.h b/src/peds/PedType.h index 455d8d8d..455d8d8d 100644 --- a/src/control/PedType.h +++ b/src/peds/PedType.h diff --git a/src/entities/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 7eb01db0..7eb01db0 100644 --- a/src/entities/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp diff --git a/src/entities/PlayerPed.h b/src/peds/PlayerPed.h index 4f325da3..4f325da3 100644 --- a/src/entities/PlayerPed.h +++ b/src/peds/PlayerPed.h diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 081aaa64..680720e0 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -496,7 +496,7 @@ void CHud::Draw() fZoneAlpha = 255.0f; break; case 2: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_ZoneFadeTimer += CTimer::GetTimeStepInMilliseconds(); if (m_ZoneFadeTimer > 1000) { m_ZoneState = 1; m_ZoneFadeTimer = 1000; @@ -504,7 +504,7 @@ void CHud::Draw() fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; break; case 3: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_ZoneFadeTimer < 0) { m_ZoneState = 0; m_ZoneFadeTimer = 0; @@ -512,7 +512,7 @@ void CHud::Draw() fZoneAlpha = m_ZoneFadeTimer * 0.001f * 255.0f; break; case 4: - m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_ZoneFadeTimer < 0) { m_ZoneFadeTimer = 0; m_ZoneToPrint = m_pLastZoneName; @@ -526,7 +526,7 @@ void CHud::Draw() } if (!m_Message[0]) { - m_ZoneNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds(); CFont::SetJustifyOff(); CFont::SetPropOn(); CFont::SetBackgroundOff(); @@ -592,7 +592,7 @@ void CHud::Draw() fVehicleAlpha = 255.0f; break; case 2: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_VehicleFadeTimer += CTimer::GetTimeStepInMilliseconds(); if (m_VehicleFadeTimer > 1000) { m_VehicleState = 1; m_VehicleFadeTimer = 1000; @@ -600,7 +600,7 @@ void CHud::Draw() fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; break; case 3: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_VehicleFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_VehicleFadeTimer < 0) { m_VehicleState = 0; m_VehicleFadeTimer = 0; @@ -608,7 +608,7 @@ void CHud::Draw() fVehicleAlpha = m_VehicleFadeTimer * 0.001f * 255.0f; break; case 4: - m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f); + m_VehicleFadeTimer -= CTimer::GetTimeStepInMilliseconds(); if (m_VehicleFadeTimer < 0) { m_VehicleFadeTimer = 0; m_pVehicleNameToPrint = m_pLastVehicleName; @@ -622,7 +622,7 @@ void CHud::Draw() } if (!m_Message[0]) { - m_VehicleNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_VehicleNameTimer += CTimer::GetTimeStepInMilliseconds(); CFont::SetJustifyOff(); CFont::SetPropOn(); CFont::SetBackgroundOff(); @@ -924,11 +924,11 @@ void CHud::Draw() CFont::SetFontStyle(FONT_HEADING); if (BigMessageX[0] >= (SCREEN_WIDTH - 20)) { - BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f); + BigMessageInUse[0] += (CTimer::GetTimeStepInSeconds() * 120.0f); if (BigMessageInUse[0] >= 120.0f) { BigMessageInUse[0] = 120.0; - BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f); + BigMessageAlpha[0] += (CTimer::GetTimeStepInSeconds() * -255.0f); } if (BigMessageAlpha[0] <= 0.0f) { @@ -937,8 +937,8 @@ void CHud::Draw() } } else { - BigMessageX[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); - BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageX[0] += (CTimer::GetTimeStepInSeconds() * 255.0f); + BigMessageAlpha[0] += (CTimer::GetTimeStepInSeconds() * 255.0f); if (BigMessageAlpha[0] >= 255.0f) BigMessageAlpha[0] = 255.0f; @@ -963,7 +963,7 @@ void CHud::Draw() // WastedBustedText if (m_BigMessage[2][0]) { if (BigMessageInUse[2] != 0.0f) { - BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageAlpha[2] += (CTimer::GetTimeStepInSeconds() * 255.0f); if (BigMessageAlpha[2] > 255.0f) BigMessageAlpha[2] = 255.0; @@ -1045,7 +1045,7 @@ void CHud::DrawAfterFade() } break; case 2: - m_HelpMessageFadeTimer += 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds(); if (m_HelpMessageFadeTimer > 0) { m_HelpMessageState = 1; m_HelpMessageFadeTimer = 0; @@ -1053,7 +1053,7 @@ void CHud::DrawAfterFade() fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f; break; case 3: - m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds(); if (m_HelpMessageFadeTimer >= 0) { m_HelpMessageState = 0; m_HelpMessageFadeTimer = 0; @@ -1061,7 +1061,7 @@ void CHud::DrawAfterFade() fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f; break; case 4: - m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds(); if (m_HelpMessageFadeTimer >= 0) { m_HelpMessageState = 2; m_HelpMessageFadeTimer = 0; @@ -1073,7 +1073,7 @@ void CHud::DrawAfterFade() break; } - m_HelpMessageTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f); + m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds(); CFont::SetAlphaFade(fAlpha); CFont::SetCentreOff(); @@ -1121,7 +1121,7 @@ void CHud::DrawAfterFade() // Oddjob result if (OddJob2OffTimer > 0) - OddJob2OffTimer = OddJob2OffTimer - (CTimer::GetTimeStep() * 0.02f * 1000.0f); + OddJob2OffTimer = OddJob2OffTimer - CTimer::GetTimeStepInMilliseconds(); static float fStep; if (!m_BigMessage[1][0] && m_BigMessage[4][0] && m_BigMessage[5][0] && OddJob2OffTimer <= 0.0f) { @@ -1197,11 +1197,11 @@ void CHud::DrawAfterFade() CFont::SetRightJustifyOn(); CFont::SetFontStyle(FONT_HEADING); if (BigMessageX[1] >= (SCREEN_WIDTH - 20)) { - BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f); + BigMessageInUse[1] += (CTimer::GetTimeStepInSeconds() * 120.0f); if (BigMessageInUse[1] >= 120.0f) { BigMessageInUse[1] = 120.0; - BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f); + BigMessageAlpha[1] += (CTimer::GetTimeStepInSeconds() * -255.0f); } if (BigMessageAlpha[1] <= 0) { m_BigMessage[1][0] = 0; @@ -1209,8 +1209,8 @@ void CHud::DrawAfterFade() } } else { - BigMessageX[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f); - BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f); + BigMessageX[1] += (CTimer::GetTimeStepInSeconds() * 255.0f); + BigMessageAlpha[1] += (CTimer::GetTimeStepInSeconds() * 255.0f); if (BigMessageAlpha[1] >= 255.0f) BigMessageAlpha[1] = 255.0f; diff --git a/src/render/Lights.cpp b/src/render/Lights.cpp index 1e27ec48..cd83a898 100644 --- a/src/render/Lights.cpp +++ b/src/render/Lights.cpp @@ -6,7 +6,7 @@ #include "Timecycle.h" #include "Coronas.h" #include "Weather.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "Frontend.h" RpLight *&pAmbient = *(RpLight**)0x885B6C; diff --git a/src/render/Particle.h b/src/render/Particle.h index 92b6809e..25677569 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -74,7 +74,7 @@ public: static void RemovePSystem(tParticleType type); static void RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData); - static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, bool bRemoveParticle) + static void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, bool bRemoveParticle) { if ( bRemoveParticle ) { diff --git a/src/Timecycle.cpp b/src/render/Timecycle.cpp index c04295dd..af154716 100644 --- a/src/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -5,7 +5,7 @@ #include "Weather.h" #include "Camera.h" #include "Shadows.h" -#include "CullZones.h" +#include "ZoneCull.h" #include "CutsceneMgr.h" #include "FileMgr.h" #include "Timecycle.h" diff --git a/src/Timecycle.h b/src/render/Timecycle.h index 71ddedb7..71ddedb7 100644 --- a/src/Timecycle.h +++ b/src/render/Timecycle.h diff --git a/src/Weather.cpp b/src/render/Weather.cpp index 460deeac..460deeac 100644 --- a/src/Weather.cpp +++ b/src/render/Weather.cpp diff --git a/src/Weather.h b/src/render/Weather.h index a9c15fd9..a9c15fd9 100644 --- a/src/Weather.h +++ b/src/render/Weather.h diff --git a/src/entities/Automobile.cpp b/src/vehicles/Automobile.cpp index 54eed17a..54eed17a 100644 --- a/src/entities/Automobile.cpp +++ b/src/vehicles/Automobile.cpp diff --git a/src/entities/Automobile.h b/src/vehicles/Automobile.h index b6617f4b..630635c7 100644 --- a/src/entities/Automobile.h +++ b/src/vehicles/Automobile.h @@ -25,8 +25,8 @@ public: CDoor Doors[6]; RwFrame *m_aCarNodes[NUM_CAR_NODES]; CColPoint m_aWheelColPoints[4]; - float m_aWheelDist[4]; - float m_aWheelDist_2[4]; + float m_aSuspensionSpringRatio[4]; + float m_aSuspensionSpringRatioPrev[4]; float m_aWheelSkidThing[4]; int field_49C; bool m_aWheelSkidmarkMuddy[4]; @@ -37,7 +37,7 @@ public: uint8 stuff3[12]; uint32 m_nBusDoorTimerEnd; uint32 m_nBusDoorTimerStart; - float m_aSuspensionRange[4]; + float m_aSuspensionSpringLength[4]; float m_aSuspensionLineLength[4]; float m_fHeightAboveRoad; float m_fImprovedHandling; @@ -65,4 +65,3 @@ public: void dtor() { this->CAutomobile::~CAutomobile(); } }; static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error"); -static_assert(offsetof(CAutomobile, m_aWheelDist) == 0x46C, "CAutomobile: error"); diff --git a/src/entities/Boat.cpp b/src/vehicles/Boat.cpp index 076a910e..076a910e 100644 --- a/src/entities/Boat.cpp +++ b/src/vehicles/Boat.cpp diff --git a/src/entities/Boat.h b/src/vehicles/Boat.h index 6d6482a4..6d6482a4 100644 --- a/src/entities/Boat.h +++ b/src/vehicles/Boat.h diff --git a/src/DamageManager.cpp b/src/vehicles/DamageManager.cpp index 1a7f25ed..1a7f25ed 100644 --- a/src/DamageManager.cpp +++ b/src/vehicles/DamageManager.cpp diff --git a/src/DamageManager.h b/src/vehicles/DamageManager.h index 1fdbc6b1..1fdbc6b1 100644 --- a/src/DamageManager.h +++ b/src/vehicles/DamageManager.h diff --git a/src/control/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 47d0564c..47d0564c 100644 --- a/src/control/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp diff --git a/src/control/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 958e2351..958e2351 100644 --- a/src/control/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h diff --git a/src/entities/Heli.cpp b/src/vehicles/Heli.cpp index 01ee5375..01ee5375 100644 --- a/src/entities/Heli.cpp +++ b/src/vehicles/Heli.cpp diff --git a/src/entities/Heli.h b/src/vehicles/Heli.h index da7bb171..da7bb171 100644 --- a/src/entities/Heli.h +++ b/src/vehicles/Heli.h diff --git a/src/entities/Plane.cpp b/src/vehicles/Plane.cpp index 6e30bced..6e30bced 100644 --- a/src/entities/Plane.cpp +++ b/src/vehicles/Plane.cpp diff --git a/src/entities/Plane.h b/src/vehicles/Plane.h index e26008f6..e26008f6 100644 --- a/src/entities/Plane.h +++ b/src/vehicles/Plane.h diff --git a/src/entities/Train.cpp b/src/vehicles/Train.cpp index 62fd53ec..62fd53ec 100644 --- a/src/entities/Train.cpp +++ b/src/vehicles/Train.cpp diff --git a/src/entities/Train.h b/src/vehicles/Train.h index 84b6faf5..84b6faf5 100644 --- a/src/entities/Train.h +++ b/src/vehicles/Train.h diff --git a/src/control/Transmission.cpp b/src/vehicles/Transmission.cpp index 2be25cbb..2be25cbb 100644 --- a/src/control/Transmission.cpp +++ b/src/vehicles/Transmission.cpp diff --git a/src/control/Transmission.h b/src/vehicles/Transmission.h index 686e0aca..686e0aca 100644 --- a/src/control/Transmission.h +++ b/src/vehicles/Transmission.h diff --git a/src/entities/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 25bede65..dccd9195 100644 --- a/src/entities/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -429,7 +429,7 @@ CVehicle::ProcessCarAlarm(void) if(m_nAlarmState == 0 || m_nAlarmState == -1) return; - step = CTimer::GetTimeStep()/50.0f * 1000.0f; + step = CTimer::GetTimeStepInMilliseconds(); if((uint16)m_nAlarmState < step) m_nAlarmState = 0; else diff --git a/src/entities/Vehicle.h b/src/vehicles/Vehicle.h index 7b9bebef..39a56fe0 100644 --- a/src/entities/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -69,13 +69,6 @@ enum eDoors DOOR_REAR_RIGHT }; -enum { - GETTING_IN_OUT_FL = 1, - GETTING_IN_OUT_RL = 2, - GETTING_IN_OUT_FR = 4, - GETTING_IN_OUT_RR = 8 -}; - class CVehicle : public CPhysical { public: |