diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 533fb5ddf3..25afd461ba 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -73,8 +73,8 @@ static void window_editor_inventions_list_mouseup(rct_window *w, rct_widgetindex static void window_editor_inventions_list_resize(rct_window *w); static void window_editor_inventions_list_update(rct_window *w); static void window_editor_inventions_list_scrollgetheight(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_editor_inventions_list_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_editor_inventions_list_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_editor_inventions_list_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_editor_inventions_list_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_editor_inventions_list_cursor(rct_window *w, rct_widgetindex widgetIndex, int32_t x, int32_t y, int32_t *cursorId); static void window_editor_inventions_list_invalidate(rct_window *w); static void window_editor_inventions_list_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -421,11 +421,11 @@ static void window_editor_inventions_list_scrollgetheight(rct_window* w, int32_t * * rct2: 0x006852D4 */ -static void window_editor_inventions_list_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_editor_inventions_list_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { ResearchItem* researchItem; - researchItem = window_editor_inventions_list_get_item_from_scroll_y(scrollIndex, y); + researchItem = window_editor_inventions_list_get_item_from_scroll_y(scrollIndex, screenCoords.y); if (researchItem == nullptr) return; @@ -441,11 +441,11 @@ static void window_editor_inventions_list_scrollmousedown(rct_window* w, int32_t * * rct2: 0x00685275 */ -static void window_editor_inventions_list_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_editor_inventions_list_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { ResearchItem* researchItem; - researchItem = window_editor_inventions_list_get_item_from_scroll_y(scrollIndex, y); + researchItem = window_editor_inventions_list_get_item_from_scroll_y(scrollIndex, screenCoords.y); if (researchItem != w->research_item) { w->research_item = researchItem; diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 873415afa9..069dc10eaf 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -176,8 +176,8 @@ static void window_editor_object_selection_mousedown(rct_window *w, rct_widgetin static void window_editor_object_selection_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex); static void window_editor_object_selection_update(rct_window *w); static void window_editor_object_selection_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_editor_object_selection_scroll_mousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_editor_object_selection_scroll_mouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_editor_object_selection_scroll_mousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_editor_object_selection_scroll_mouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_editor_object_selection_tooltip(rct_window* w, rct_widgetindex widgetIndex, rct_string_id *stringId); static void window_editor_object_selection_invalidate(rct_window *w); static void window_editor_object_selection_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -680,13 +680,13 @@ static void window_editor_object_selection_scrollgetsize(rct_window* w, int32_t * * rct2: 0x006AB0B6 */ -static void window_editor_object_selection_scroll_mousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_editor_object_selection_scroll_mousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { // Used for in-game object selection cheat to prevent crashing the game // when windows attempt to draw objects that don't exist any more window_close_all_except_class(WC_EDITOR_OBJECT_SELECTION); - int32_t selected_object = get_object_from_object_selection(get_selected_object_type(w), y); + int32_t selected_object = get_object_from_object_selection(get_selected_object_type(w), screenCoords.y); if (selected_object == -1) return; @@ -745,9 +745,9 @@ static void window_editor_object_selection_scroll_mousedown(rct_window* w, int32 * * rct2: 0x006AB079 */ -static void window_editor_object_selection_scroll_mouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_editor_object_selection_scroll_mouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - int32_t selectedObject = get_object_from_object_selection(get_selected_object_type(w), y); + int32_t selectedObject = get_object_from_object_selection(get_selected_object_type(w), screenCoords.y); if (selectedObject != -1) { list_item* listItem = &_listItems[selectedObject]; diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index f8aecd0e00..471e2118cb 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -131,8 +131,8 @@ static void window_editor_objective_options_rides_mouseup(rct_window *w, rct_wid static void window_editor_objective_options_rides_resize(rct_window *w); static void window_editor_objective_options_rides_update(rct_window *w); static void window_editor_objective_options_rides_scrollgetheight(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_editor_objective_options_rides_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_editor_objective_options_rides_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_editor_objective_options_rides_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_editor_objective_options_rides_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_editor_objective_options_rides_invalidate(rct_window *w); static void window_editor_objective_options_rides_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_editor_objective_options_rides_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -1066,9 +1066,10 @@ static void window_editor_objective_options_rides_scrollgetheight( * * rct2: 0x006724FC */ -static void window_editor_objective_options_rides_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_editor_objective_options_rides_scrollmousedown( + rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - auto i = y / 12; + auto i = screenCoords.y / 12; if (i < 0 || i >= w->no_list_items) return; @@ -1084,11 +1085,12 @@ static void window_editor_objective_options_rides_scrollmousedown(rct_window* w, * * rct2: 0x006724CC */ -static void window_editor_objective_options_rides_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_editor_objective_options_rides_scrollmouseover( + rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t i; - i = y / 12; + i = screenCoords.y / 12; if (i < 0 || i >= w->no_list_items) return; diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 6c7552861b..0e991917e7 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -162,8 +162,8 @@ static void window_guest_stats_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_guest_rides_update(rct_window *w); static void window_guest_rides_scroll_get_size(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_guest_rides_scroll_mouse_down(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_guest_rides_scroll_mouse_over(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_guest_rides_scroll_mouse_down(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_guest_rides_scroll_mouse_over(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_guest_rides_invalidate(rct_window *w); static void window_guest_rides_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_guest_rides_scroll_paint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -1631,11 +1631,11 @@ void window_guest_rides_scroll_get_size(rct_window* w, int32_t scrollIndex, int3 * * rct2: 0x006978CC */ -void window_guest_rides_scroll_mouse_down(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_guest_rides_scroll_mouse_down(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / 10; + index = screenCoords.y / 10; if (index >= w->no_list_items) return; @@ -1648,11 +1648,11 @@ void window_guest_rides_scroll_mouse_down(rct_window* w, int32_t scrollIndex, in * * rct2: 0x0069789C */ -void window_guest_rides_scroll_mouse_over(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_guest_rides_scroll_mouse_over(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / 10; + index = screenCoords.y / 10; if (index >= w->no_list_items) return; diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 23e4260b4e..5c42b1046d 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -97,8 +97,8 @@ static void window_guest_list_mousedown(rct_window *w, rct_widgetindex widgetInd static void window_guest_list_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex); static void window_guest_list_update(rct_window *w); static void window_guest_list_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_guest_list_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_guest_list_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_guest_list_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_guest_list_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_guest_list_invalidate(rct_window *w); static void window_guest_list_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -553,7 +553,7 @@ static void window_guest_list_scrollgetsize(rct_window* w, int32_t scrollIndex, * * rct2: 0x00699D7D */ -static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t i, spriteIndex; Peep* peep; @@ -561,7 +561,7 @@ static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex switch (_window_guest_list_selected_tab) { case PAGE_INDIVIDUAL: - i = y / SCROLLABLE_ROW_HEIGHT; + i = screenCoords.y / SCROLLABLE_ROW_HEIGHT; i += _window_guest_list_selected_page * GUESTS_PER_PAGE; FOR_ALL_GUESTS (spriteIndex, peep) { @@ -587,7 +587,7 @@ static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex } break; case PAGE_SUMMARISED: - i = y / SUMMARISED_GUEST_ROW_HEIGHT; + i = screenCoords.y / SUMMARISED_GUEST_ROW_HEIGHT; if (i < _window_guest_list_num_groups) { _window_guest_list_filter_arguments = _window_guest_list_groups_arguments[i]; @@ -605,11 +605,12 @@ static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex * * rct2: 0x00699D3B */ -static void window_guest_list_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_guest_list_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t i; - i = y / (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? SCROLLABLE_ROW_HEIGHT : SUMMARISED_GUEST_ROW_HEIGHT); + i = screenCoords.y + / (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? SCROLLABLE_ROW_HEIGHT : SUMMARISED_GUEST_ROW_HEIGHT); i += _window_guest_list_selected_page * GUESTS_PER_PAGE; if (i != _window_guest_list_highlighted_index) { diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index d4e9dc2c4e..ccf06d433b 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -84,8 +84,8 @@ static void window_loadsave_close(rct_window *w); static void window_loadsave_mouseup(rct_window *w, rct_widgetindex widgetIndex); static void window_loadsave_resize(rct_window *w); static void window_loadsave_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_loadsave_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_loadsave_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_loadsave_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_loadsave_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_loadsave_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text); static void window_loadsave_compute_max_date_width(); static void window_loadsave_invalidate(rct_window *w); @@ -527,11 +527,11 @@ static void window_loadsave_scrollgetsize(rct_window* w, int32_t scrollIndex, in *height = w->no_list_items * SCROLLABLE_ROW_HEIGHT; } -static void window_loadsave_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_loadsave_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t selectedItem; - selectedItem = y / SCROLLABLE_ROW_HEIGHT; + selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (selectedItem >= w->no_list_items) return; @@ -563,11 +563,11 @@ static void window_loadsave_scrollmousedown(rct_window* w, int32_t scrollIndex, } } -static void window_loadsave_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_loadsave_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t selectedItem; - selectedItem = y / SCROLLABLE_ROW_HEIGHT; + selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (selectedItem >= w->no_list_items) return; diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 88c364ded2..cd312ae30f 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -128,7 +128,7 @@ static void window_map_tooldown(rct_window* w, rct_widgetindex widgetIndex, Scre static void window_map_tooldrag(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords); static void window_map_toolabort(rct_window *w, rct_widgetindex widgetIndex); static void window_map_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_map_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_map_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_map_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text); static void window_map_invalidate(rct_window *w); static void window_map_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -196,7 +196,7 @@ static void map_window_increase_map_size(); static void map_window_decrease_map_size(); static void map_window_set_pixels(rct_window* w); -static CoordsXY map_window_screen_to_map(int32_t screenX, int32_t screenY); +static CoordsXY map_window_screen_to_map(ScreenCoordsXY screenCoords); /** * @@ -561,12 +561,12 @@ static void window_map_scrollgetsize(rct_window* w, int32_t scrollIndex, int32_t * * rct2: 0x0068D726 */ -static void window_map_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_map_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - CoordsXY c = map_window_screen_to_map(x, y); + CoordsXY c = map_window_screen_to_map(screenCoords); int32_t mapX = std::clamp(c.x, 0, MAXIMUM_MAP_SIZE_TECHNICAL * 32 - 1); int32_t mapY = std::clamp(c.y, 0, MAXIMUM_MAP_SIZE_TECHNICAL * 32 - 1); - int32_t mapZ = tile_element_height({ x, y }); + int32_t mapZ = tile_element_height({ screenCoords.x, screenCoords.y }); rct_window* mainWindow = window_get_main(); if (mainWindow != nullptr) @@ -1681,12 +1681,12 @@ static void map_window_set_pixels(rct_window* w) _currentLine = 0; } -static CoordsXY map_window_screen_to_map(int32_t screenX, int32_t screenY) +static CoordsXY map_window_screen_to_map(ScreenCoordsXY screenCoords) { - screenX = ((screenX + 8) - MAXIMUM_MAP_SIZE_TECHNICAL) / 2; - screenY = ((screenY + 8)) / 2; - int32_t x = (screenY - screenX) * 32; - int32_t y = (screenX + screenY) * 32; + screenCoords.x = ((screenCoords.x + 8) - MAXIMUM_MAP_SIZE_TECHNICAL) / 2; + screenCoords.y = ((screenCoords.y + 8)) / 2; + int32_t x = (screenCoords.y - screenCoords.x) * 32; + int32_t y = (screenCoords.x + screenCoords.y) * 32; switch (get_current_rotation()) { diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index f33b7167d5..02ca9b7984 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -136,8 +136,8 @@ static void window_multiplayer_players_mouseup(rct_window *w, rct_widgetindex wi static void window_multiplayer_players_resize(rct_window *w); static void window_multiplayer_players_update(rct_window *w); static void window_multiplayer_players_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_multiplayer_players_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_multiplayer_players_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_multiplayer_players_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_multiplayer_players_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_multiplayer_players_invalidate(rct_window *w); static void window_multiplayer_players_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_multiplayer_players_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -148,8 +148,8 @@ static void window_multiplayer_groups_mousedown(rct_window *w, rct_widgetindex w static void window_multiplayer_groups_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex); static void window_multiplayer_groups_update(rct_window *w); static void window_multiplayer_groups_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_multiplayer_groups_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_multiplayer_groups_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_multiplayer_groups_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_multiplayer_groups_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_multiplayer_groups_text_input(rct_window *w, rct_widgetindex widgetIndex, char *text); static void window_multiplayer_groups_invalidate(rct_window *w); static void window_multiplayer_groups_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -591,11 +591,11 @@ static void window_multiplayer_players_scrollgetsize(rct_window* w, int32_t scro } } -static void window_multiplayer_players_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_multiplayer_players_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / SCROLLABLE_ROW_HEIGHT; + index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (index >= w->no_list_items) return; @@ -605,11 +605,11 @@ static void window_multiplayer_players_scrollmousedown(rct_window* w, int32_t sc window_player_open(network_get_player_id(index)); } -static void window_multiplayer_players_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_multiplayer_players_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / SCROLLABLE_ROW_HEIGHT; + index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (index >= w->no_list_items) return; @@ -836,11 +836,11 @@ static void window_multiplayer_groups_scrollgetsize(rct_window* w, int32_t scrol } } -static void window_multiplayer_groups_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_multiplayer_groups_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / SCROLLABLE_ROW_HEIGHT; + index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (index >= w->no_list_items) return; @@ -852,11 +852,11 @@ static void window_multiplayer_groups_scrollmousedown(rct_window* w, int32_t scr GameActions::Execute(&networkModifyGroup); } -static void window_multiplayer_groups_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_multiplayer_groups_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / SCROLLABLE_ROW_HEIGHT; + index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (index >= w->no_list_items) return; diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 6815ce2c11..efb571db29 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -207,8 +207,8 @@ static void window_new_ride_mouseup(rct_window *w, rct_widgetindex widgetIndex); static void window_new_ride_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget *widget); static void window_new_ride_update(rct_window *w); static void window_new_ride_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_new_ride_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_new_ride_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_new_ride_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_new_ride_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_new_ride_invalidate(rct_window *w); static void window_new_ride_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_new_ride_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -264,7 +264,7 @@ static constexpr const int32_t window_new_ride_tab_animation_divisor[] = { 4, 8, static void window_new_ride_set_page(rct_window* w, int32_t page); static void window_new_ride_refresh_widget_sizing(rct_window* w); -static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window* w, int32_t x, int32_t y); +static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window* w, ScreenCoordsXY screenCoords); static void window_new_ride_paint_ride_information( rct_window* w, rct_drawpixelinfo* dpi, ride_list_item item, int32_t x, int32_t y, int32_t width); static void window_new_ride_select(rct_window* w); @@ -763,11 +763,11 @@ static void window_new_ride_scrollgetsize(rct_window* w, int32_t scrollIndex, in * * rct2: 0x006B6C89 */ -static void window_new_ride_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_new_ride_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { ride_list_item item; - item = window_new_ride_scroll_get_ride_list_item_at(w, x, y); + item = window_new_ride_scroll_get_ride_list_item_at(w, screenCoords); if (item.type == RIDE_TYPE_NULL && item.entry_index == RIDE_ENTRY_INDEX_NULL) return; @@ -783,14 +783,14 @@ static void window_new_ride_scrollmousedown(rct_window* w, int32_t scrollIndex, * * rct2: 0x006B6C51 */ -static void window_new_ride_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_new_ride_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { ride_list_item item; if (w->new_ride.selected_ride_id != -1) return; - item = window_new_ride_scroll_get_ride_list_item_at(w, x, y); + item = window_new_ride_scroll_get_ride_list_item_at(w, screenCoords); if (w->new_ride.highlighted_ride_id == item.ride_type_and_entry) return; @@ -903,17 +903,17 @@ static void window_new_ride_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i * * rct2: 0x006B6D3C */ -static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window* w, int32_t x, int32_t y) +static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window* w, ScreenCoordsXY screenCoords) { ride_list_item result; result.type = RIDE_TYPE_NULL; result.entry_index = RIDE_ENTRY_INDEX_NULL; - if (--x < 0 || --y < 0) + if (--screenCoords.x < 0 || --screenCoords.y < 0) return result; - int32_t column = x / 116; - int32_t row = y / 116; + int32_t column = screenCoords.x / 116; + int32_t row = screenCoords.y / 116; if (column >= 5) return result; diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 7eb4eb35b2..ecd6f4cdb3 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -40,7 +40,7 @@ static rct_widget window_news_widgets[] = { static void window_news_mouseup(rct_window *w, rct_widgetindex widgetIndex); static void window_news_update(rct_window *w); static void window_news_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_news_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_news_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_news_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -199,7 +199,7 @@ static void window_news_scrollgetsize(rct_window* w, int32_t scrollIndex, int32_ * * rct2: 0x0066EA5C */ -static void window_news_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_news_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t itemHeight = window_news_get_item_height(); int32_t i, buttonIndex; @@ -210,26 +210,26 @@ static void window_news_scrollmousedown(rct_window* w, int32_t scrollIndex, int3 if (news_item_is_empty(i)) break; - if (y < itemHeight) + if (screenCoords.y < itemHeight) { NewsItem* const newsItem = news_item_get(i); - if (newsItem->Flags & NEWS_FLAG_HAS_BUTTON || y < 14 || y >= 38 || x < 328) + if (newsItem->Flags & NEWS_FLAG_HAS_BUTTON || screenCoords.y < 14 || screenCoords.y >= 38 || screenCoords.x < 328) { buttonIndex = 0; break; } - else if (x < 351 && news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_SUBJECT) + else if (screenCoords.x < 351 && news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_SUBJECT) { buttonIndex = 1; break; } - else if (x < 376 && news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_LOCATION) + else if (screenCoords.x < 376 && news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_LOCATION) { buttonIndex = 2; break; } } - y -= itemHeight; + screenCoords.y -= itemHeight; } if (buttonIndex != 0) diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index 84fbecbcc8..9cd93d4af9 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -291,8 +291,8 @@ static void window_object_load_error_close(rct_window *w); static void window_object_load_error_update(rct_window *w); static void window_object_load_error_mouseup(rct_window *w, rct_widgetindex widgetIndex); static void window_object_load_error_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_object_load_error_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_object_load_error_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_object_load_error_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_object_load_error_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_object_load_error_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_object_load_error_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); #ifndef DISABLE_HTTP @@ -519,11 +519,11 @@ static void window_object_load_error_mouseup(rct_window* w, rct_widgetindex widg } } -static void window_object_load_error_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_object_load_error_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { // Highlight item that the cursor is over, or remove highlighting if none int32_t selected_item; - selected_item = y / SCROLLABLE_ROW_HEIGHT; + selected_item = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (selected_item < 0 || selected_item >= w->no_list_items) highlighted_index = -1; else @@ -545,10 +545,10 @@ static void window_object_load_error_select_element_from_list(rct_window* w, int widget_invalidate(w, WIDX_SCROLL); } -static void window_object_load_error_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_object_load_error_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t selected_item; - selected_item = y / SCROLLABLE_ROW_HEIGHT; + selected_item = screenCoords.y / SCROLLABLE_ROW_HEIGHT; window_object_load_error_select_element_from_list(w, selected_item); } diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 08e341fe75..a528599c57 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -77,8 +77,8 @@ static void window_ride_list_mousedown(rct_window *w, rct_widgetindex widgetInde static void window_ride_list_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex); static void window_ride_list_update(rct_window *w); static void window_ride_list_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_ride_list_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_ride_list_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_ride_list_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_ride_list_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_ride_list_invalidate(rct_window *w); static void window_ride_list_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_ride_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -442,11 +442,11 @@ static void window_ride_list_scrollgetsize(rct_window* w, int32_t scrollIndex, i * * rct2: 0x006B361F */ -static void window_ride_list_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_ride_list_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / SCROLLABLE_ROW_HEIGHT; + index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (index >= w->no_list_items) return; @@ -470,11 +470,11 @@ static void window_ride_list_scrollmousedown(rct_window* w, int32_t scrollIndex, * * rct2: 0x006B35EF */ -static void window_ride_list_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_ride_list_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t index; - index = y / SCROLLABLE_ROW_HEIGHT; + index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (index >= w->no_list_items) return; diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 3f09049407..57b673690a 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -64,8 +64,8 @@ static void window_scenery_dropdown(rct_window *w, rct_widgetindex widgetIndex, static void window_scenery_update(rct_window *w); static void window_scenery_periodic_update(rct_window *w); static void window_scenery_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_scenery_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_scenery_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_scenery_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_scenery_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_scenery_tooltip(rct_window* w, rct_widgetindex widgetIndex, rct_string_id *stringId); static void window_scenery_invalidate(rct_window *w); static void window_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -855,9 +855,9 @@ void window_scenery_scrollgetsize(rct_window* w, int32_t scrollIndex, int32_t* w *height = window_scenery_rows_height(rows); } -static uint16_t get_scenery_id_by_cursor_pos(int16_t x, int16_t y) +static uint16_t get_scenery_id_by_cursor_pos(ScreenCoordsXY screenCoords) { - int32_t tabSceneryIndex = x / SCENERY_BUTTON_WIDTH + (y / SCENERY_BUTTON_HEIGHT) * 9; + int32_t tabSceneryIndex = screenCoords.x / SCENERY_BUTTON_WIDTH + (screenCoords.y / SCENERY_BUTTON_HEIGHT) * 9; uint8_t tabIndex = gWindowSceneryActiveTabIndex; int32_t itemCounter = 0; @@ -878,9 +878,9 @@ static uint16_t get_scenery_id_by_cursor_pos(int16_t x, int16_t y) * * rct2: 0x006E1C4A */ -void window_scenery_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_scenery_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - uint16_t sceneryId = get_scenery_id_by_cursor_pos(x, y); + uint16_t sceneryId = get_scenery_id_by_cursor_pos(screenCoords); if (sceneryId == WINDOW_SCENERY_TAB_SELECTION_UNDEFINED) return; @@ -899,9 +899,9 @@ void window_scenery_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t * * rct2: 0x006E1BB8 */ -void window_scenery_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_scenery_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - uint16_t sceneryId = get_scenery_id_by_cursor_pos(x, y); + uint16_t sceneryId = get_scenery_id_by_cursor_pos(screenCoords); if (sceneryId != WINDOW_SCENERY_TAB_SELECTION_UNDEFINED) { w->scenery.selected_scenery_id = sceneryId; diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 85149d150a..ec62fa2041 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -76,8 +76,8 @@ static void window_server_list_resize(rct_window *w); static void window_server_list_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex); static void window_server_list_update(rct_window *w); static void window_server_list_scroll_getsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_server_list_scroll_mousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_server_list_scroll_mouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_server_list_scroll_mousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_server_list_scroll_mouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_server_list_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text); static void window_server_list_invalidate(rct_window *w); static void window_server_list_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -265,7 +265,7 @@ static void window_server_list_scroll_getsize(rct_window* w, int32_t scrollIndex *height = w->no_list_items * ITEM_HEIGHT; } -static void window_server_list_scroll_mousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_server_list_scroll_mousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t serverIndex = w->selected_list_item; if (serverIndex >= 0 && serverIndex < (int32_t)_serverList.GetCount()) @@ -273,8 +273,8 @@ static void window_server_list_scroll_mousedown(rct_window* w, int32_t scrollInd const auto& server = _serverList.GetServer(serverIndex); auto listWidget = &w->widgets[WIDX_LIST]; - int32_t ddx = w->x + listWidget->left + x + 2 - w->scrolls[0].h_left; - int32_t ddy = w->y + listWidget->top + y + 2 - w->scrolls[0].v_top; + int32_t ddx = w->x + listWidget->left + screenCoords.x + 2 - w->scrolls[0].h_left; + int32_t ddy = w->y + listWidget->top + screenCoords.y + 2 - w->scrolls[0].v_top; gDropdownItemsFormat[0] = STR_JOIN_GAME; if (server.favourite) @@ -289,10 +289,10 @@ static void window_server_list_scroll_mousedown(rct_window* w, int32_t scrollInd } } -static void window_server_list_scroll_mouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_server_list_scroll_mouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { // Item - int32_t index = y / ITEM_HEIGHT; + int32_t index = screenCoords.y / ITEM_HEIGHT; if (index < 0 || index >= w->no_list_items) { index = -1; @@ -308,7 +308,7 @@ static void window_server_list_scroll_mouseover(rct_window* w, int32_t scrollInd int32_t bx, by; server_list_get_item_button(i, 0, sy, width, &bx, &by); - if (x >= bx && y >= by && x < bx + 24 && y < by + 24) + if (screenCoords.x >= bx && screenCoords.y >= by && screenCoords.x < bx + 24 && screenCoords.y < by + 24) { hoverButtonIndex = i; break; @@ -318,7 +318,7 @@ static void window_server_list_scroll_mouseover(rct_window* w, int32_t scrollInd int32_t width = w->widgets[WIDX_LIST].right - w->widgets[WIDX_LIST].left; int32_t right = width - 3 - 14 - 10; - if (x < right) + if (screenCoords.x < right) { w->widgets[WIDX_LIST].tooltip = STR_NONE; window_tooltip_close(); diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index 9854f47268..866ed34ccf 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -45,8 +45,8 @@ static void window_shortcut_resize(rct_window *w); static void window_shortcut_invalidate(rct_window *w); static void window_shortcut_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_shortcut_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_shortcut_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_shortcut_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_shortcut_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_shortcut_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); static rct_window_event_list window_shortcut_events = { @@ -238,9 +238,9 @@ static void window_shortcut_scrollgetsize(rct_window* w, int32_t scrollIndex, in * * rct2: 0x006E3A3E */ -static void window_shortcut_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_shortcut_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - int32_t selected_item = (y - 1) / SCROLLABLE_ROW_HEIGHT; + int32_t selected_item = (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT; if (selected_item >= w->no_list_items) return; @@ -251,9 +251,9 @@ static void window_shortcut_scrollmousedown(rct_window* w, int32_t scrollIndex, * * rct2: 0x006E3A16 */ -static void window_shortcut_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_shortcut_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - int32_t selected_item = (y - 1) / SCROLLABLE_ROW_HEIGHT; + int32_t selected_item = (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT; if (selected_item >= w->no_list_items) return; diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 9f0d95ba31..c35228372e 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -48,8 +48,8 @@ static void window_staff_list_update(rct_window *w); static void window_staff_list_tooldown(rct_window *w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords); static void window_staff_list_toolabort(rct_window *w, rct_widgetindex widgetIndex); static void window_staff_list_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_staff_list_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_staff_list_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_staff_list_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_staff_list_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_staff_list_invalidate(rct_window *w); static void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_staff_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -453,12 +453,12 @@ void window_staff_list_scrollgetsize(rct_window* w, int32_t scrollIndex, int32_t * * rct2: 0x006BDC9A */ -void window_staff_list_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_staff_list_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t i, spriteIndex; Peep* peep; - i = y / SCROLLABLE_ROW_HEIGHT; + i = screenCoords.y / SCROLLABLE_ROW_HEIGHT; FOR_ALL_STAFF (spriteIndex, peep) { if (peep->staff_type != _windowStaffListSelectedTab) @@ -488,11 +488,11 @@ void window_staff_list_scrollmousedown(rct_window* w, int32_t scrollIndex, int32 * * rct2: 0x006BDC6B */ -void window_staff_list_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_staff_list_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { int32_t i; - i = y / SCROLLABLE_ROW_HEIGHT; + i = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (i != _windowStaffListHighlightedIndex) { _windowStaffListHighlightedIndex = i; diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 23ca6433e3..a4faba8051 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -41,8 +41,8 @@ static void window_themes_mousedown(rct_window *w, rct_widgetindex widgetIndex, static void window_themes_dropdown(rct_window *w, rct_widgetindex widgetIndex, int32_t dropdownIndex); static void window_themes_update(rct_window *w); static void window_themes_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_themes_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_themes_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_themes_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_themes_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_themes_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text); static void window_themes_invalidate(rct_window *w); static void window_themes_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -635,19 +635,20 @@ void window_themes_scrollgetsize(rct_window* w, int32_t scrollIndex, int32_t* wi *height = scrollHeight; } -void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - if (y / _row_height < get_colour_scheme_tab_count()) + if (screenCoords.y / _row_height < get_colour_scheme_tab_count()) { - int32_t y2 = y % _row_height; - _colour_index_1 = y / _row_height; - _colour_index_2 = ((x - _button_offset_x) / 12); + int32_t y2 = screenCoords.y % _row_height; + _colour_index_1 = screenCoords.y / _row_height; + _colour_index_2 = ((screenCoords.x - _button_offset_x) / 12); rct_windowclass wc = get_window_class_tab_index(_colour_index_1); int32_t numColours = theme_desc_get_num_colours(wc); if (_colour_index_2 < numColours) { - if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y && y2 < _button_offset_y + 11) + if (screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y + && y2 < _button_offset_y + 11) { if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) { @@ -673,7 +674,7 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x } } else if ( - x >= _button_offset_x && x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y + screenCoords.x >= _button_offset_x && screenCoords.x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y && y2 < _check_offset_y + 11) { if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) @@ -700,7 +701,7 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x } } -void window_themes_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +void window_themes_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { // if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS) // return; diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 89ed98bc43..f8bfb9cbc0 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -461,8 +461,8 @@ static void window_tile_inspector_update_selected_tile(rct_window* w, int32_t x, static void window_tile_inspector_tool_down(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords); static void window_tile_inspector_tool_drag(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords); static void window_tile_inspector_scrollgetsize(rct_window* w, int32_t scrollIndex, int32_t* width, int32_t* height); -static void window_tile_inspector_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_tile_inspector_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_tile_inspector_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_tile_inspector_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_tile_inspector_invalidate(rct_window* w); static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi); static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex); @@ -1350,16 +1350,16 @@ static void window_tile_inspector_set_page(rct_window* w, const TILE_INSPECTOR_P w->pressed_widgets = 0; } -static void window_tile_inspector_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_tile_inspector_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { // Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements - const int16_t index = windowTileInspectorElementCount - (y - 1) / SCROLLABLE_ROW_HEIGHT - 1; + const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1; window_tile_inspector_select_element_from_list(w, index); } -static void window_tile_inspector_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_tile_inspector_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - int16_t index = windowTileInspectorElementCount - (y - 1) / SCROLLABLE_ROW_HEIGHT - 1; + int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1; if (index < 0 || index >= windowTileInspectorElementCount) windowTileInspectorHighlightedIndex = -1; else diff --git a/src/openrct2-ui/windows/TitleEditor.cpp b/src/openrct2-ui/windows/TitleEditor.cpp index c47cf68869..daacbd22f8 100644 --- a/src/openrct2-ui/windows/TitleEditor.cpp +++ b/src/openrct2-ui/windows/TitleEditor.cpp @@ -47,8 +47,8 @@ static void window_title_editor_mousedown(rct_window * w, rct_widgetindex widget static void window_title_editor_dropdown(rct_window * w, rct_widgetindex widgetIndex, int32_t dropdownIndex); static void window_title_editor_update(rct_window * w); static void window_title_editor_scrollgetsize(rct_window * w, int32_t scrollIndex, int32_t * width, int32_t * height); -static void window_title_editor_scrollmousedown(rct_window * w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_title_editor_scrollmouseover(rct_window * w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_title_editor_scrollmousedown(rct_window * w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_title_editor_scrollmouseover(rct_window * w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_title_editor_textinput(rct_window * w, rct_widgetindex widgetIndex, char * text); static void window_title_editor_invalidate(rct_window * w); static void window_title_editor_paint(rct_window * w, rct_drawpixelinfo * dpi); @@ -616,9 +616,9 @@ static void window_title_editor_scrollgetsize(rct_window* w, int32_t scrollIndex *width = SCROLL_WIDTH; } -static void window_title_editor_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_title_editor_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - int32_t index = y / SCROLLABLE_ROW_HEIGHT; + int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; w->selected_list_item = -1; switch (w->selected_tab) { @@ -639,9 +639,9 @@ static void window_title_editor_scrollmousedown(rct_window* w, int32_t scrollInd } } -static void window_title_editor_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_title_editor_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { - int32_t index = y / SCROLLABLE_ROW_HEIGHT; + int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; switch (w->selected_tab) { case WINDOW_TITLE_EDITOR_TAB_SAVES: diff --git a/src/openrct2-ui/windows/TitleScenarioSelect.cpp b/src/openrct2-ui/windows/TitleScenarioSelect.cpp index 74d4162631..2a0803531f 100644 --- a/src/openrct2-ui/windows/TitleScenarioSelect.cpp +++ b/src/openrct2-ui/windows/TitleScenarioSelect.cpp @@ -102,8 +102,8 @@ static void window_scenarioselect_close(rct_window *w); static void window_scenarioselect_mouseup(rct_window *w, rct_widgetindex widgetIndex); static void window_scenarioselect_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget* widget); static void window_scenarioselect_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_scenarioselect_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_scenarioselect_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_scenarioselect_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_scenarioselect_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_scenarioselect_invalidate(rct_window *w); static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi); static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int32_t scrollIndex); @@ -325,7 +325,7 @@ static void window_scenarioselect_scrollgetsize(rct_window* w, int32_t scrollInd * * rct2: 0x6780FE */ -static void window_scenarioselect_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_scenarioselect_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { const int32_t scenarioItemHeight = get_scenario_list_item_size(); @@ -334,11 +334,11 @@ static void window_scenarioselect_scrollmousedown(rct_window* w, int32_t scrollI switch (listItem.type) { case LIST_ITEM_TYPE::HEADING: - y -= 18; + screenCoords.y -= 18; break; case LIST_ITEM_TYPE::SCENARIO: - y -= scenarioItemHeight; - if (y < 0 && !listItem.scenario.is_locked) + screenCoords.y -= scenarioItemHeight; + if (screenCoords.y < 0 && !listItem.scenario.is_locked) { audio_play_sound(SoundId::Click1, 0, w->x + (w->width / 2)); gFirstTimeSaving = true; @@ -350,7 +350,7 @@ static void window_scenarioselect_scrollmousedown(rct_window* w, int32_t scrollI } break; } - if (y < 0) + if (screenCoords.y < 0) { break; } @@ -361,7 +361,7 @@ static void window_scenarioselect_scrollmousedown(rct_window* w, int32_t scrollI * * rct2: 0x678162 */ -static void window_scenarioselect_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_scenarioselect_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { const int32_t scenarioItemHeight = get_scenario_list_item_size(); @@ -373,11 +373,11 @@ static void window_scenarioselect_scrollmouseover(rct_window* w, int32_t scrollI switch (listItem.type) { case LIST_ITEM_TYPE::HEADING: - y -= 18; + screenCoords.y -= 18; break; case LIST_ITEM_TYPE::SCENARIO: - y -= scenarioItemHeight; - if (y < 0) + screenCoords.y -= scenarioItemHeight; + if (screenCoords.y < 0) { if (listItem.scenario.is_locked) { @@ -390,7 +390,7 @@ static void window_scenarioselect_scrollmouseover(rct_window* w, int32_t scrollI } break; } - if (y < 0) + if (screenCoords.y < 0) { break; } diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 332066bdca..59311917a6 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -58,8 +58,8 @@ static void window_track_list_close(rct_window *w); static void window_track_list_mouseup(rct_window *w, rct_widgetindex widgetIndex); static void window_track_list_update(rct_window *w); static void window_track_list_scrollgetsize(rct_window *w, int32_t scrollIndex, int32_t *width, int32_t *height); -static void window_track_list_scrollmousedown(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); -static void window_track_list_scrollmouseover(rct_window *w, int32_t scrollIndex, int32_t x, int32_t y); +static void window_track_list_scrollmousedown(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); +static void window_track_list_scrollmouseover(rct_window *w, int32_t scrollIndex, ScreenCoordsXY screenCoords); static void window_track_list_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text); static void window_track_list_invalidate(rct_window *w); static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -285,7 +285,7 @@ static void window_track_list_select(rct_window* w, int32_t listIndex) } } -static int32_t window_track_list_get_list_item_index_from_position(int32_t x, int32_t y) +static int32_t window_track_list_get_list_item_index_from_position(ScreenCoordsXY screenCoords) { size_t maxItems = _filteredTrackIds.size(); if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) @@ -294,7 +294,7 @@ static int32_t window_track_list_get_list_item_index_from_position(int32_t x, in maxItems++; } - int32_t index = y / SCROLLABLE_ROW_HEIGHT; + int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT; if (index < 0 || (uint32_t)index >= maxItems) { index = -1; @@ -372,11 +372,11 @@ static void window_track_list_scrollgetsize(rct_window* w, int32_t scrollIndex, * * rct2: 0x006CFB39 */ -static void window_track_list_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_track_list_scrollmousedown(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { if (!w->track_list.track_list_being_updated) { - int32_t i = window_track_list_get_list_item_index_from_position(x, y); + int32_t i = window_track_list_get_list_item_index_from_position(screenCoords); if (i != -1) { window_track_list_select(w, i); @@ -388,11 +388,11 @@ static void window_track_list_scrollmousedown(rct_window* w, int32_t scrollIndex * * rct2: 0x006CFAD7 */ -static void window_track_list_scrollmouseover(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) +static void window_track_list_scrollmouseover(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { if (!w->track_list.track_list_being_updated) { - int32_t i = window_track_list_get_list_item_index_from_position(x, y); + int32_t i = window_track_list_get_list_item_index_from_position(screenCoords); if (i != -1 && w->selected_list_item != i) { w->selected_list_item = i; diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 27f4c48ced..5678335e47 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -1481,19 +1481,19 @@ void window_get_scroll_size(rct_window* w, int32_t scrollIndex, int32_t* width, void window_event_scroll_mousedown_call(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { if (w->event_handlers->scroll_mousedown != nullptr) - w->event_handlers->scroll_mousedown(w, scrollIndex, screenCoords.x, screenCoords.y); + w->event_handlers->scroll_mousedown(w, scrollIndex, screenCoords); } void window_event_scroll_mousedrag_call(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { if (w->event_handlers->scroll_mousedrag != nullptr) - w->event_handlers->scroll_mousedrag(w, scrollIndex, screenCoords.x, screenCoords.y); + w->event_handlers->scroll_mousedrag(w, scrollIndex, screenCoords); } void window_event_scroll_mouseover_call(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords) { if (w->event_handlers->scroll_mouseover != nullptr) - w->event_handlers->scroll_mouseover(w, scrollIndex, screenCoords.x, screenCoords.y); + w->event_handlers->scroll_mouseover(w, scrollIndex, screenCoords); } void window_event_textinput_call(rct_window* w, rct_widgetindex widgetIndex, char* text) diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 37ab4a788e..4f81b8bb11 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -187,9 +187,9 @@ struct rct_window_event_list void (*tool_abort)(struct rct_window*, rct_widgetindex); void (*unknown_0E)(struct rct_window*); void (*get_scroll_size)(struct rct_window*, int32_t, int32_t*, int32_t*); - void (*scroll_mousedown)(struct rct_window*, int32_t, int32_t, int32_t); - void (*scroll_mousedrag)(struct rct_window*, int32_t, int32_t, int32_t); - void (*scroll_mouseover)(struct rct_window*, int32_t, int32_t, int32_t); + void (*scroll_mousedown)(struct rct_window*, int32_t, ScreenCoordsXY); + void (*scroll_mousedrag)(struct rct_window*, int32_t, ScreenCoordsXY); + void (*scroll_mouseover)(struct rct_window*, int32_t, ScreenCoordsXY); void (*text_input)(struct rct_window*, rct_widgetindex, char*); void (*viewport_rotate)(struct rct_window*); void (*unknown_15)(struct rct_window*, int32_t, int32_t);