mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use ScreenCoordsXY for window functions (#10086)
* Use ScreenCoordsXY for window_create function * Use ScreenCoordsXY for window_find_from_point function * Use ScreenCoordsXY for window_find_widget_from_point * Use ScreenCoordsXY for ride_contruction_tool* * Use ScreenCoordsXY for window_event_tool* * Use ScreenCoordsXY for window_event_scroll_mouse* * Use ScreenCoordsXY for remaining window_event* * Use ScreenCoordsXY for window_(set|move)_position
This commit is contained in:
parent
c3e14328f1
commit
ce1f38da25
|
@ -278,8 +278,8 @@ static void game_handle_input_mouse(int32_t x, int32_t y, int32_t state)
|
|||
rct_widgetindex widgetIndex;
|
||||
|
||||
// Get window and widget under cursor position
|
||||
w = window_find_from_point(x, y);
|
||||
widgetIndex = w == nullptr ? -1 : window_find_widget_from_point(w, x, y);
|
||||
w = window_find_from_point(ScreenCoordsXY(x, y));
|
||||
widgetIndex = w == nullptr ? -1 : window_find_widget_from_point(w, ScreenCoordsXY(x, y));
|
||||
widget = widgetIndex == -1 ? nullptr : &w->widgets[widgetIndex];
|
||||
|
||||
switch (_inputState)
|
||||
|
@ -387,7 +387,7 @@ static void game_handle_input_mouse(int32_t x, int32_t y, int32_t state)
|
|||
break;
|
||||
}
|
||||
|
||||
window_event_tool_drag_call(w, gCurrentToolWidget.widget_index, x, y);
|
||||
window_event_tool_drag_call(w, gCurrentToolWidget.widget_index, ScreenCoordsXY(x, y));
|
||||
break;
|
||||
case MOUSE_STATE_LEFT_RELEASE:
|
||||
_inputState = INPUT_STATE_RESET;
|
||||
|
@ -399,7 +399,7 @@ static void game_handle_input_mouse(int32_t x, int32_t y, int32_t state)
|
|||
gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
window_event_tool_up_call(w, gCurrentToolWidget.widget_index, x, y);
|
||||
window_event_tool_up_call(w, gCurrentToolWidget.widget_index, ScreenCoordsXY(x, y));
|
||||
}
|
||||
}
|
||||
else if (!(_inputFlags & INPUT_FLAG_4))
|
||||
|
@ -462,7 +462,7 @@ static void input_window_position_continue(rct_window* w, int32_t lastX, int32_t
|
|||
int32_t snapProximity;
|
||||
|
||||
snapProximity = (w->flags & WF_NO_SNAPPING) ? 0 : gConfigGeneral.window_snap_proximity;
|
||||
window_move_and_snap(w, newX - lastX, newY - lastY, snapProximity);
|
||||
window_move_and_snap(w, ScreenCoordsXY(newX - lastX, newY - lastY), snapProximity);
|
||||
}
|
||||
|
||||
static void input_window_position_end(rct_window* w, int32_t x, int32_t y)
|
||||
|
@ -470,7 +470,7 @@ static void input_window_position_end(rct_window* w, int32_t x, int32_t y)
|
|||
_inputState = INPUT_STATE_NORMAL;
|
||||
gTooltipTimeout = 0;
|
||||
gTooltipWidget = _dragWidget;
|
||||
window_event_moved_call(w, x, y);
|
||||
window_event_moved_call(w, ScreenCoordsXY(x, y));
|
||||
}
|
||||
|
||||
static void input_window_resize_begin(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
||||
|
@ -620,7 +620,7 @@ static void input_scroll_begin(rct_window* w, rct_widgetindex widgetIndex, int32
|
|||
window_event_unknown_15_call(w, scroll_id, scroll_area);
|
||||
if (scroll_area == SCROLL_PART_VIEW)
|
||||
{
|
||||
window_event_scroll_mousedown_call(w, scroll_id, eax, ebx);
|
||||
window_event_scroll_mousedown_call(w, scroll_id, ScreenCoordsXY(eax, ebx));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -716,7 +716,7 @@ static void input_scroll_continue(rct_window* w, rct_widgetindex widgetIndex, in
|
|||
switch (scroll_part)
|
||||
{
|
||||
case SCROLL_PART_VIEW:
|
||||
window_event_scroll_mousedrag_call(w, scroll_id, x, y);
|
||||
window_event_scroll_mousedrag_call(w, scroll_id, ScreenCoordsXY(x, y));
|
||||
break;
|
||||
case SCROLL_PART_HSCROLLBAR_LEFT:
|
||||
input_scroll_part_update_hleft(w, widgetIndex, scroll_id);
|
||||
|
@ -934,7 +934,7 @@ static void input_widget_over(int32_t x, int32_t y, rct_window* w, rct_widgetind
|
|||
window_tooltip_close();
|
||||
else
|
||||
{
|
||||
window_event_scroll_mouseover_call(w, edx, eax, ebx);
|
||||
window_event_scroll_mouseover_call(w, edx, ScreenCoordsXY(eax, ebx));
|
||||
input_update_tooltip(w, widgetIndex, x, y);
|
||||
}
|
||||
}
|
||||
|
@ -1049,7 +1049,7 @@ static void input_widget_left(int32_t x, int32_t y, rct_window* w, rct_widgetind
|
|||
w = window_find_by_number(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
window_event_tool_down_call(w, gCurrentToolWidget.widget_index, x, y);
|
||||
window_event_tool_down_call(w, gCurrentToolWidget.widget_index, ScreenCoordsXY(x, y));
|
||||
_inputFlags |= INPUT_FLAG_4;
|
||||
}
|
||||
}
|
||||
|
@ -1094,13 +1094,13 @@ void process_mouse_over(int32_t x, int32_t y)
|
|||
|
||||
cursorId = CURSOR_ARROW;
|
||||
set_map_tooltip_format_arg(0, rct_string_id, STR_NONE);
|
||||
window = window_find_from_point(x, y);
|
||||
window = window_find_from_point(ScreenCoordsXY(x, y));
|
||||
|
||||
if (window != nullptr)
|
||||
{
|
||||
int32_t ebx, edi;
|
||||
rct_window* subWindow;
|
||||
rct_widgetindex widgetId = window_find_widget_from_point(window, x, y);
|
||||
rct_widgetindex widgetId = window_find_widget_from_point(window, ScreenCoordsXY(x, y));
|
||||
if (widgetId != -1)
|
||||
{
|
||||
switch (window->widgets[widgetId].type)
|
||||
|
@ -1163,13 +1163,13 @@ void process_mouse_over(int32_t x, int32_t y)
|
|||
break;
|
||||
}
|
||||
// Same as default but with scroll_x/y
|
||||
cursorId = window_event_cursor_call(window, widgetId, scroll_x, scroll_y);
|
||||
cursorId = window_event_cursor_call(window, widgetId, ScreenCoordsXY(scroll_x, scroll_y));
|
||||
if (cursorId == -1)
|
||||
cursorId = CURSOR_ARROW;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
cursorId = window_event_cursor_call(window, widgetId, x, y);
|
||||
cursorId = window_event_cursor_call(window, widgetId, ScreenCoordsXY(x, y));
|
||||
if (cursorId == -1)
|
||||
cursorId = CURSOR_ARROW;
|
||||
break;
|
||||
|
@ -1194,7 +1194,7 @@ void process_mouse_tool(int32_t x, int32_t y)
|
|||
if (!w)
|
||||
tool_cancel();
|
||||
else
|
||||
window_event_tool_update_call(w, gCurrentToolWidget.widget_index, x, y);
|
||||
window_event_tool_update_call(w, gCurrentToolWidget.widget_index, ScreenCoordsXY(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -619,7 +619,7 @@ static Peep* viewport_interaction_get_closest_peep(int32_t x, int32_t y, int32_t
|
|||
rct_viewport* viewport;
|
||||
Peep *peep, *closestPeep;
|
||||
|
||||
w = window_find_from_point(x, y);
|
||||
w = window_find_from_point(ScreenCoordsXY(x, y));
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ static bool window_fits_on_screen(int32_t x, int32_t y, int32_t width, int32_t h
|
|||
}
|
||||
|
||||
rct_window* window_create(
|
||||
int32_t x, int32_t y, int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls,
|
||||
ScreenCoordsXY screenCoords, int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls,
|
||||
uint16_t flags)
|
||||
{
|
||||
// Check if there are any window slots left
|
||||
|
@ -141,12 +141,12 @@ rct_window* window_create(
|
|||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
audio_play_sound(SoundId::WindowOpen, 0, x + (width / 2));
|
||||
audio_play_sound(SoundId::WindowOpen, 0, screenCoords.x + (width / 2));
|
||||
}
|
||||
|
||||
w->number = 0;
|
||||
w->x = x;
|
||||
w->y = y;
|
||||
w->x = screenCoords.x;
|
||||
w->y = screenCoords.y;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->viewport = nullptr;
|
||||
|
@ -314,7 +314,7 @@ foundSpace:
|
|||
if (x + width > screenWidth)
|
||||
x = screenWidth - width;
|
||||
|
||||
return window_create(x, y, width, height, event_handlers, cls, flags);
|
||||
return window_create(ScreenCoordsXY(x, y), width, height, event_handlers, cls, flags);
|
||||
}
|
||||
|
||||
rct_window* window_create_centred(
|
||||
|
@ -326,7 +326,7 @@ rct_window* window_create_centred(
|
|||
|
||||
int32_t x = (screenWidth - width) / 2;
|
||||
int32_t y = std::max(TOP_TOOLBAR_HEIGHT + 1, (screenHeight - height) / 2);
|
||||
return window_create(x, y, width, height, event_handlers, cls, flags);
|
||||
return window_create(ScreenCoordsXY(x, y), width, height, event_handlers, cls, flags);
|
||||
}
|
||||
|
||||
static int32_t window_get_widget_index(rct_window* w, rct_widget* widget)
|
||||
|
@ -545,7 +545,7 @@ void window_all_wheel_input()
|
|||
// Check window cursor is over
|
||||
if (!(input_test_flag(INPUT_FLAG_5)))
|
||||
{
|
||||
rct_window* w = window_find_from_point(cursorState->x, cursorState->y);
|
||||
rct_window* w = window_find_from_point(ScreenCoordsXY(cursorState->x, cursorState->y));
|
||||
if (w != nullptr)
|
||||
{
|
||||
// Check if main window
|
||||
|
@ -556,7 +556,7 @@ void window_all_wheel_input()
|
|||
}
|
||||
|
||||
// Check scroll view, cursor is over
|
||||
rct_widgetindex widgetIndex = window_find_widget_from_point(w, cursorState->x, cursorState->y);
|
||||
rct_widgetindex widgetIndex = window_find_widget_from_point(w, ScreenCoordsXY(cursorState->x, cursorState->y));
|
||||
if (widgetIndex != -1)
|
||||
{
|
||||
rct_widget* widget = &w->widgets[widgetIndex];
|
||||
|
|
|
@ -612,7 +612,7 @@ rct_window* window_cheats_open()
|
|||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = window_create(32, 32, WW, WH, &window_cheats_money_events, WC_CHEATS, 0);
|
||||
window = window_create(ScreenCoordsXY(32, 32), WW, WH, &window_cheats_money_events, WC_CHEATS, 0);
|
||||
window->widgets = window_cheats_money_widgets;
|
||||
window->enabled_widgets = window_cheats_page_enabled_widgets[0];
|
||||
window->hold_down_widgets = window_cheats_page_hold_down_widgets[0];
|
||||
|
|
|
@ -96,7 +96,8 @@ rct_window* window_clear_scenery_open()
|
|||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = window_create(context_get_width() - 98, 29, 98, 94, &window_clear_scenery_events, WC_CLEAR_SCENERY, 0);
|
||||
window = window_create(
|
||||
ScreenCoordsXY(context_get_width() - 98, 29), 98, 94, &window_clear_scenery_events, WC_CLEAR_SCENERY, 0);
|
||||
window->widgets = window_clear_scenery_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT) | (1 << WIDX_PREVIEW)
|
||||
| (1 << WIDX_SMALL_SCENERY) | (1 << WIDX_LARGE_SCENERY) | (1 << WIDX_FOOTPATH);
|
||||
|
|
|
@ -91,8 +91,8 @@ rct_window* window_debug_paint_open()
|
|||
return window;
|
||||
|
||||
window = window_create(
|
||||
16, context_get_height() - 16 - 33 - WINDOW_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, &window_debug_paint_events,
|
||||
WC_DEBUG_PAINT, WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
ScreenCoordsXY(16, context_get_height() - 16 - 33 - WINDOW_HEIGHT), WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||
&window_debug_paint_events, WC_DEBUG_PAINT, WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
|
||||
window->widgets = window_debug_paint_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_TOGGLE_SHOW_WIDE_PATHS) | (1 << WIDX_TOGGLE_SHOW_BLOCKED_TILES)
|
||||
|
|
|
@ -130,7 +130,7 @@ rct_window* window_ride_demolish_prompt_open(Ride* ride)
|
|||
int x = w->x;
|
||||
int y = w->y;
|
||||
window_close(w);
|
||||
w = window_create(x, y, WW, WH, &window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);
|
||||
w = window_create(ScreenCoordsXY(x, y), WW, WH, &window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ rct_window* window_ride_refurbish_prompt_open(Ride* ride)
|
|||
int x = w->x;
|
||||
int y = w->y;
|
||||
window_close(w);
|
||||
w = window_create(x, y, WW, WH, &window_ride_refurbish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);
|
||||
w = window_create(ScreenCoordsXY(x, y), WW, WH, &window_ride_refurbish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -208,8 +208,8 @@ void window_dropdown_show_text_custom_width(
|
|||
|
||||
// Create the window
|
||||
w = window_create(
|
||||
x, y + extray, window_dropdown_widgets[WIDX_BACKGROUND].right + 1, window_dropdown_widgets[WIDX_BACKGROUND].bottom + 1,
|
||||
&window_dropdown_events, WC_DROPDOWN, WF_STICK_TO_FRONT);
|
||||
ScreenCoordsXY(x, y + extray), window_dropdown_widgets[WIDX_BACKGROUND].right + 1,
|
||||
window_dropdown_widgets[WIDX_BACKGROUND].bottom + 1, &window_dropdown_events, WC_DROPDOWN, WF_STICK_TO_FRONT);
|
||||
w->widgets = window_dropdown_widgets;
|
||||
if (colour & COLOUR_FLAG_TRANSLUCENT)
|
||||
w->flags |= WF_TRANSPARENT;
|
||||
|
@ -288,8 +288,8 @@ void window_dropdown_show_image(
|
|||
|
||||
// Create the window
|
||||
w = window_create(
|
||||
x, y + extray, window_dropdown_widgets[WIDX_BACKGROUND].right + 1, window_dropdown_widgets[WIDX_BACKGROUND].bottom + 1,
|
||||
&window_dropdown_events, WC_DROPDOWN, WF_STICK_TO_FRONT);
|
||||
ScreenCoordsXY(x, y + extray), window_dropdown_widgets[WIDX_BACKGROUND].right + 1,
|
||||
window_dropdown_widgets[WIDX_BACKGROUND].bottom + 1, &window_dropdown_events, WC_DROPDOWN, WF_STICK_TO_FRONT);
|
||||
w->widgets = window_dropdown_widgets;
|
||||
if (colour & COLOUR_FLAG_TRANSLUCENT)
|
||||
w->flags |= WF_TRANSPARENT;
|
||||
|
|
|
@ -129,8 +129,8 @@ static constexpr const rct_string_id EditorStepNames[] = {
|
|||
rct_window* window_editor_bottom_toolbar_open()
|
||||
{
|
||||
rct_window* window = window_create(
|
||||
0, context_get_height() - 32, context_get_width(), 32, &window_editor_bottom_toolbar_events, WC_BOTTOM_TOOLBAR,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
ScreenCoordsXY(0, context_get_height() - 32), context_get_width(), 32, &window_editor_bottom_toolbar_events,
|
||||
WC_BOTTOM_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
window->widgets = window_editor_bottom_toolbar_widgets;
|
||||
|
||||
window->enabled_widgets |= (1 << WIDX_PREVIOUS_STEP_BUTTON) | (1 << WIDX_NEXT_STEP_BUTTON) | (1 << WIDX_PREVIOUS_IMAGE)
|
||||
|
|
|
@ -266,7 +266,7 @@ static ResearchItem* get_research_item_at(int32_t x, int32_t y, int32_t* outScro
|
|||
rct_window* w = window_find_by_class(WC_EDITOR_INVENTION_LIST);
|
||||
if (w != nullptr && w->x <= x && w->y < y && w->x + w->width > x && w->y + w->height > y)
|
||||
{
|
||||
rct_widgetindex widgetIndex = window_find_widget_from_point(w, x, y);
|
||||
rct_widgetindex widgetIndex = window_find_widget_from_point(w, ScreenCoordsXY(x, y));
|
||||
rct_widget* widget = &w->widgets[widgetIndex];
|
||||
if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL)
|
||||
{
|
||||
|
@ -751,8 +751,9 @@ static void window_editor_inventions_list_drag_open(ResearchItem* researchItem)
|
|||
window_editor_inventions_list_drag_widgets[0].right = stringWidth;
|
||||
|
||||
w = window_create(
|
||||
gTooltipCursorX - (stringWidth / 2), gTooltipCursorY - 7, stringWidth, 14, &window_editor_inventions_list_drag_events,
|
||||
WC_EDITOR_INVENTION_LIST_DRAG, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING);
|
||||
ScreenCoordsXY(gTooltipCursorX - (stringWidth / 2), gTooltipCursorY - 7), stringWidth, 14,
|
||||
&window_editor_inventions_list_drag_events, WC_EDITOR_INVENTION_LIST_DRAG,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING);
|
||||
w->widgets = window_editor_inventions_list_drag_widgets;
|
||||
w->colours[1] = COLOUR_WHITE;
|
||||
input_window_position_begin(w, 0, gTooltipCursorX, gTooltipCursorY);
|
||||
|
|
|
@ -62,8 +62,8 @@ rct_window* window_editor_main_open()
|
|||
window_editor_main_widgets[0].right = context_get_width();
|
||||
window_editor_main_widgets[0].bottom = context_get_height();
|
||||
rct_window* window = window_create(
|
||||
0, 0, window_editor_main_widgets[0].right, window_editor_main_widgets[0].bottom, &window_editor_main_events,
|
||||
WC_MAIN_WINDOW, WF_STICK_TO_BACK);
|
||||
ScreenCoordsXY(0, 0), window_editor_main_widgets[0].right, window_editor_main_widgets[0].bottom,
|
||||
&window_editor_main_events, WC_MAIN_WINDOW, WF_STICK_TO_BACK);
|
||||
window->widgets = window_editor_main_widgets;
|
||||
|
||||
viewport_create(window, window->x, window->y, window->width, window->height, 0, 0x0FFF, 0x0FFF, 0, 0x1, SPRITE_INDEX_NULL);
|
||||
|
|
|
@ -138,7 +138,8 @@ rct_window* window_error_open(rct_string_id title, rct_string_id message)
|
|||
y = std::min(y, maxY);
|
||||
}
|
||||
|
||||
w = window_create(x, y, width, height, &window_error_events, WC_ERROR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_RESIZABLE);
|
||||
w = window_create(
|
||||
ScreenCoordsXY(x, y), width, height, &window_error_events, WC_ERROR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_RESIZABLE);
|
||||
w->widgets = window_error_widgets;
|
||||
w->error.var_480 = 0;
|
||||
if (!gDisableErrorWindowSound)
|
||||
|
|
|
@ -216,7 +216,7 @@ rct_window* window_footpath_open()
|
|||
return window;
|
||||
}
|
||||
|
||||
window = window_create(0, 29, 106, 381, &window_footpath_events, WC_FOOTPATH, 0);
|
||||
window = window_create(ScreenCoordsXY(0, 29), 106, 381, &window_footpath_events, WC_FOOTPATH, 0);
|
||||
window->widgets = window_footpath_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_FOOTPATH_TYPE) | (1 << WIDX_QUEUELINE_TYPE)
|
||||
| (1 << WIDX_DIRECTION_NW) | (1 << WIDX_DIRECTION_NE) | (1 << WIDX_DIRECTION_SW) | (1 << WIDX_DIRECTION_SE)
|
||||
|
|
|
@ -134,8 +134,8 @@ rct_window* window_game_bottom_toolbar_open()
|
|||
uint32_t toolbar_height = line_height * 2 + 12;
|
||||
|
||||
rct_window* window = window_create(
|
||||
0, screenHeight - toolbar_height, screenWidth, toolbar_height, &window_game_bottom_toolbar_events, WC_BOTTOM_TOOLBAR,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
ScreenCoordsXY(0, screenHeight - toolbar_height), screenWidth, toolbar_height, &window_game_bottom_toolbar_events,
|
||||
WC_BOTTOM_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
window->widgets = window_game_bottom_toolbar_widgets;
|
||||
window->enabled_widgets |= (1 << WIDX_LEFT_OUTSET) | (1 << WIDX_MONEY) | (1 << WIDX_GUESTS) | (1 << WIDX_PARK_RATING)
|
||||
| (1 << WIDX_MIDDLE_OUTSET) | (1 << WIDX_MIDDLE_INSET) | (1 << WIDX_NEWS_SUBJECT) | (1 << WIDX_NEWS_LOCATE)
|
||||
|
|
|
@ -134,7 +134,7 @@ rct_window* window_install_track_open(const utf8* path)
|
|||
int32_t x = screenWidth / 2 - 201;
|
||||
int32_t y = std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200);
|
||||
|
||||
rct_window* w = window_create(x, y, WW, WH, &window_install_track_events, WC_INSTALL_TRACK, 0);
|
||||
rct_window* w = window_create(ScreenCoordsXY(x, y), WW, WH, &window_install_track_events, WC_INSTALL_TRACK, 0);
|
||||
w->widgets = window_install_track_widgets;
|
||||
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_INSTALL)
|
||||
| (1 << WIDX_CANCEL);
|
||||
|
|
|
@ -112,7 +112,7 @@ rct_window* window_land_open()
|
|||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = window_create(context_get_width() - 98, 29, 98, 160, &window_land_events, WC_LAND, 0);
|
||||
window = window_create(ScreenCoordsXY(context_get_width() - 98, 29), 98, 160, &window_land_events, WC_LAND, 0);
|
||||
window->widgets = window_land_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_FLOOR)
|
||||
| (1 << WIDX_WALL) | (1 << WIDX_MOUNTAINMODE) | (1 << WIDX_PAINTMODE) | (1 << WIDX_PREVIEW);
|
||||
|
|
|
@ -106,7 +106,7 @@ rct_window* window_land_rights_open()
|
|||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = window_create(context_get_width() - 98, 29, 98, 94, &window_land_rights_events, WC_LAND_RIGHTS, 0);
|
||||
window = window_create(ScreenCoordsXY(context_get_width() - 98, 29), 98, 94, &window_land_rights_events, WC_LAND_RIGHTS, 0);
|
||||
window->widgets = window_land_rights_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_PREVIEW)
|
||||
| (1 << WIDX_BUY_LAND_RIGHTS) | (1 << WIDX_BUY_CONSTRUCTION_RIGHTS);
|
||||
|
|
|
@ -64,7 +64,7 @@ rct_window* window_main_open()
|
|||
window_main_widgets[0].right = context_get_width();
|
||||
window_main_widgets[0].bottom = context_get_height();
|
||||
rct_window* window = window_create(
|
||||
0, 0, window_main_widgets[0].right, window_main_widgets[0].bottom, &window_main_events, WC_MAIN_WINDOW,
|
||||
ScreenCoordsXY(0, 0), window_main_widgets[0].right, window_main_widgets[0].bottom, &window_main_events, WC_MAIN_WINDOW,
|
||||
WF_STICK_TO_BACK);
|
||||
window->widgets = window_main_widgets;
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ static void window_map_tooltip_open()
|
|||
if (w == nullptr)
|
||||
{
|
||||
w = window_create(
|
||||
x, y, width, height, &window_map_tooltip_events, WC_MAP_TOOLTIP,
|
||||
ScreenCoordsXY(x, y), width, height, &window_map_tooltip_events, WC_MAP_TOOLTIP,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
w->widgets = window_map_tooltip_widgets;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,8 @@ static void window_maze_construction_construct(int32_t direction);
|
|||
*/
|
||||
rct_window* window_maze_construction_open()
|
||||
{
|
||||
rct_window* w = window_create(0, 29, 166, 200, &window_maze_construction_events, WC_RIDE_CONSTRUCTION, WF_NO_AUTO_CLOSE);
|
||||
rct_window* w = window_create(
|
||||
ScreenCoordsXY(0, 29), 166, 200, &window_maze_construction_events, WC_RIDE_CONSTRUCTION, WF_NO_AUTO_CLOSE);
|
||||
w->widgets = window_maze_construction_widgets;
|
||||
w->enabled_widgets = (1ULL << WIDX_CLOSE) | (1ULL << WIDX_MAZE_BUILD_MODE) | (1ULL << WIDX_MAZE_MOVE_MODE)
|
||||
| (1ULL << WIDX_MAZE_FILL_MODE) | (1ULL << WIDX_MAZE_DIRECTION_NW) | (1ULL << WIDX_MAZE_DIRECTION_NE)
|
||||
|
@ -339,11 +340,11 @@ static void window_maze_construction_toolupdate(rct_window* w, rct_widgetindex w
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_MAZE_DIRECTION_GROUPBOX:
|
||||
ride_construction_toolupdate_construct(x, y);
|
||||
ride_construction_toolupdate_construct(ScreenCoordsXY(x, y));
|
||||
break;
|
||||
case WIDX_MAZE_ENTRANCE:
|
||||
case WIDX_MAZE_EXIT:
|
||||
ride_construction_toolupdate_entrance_exit(x, y);
|
||||
ride_construction_toolupdate_entrance_exit(ScreenCoordsXY(x, y));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +406,7 @@ static void window_maze_construction_tooldown(rct_window* w, rct_widgetindex wid
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_MAZE_DIRECTION_GROUPBOX:
|
||||
ride_construction_tooldown_construct(x, y);
|
||||
ride_construction_tooldown_construct(ScreenCoordsXY(x, y));
|
||||
break;
|
||||
case WIDX_MAZE_ENTRANCE:
|
||||
case WIDX_MAZE_EXIT:
|
||||
|
|
|
@ -480,7 +480,7 @@ static void window_ride_construction_show_special_track_dropdown(rct_window* w,
|
|||
static void ride_selected_track_set_seat_rotation(int32_t seatRotation);
|
||||
static void loc_6C7502(int32_t al);
|
||||
static void ride_construction_set_brakes_speed(int32_t brakesSpeed);
|
||||
static void ride_construction_tooldown_entrance_exit(int32_t screenX, int32_t screenY);
|
||||
static void ride_construction_tooldown_entrance_exit(ScreenCoordsXY screenCoords);
|
||||
|
||||
static uint8_t _currentPossibleRideConfigurations[32];
|
||||
|
||||
|
@ -534,7 +534,8 @@ rct_window* window_ride_construction_open()
|
|||
return context_open_window_view(WV_MAZE_CONSTRUCTION);
|
||||
}
|
||||
|
||||
auto w = window_create(0, 29, 166, 394, &window_ride_construction_events, WC_RIDE_CONSTRUCTION, WF_NO_AUTO_CLOSE);
|
||||
auto w = window_create(
|
||||
ScreenCoordsXY(0, 29), 166, 394, &window_ride_construction_events, WC_RIDE_CONSTRUCTION, WF_NO_AUTO_CLOSE);
|
||||
|
||||
w->widgets = window_ride_construction_widgets;
|
||||
w->enabled_widgets = (1ULL << WIDX_CLOSE) | (1ULL << WIDX_LEFT_CURVE_VERY_SMALL) | (1ULL << WIDX_LEFT_CURVE_SMALL)
|
||||
|
@ -2215,11 +2216,11 @@ static void window_ride_construction_toolupdate(rct_window* w, rct_widgetindex w
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CONSTRUCT:
|
||||
ride_construction_toolupdate_construct(x, y);
|
||||
ride_construction_toolupdate_construct(ScreenCoordsXY(x, y));
|
||||
break;
|
||||
case WIDX_ENTRANCE:
|
||||
case WIDX_EXIT:
|
||||
ride_construction_toolupdate_entrance_exit(x, y);
|
||||
ride_construction_toolupdate_entrance_exit(ScreenCoordsXY(x, y));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2233,11 +2234,11 @@ static void window_ride_construction_tooldown(rct_window* w, rct_widgetindex wid
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CONSTRUCT:
|
||||
ride_construction_tooldown_construct(x, y);
|
||||
ride_construction_tooldown_construct(ScreenCoordsXY(x, y));
|
||||
break;
|
||||
case WIDX_ENTRANCE:
|
||||
case WIDX_EXIT:
|
||||
ride_construction_tooldown_entrance_exit(x, y);
|
||||
ride_construction_tooldown_entrance_exit(ScreenCoordsXY(x, y));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3472,7 +3473,7 @@ static void ride_construction_set_brakes_speed(int32_t brakesSpeed)
|
|||
*
|
||||
* rct2: 0x006CC6A8
|
||||
*/
|
||||
void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
|
||||
void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords)
|
||||
{
|
||||
int32_t x, y, z;
|
||||
const rct_preview_track* trackBlock;
|
||||
|
@ -3481,7 +3482,7 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
|
|||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
if (!ride_get_place_position_from_screen_position(screenX, screenY, &x, &y))
|
||||
if (!ride_get_place_position_from_screen_position(screenCoords.x, screenCoords.y, &x, &y))
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
map_invalidate_map_selection_tiles();
|
||||
|
@ -3683,7 +3684,7 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
|
|||
*
|
||||
* rct2: 0x006CD354
|
||||
*/
|
||||
void ride_construction_toolupdate_entrance_exit(int32_t screenX, int32_t screenY)
|
||||
void ride_construction_toolupdate_entrance_exit(ScreenCoordsXY screenCoords)
|
||||
{
|
||||
int32_t x, y, direction;
|
||||
uint8_t stationNum;
|
||||
|
@ -3693,7 +3694,7 @@ void ride_construction_toolupdate_entrance_exit(int32_t screenX, int32_t screenY
|
|||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
ride_get_entrance_or_exit_position_from_screen_position(screenX, screenY, &x, &y, &direction);
|
||||
ride_get_entrance_or_exit_position_from_screen_position(screenCoords.x, screenCoords.y, &x, &y, &direction);
|
||||
if (gRideEntranceExitPlaceDirection == 255)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
|
@ -3731,7 +3732,7 @@ void ride_construction_toolupdate_entrance_exit(int32_t screenX, int32_t screenY
|
|||
*
|
||||
* rct2: 0x006CCA73
|
||||
*/
|
||||
void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
|
||||
void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords)
|
||||
{
|
||||
const CursorState* state = context_get_cursor_state();
|
||||
ride_id_t rideIndex;
|
||||
|
@ -3765,7 +3766,7 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
|
|||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
if (!ride_get_place_position_from_screen_position(screenX, screenY, &x, &y))
|
||||
if (!ride_get_place_position_from_screen_position(screenCoords.x, screenCoords.y, &x, &y))
|
||||
return;
|
||||
|
||||
z = _trackPlaceZ;
|
||||
|
@ -3926,7 +3927,7 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
|
|||
*
|
||||
* rct2: 0x006CCA73
|
||||
*/
|
||||
static void ride_construction_tooldown_entrance_exit(int32_t screenX, int32_t screenY)
|
||||
static void ride_construction_tooldown_entrance_exit(ScreenCoordsXY screenCoords)
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
map_invalidate_selection_rect();
|
||||
|
@ -3934,7 +3935,7 @@ static void ride_construction_tooldown_entrance_exit(int32_t screenX, int32_t sc
|
|||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
|
||||
int32_t mapX, mapY, direction;
|
||||
ride_get_entrance_or_exit_position_from_screen_position(screenX, screenY, &mapX, &mapY, &direction);
|
||||
ride_get_entrance_or_exit_position_from_screen_position(screenCoords.x, screenCoords.y, &mapX, &mapY, &direction);
|
||||
if (gRideEntranceExitPlaceDirection == 255)
|
||||
return;
|
||||
|
||||
|
|
|
@ -448,8 +448,8 @@ rct_window* window_scenery_open()
|
|||
window_scenery_init();
|
||||
|
||||
window = window_create(
|
||||
context_get_width() - WINDOW_SCENERY_WIDTH, 0x1D, WINDOW_SCENERY_WIDTH, WINDOW_SCENERY_HEIGHT, &window_scenery_events,
|
||||
WC_SCENERY, WF_NO_SCROLLING);
|
||||
ScreenCoordsXY(context_get_width() - WINDOW_SCENERY_WIDTH, 0x1D), WINDOW_SCENERY_WIDTH, WINDOW_SCENERY_HEIGHT,
|
||||
&window_scenery_events, WC_SCENERY, WF_NO_SCROLLING);
|
||||
window->widgets = window_scenery_widgets;
|
||||
|
||||
window->enabled_widgets = (1 << WIDX_SCENERY_CLOSE) | (1 << WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) | (1 << WIDX_SCENERY_TAB_1)
|
||||
|
@ -748,7 +748,7 @@ static void window_scenery_periodic_update(rct_window* w)
|
|||
static void window_scenery_update(rct_window* w)
|
||||
{
|
||||
const CursorState* state = context_get_cursor_state();
|
||||
rct_window* other = window_find_from_point(state->x, state->y);
|
||||
rct_window* other = window_find_from_point(ScreenCoordsXY(state->x, state->y));
|
||||
if (other == w)
|
||||
{
|
||||
int32_t window_x = state->x - w->x + 26;
|
||||
|
@ -756,7 +756,7 @@ static void window_scenery_update(rct_window* w)
|
|||
|
||||
if (window_y < 44 || window_x <= w->width)
|
||||
{
|
||||
rct_widgetindex widgetIndex = window_find_widget_from_point(w, state->x, state->y);
|
||||
rct_widgetindex widgetIndex = window_find_widget_from_point(w, ScreenCoordsXY(state->x, state->y));
|
||||
if (widgetIndex >= WIDX_SCENERY_TAB_CONTENT_PANEL)
|
||||
{
|
||||
w->scenery.hover_counter++;
|
||||
|
|
|
@ -549,7 +549,7 @@ rct_window* window_tile_inspector_open()
|
|||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = window_create(0, 29, WW, WH, &TileInspectorWindowEvents, WC_TILE_INSPECTOR, WF_RESIZABLE);
|
||||
window = window_create(ScreenCoordsXY(0, 29), WW, WH, &TileInspectorWindowEvents, WC_TILE_INSPECTOR, WF_RESIZABLE);
|
||||
|
||||
window_tile_inspector_set_page(window, TILE_INSPECTOR_PAGE_DEFAULT);
|
||||
window->min_width = MIN_WW;
|
||||
|
|
|
@ -69,7 +69,7 @@ rct_window* window_title_exit_open()
|
|||
rct_window* window;
|
||||
|
||||
window = window_create(
|
||||
context_get_width() - 40, context_get_height() - 64, 40, 64, &window_title_exit_events, WC_TITLE_EXIT,
|
||||
ScreenCoordsXY(context_get_width() - 40, context_get_height() - 64), 40, 64, &window_title_exit_events, WC_TITLE_EXIT,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
window->widgets = window_title_exit_widgets;
|
||||
window->enabled_widgets |= (1ULL << WIDX_EXIT);
|
||||
|
|
|
@ -60,7 +60,7 @@ static rct_window_event_list window_title_logo_events = {
|
|||
rct_window* window_title_logo_open()
|
||||
{
|
||||
rct_window* window = window_create(
|
||||
0, 0, 232, 136, &window_title_logo_events, WC_TITLE_LOGO, WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
ScreenCoordsXY(0, 0), 232, 136, &window_title_logo_events, WC_TITLE_LOGO, WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
window->widgets = window_title_logo_widgets;
|
||||
window_init_scroll_widgets(window);
|
||||
window->colours[0] = TRANSLUCENT(COLOUR_GREY);
|
||||
|
|
|
@ -85,7 +85,7 @@ rct_window* window_title_menu_open()
|
|||
rct_window* window;
|
||||
|
||||
window = window_create(
|
||||
0, context_get_height() - 154, 0, 100, &window_title_menu_events, WC_TITLE_MENU,
|
||||
ScreenCoordsXY(0, context_get_height() - 154), 0, 100, &window_title_menu_events, WC_TITLE_MENU,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
window->widgets = window_title_menu_widgets;
|
||||
window->enabled_widgets
|
||||
|
|
|
@ -65,7 +65,8 @@ static rct_window_event_list window_title_options_events = {
|
|||
rct_window* window_title_options_open()
|
||||
{
|
||||
rct_window* window = window_create(
|
||||
context_get_width() - 80, 0, 80, 15, &window_title_options_events, WC_TITLE_OPTIONS, WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
ScreenCoordsXY(context_get_width() - 80, 0), 80, 15, &window_title_options_events, WC_TITLE_OPTIONS,
|
||||
WF_STICK_TO_BACK | WF_TRANSPARENT);
|
||||
window->widgets = window_title_options_widgets;
|
||||
window->enabled_widgets |= (1ULL << WIDX_OPTIONS);
|
||||
window_init_scroll_widgets(window);
|
||||
|
|
|
@ -120,8 +120,7 @@ void window_tooltip_show(rct_string_id id, ScreenCoordsXY screenCoords)
|
|||
screenCoords.y -= height + 40;
|
||||
screenCoords.y = std::clamp(screenCoords.y, 22, max_y);
|
||||
|
||||
w = window_create(
|
||||
screenCoords.x, screenCoords.y, width, height, &window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_STICK_TO_FRONT);
|
||||
w = window_create(screenCoords, width, height, &window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_STICK_TO_FRONT);
|
||||
w->widgets = window_tooltip_widgets;
|
||||
|
||||
reset_tooltip_not_shown();
|
||||
|
|
|
@ -341,7 +341,7 @@ static colour_t _tertiaryColour;
|
|||
rct_window* window_top_toolbar_open()
|
||||
{
|
||||
rct_window* window = window_create(
|
||||
0, 0, context_get_width(), TOP_TOOLBAR_HEIGHT + 1, &window_top_toolbar_events, WC_TOP_TOOLBAR,
|
||||
ScreenCoordsXY(0, 0), context_get_width(), TOP_TOOLBAR_HEIGHT + 1, &window_top_toolbar_events, WC_TOP_TOOLBAR,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
window->widgets = window_top_toolbar_widgets;
|
||||
|
||||
|
@ -3064,10 +3064,10 @@ static money32 selection_lower_land(uint8_t flags)
|
|||
*/
|
||||
static void window_top_toolbar_land_tool_drag(int16_t x, int16_t y)
|
||||
{
|
||||
rct_window* window = window_find_from_point(x, y);
|
||||
rct_window* window = window_find_from_point(ScreenCoordsXY(x, y));
|
||||
if (!window)
|
||||
return;
|
||||
rct_widgetindex widget_index = window_find_widget_from_point(window, x, y);
|
||||
rct_widgetindex widget_index = window_find_widget_from_point(window, ScreenCoordsXY(x, y));
|
||||
if (widget_index == -1)
|
||||
return;
|
||||
rct_widget* widget = &window->widgets[widget_index];
|
||||
|
@ -3107,10 +3107,10 @@ static void window_top_toolbar_land_tool_drag(int16_t x, int16_t y)
|
|||
*/
|
||||
static void window_top_toolbar_water_tool_drag(int16_t x, int16_t y)
|
||||
{
|
||||
rct_window* window = window_find_from_point(x, y);
|
||||
rct_window* window = window_find_from_point(ScreenCoordsXY(x, y));
|
||||
if (!window)
|
||||
return;
|
||||
rct_widgetindex widget_index = window_find_widget_from_point(window, x, y);
|
||||
rct_widgetindex widget_index = window_find_widget_from_point(window, ScreenCoordsXY(x, y));
|
||||
if (widget_index == -1)
|
||||
return;
|
||||
rct_widget* widget = &window->widgets[widget_index];
|
||||
|
|
|
@ -248,7 +248,7 @@ static void window_track_delete_prompt_open()
|
|||
int32_t screenWidth = context_get_width();
|
||||
int32_t screenHeight = context_get_height();
|
||||
rct_window* w = window_create(
|
||||
std::max(TOP_TOOLBAR_HEIGHT + 1, (screenWidth - 250) / 2), (screenHeight - 44) / 2, 250, 74,
|
||||
ScreenCoordsXY(std::max(TOP_TOOLBAR_HEIGHT + 1, (screenWidth - 250) / 2), (screenHeight - 44) / 2), 250, 74,
|
||||
&window_track_delete_prompt_events, WC_TRACK_DELETE_PROMPT, WF_STICK_TO_FRONT);
|
||||
w->widgets = window_track_delete_prompt_widgets;
|
||||
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RENAME) | (1 << WIDX_DELETE);
|
||||
|
|
|
@ -158,7 +158,7 @@ rct_window* window_track_place_open(const track_design_file_ref* tdFileRef)
|
|||
|
||||
_window_track_place_mini_preview.resize(TRACK_MINI_PREVIEW_SIZE);
|
||||
|
||||
rct_window* w = window_create(0, 29, 200, 124, &window_track_place_events, WC_TRACK_DESIGN_PLACE, 0);
|
||||
rct_window* w = window_create(ScreenCoordsXY(0, 29), 200, 124, &window_track_place_events, WC_TRACK_DESIGN_PLACE, 0);
|
||||
w->widgets = window_track_place_widgets;
|
||||
w->enabled_widgets = 1 << WIDX_CLOSE | 1 << WIDX_ROTATE | 1 << WIDX_MIRROR | 1 << WIDX_SELECT_DIFFERENT_DESIGN;
|
||||
window_init_scroll_widgets(w);
|
||||
|
|
|
@ -137,7 +137,7 @@ rct_window* window_track_list_open(ride_list_item item)
|
|||
y = TOP_TOOLBAR_HEIGHT + 2;
|
||||
}
|
||||
|
||||
rct_window* w = window_create(x, y, 600, 432, &window_track_list_events, WC_TRACK_DESIGN_LIST, 0);
|
||||
rct_window* w = window_create(ScreenCoordsXY(x, y), 600, 432, &window_track_list_events, WC_TRACK_DESIGN_LIST, 0);
|
||||
|
||||
window_track_list_widgets[WIDX_FILTER_STRING].string = _filterString;
|
||||
w->widgets = window_track_list_widgets;
|
||||
|
|
|
@ -147,7 +147,7 @@ rct_window* window_view_clipping_open()
|
|||
}
|
||||
|
||||
// Window is not open - create it.
|
||||
window = window_create(32, 32, WW, WH, &window_view_clipping_events, WC_VIEW_CLIPPING, 0);
|
||||
window = window_create(ScreenCoordsXY(32, 32), WW, WH, &window_view_clipping_events, WC_VIEW_CLIPPING, 0);
|
||||
window->widgets = window_view_clipping_widgets;
|
||||
window->enabled_widgets = (1ULL << WIDX_CLOSE) | (1ULL << WIDX_CLIP_CHECKBOX_ENABLE) | (1ULL << WIDX_CLIP_HEIGHT_VALUE)
|
||||
| (1ULL << WIDX_CLIP_HEIGHT_INCREASE) | (1ULL << WIDX_CLIP_HEIGHT_DECREASE) | (1ULL << WIDX_CLIP_HEIGHT_SLIDER)
|
||||
|
|
|
@ -90,7 +90,7 @@ rct_window* window_water_open()
|
|||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = window_create(context_get_width() - 76, 29, 76, 77, &window_water_events, WC_WATER, 0);
|
||||
window = window_create(ScreenCoordsXY(context_get_width() - 76, 29), 76, 77, &window_water_events, WC_WATER, 0);
|
||||
window->widgets = window_water_widgets;
|
||||
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_PREVIEW);
|
||||
window->hold_down_widgets = (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT);
|
||||
|
|
|
@ -1658,7 +1658,7 @@ void get_map_coordinates_from_pos(
|
|||
int32_t screenX, int32_t screenY, int32_t flags, int16_t* x, int16_t* y, int32_t* interactionType,
|
||||
TileElement** tileElement, rct_viewport** viewport)
|
||||
{
|
||||
rct_window* window = window_find_from_point(screenX, screenY);
|
||||
rct_window* window = window_find_from_point(ScreenCoordsXY(screenX, screenY));
|
||||
get_map_coordinates_from_pos_window(window, screenX, screenY, flags, x, y, interactionType, tileElement, viewport);
|
||||
}
|
||||
|
||||
|
@ -1763,7 +1763,7 @@ void viewport_invalidate(rct_viewport* viewport, int32_t left, int32_t top, int3
|
|||
|
||||
static rct_viewport* viewport_find_from_point(int32_t screenX, int32_t screenY)
|
||||
{
|
||||
rct_window* w = window_find_from_point(screenX, screenY);
|
||||
rct_window* w = window_find_from_point(ScreenCoordsXY(screenX, screenY));
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -396,17 +396,18 @@ void window_close_all_except_flags(uint16_t flags)
|
|||
*
|
||||
* rct2: 0x006EA845
|
||||
*/
|
||||
rct_window* window_find_from_point(int32_t x, int32_t y)
|
||||
rct_window* window_find_from_point(ScreenCoordsXY screenCoords)
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
auto& w = *it;
|
||||
if (x < w->x || x >= w->x + w->width || y < w->y || y >= w->y + w->height)
|
||||
if (screenCoords.x < w->x || screenCoords.x >= w->x + w->width || screenCoords.y < w->y
|
||||
|| screenCoords.y >= w->y + w->height)
|
||||
continue;
|
||||
|
||||
if (w->flags & WF_NO_BACKGROUND)
|
||||
{
|
||||
auto widgetIndex = window_find_widget_from_point(w.get(), x, y);
|
||||
auto widgetIndex = window_find_widget_from_point(w.get(), screenCoords);
|
||||
if (widgetIndex == -1)
|
||||
continue;
|
||||
}
|
||||
|
@ -425,7 +426,7 @@ rct_window* window_find_from_point(int32_t x, int32_t y)
|
|||
* returns widget_index (edx)
|
||||
* EDI NEEDS TO BE SET TO w->widgets[widget_index] AFTER
|
||||
*/
|
||||
rct_widgetindex window_find_widget_from_point(rct_window* w, int32_t x, int32_t y)
|
||||
rct_widgetindex window_find_widget_from_point(rct_window* w, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
// Invalidate the window
|
||||
window_event_invalidate_call(w);
|
||||
|
@ -441,7 +442,8 @@ rct_widgetindex window_find_widget_from_point(rct_window* w, int32_t x, int32_t
|
|||
}
|
||||
else if (widget->type != WWT_EMPTY)
|
||||
{
|
||||
if (x >= w->x + widget->left && x <= w->x + widget->right && y >= w->y + widget->top && y <= w->y + widget->bottom)
|
||||
if (screenCoords.x >= w->x + widget->left && screenCoords.x <= w->x + widget->right
|
||||
&& screenCoords.y >= w->y + widget->top && screenCoords.y <= w->y + widget->bottom)
|
||||
{
|
||||
widget_index = i;
|
||||
}
|
||||
|
@ -1239,26 +1241,26 @@ void window_draw_viewport(rct_drawpixelinfo* dpi, rct_window* w)
|
|||
viewport_render(dpi, w->viewport, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height);
|
||||
}
|
||||
|
||||
void window_set_position(rct_window* w, int32_t x, int32_t y)
|
||||
void window_set_position(rct_window* w, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
window_move_position(w, x - w->x, y - w->y);
|
||||
window_move_position(w, ScreenCoordsXY(screenCoords.x - w->x, screenCoords.y - w->y));
|
||||
}
|
||||
|
||||
void window_move_position(rct_window* w, int32_t dx, int32_t dy)
|
||||
void window_move_position(rct_window* w, ScreenCoordsXY deltaCoords)
|
||||
{
|
||||
if (dx == 0 && dy == 0)
|
||||
if (deltaCoords.x == 0 && deltaCoords.y == 0)
|
||||
return;
|
||||
|
||||
// Invalidate old region
|
||||
w->Invalidate();
|
||||
|
||||
// Translate window and viewport
|
||||
w->x += dx;
|
||||
w->y += dy;
|
||||
w->x += deltaCoords.x;
|
||||
w->y += deltaCoords.y;
|
||||
if (w->viewport != nullptr)
|
||||
{
|
||||
w->viewport->x += dx;
|
||||
w->viewport->y += dy;
|
||||
w->viewport->x += deltaCoords.x;
|
||||
w->viewport->y += deltaCoords.y;
|
||||
}
|
||||
|
||||
// Invalidate new region
|
||||
|
@ -1431,28 +1433,28 @@ void window_event_unknown_08_call(rct_window* w)
|
|||
w->event_handlers->unknown_08(w);
|
||||
}
|
||||
|
||||
void window_event_tool_update_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
||||
void window_event_tool_update_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
if (w->event_handlers->tool_update != nullptr)
|
||||
w->event_handlers->tool_update(w, widgetIndex, x, y);
|
||||
w->event_handlers->tool_update(w, widgetIndex, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_tool_down_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
||||
void window_event_tool_down_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
if (w->event_handlers->tool_down != nullptr)
|
||||
w->event_handlers->tool_down(w, widgetIndex, x, y);
|
||||
w->event_handlers->tool_down(w, widgetIndex, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_tool_drag_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
||||
void window_event_tool_drag_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
if (w->event_handlers->tool_drag != nullptr)
|
||||
w->event_handlers->tool_drag(w, widgetIndex, x, y);
|
||||
w->event_handlers->tool_drag(w, widgetIndex, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_tool_up_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
||||
void window_event_tool_up_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
if (w->event_handlers->tool_up != nullptr)
|
||||
w->event_handlers->tool_up(w, widgetIndex, x, y);
|
||||
w->event_handlers->tool_up(w, widgetIndex, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_tool_abort_call(rct_window* w, rct_widgetindex widgetIndex)
|
||||
|
@ -1475,22 +1477,22 @@ 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, int32_t x, int32_t y)
|
||||
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, x, y);
|
||||
w->event_handlers->scroll_mousedown(w, scrollIndex, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_scroll_mousedrag_call(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y)
|
||||
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, x, y);
|
||||
w->event_handlers->scroll_mousedrag(w, scrollIndex, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_scroll_mouseover_call(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y)
|
||||
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, x, y);
|
||||
w->event_handlers->scroll_mouseover(w, scrollIndex, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_textinput_call(rct_window* w, rct_widgetindex widgetIndex, char* text)
|
||||
|
@ -1519,18 +1521,18 @@ rct_string_id window_event_tooltip_call(rct_window* w, rct_widgetindex widgetInd
|
|||
return result;
|
||||
}
|
||||
|
||||
int32_t window_event_cursor_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y)
|
||||
int32_t window_event_cursor_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
int32_t cursorId = CURSOR_ARROW;
|
||||
if (w->event_handlers->cursor != nullptr)
|
||||
w->event_handlers->cursor(w, widgetIndex, x, y, &cursorId);
|
||||
w->event_handlers->cursor(w, widgetIndex, screenCoords.x, screenCoords.y, &cursorId);
|
||||
return cursorId;
|
||||
}
|
||||
|
||||
void window_event_moved_call(rct_window* w, int32_t x, int32_t y)
|
||||
void window_event_moved_call(rct_window* w, ScreenCoordsXY screenCoords)
|
||||
{
|
||||
if (w->event_handlers->moved != nullptr)
|
||||
w->event_handlers->moved(w, x, y);
|
||||
w->event_handlers->moved(w, screenCoords.x, screenCoords.y);
|
||||
}
|
||||
|
||||
void window_event_invalidate_call(rct_window* w)
|
||||
|
@ -1890,18 +1892,18 @@ static void window_snap_bottom(rct_window* w, int32_t proximity)
|
|||
w->y = topMost - w->height;
|
||||
}
|
||||
|
||||
void window_move_and_snap(rct_window* w, int32_t newWindowX, int32_t newWindowY, int32_t snapProximity)
|
||||
void window_move_and_snap(rct_window* w, ScreenCoordsXY newWindowCoords, int32_t snapProximity)
|
||||
{
|
||||
int32_t originalX = w->x;
|
||||
int32_t originalY = w->y;
|
||||
int32_t minY = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 1 : TOP_TOOLBAR_HEIGHT + 2;
|
||||
|
||||
newWindowY = std::clamp(newWindowY, minY, context_get_height() - 34);
|
||||
newWindowCoords.y = std::clamp(newWindowCoords.y, minY, context_get_height() - 34);
|
||||
|
||||
if (snapProximity > 0)
|
||||
{
|
||||
w->x = newWindowX;
|
||||
w->y = newWindowY;
|
||||
w->x = newWindowCoords.x;
|
||||
w->y = newWindowCoords.y;
|
||||
|
||||
window_snap_right(w, snapProximity);
|
||||
window_snap_bottom(w, snapProximity);
|
||||
|
@ -1911,13 +1913,13 @@ void window_move_and_snap(rct_window* w, int32_t newWindowX, int32_t newWindowY,
|
|||
if (w->x == originalX && w->y == originalY)
|
||||
return;
|
||||
|
||||
newWindowX = w->x;
|
||||
newWindowY = w->y;
|
||||
newWindowCoords.x = w->x;
|
||||
newWindowCoords.y = w->y;
|
||||
w->x = originalX;
|
||||
w->y = originalY;
|
||||
}
|
||||
|
||||
window_set_position(w, newWindowX, newWindowY);
|
||||
window_set_position(w, newWindowCoords);
|
||||
}
|
||||
|
||||
int32_t window_can_resize(rct_window* w)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
#include "../ride/RideTypes.h"
|
||||
#include "../world/Location.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
|
@ -593,7 +594,7 @@ void window_update_all();
|
|||
void window_set_window_limit(int32_t value);
|
||||
|
||||
rct_window* window_create(
|
||||
int32_t x, int32_t y, int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls,
|
||||
ScreenCoordsXY screenCoords, int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls,
|
||||
uint16_t flags);
|
||||
rct_window* window_create_auto_pos(
|
||||
int32_t width, int32_t height, rct_window_event_list* event_handlers, rct_windowclass cls, uint16_t flags);
|
||||
|
@ -608,8 +609,8 @@ void window_close_all_except_class(rct_windowclass cls);
|
|||
void window_close_all_except_flags(uint16_t flags);
|
||||
rct_window* window_find_by_class(rct_windowclass cls);
|
||||
rct_window* window_find_by_number(rct_windowclass cls, rct_windownumber number);
|
||||
rct_window* window_find_from_point(int32_t x, int32_t y);
|
||||
rct_widgetindex window_find_widget_from_point(rct_window* w, int32_t x, int32_t y);
|
||||
rct_window* window_find_from_point(ScreenCoordsXY screenCoords);
|
||||
rct_widgetindex window_find_widget_from_point(rct_window* w, ScreenCoordsXY screenCoords);
|
||||
void window_invalidate_by_class(rct_windowclass cls);
|
||||
void window_invalidate_by_number(rct_windowclass cls, rct_windownumber number);
|
||||
void window_invalidate_all();
|
||||
|
@ -647,8 +648,8 @@ void window_draw(rct_drawpixelinfo* dpi, rct_window* w, int32_t left, int32_t to
|
|||
void window_draw_widgets(rct_window* w, rct_drawpixelinfo* dpi);
|
||||
void window_draw_viewport(rct_drawpixelinfo* dpi, rct_window* w);
|
||||
|
||||
void window_set_position(rct_window* w, int32_t x, int32_t y);
|
||||
void window_move_position(rct_window* w, int32_t dx, int32_t dy);
|
||||
void window_set_position(rct_window* w, ScreenCoordsXY screenCoords);
|
||||
void window_move_position(rct_window* w, ScreenCoordsXY screenCoords);
|
||||
void window_resize(rct_window* w, int32_t dw, int32_t dh);
|
||||
void window_set_resize(rct_window* w, int32_t minWidth, int32_t minHeight, int32_t maxWidth, int32_t maxHeight);
|
||||
|
||||
|
@ -666,9 +667,9 @@ void window_relocate_windows(int32_t width, int32_t height);
|
|||
void window_resize_gui(int32_t width, int32_t height);
|
||||
void window_resize_gui_scenario_editor(int32_t width, int32_t height);
|
||||
void window_ride_construct(rct_window* w);
|
||||
void ride_construction_toolupdate_entrance_exit(int32_t screenX, int32_t screenY);
|
||||
void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY);
|
||||
void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY);
|
||||
void ride_construction_toolupdate_entrance_exit(ScreenCoordsXY screenCoords);
|
||||
void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords);
|
||||
void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords);
|
||||
|
||||
void window_bubble_list_item(rct_window* w, int32_t item_position);
|
||||
|
||||
|
@ -685,22 +686,22 @@ void window_event_unknown_05_call(rct_window* w);
|
|||
void window_event_update_call(rct_window* w);
|
||||
void window_event_periodic_update_call(rct_window* w);
|
||||
void window_event_unknown_08_call(rct_window* w);
|
||||
void window_event_tool_update_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y);
|
||||
void window_event_tool_down_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y);
|
||||
void window_event_tool_drag_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y);
|
||||
void window_event_tool_up_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y);
|
||||
void window_event_tool_update_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_tool_down_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_tool_drag_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_tool_up_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_tool_abort_call(rct_window* w, rct_widgetindex widgetIndex);
|
||||
void window_event_unknown_0E_call(rct_window* w);
|
||||
void window_get_scroll_size(rct_window* w, int32_t scrollIndex, int32_t* width, int32_t* height);
|
||||
void window_event_scroll_mousedown_call(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y);
|
||||
void window_event_scroll_mousedrag_call(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y);
|
||||
void window_event_scroll_mouseover_call(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y);
|
||||
void window_event_scroll_mousedown_call(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_scroll_mousedrag_call(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_scroll_mouseover_call(rct_window* w, int32_t scrollIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_textinput_call(rct_window* w, rct_widgetindex widgetIndex, char* text);
|
||||
void window_event_viewport_rotate_call(rct_window* w);
|
||||
void window_event_unknown_15_call(rct_window* w, int32_t scrollIndex, int32_t scrollAreaType);
|
||||
rct_string_id window_event_tooltip_call(rct_window* w, rct_widgetindex widgetIndex);
|
||||
int32_t window_event_cursor_call(rct_window* w, rct_widgetindex widgetIndex, int32_t x, int32_t y);
|
||||
void window_event_moved_call(rct_window* w, int32_t x, int32_t y);
|
||||
int32_t window_event_cursor_call(rct_window* w, rct_widgetindex widgetIndex, ScreenCoordsXY screenCoords);
|
||||
void window_event_moved_call(rct_window* w, ScreenCoordsXY screenCoords);
|
||||
void window_event_invalidate_call(rct_window* w);
|
||||
void window_event_paint_call(rct_window* w, rct_drawpixelinfo* dpi);
|
||||
void window_event_scroll_paint_call(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex);
|
||||
|
@ -708,7 +709,7 @@ void window_event_scroll_paint_call(rct_window* w, rct_drawpixelinfo* dpi, int32
|
|||
void invalidate_all_windows_after_input();
|
||||
void textinput_cancel();
|
||||
|
||||
void window_move_and_snap(rct_window* w, int32_t newWindowX, int32_t newWindowY, int32_t snapProximity);
|
||||
void window_move_and_snap(rct_window* w, ScreenCoordsXY newWindowCoords, int32_t snapProximity);
|
||||
int32_t window_can_resize(rct_window* w);
|
||||
|
||||
void window_start_textbox(
|
||||
|
|
Loading…
Reference in New Issue