1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Clean up brake speed in ride construction window, fix #6271

This commit is contained in:
Michael Steenbeek
2017-09-13 17:10:03 +02:00
parent 8677793624
commit d4cc97165c
5 changed files with 28 additions and 40 deletions

View File

@@ -4453,6 +4453,7 @@ STR_6141 :RCT1 Bottom Toolbar
STR_6142 :{WINDOW_COLOUR_2}Track name: {BLACK}{STRING}
STR_6143 :{WINDOW_COLOUR_2}Ride type: {BLACK}{STRINGID}
STR_6144 :Show dirty visuals
STR_6145 :{SMALLFONT}{BLACK}Set speed limit for boosters
STR_6146 :Enable all drawable track pieces
STR_6147 :{SMALLFONT}{BLACK}Enables all track pieces the ride type is capable of in the construction window, regardless of whether the vehicle support them.

View File

@@ -3793,6 +3793,8 @@ enum {
STR_DEBUG_PAINT_SHOW_DIRTY_VISUALS = 6144,
STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP = 6145,
STR_CHEAT_ENABLE_ALL_DRAWABLE_TRACK_PIECES = 6146,
STR_CHEAT_ENABLE_ALL_DRAWABLE_TRACK_PIECES_TIP = 6147,

View File

@@ -182,8 +182,6 @@ uint16 _previousTrackPieceX;
uint16 _previousTrackPieceY;
uint16 _previousTrackPieceZ;
uint8 _currentlyShowingBrakeSpeed;
uint8 _currentBrakeSpeed;
uint8 _currentBrakeSpeed2;
uint8 _currentSeatRotationAngle;

View File

@@ -1001,8 +1001,6 @@ extern uint16 _previousTrackPieceX;
extern uint16 _previousTrackPieceY;
extern uint16 _previousTrackPieceZ;
extern uint8 _currentlyShowingBrakeSpeed;
extern uint8 _currentBrakeSpeed;
extern uint8 _currentBrakeSpeed2;
extern uint8 _currentSeatRotationAngle;

View File

@@ -446,15 +446,16 @@ rct_string_id RideConfigurationStringIds[] = {
uint64 _enabledRidePieces;
static bool _trackPlaceCtrlState;
static sint32 _trackPlaceCtrlZ;
static sint32 _trackPlaceCtrlZ;
static bool _trackPlaceShiftState;
static sint32 _trackPlaceShiftStartScreenX;
static sint32 _trackPlaceShiftStartScreenY;
static sint32 _trackPlaceShiftZ;
static sint32 _trackPlaceZ;
static sint32 _trackPlaceShiftStartScreenX;
static sint32 _trackPlaceShiftStartScreenY;
static sint32 _trackPlaceShiftZ;
static sint32 _trackPlaceZ;
static money32 _trackPlaceCost;
static bool _autoOpeningShop;
static uint8 _rideConstructionState2;
static uint8 _currentlyShowingBrakeOrBoosterSpeed;
static bool _boosterTrackSelected;
static uint32 _currentDisabledSpecialTrackPieces;
@@ -600,15 +601,8 @@ rct_window *window_ride_construction_open()
_currentTrackPrice = MONEY32_UNDEFINED;
_currentBrakeSpeed2 = 8;
_currentBrakeSpeed = 18;
_currentSeatRotationAngle = 4;
if (ride->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER)
_currentBrakeSpeed = 30;
if (ride->type == RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER)
_currentBrakeSpeed = 30;
_currentTrackCurve = RideConstructionDefaultTrackType[ride->type] | 0x100;
_currentTrackSlopeEnd = 0;
_currentTrackBankEnd = 0;
@@ -1268,7 +1262,7 @@ static void window_ride_construction_resize(rct_window *w)
(1ULL << WIDX_LEFT_CURVE_LARGE) |
(1ULL << WIDX_RIGHT_CURVE_LARGE);
}
if (_currentlyShowingBrakeSpeed != 0) {
if (_currentlyShowingBrakeOrBoosterSpeed) {
disabledWidgets &= ~(1ULL << WIDX_BANKING_GROUPBOX);
disabledWidgets &= ~(1ULL << WIDX_BANK_LEFT);
disabledWidgets &= ~(1ULL << WIDX_BANK_STRAIGHT);
@@ -1526,7 +1520,7 @@ static void window_ride_construction_mousedown(rct_window *w, rct_widgetindex wi
break;
case WIDX_BANK_LEFT:
ride_construction_invalidate_current_track();
if (_currentlyShowingBrakeSpeed == 0) {
if (!_currentlyShowingBrakeOrBoosterSpeed) {
_currentTrackBankEnd = TRACK_BANK_LEFT;
_currentTrackPrice = MONEY32_UNDEFINED;
window_ride_construction_update_active_elements();
@@ -1534,17 +1528,13 @@ static void window_ride_construction_mousedown(rct_window *w, rct_widgetindex wi
break;
case WIDX_BANK_STRAIGHT:
ride_construction_invalidate_current_track();
if (_currentlyShowingBrakeSpeed == 0) {
if (!_currentlyShowingBrakeOrBoosterSpeed) {
_currentTrackBankEnd = TRACK_BANK_NONE;
_currentTrackPrice = MONEY32_UNDEFINED;
window_ride_construction_update_active_elements();
} else {
uint8 *brakesSpeedPtr = &_currentBrakeSpeed2;
uint8 maxBrakesSpeed = 30;
if (_currentlyShowingBrakeSpeed != 1) {
brakesSpeedPtr = &_currentBrakeSpeed;
maxBrakesSpeed = RideProperties[ride->type].max_brakes_speed;
}
uint8 brakesSpeed = *brakesSpeedPtr + 2;
if (brakesSpeed <= maxBrakesSpeed) {
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED) {
@@ -1558,15 +1548,12 @@ static void window_ride_construction_mousedown(rct_window *w, rct_widgetindex wi
break;
case WIDX_BANK_RIGHT:
ride_construction_invalidate_current_track();
if (_currentlyShowingBrakeSpeed == 0) {
if (!_currentlyShowingBrakeOrBoosterSpeed) {
_currentTrackBankEnd = TRACK_BANK_RIGHT;
_currentTrackPrice = MONEY32_UNDEFINED;
window_ride_construction_update_active_elements();
} else {
uint8 *brakesSpeedPtr = &_currentBrakeSpeed2;
if (_currentlyShowingBrakeSpeed != 1) {
brakesSpeedPtr = &_currentBrakeSpeed;
}
uint8 brakesSpeed = *brakesSpeedPtr - 2;
if (brakesSpeed >= 2) {
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED) {
@@ -2178,7 +2165,7 @@ static void window_ride_construction_invalidate(rct_window *w)
}
set_format_arg(0, uint16, stringId);
if (_currentlyShowingBrakeSpeed == 1) {
if (_currentlyShowingBrakeOrBoosterSpeed) {
uint16 brakeSpeed2 = ((_currentBrakeSpeed2 * 9) >> 2) & 0xFFFF;
if (_boosterTrackSelected)
{
@@ -2189,12 +2176,6 @@ static void window_ride_construction_invalidate(rct_window *w)
window_ride_construction_widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].text = RideConstructionSeatAngleRotationStrings[_currentSeatRotationAngle];
// TODO: Embed table
if (_currentlyShowingBrakeSpeed == 2) { // never gets set to 2
uint16 brakeSpeed = ((_currentBrakeSpeed * 9) / 4) & 0xFFFF;
set_format_arg(2, uint16, brakeSpeed);
}
// Set window title arguments
set_format_arg(4, rct_string_id, ride->name);
set_format_arg(6, uint32, ride->name_arguments);
@@ -2963,7 +2944,7 @@ static void window_ride_construction_update_possible_ride_configurations()
ride = get_ride(_currentRideIndex);
_currentlyShowingBrakeSpeed = 0;
_currentlyShowingBrakeOrBoosterSpeed = false;
if (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_TYPE)
edi = RideData4[ride->type].alternate_type;
else
@@ -3322,15 +3303,23 @@ static void window_ride_construction_update_widgets(rct_window *w)
}
} else {
if (brakesSelected)
{
window_ride_construction_widgets[WIDX_BANKING_GROUPBOX].text = STR_RIDE_CONSTRUCTION_BRAKE_SPEED;
window_ride_construction_widgets[WIDX_BANK_LEFT].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP;
window_ride_construction_widgets[WIDX_BANK_STRAIGHT].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP;
window_ride_construction_widgets[WIDX_BANK_RIGHT].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP;
}
else
{
window_ride_construction_widgets[WIDX_BANKING_GROUPBOX].text = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED;
window_ride_construction_widgets[WIDX_BANK_LEFT].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP;
window_ride_construction_widgets[WIDX_BANK_STRAIGHT].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP;
window_ride_construction_widgets[WIDX_BANK_RIGHT].tooltip = STR_RIDE_CONSTRUCTION_BOOSTER_SPEED_LIMIT_TIP;
}
_currentlyShowingBrakeSpeed = 1;
_currentlyShowingBrakeOrBoosterSpeed = true;
window_ride_construction_widgets[WIDX_BANK_LEFT].text = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_VELOCITY;
window_ride_construction_widgets[WIDX_BANK_LEFT].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP;
window_ride_construction_widgets[WIDX_BANK_STRAIGHT].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP;
window_ride_construction_widgets[WIDX_BANK_RIGHT].tooltip = STR_RIDE_CONSTRUCTION_BRAKE_SPEED_LIMIT_TIP;
window_ride_construction_widgets[WIDX_BANK_LEFT].type = WWT_SPINNER;
window_ride_construction_widgets[WIDX_BANK_LEFT].left = 12;
window_ride_construction_widgets[WIDX_BANK_LEFT].right = 83;
@@ -3484,7 +3473,7 @@ static void window_ride_construction_update_widgets(rct_window *w)
}
pressedWidgets |= (1ULL << widgetIndex);
if (_currentlyShowingBrakeSpeed == 0) {
if (!_currentlyShowingBrakeOrBoosterSpeed) {
if (ride_type_has_flag(rideType, RIDE_TYPE_FLAG_TRACK_ELEMENTS_HAVE_TWO_VARIETIES)) {
if (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_PIECES) {
w->pressed_widgets |= (1ULL << WIDX_O_TRACK);