From dbe205ad080b8fb9ef4df0b936e7982850c0b1fc Mon Sep 17 00:00:00 2001 From: guard3 Date: Wed, 17 Jul 2019 23:05:11 +0300 Subject: Fixed Bridge --- src/control/Bridge.cpp | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'src/control') 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; } -- cgit v1.2.3 From ba242bcf584d885167a9499e53f5bcaf6c9cc866 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 17 Jul 2019 23:58:06 +0200 Subject: more CAutomobile::ProcessControl --- src/control/CarCtrl.cpp | 8 ++++++++ src/control/CarCtrl.h | 1 + src/control/Replay.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/control') 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()) -- cgit v1.2.3