1
0
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:
Gymnasiast
2015-03-14 20:29:49 +01:00
parent 22b4001c29
commit 5a5cf21cd3
5 changed files with 28 additions and 12 deletions

View File

@@ -3454,4 +3454,5 @@ STR_3446 :Cancel Patrol Area
# New strings, cleaner # New strings, cleaner
STR_5120 :Show finances button on toolbar 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

View File

@@ -165,6 +165,7 @@ config_property_definition _generalDefinitions[] = {
config_property_definition _interfaceDefinitions[] = { config_property_definition _interfaceDefinitions[] = {
{ offsetof(interface_configuration, toolbar_show_finances), "toolbar_show_finances", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { 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, 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[] = { config_property_definition _soundDefinitions[] = {
@@ -951,4 +952,4 @@ bool config_shortcut_keys_save()
return result; return result;
} }
#pragma endregion #pragma endregion

View File

@@ -134,6 +134,7 @@ typedef struct {
typedef struct { typedef struct {
uint8 toolbar_show_finances; uint8 toolbar_show_finances;
uint8 toolbar_show_research; uint8 toolbar_show_research;
uint8 allow_subtype_switching;
} interface_configuration; } interface_configuration;
typedef struct { typedef struct {

View File

@@ -95,7 +95,8 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
WIDX_REAL_NAME_CHECKBOX, WIDX_REAL_NAME_CHECKBOX,
WIDX_SAVE_PLUGIN_DATA_CHECKBOX, WIDX_SAVE_PLUGIN_DATA_CHECKBOX,
WIDX_AUTOSAVE, WIDX_AUTOSAVE,
WIDX_AUTOSAVE_DROPDOWN WIDX_AUTOSAVE_DROPDOWN,
WIDX_ALLOW_SUBTYPE_SWITCHING
}; };
#define WW 310 #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_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, 0, 155, 299, 83, 94, STR_NONE, STR_NONE },
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 84, 93, 876, 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 }, { WIDGETS_END },
}; };
@@ -258,7 +260,8 @@ void window_options_open()
(1ULL << WIDX_GRIDLINES_CHECKBOX) | (1ULL << WIDX_GRIDLINES_CHECKBOX) |
(1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) | (1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) |
(1ULL << WIDX_AUTOSAVE) | (1ULL << WIDX_AUTOSAVE) |
(1ULL << WIDX_AUTOSAVE_DROPDOWN); (1ULL << WIDX_AUTOSAVE_DROPDOWN) |
(1ULL << WIDX_ALLOW_SUBTYPE_SWITCHING);
w->page = WINDOW_OPTIONS_PAGE_DISPLAY; w->page = WINDOW_OPTIONS_PAGE_DISPLAY;
window_init_scroll_widgets(w); window_init_scroll_widgets(w);
@@ -309,6 +312,12 @@ static void window_options_mouseup()
window_invalidate(w); window_invalidate(w);
window_invalidate_by_class(WC_TOP_TOOLBAR); window_invalidate_by_class(WC_TOP_TOOLBAR);
break; 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: case WIDX_REAL_NAME_CHECKBOX:
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; 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); 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; window_options_widgets[WIDX_TOOLBAR_SHOW_RESEARCH].type = WWT_CHECKBOX;
break; break;
case WINDOW_OPTIONS_PAGE_MISC: case WINDOW_OPTIONS_PAGE_MISC:
widget_set_checkbox_value(w, WIDX_ALLOW_SUBTYPE_SWITCHING, gConfigInterface.allow_subtype_switching);
// real name checkbox // real name checkbox
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES)
w->pressed_widgets |= (1ULL << WIDX_REAL_NAME_CHECKBOX); 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_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX;
window_options_widgets[WIDX_AUTOSAVE].type = WWT_DROPDOWN; window_options_widgets[WIDX_AUTOSAVE].type = WWT_DROPDOWN;
window_options_widgets[WIDX_AUTOSAVE_DROPDOWN].type = WWT_DROPDOWN_BUTTON; window_options_widgets[WIDX_AUTOSAVE_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
window_options_widgets[WIDX_ALLOW_SUBTYPE_SWITCHING].type = WWT_CHECKBOX;
break; 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); window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_MISC, 5205);
} }
#pragma endregion #pragma endregion

View File

@@ -19,6 +19,7 @@
*****************************************************************************/ *****************************************************************************/
#include "../addresses.h" #include "../addresses.h"
#include "../config.h"
#include "../game.h" #include "../game.h"
#include "../input.h" #include "../input.h"
#include "../interface/viewport.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++) { for (currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != 0xFF; currentRideEntryIndex++) {
rideEntryIndex = *currentRideEntryIndex; rideEntryIndex = *currentRideEntryIndex;
currentRideEntry = GET_RIDE_ENTRY(rideEntryIndex); currentRideEntry = GET_RIDE_ENTRY(rideEntryIndex);
// Same track type, but not same subtype // Skip if vehicle has the same track type, but not same subtype, unless subtype switching is enabled
/*if (currentRideEntry->var_008 & 0x3000) if ((currentRideEntry->var_008 & 0x3000) && !gConfigInterface.allow_subtype_switching)
continue;*/ continue;
quadIndex = rideEntryIndex >> 5; quadIndex = rideEntryIndex >> 5;
bitIndex = rideEntryIndex & 0x1F; bitIndex = rideEntryIndex & 0x1F;
@@ -2439,16 +2440,16 @@ static void window_ride_vehicle_invalidate()
// Vehicle type // Vehicle type
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].image = rideEntry->name; window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].image = rideEntry->name;
// Always show a dropdown button // Always show a dropdown button when changing subtypes is allowed
/*if (var_496(w) <= 1 || (rideEntry->var_008 & (1 << 13))) { 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].type = WWT_14;
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_EMPTY; window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_EMPTY;
w->enabled_widgets &= ~(1 << WIDX_VEHICLE_TYPE); 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].type = WWT_DROPDOWN;
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_DROPDOWN_BUTTON; window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
w->enabled_widgets |= (1 << WIDX_VEHICLE_TYPE); w->enabled_widgets |= (1 << WIDX_VEHICLE_TYPE);
//} }
// Trains // Trains
if (rideEntry->var_011 > 1) { if (rideEntry->var_011 > 1) {