diff --git a/src/game.c b/src/game.c index fef2cb6850..39c62a6719 100644 --- a/src/game.c +++ b/src/game.c @@ -655,11 +655,11 @@ int game_load_save(const char *path) if (!load_success){ set_load_objects_fail_reason(); - if (RCT2_GLOBAL(0x9DE518,uint32) & (1<<5)){ + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_5){ RCT2_GLOBAL(0x14241BC, uint32) = 2; //call 0x0040705E Sets cursor position and something else. Calls maybe wind func 8 probably pointless RCT2_GLOBAL(0x14241BC, uint32) = 0; - RCT2_GLOBAL(0x9DE518, uint32) &= ~(1<<5); + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~INPUT_FLAG_5; } title_load(); rct2_endupdate(); diff --git a/src/input.c b/src/input.c index 33fe278e00..fce9a72caa 100644 --- a/src/input.c +++ b/src/input.c @@ -283,7 +283,7 @@ static void game_handle_input_mouse(int x, int y, int state) if (w->classification != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWCLASS, rct_windowclass) || w->number != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_WINDOWNUMBER, rct_windownumber) || - !(RCT2_GLOBAL(0x9DE518, uint32)&(1 << 3)))break; + !(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)) break; w = window_find_by_number( RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass), @@ -298,7 +298,7 @@ static void game_handle_input_mouse(int x, int y, int state) RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = 0; if (RCT2_GLOBAL(0x9DE52E, rct_windownumber) != w->number)break; - if ((RCT2_GLOBAL(0x9DE518, uint32)&(1 << 3))){ + if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE)){ w = window_find_by_number( RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass), RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) @@ -308,7 +308,7 @@ static void game_handle_input_mouse(int x, int y, int state) RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_UP], x, y, 0, (int)RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0); } else{ - if ((RCT2_GLOBAL(0x9DE518, uint32) & (1 << 4))) + if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_4)) break; viewport_interaction_left_click(x, y); @@ -811,7 +811,7 @@ void process_mouse_over(int x, int y) switch (window->widgets[widgetId].type){ case WWT_VIEWPORT: - if ((RCT2_GLOBAL(0x9DE518, int) & 0x8) == 0) { + if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, int) & INPUT_FLAG_TOOL_ACTIVE) == 0) { if (viewport_interaction_left_over(x, y)) { sub_6ED990(CURSOR_HAND_POINT); return; @@ -897,7 +897,7 @@ void process_mouse_over(int x, int y) */ void process_mouse_tool(int x, int y) { - if (RCT2_GLOBAL(0x9DE518, uint32) & (1 << 3)) + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) { rct_window* w = window_find_by_number( RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8), @@ -951,9 +951,9 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi window_event_mouse_down_call(w, widgetIndex); } - if (RCT2_GLOBAL(0x009DE518, uint32) & 1) return; + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_WIDGET_PRESSED) return; - RCT2_GLOBAL(0x009DE518, uint32) |= 1; + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_WIDGET_PRESSED; widget_invalidate_by_number(cursor_w_class, cursor_w_number, widgetIndex); return; case 3: @@ -976,9 +976,9 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex) goto dropdown_cleanup; dropdown_index = -1; - if (RCT2_GLOBAL(0x9DE518, uint32) & 2){ - if (!(RCT2_GLOBAL(0x9DE518, uint32) & 4)){ - RCT2_GLOBAL(0x9DE518, uint32) |= (1 << 2); + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_DROPDOWN_STAY_OPEN){ + if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_DROPDOWN_MOUSE_UP)){ + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_DROPDOWN_MOUSE_UP; return; } } @@ -986,8 +986,8 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi window_close_by_class(WC_DROPDOWN); cursor_w = window_find_by_number(cursor_w_class, cursor_w_number); - if (RCT2_GLOBAL(0x9DE518, uint32) & 1) { - RCT2_GLOBAL(0x9DE518, uint32) &= 0xFFFE; + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_WIDGET_PRESSED) { + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= 0xFFFE; widget_invalidate_by_number(cursor_w_class, cursor_w_number, cursor_widgetIndex); } @@ -1030,8 +1030,8 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi RCT2_GLOBAL(0x9DE528, uint16) = 0; if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) != 5){ // Hold down widget and drag outside of area?? - if (RCT2_GLOBAL(0x9DE518, uint32) & 1){ - RCT2_GLOBAL(0x9DE518, uint32) &= 0xFFFE; + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_WIDGET_PRESSED){ + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= 0xFFFE; widget_invalidate_by_number(cursor_w_class, cursor_w_number, cursor_widgetIndex); } return; diff --git a/src/input.h b/src/input.h index e28adf0b09..3d36382961 100644 --- a/src/input.h +++ b/src/input.h @@ -26,11 +26,12 @@ enum { INPUT_FLAG_WIDGET_PRESSED = (1 << 0), - // Related to dropdowns, set on flag 0x80 - INPUT_FLAG_1 = (1 << 1), + // The dropdown can stay open if the mouse is released, set on flag DROPDOWN_FLAG_STAY_OPEN + INPUT_FLAG_DROPDOWN_STAY_OPEN = (1 << 1), - // Related to dropdowns - INPUT_FLAG_2 = (1 << 2), + // The mouse has been released and the dropdown is still open + // INPUT_FLAG_DROPDOWN_STAY_OPEN is already set if this happens + INPUT_FLAG_DROPDOWN_MOUSE_UP = (1 << 2), INPUT_FLAG_TOOL_ACTIVE = (1 << 3), diff --git a/src/interface/viewport_interaction.c b/src/interface/viewport_interaction.c index 80dcc80ffe..0fd492a6d5 100644 --- a/src/interface/viewport_interaction.c +++ b/src/interface/viewport_interaction.c @@ -29,6 +29,7 @@ #include "../world/map.h" #include "../world/scenery.h" #include "../world/sprite.h" +#include "../input.h" #include "viewport.h" static void viewport_interaction_remove_scenery(rct_map_element *mapElement, int x, int y); @@ -264,7 +265,6 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info return info->type; } - if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & 0x48) != 0x48) if (window_find_by_class(WC_RIDE_CONSTRUCTION) == NULL && window_find_by_class(WC_FOOTPATH) == NULL) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; diff --git a/src/windows/banner.c b/src/windows/banner.c index 79100e79d4..76626d71cf 100644 --- a/src/windows/banner.c +++ b/src/windows/banner.c @@ -244,7 +244,7 @@ static void window_banner_mousedown(int widgetIndex, rct_window*w, rct_widget* w widget->top + w->y, widget->bottom - widget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 13, widget->right - widget->left - 3); diff --git a/src/windows/dropdown.c b/src/windows/dropdown.c index 0804d787d1..d993f2fd48 100644 --- a/src/windows/dropdown.c +++ b/src/windows/dropdown.c @@ -136,9 +136,9 @@ void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colo memcpy((void*)0x009DEBA4, gDropdownItemsFormat, 40 * 2); memcpy((void*)0x009DEBF4, gDropdownItemsArgs, 40 * 8); - RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(INPUT_FLAG_1 | INPUT_FLAG_2); - if (flags & 0x80) - RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_1; + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP); + if (flags & DROPDOWN_FLAG_STAY_OPEN) + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_DROPDOWN_STAY_OPEN; window_dropdown_close(); _dropdown_num_columns = 1; @@ -213,9 +213,9 @@ void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 fl memcpy((void*)0x009DEBA4, gDropdownItemsFormat, 40 * 2); memcpy((void*)0x009DEBF4, gDropdownItemsArgs, 40 * 8); - RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(INPUT_FLAG_1 | INPUT_FLAG_2); - if (flags & 0x80) - RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_1; + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP); + if (flags & DROPDOWN_FLAG_STAY_OPEN) + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_DROPDOWN_STAY_OPEN; // Close existing dropdown window_dropdown_close(); @@ -428,7 +428,7 @@ void window_dropdown_show_colour_available(rct_window *w, rct_widget *widget, ui w->y + widget->top, widget->bottom - widget->top + 1, dropdownColour, - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems, 12, 12, diff --git a/src/windows/dropdown.h b/src/windows/dropdown.h index 76370cd212..e2285714e2 100644 --- a/src/windows/dropdown.h +++ b/src/windows/dropdown.h @@ -25,6 +25,11 @@ #define DROPDOWN_SEPARATOR 0 +enum +{ + DROPDOWN_FLAG_STAY_OPEN = (1 << 7) +}; + extern int gAppropriateImageDropdownItemsPerRow[]; extern int gDropdownNumItems; diff --git a/src/windows/editor_objective_options.c b/src/windows/editor_objective_options.c index bc41e94f7a..fac111c1ae 100644 --- a/src/windows/editor_objective_options.c +++ b/src/windows/editor_objective_options.c @@ -507,7 +507,7 @@ static void window_editor_objective_options_show_objective_dropdown(rct_window * w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems, dropdownWidget->right - dropdownWidget->left - 3 ); @@ -537,7 +537,7 @@ static void window_editor_objective_options_show_climate_dropdown(rct_window *w) w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 4, dropdownWidget->right - dropdownWidget->left - 3 ); @@ -561,7 +561,7 @@ static void window_editor_objective_options_show_category_dropdown(rct_window *w w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 5, dropdownWidget->right - dropdownWidget->left - 3 ); diff --git a/src/windows/editor_scenario_options.c b/src/windows/editor_scenario_options.c index bbcdccbb80..9dbb05174f 100644 --- a/src/windows/editor_scenario_options.c +++ b/src/windows/editor_scenario_options.c @@ -1049,7 +1049,7 @@ static void window_editor_scenario_options_park_mousedown(int widgetIndex, rct_w w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top - 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 2, dropdownWidget->right - dropdownWidget->left - 3 ); diff --git a/src/windows/finances.c b/src/windows/finances.c index 5ba64652ef..bff2716d38 100644 --- a/src/windows/finances.c +++ b/src/windows/finances.c @@ -1375,7 +1375,7 @@ static void window_finances_research_mousedown(int widgetIndex, rct_window *w, r w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 4, dropdownWidget->right - dropdownWidget->left - 3 ); diff --git a/src/windows/guest.c b/src/windows/guest.c index ddc3496df2..e1c7af4e7e 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -33,6 +33,7 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "../world/footpath.h" +#include "../input.h" #include "dropdown.h" #include "error.h" @@ -555,7 +556,7 @@ void window_guest_overview_close(){ window_get_register(w); - if (RCT2_GLOBAL(0x9DE518,uint32) & (1<<3)){ + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE){ if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS,rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER,rct_windownumber)) tool_cancel(); @@ -645,7 +646,7 @@ void window_guest_overview_mouse_up(){ /* rct2: 0x696AA0 */ void window_guest_set_page(rct_window* w, int page){ - if (RCT2_GLOBAL(0x9DE518,uint32) & (1 << 3)) + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) { if(w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) && w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass)) diff --git a/src/windows/guest_list.c b/src/windows/guest_list.c index 856a8d59c4..4634aa33a6 100644 --- a/src/windows/guest_list.c +++ b/src/windows/guest_list.c @@ -339,7 +339,7 @@ static void window_guest_list_mousedown(int widgetIndex, rct_window*w, rct_widge w->y + widget->top, widget->bottom - widget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, _window_guest_list_num_pages, widget->right - widget->left - 3 ); @@ -363,7 +363,7 @@ static void window_guest_list_mousedown(int widgetIndex, rct_window*w, rct_widge w->y + widget->top, widget->bottom - widget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 2, widget->right - widget->left - 3 ); diff --git a/src/windows/map.c b/src/windows/map.c index 742f9e5809..bf6b64d0c4 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -319,8 +319,8 @@ static void window_map_mouseup() RCT2_GLOBAL(0x9E32D2, sint8) = 0; - if (!(RCT2_GLOBAL(0x9DE518, sint32) & (1 << 6))) // Remove? - RCT2_GLOBAL(0x9DE518, sint32) |= (1 << 6); + if (!(RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, sint32) & INPUT_FLAG_6)) // Remove? + RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, sint32) |= INPUT_FLAG_6; show_gridlines(); show_land_rights(); diff --git a/src/windows/new_campaign.c b/src/windows/new_campaign.c index 31e6a07263..e3d6e4c18d 100644 --- a/src/windows/new_campaign.c +++ b/src/windows/new_campaign.c @@ -273,7 +273,7 @@ static void window_new_campaign_mousedown(int widgetIndex, rct_window *w, rct_wi w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems, dropdownWidget->right - dropdownWidget->left - 3 ); @@ -295,7 +295,7 @@ static void window_new_campaign_mousedown(int widgetIndex, rct_window *w, rct_wi w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems, dropdownWidget->right - dropdownWidget->left - 3 ); diff --git a/src/windows/options.c b/src/windows/options.c index 782939dbb5..a4301b0619 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -866,7 +866,7 @@ static void window_options_show_dropdown(rct_window *w, rct_widget *widget, int w->y + widget->top, widget->bottom - widget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, num_items, widget->right - widget->left - 3 ); diff --git a/src/windows/research.c b/src/windows/research.c index 447d539788..e75ac0256f 100644 --- a/src/windows/research.c +++ b/src/windows/research.c @@ -472,7 +472,7 @@ static void window_research_funding_mousedown(int widgetIndex, rct_window *w, rc w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 4, dropdownWidget->right - dropdownWidget->left - 3 ); diff --git a/src/windows/ride.c b/src/windows/ride.c index a9a928512f..2e31744ec7 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -1697,7 +1697,7 @@ static void window_ride_show_view_dropdown(rct_window *w, rct_widget *widget) w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + 0, numItems, widget->right - dropdownWidget->left ); @@ -2308,7 +2308,7 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - dropdownWidget->left ); @@ -2321,7 +2321,7 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, ride->var_0CC, widget->right - dropdownWidget->left ); @@ -2343,7 +2343,7 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, maxCars - minCars + 1, widget->right - dropdownWidget->left ); @@ -2759,7 +2759,7 @@ static void window_ride_mode_dropdown(rct_window *w, rct_widget *widget) w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numAvailableModes, widget->right - dropdownWidget->left ); @@ -2791,7 +2791,7 @@ static void window_ride_load_dropdown(rct_window *w, rct_widget *widget) w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 5, widget->right - dropdownWidget->left ); @@ -3323,7 +3323,7 @@ static void window_ride_maintenance_mousedown(int widgetIndex, rct_window *w, rc w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 7, widget->right - dropdownWidget->left ); @@ -3676,7 +3676,7 @@ static void window_ride_colour_mousedown(int widgetIndex, rct_window *w, rct_wid w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 4, widget->right - dropdownWidget->left ); @@ -3703,7 +3703,7 @@ static void window_ride_colour_mousedown(int widgetIndex, rct_window *w, rct_wid w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 4, widget->right - dropdownWidget->left ); @@ -3725,7 +3725,7 @@ static void window_ride_colour_mousedown(int widgetIndex, rct_window *w, rct_wid w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, countof(window_ride_entrance_style_list), widget->right - dropdownWidget->left ); @@ -3743,7 +3743,7 @@ static void window_ride_colour_mousedown(int widgetIndex, rct_window *w, rct_wid w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, rideEntry->max_cars_in_train > 1 ? 3 : 2, widget->right - dropdownWidget->left ); @@ -3766,7 +3766,7 @@ static void window_ride_colour_mousedown(int widgetIndex, rct_window *w, rct_wid w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - dropdownWidget->left ); @@ -4337,7 +4337,7 @@ static void window_ride_music_mousedown(int widgetIndex, rct_window *w, rct_widg w->y + dropdownWidget->top, dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - dropdownWidget->left ); diff --git a/src/windows/ride_list.c b/src/windows/ride_list.c index 29b244ee63..329c6be84d 100644 --- a/src/windows/ride_list.c +++ b/src/windows/ride_list.c @@ -253,7 +253,15 @@ static void window_ride_list_mousedown(int widgetIndex, rct_window*w, rct_widget gDropdownItemsFormat[i] = 1142; gDropdownItemsArgs[i] = STR_STATUS + i; } - window_dropdown_show_text_custom_width(w->x + widget->left, w->y + widget->top, widget->bottom - widget->top, w->colours[1], 0x80, numItems, widget->right - widget->left - 3); + window_dropdown_show_text_custom_width( + w->x + widget->left, + w->y + widget->top, + widget->bottom - widget->top, + w->colours[1], + DROPDOWN_FLAG_STAY_OPEN, + numItems, + widget->right - widget->left - 3 + ); gDropdownItemsChecked |= (1 << _window_ride_list_information_type); } } diff --git a/src/windows/staff.c b/src/windows/staff.c index 7d4f3c6015..21bdf50562 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -30,6 +30,7 @@ #include "../world/footpath.h" #include "../world/sprite.h" #include "../world/scenery.h" +#include "../input.h" #include "dropdown.h" #include "error.h" @@ -375,7 +376,7 @@ void window_staff_overview_close() window_get_register(w); - if (RCT2_GLOBAL(0x9DE518, uint32) & (1 << 3)){ + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE){ if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)) tool_cancel(); @@ -388,7 +389,7 @@ void window_staff_overview_close() */ void window_staff_set_page(rct_window* w, int page) { - if (RCT2_GLOBAL(0x9DE518,uint32) & (1 << 3)) + if (RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) { if(w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) && w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass)) @@ -1356,7 +1357,7 @@ void window_staff_options_mousedown(int widgetIndex, rct_window* w, rct_widget* int y = widget->top + w->y; int extray = widget->bottom - widget->top + 1; int width = widget->right - widget->left - 3; - window_dropdown_show_text_custom_width(x, y, extray, w->colours[1], 0x80, no_entries, width); + window_dropdown_show_text_custom_width(x, y, extray, w->colours[1], DROPDOWN_FLAG_STAY_OPEN, no_entries, width); // See above note. gDropdownItemsChecked = item_checked; diff --git a/src/windows/title_menu.c b/src/windows/title_menu.c index c528527fc1..19c0cf3823 100644 --- a/src/windows/title_menu.c +++ b/src/windows/title_menu.c @@ -130,7 +130,7 @@ static void window_title_menu_mousedown(int widgetIndex, rct_window*w, rct_widge w->y + widget->top, widget->bottom - widget->top + 1, w->colours[0] | 0x80, - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 3 ); } else if (widgetIndex == WIDX_GAME_TOOLS) { @@ -143,7 +143,7 @@ static void window_title_menu_mousedown(int widgetIndex, rct_window*w, rct_widge w->y + widget->top, widget->bottom - widget->top + 1, w->colours[0] | 0x80, - 0x80, + DROPDOWN_FLAG_STAY_OPEN, 4 ); } diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 3807aa5474..5f5c543df2 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -347,7 +347,7 @@ static void window_top_toolbar_mousedown(int widgetIndex, rct_window*w, rct_widg w->y + widget->top, widget->bottom - widget->top + 1, w->colours[0] | 0x80, - 0x80, + DROPDOWN_FLAG_STAY_OPEN, numItems ); break;