summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-07-18 04:28:06 +0200
committereray orçunus <erayorcunus@gmail.com>2019-07-18 04:28:06 +0200
commit993944c05c9f204a2caf61b973d68b7f7a1c56ab (patch)
tree998813788845b3a334f2f04612136b390a1e872c /src/control
parentThe Peds, mainly dying/injuring (diff)
parentmore CAutomobile::ProcessControl (diff)
downloadre3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.gz
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.bz2
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.lz
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.xz
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.tar.zst
re3-993944c05c9f204a2caf61b973d68b7f7a1c56ab.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Bridge.cpp49
-rw-r--r--src/control/CarCtrl.cpp8
-rw-r--r--src/control/CarCtrl.h1
-rw-r--r--src/control/Replay.cpp2
4 files changed, 35 insertions, 25 deletions
diff --git a/src/control/Bridge.cpp b/src/control/Bridge.cpp
index 3215ea2d..81f43f32 100644
--- a/src/control/Bridge.cpp
+++ b/src/control/Bridge.cpp
@@ -46,6 +46,7 @@ void CBridge::Update()
float liftHeight;
+ // Set bridge height and state
if (CStats::CommercialPassed)
{
if (TimeOfBridgeBecomingOperational == 0)
@@ -81,30 +82,6 @@ void CBridge::Update()
liftHeight = 25.0;
State = STATE_LIFT_PART_IS_UP;
}
-
- // Move bridge part
- if (liftHeight != OldLift)
- {
- pLiftPart->GetPosition().z = DefaultZLiftPart + liftHeight;
- pLiftPart->GetMatrix().UpdateRW();
- pLiftPart->UpdateRwFrame();
- if (pLiftRoad)
- {
- pLiftRoad->GetPosition().z = DefaultZLiftRoad + liftHeight;
- pLiftRoad->GetMatrix().UpdateRW();
- pLiftRoad->UpdateRwFrame();
- }
- pWeight->GetPosition().z = DefaultZLiftWeight - liftHeight;
- pWeight->GetMatrix().UpdateRW();
- pWeight->UpdateRwFrame();
-
- OldLift = liftHeight;
- }
-
- if (State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP && OldState == STATE_LIFT_PART_IS_DOWN)
- ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
- else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
- ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
}
else
{
@@ -112,6 +89,30 @@ void CBridge::Update()
TimeOfBridgeBecomingOperational = 0;
State = STATE_BRIDGE_LOCKED;
}
+
+ // Move bridge part
+ if (liftHeight != OldLift)
+ {
+ pLiftPart->GetPosition().z = DefaultZLiftPart + liftHeight;
+ pLiftPart->GetMatrix().UpdateRW();
+ pLiftPart->UpdateRwFrame();
+ if (pLiftRoad)
+ {
+ pLiftRoad->GetPosition().z = DefaultZLiftRoad + liftHeight;
+ pLiftRoad->GetMatrix().UpdateRW();
+ pLiftRoad->UpdateRwFrame();
+ }
+ pWeight->GetPosition().z = DefaultZLiftWeight - liftHeight;
+ pWeight->GetMatrix().UpdateRW();
+ pWeight->UpdateRwFrame();
+
+ OldLift = liftHeight;
+ }
+
+ if (State == STATE_LIFT_PART_ABOUT_TO_MOVE_UP && OldState == STATE_LIFT_PART_IS_DOWN)
+ ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, true);
+ else if (State == STATE_LIFT_PART_IS_DOWN && OldState == STATE_LIFT_PART_MOVING_DOWN)
+ ThePaths.SetLinksBridgeLights(-330.0, -230.0, -700.0, -588.0, false);
}
bool CBridge::ShouldLightsBeFlashing() { return State != STATE_LIFT_PART_IS_DOWN; }
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 7acfa64a..edf4d1ae 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -16,3 +16,11 @@ WRAPPER bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle*, CVector, bool)
WRAPPER void CCarCtrl::JoinCarWithRoadSystem(CVehicle*) { EAXJMP(0x41F820); }
WRAPPER void CCarCtrl::SteerAICarWithPhysics(CVehicle*) { EAXJMP(0x41DA60); }
WRAPPER void CCarCtrl::UpdateCarOnRails(CVehicle*) { EAXJMP(0x418880); }
+
+bool
+CCarCtrl::MapCouldMoveInThisArea(float x, float y)
+{
+ // bridge moves up and down
+ return x > -342.0f && x < -219.0f &&
+ y > -677.0f && y < -580.0f;
+}
diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h
index a15279d3..7e3f70a9 100644
--- a/src/control/CarCtrl.h
+++ b/src/control/CarCtrl.h
@@ -13,6 +13,7 @@ public:
static void JoinCarWithRoadSystem(CVehicle*);
static void SteerAICarWithPhysics(CVehicle*);
static void UpdateCarOnRails(CVehicle*);
+ static bool MapCouldMoveInThisArea(float x, float y);
static int32 &NumLawEnforcerCars;
static int32 &NumAmbulancesOnDuty;
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 3ce9085f..29bdacd7 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -718,7 +718,7 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
}
vehicle->bEngineOn = true;
if (vehicle->IsCar())
- ((CAutomobile*)vehicle)->m_nWheelsOnGround = 4;
+ ((CAutomobile*)vehicle)->m_nDriveWheelsOnGround = 4;
CWorld::Remove(vehicle);
CWorld::Add(vehicle);
if (vehicle->IsBoat())