mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Made subtype switching an option
This commit is contained in:
@@ -3454,4 +3454,5 @@ STR_3446 :Cancel Patrol Area
|
||||
|
||||
# New strings, cleaner
|
||||
STR_5120 :Show finances button on toolbar
|
||||
STR_5121 :Show research button on toolbar
|
||||
STR_5121 :Show research button on toolbar
|
||||
STR_5122 :Show all vehicles sharing a track/ride type
|
||||
|
||||
@@ -165,6 +165,7 @@ config_property_definition _generalDefinitions[] = {
|
||||
config_property_definition _interfaceDefinitions[] = {
|
||||
{ offsetof(interface_configuration, toolbar_show_finances), "toolbar_show_finances", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
{ offsetof(interface_configuration, toolbar_show_research), "toolbar_show_research", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
|
||||
{ offsetof(interface_configuration, allow_subtype_switching), "allow_subtype_switching", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
};
|
||||
|
||||
config_property_definition _soundDefinitions[] = {
|
||||
@@ -951,4 +952,4 @@ bool config_shortcut_keys_save()
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
@@ -134,6 +134,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint8 toolbar_show_finances;
|
||||
uint8 toolbar_show_research;
|
||||
uint8 allow_subtype_switching;
|
||||
} interface_configuration;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -95,7 +95,8 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
|
||||
WIDX_REAL_NAME_CHECKBOX,
|
||||
WIDX_SAVE_PLUGIN_DATA_CHECKBOX,
|
||||
WIDX_AUTOSAVE,
|
||||
WIDX_AUTOSAVE_DROPDOWN
|
||||
WIDX_AUTOSAVE_DROPDOWN,
|
||||
WIDX_ALLOW_SUBTYPE_SWITCHING
|
||||
};
|
||||
|
||||
#define WW 310
|
||||
@@ -153,6 +154,7 @@ static rct_widget window_options_widgets[] = {
|
||||
{ WWT_CHECKBOX, 2, 10, 299, 68, 79, STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP },
|
||||
{ WWT_DROPDOWN, 0, 155, 299, 83, 94, STR_NONE, STR_NONE },
|
||||
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 84, 93, 876, STR_NONE },
|
||||
{ WWT_CHECKBOX, 2, 10, 299, 98, 109, 5122, STR_NONE }, // allow subtype switching
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
@@ -258,7 +260,8 @@ void window_options_open()
|
||||
(1ULL << WIDX_GRIDLINES_CHECKBOX) |
|
||||
(1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) |
|
||||
(1ULL << WIDX_AUTOSAVE) |
|
||||
(1ULL << WIDX_AUTOSAVE_DROPDOWN);
|
||||
(1ULL << WIDX_AUTOSAVE_DROPDOWN) |
|
||||
(1ULL << WIDX_ALLOW_SUBTYPE_SWITCHING);
|
||||
|
||||
w->page = WINDOW_OPTIONS_PAGE_DISPLAY;
|
||||
window_init_scroll_widgets(w);
|
||||
@@ -309,6 +312,12 @@ static void window_options_mouseup()
|
||||
window_invalidate(w);
|
||||
window_invalidate_by_class(WC_TOP_TOOLBAR);
|
||||
break;
|
||||
case WIDX_ALLOW_SUBTYPE_SWITCHING:
|
||||
gConfigInterface.allow_subtype_switching ^= 1;
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
window_invalidate_by_class(WC_RIDE);
|
||||
break;
|
||||
case WIDX_REAL_NAME_CHECKBOX:
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
RCT2_CALLPROC_X(0x0069C52F, RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? 0 : 1, 0, 0, 0, 0, 0, 0);
|
||||
@@ -741,6 +750,8 @@ static void window_options_invalidate()
|
||||
window_options_widgets[WIDX_TOOLBAR_SHOW_RESEARCH].type = WWT_CHECKBOX;
|
||||
break;
|
||||
case WINDOW_OPTIONS_PAGE_MISC:
|
||||
widget_set_checkbox_value(w, WIDX_ALLOW_SUBTYPE_SWITCHING, gConfigInterface.allow_subtype_switching);
|
||||
|
||||
// real name checkbox
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
|
||||
w->pressed_widgets |= (1ULL << WIDX_REAL_NAME_CHECKBOX);
|
||||
@@ -767,6 +778,7 @@ static void window_options_invalidate()
|
||||
window_options_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_widgets[WIDX_AUTOSAVE].type = WWT_DROPDOWN;
|
||||
window_options_widgets[WIDX_AUTOSAVE_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
window_options_widgets[WIDX_ALLOW_SUBTYPE_SWITCHING].type = WWT_CHECKBOX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -911,4 +923,4 @@ static void window_options_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w
|
||||
window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_MISC, 5205);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
#pragma endregion
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../addresses.h"
|
||||
#include "../config.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/viewport.h"
|
||||
@@ -2279,9 +2280,9 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi
|
||||
for (currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != 0xFF; currentRideEntryIndex++) {
|
||||
rideEntryIndex = *currentRideEntryIndex;
|
||||
currentRideEntry = GET_RIDE_ENTRY(rideEntryIndex);
|
||||
// Same track type, but not same subtype
|
||||
/*if (currentRideEntry->var_008 & 0x3000)
|
||||
continue;*/
|
||||
// Skip if vehicle has the same track type, but not same subtype, unless subtype switching is enabled
|
||||
if ((currentRideEntry->var_008 & 0x3000) && !gConfigInterface.allow_subtype_switching)
|
||||
continue;
|
||||
|
||||
quadIndex = rideEntryIndex >> 5;
|
||||
bitIndex = rideEntryIndex & 0x1F;
|
||||
@@ -2439,16 +2440,16 @@ static void window_ride_vehicle_invalidate()
|
||||
|
||||
// Vehicle type
|
||||
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].image = rideEntry->name;
|
||||
// Always show a dropdown button
|
||||
/*if (var_496(w) <= 1 || (rideEntry->var_008 & (1 << 13))) {
|
||||
// Always show a dropdown button when changing subtypes is allowed
|
||||
if ((var_496(w) <= 1 || (rideEntry->var_008 & (1 << 13))) && !gConfigInterface.allow_subtype_switching ) {
|
||||
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].type = WWT_14;
|
||||
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_EMPTY;
|
||||
w->enabled_widgets &= ~(1 << WIDX_VEHICLE_TYPE);
|
||||
} else {*/
|
||||
} else {
|
||||
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].type = WWT_DROPDOWN;
|
||||
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
w->enabled_widgets |= (1 << WIDX_VEHICLE_TYPE);
|
||||
//}
|
||||
}
|
||||
|
||||
// Trains
|
||||
if (rideEntry->var_011 > 1) {
|
||||
|
||||
Reference in New Issue
Block a user