diff options
author | aap <aap@papnet.eu> | 2019-07-17 22:06:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-17 22:06:50 +0200 |
commit | fa98f40f7c502c9601044197bc6276e33a756aff (patch) | |
tree | c66780247292c2393fbfbdacb17b67ac73aceada /src/control | |
parent | Merge pull request #141 from guard3/master (diff) | |
parent | Fixed Bridge (diff) | |
download | re3-fa98f40f7c502c9601044197bc6276e33a756aff.tar re3-fa98f40f7c502c9601044197bc6276e33a756aff.tar.gz re3-fa98f40f7c502c9601044197bc6276e33a756aff.tar.bz2 re3-fa98f40f7c502c9601044197bc6276e33a756aff.tar.lz re3-fa98f40f7c502c9601044197bc6276e33a756aff.tar.xz re3-fa98f40f7c502c9601044197bc6276e33a756aff.tar.zst re3-fa98f40f7c502c9601044197bc6276e33a756aff.zip |
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/Bridge.cpp | 49 |
1 files changed, 25 insertions, 24 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; } |