From 7fab48e2eb76161d802c2fc74589b2e7e07aebb8 Mon Sep 17 00:00:00 2001 From: blackhand1001 Date: Tue, 5 May 2020 17:35:34 +0200 Subject: [PATCH 1/2] Create constant for BLOCK_BRAKE_BASE_SPEED --- src/openrct2/ride/Track.h | 2 ++ src/openrct2/ride/Vehicle.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openrct2/ride/Track.h b/src/openrct2/ride/Track.h index 0d8e4ff67d..5d8b60866d 100644 --- a/src/openrct2/ride/Track.h +++ b/src/openrct2/ride/Track.h @@ -15,6 +15,8 @@ constexpr const uint16_t RideConstructionSpecialPieceSelected = 0x100; +constexpr const int32_t BLOCK_BRAKE_BASE_SPEED = 0x20364; + using track_type_t = uint16_t; #pragma pack(push, 1) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index e4126b584a..0b19382bb5 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -6626,10 +6626,10 @@ static void apply_non_stop_block_brake(Vehicle* vehicle, bool block_brake_closed if (vehicle->velocity >= 0) { // If the vehicle is below the speed limit - if (vehicle->velocity <= 0x20364) + if (vehicle->velocity <= BLOCK_BRAKE_BASE_SPEED) { // Boost it to the fixed block brake speed - vehicle->velocity = 0x20364; + vehicle->velocity = BLOCK_BRAKE_BASE_SPEED; vehicle->acceleration = 0; } else if (block_brake_closed) @@ -7587,7 +7587,7 @@ static void vehicle_update_handle_scenery_door(Vehicle* vehicle) static void vehicle_update_play_water_splash_sound() { - if (_vehicleVelocityF64E08 <= 0x20364) + if (_vehicleVelocityF64E08 <= BLOCK_BRAKE_BASE_SPEED) { return; } From cab9fdbe9c8295e7893b70065d2037e993b5021f Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Tue, 5 May 2020 17:46:46 +0200 Subject: [PATCH 2/2] Fix parameter name to apply_non_stop_block_brake() --- src/openrct2/ride/Vehicle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 0b19382bb5..22870e7057 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -6621,7 +6621,7 @@ void Vehicle::UpdateTrackMotionUpStopCheck() const * merely as a velocity regulator, in a closed state. When the brake is open, it * boosts the train to the speed limit */ -static void apply_non_stop_block_brake(Vehicle* vehicle, bool block_brake_closed) +static void apply_non_stop_block_brake(Vehicle* vehicle, bool slowDownToBlockBrakeSpeed) { if (vehicle->velocity >= 0) { @@ -6632,7 +6632,7 @@ static void apply_non_stop_block_brake(Vehicle* vehicle, bool block_brake_closed vehicle->velocity = BLOCK_BRAKE_BASE_SPEED; vehicle->acceleration = 0; } - else if (block_brake_closed) + else if (slowDownToBlockBrakeSpeed) { // Slow it down till the fixed block brake speed vehicle->velocity -= vehicle->velocity >> 4;