1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

refactor window event calls

This commit is contained in:
IntelOrca
2015-06-09 18:29:02 +01:00
parent 72de8ad103
commit 0dd749baac
8 changed files with 200 additions and 92 deletions

View File

@@ -84,7 +84,7 @@ void game_create_windows()
window_main_open();
window_top_toolbar_open();
window_game_bottom_toolbar_open();
RCT2_CALLPROC_EBPSAFE(0x0066B905);
window_resize_gui(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16));
}
/**

View File

@@ -103,7 +103,7 @@ void game_handle_input()
if (RCT2_GLOBAL(0x009ABDF2, uint8) != 0) {
for (w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, (int)w, 0, 0);
window_event_unknown_07_call(w);
sub_6EA73F();
RCT2_CALLPROC_EBPSAFE(0x006E8346); // update_cursor_position
@@ -130,7 +130,7 @@ void game_handle_input()
}
for (w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_08], 0, 0, 0, 0,(int) w, 0, 0);
window_event_unknown_08_call(w);
}
/**
@@ -272,7 +272,7 @@ static void game_handle_input_mouse(int x, int y, int state)
if (w == NULL)
break;
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DRAG], x, y, 0, (int)RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0);
window_event_tool_drag_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint32), x, y);
}
else if (state == 2){
@@ -285,7 +285,7 @@ static void game_handle_input_mouse(int x, int y, int state)
);
if (w == NULL)
break;
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_UP], x, y, 0, (int)RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0);
window_event_tool_up_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), x, y);
}
else{
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_4))
@@ -347,7 +347,7 @@ static void input_window_position_end(rct_window *w, int x, int y)
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) = _dragWindowClass;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) = _dragWindowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint16) = _dragWidgetIndex;
RCT2_CALLPROC_X(w->event_handlers[WE_MOVED], 0, 0, x, y, (int)w, 0, 0);
window_event_moved_call(w, x, y);
}
static void input_window_resize_begin(rct_window *w, int widgetIndex, int x, int y)
@@ -467,7 +467,7 @@ static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_ID, uint32) = scroll_id * sizeof(rct_scroll);//We do this because scroll id is not all decompiled
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_15], RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SCROLL_ID, uint32), ebx, scroll_area, scroll_id, (int)w, (int)widget, 0);
if (scroll_area == SCROLL_PART_VIEW){
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEDOWN], scroll_id, ebx, eax, ebx, (int)w, (int)widget, 0);
window_event_scroll_mousedown_call(w, scroll_id, eax, ebx);
return;
}
@@ -559,7 +559,7 @@ static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int
switch (scroll_part){
case SCROLL_PART_VIEW:
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DRAG], w->number / 18, y, x, y, (int)w, (int)widget, (int)w->event_handlers);
window_event_tool_drag_call(w, widgetIndex, w->number / 18, y);
break;
case SCROLL_PART_HSCROLLBAR_LEFT:
RCT2_CALLPROC_X(0x006E9A60, x, y, scroll_part, w->number, (int)w, (int)widget, 0);
@@ -622,7 +622,7 @@ static void input_widget_over(int x, int y, rct_window *w, int widgetIndex)
if (ecx < 0)
input_update_tooltip(w, widgetIndex, x, y);
else if (ecx == 0) {
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEOVER], edx, 0, eax, ebx, (int)w, 0, 0);
window_event_scroll_mouseover_call(w, edx, eax, ebx);
input_update_tooltip(w, widgetIndex, x, y);
}
}
@@ -741,7 +741,7 @@ static void input_widget_left(int x, int y, rct_window *w, int widgetIndex)
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (w != NULL) {
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DOWN], x, y, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0);
window_event_tool_down_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint32), x, y);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) |= INPUT_FLAG_4;
}
}
@@ -855,19 +855,9 @@ void process_mouse_over(int x, int y)
}
//Fall through to default
default:
ecx = x;
edx = y;
eax = widgetId;
ebx = 0xFFFFFFFF;
esi = (int)window;
edi = (int)&window->widgets[widgetId];
RCT2_CALLFUNC_X(window->event_handlers[WE_CURSOR], &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if (ebx == 0xFFFFFFFF) {
cursorId = window_event_cursor_call(window, widgetId, x, y);
if (cursorId == -1)
cursorId = CURSOR_ARROW;
break;
}
cursorId = ebx;
break;
}
}
@@ -893,7 +883,7 @@ void process_mouse_tool(int x, int y)
if (!w)
tool_cancel();
else
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_UPDATE], x, y, 0, RCT2_GLOBAL(0x9DE546, uint16), (int)w, 0, 0);
window_event_tool_update_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint32), x, y);
}
}
@@ -982,7 +972,7 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint16) = cursor_widgetIndex;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) = cursor_w_class;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) = cursor_w_number;
RCT2_CALLPROC_X(cursor_w->event_handlers[WE_DROPDOWN], dropdown_index, 0, 0, cursor_widgetIndex, (int)cursor_w, 0, 0);
window_event_dropdown_call(w, cursor_widgetIndex, dropdown_index);
}
dropdown_cleanup:
window_close_by_class(WC_DROPDOWN);

View File

@@ -442,7 +442,7 @@ void viewport_set_underground_flag(int underground, rct_window* window, rct_view
*/
void viewport_update_position(rct_window *window)
{
RCT2_CALLPROC_X(window->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)window, 0, 0);
window_event_resize_call(window);
rct_viewport* viewport = window->viewport;
if (!viewport)return;

View File

@@ -838,7 +838,7 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
// Draw the scroll contents
if (scroll_dpi.width > 0 && scroll_dpi.height > 0)
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_PAINT], scrollIndex, 0, 0, 0, (int)w, (int)&scroll_dpi, 0);
window_event_scroll_paint_call(w, &scroll_dpi, scrollIndex);
}
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour)

View File

@@ -178,7 +178,7 @@ void window_update_all()
if (RCT2_GLOBAL(0x009DEB7C, sint16) >= 1000) {
RCT2_GLOBAL(0x009DEB7C, sint16) = 0;
for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, (int) w, 0, 0);
window_event_unknown_07_call(w);
}
// Border flash invalidation
@@ -651,8 +651,7 @@ void window_close(rct_window* window)
rct_windowclass cls = window->classification;
rct_windownumber number = window->number;
// Call close event of window
RCT2_CALLPROC_X(window->event_handlers[WE_CLOSE], 0, 0, 0, 0, (int)window, 0, 0);
window_event_close_call(window);
window = window_find_by_number(cls, number);
if (window == NULL)
@@ -1058,18 +1057,6 @@ void window_update_scroll_widgets(rct_window *w)
}
}
int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *height)
{
rct_widget *widget = window_get_scroll_widget(w, scrollIndex);
int widgetIndex = window_get_widget_index(w, widget);
int eax = scrollIndex, ebx = scrollIndex * sizeof(rct_scroll), ecx = 0, edx = 0, esi = (int)w, edi = widgetIndex * sizeof(rct_widget), ebp = 0;
RCT2_CALLFUNC_X(w->event_handlers[WE_SCROLL_GETSIZE], & eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
*width = ecx;
*height = edx;
return 1;
}
int window_get_scroll_data_index(rct_window *w, int widget_index)
{
int i, result;
@@ -1366,7 +1353,7 @@ void sub_688956()
rct_window *w;
for (w = RCT2_NEW_WINDOW - 1; w >= g_window_list; w--)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_14], 0, 0, 0, 0, (int)w, 0, 0);
window_event_unknown_14_call(w);
}
/**
@@ -1564,11 +1551,8 @@ void window_draw(rct_window *w, int left, int top, int right, int bottom)
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WINDOW_COLOUR_3, uint8) = v->colours[2] & 0x7F;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WINDOW_COLOUR_4, uint8) = v->colours[3] & 0x7F;
// Invalidate the window
window_event_invalidate_call(v);
// Paint the window
RCT2_CALLPROC_X(v->event_handlers[WE_PAINT], 0, 0, 0, 0, (int)v, (int)dpi, 0);
window_event_paint_call(v, dpi);
}
}
@@ -1804,7 +1788,7 @@ void tool_cancel()
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (w != NULL)
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_ABORT], 0, 0, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0);
window_event_tool_abort_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16));
}
}
}
@@ -1835,6 +1819,33 @@ void window_guest_list_init_vars_b()
RCT2_GLOBAL(0x00F1AF20, uint16) = 0;
}
static void window_event_call_address(int address, rct_window *w)
{
#ifdef _MSC_VER
__asm {
push address
push w
mov esi, w
call[esp + 4]
add esp, 8
}
#else
__asm__ ( "\
push %[address]\n\
mov eax, %[w] \n\
push eax \n\
mov esi, %[w] \n\
call [esp+4] \n\
add esp, 8 \n\
" : [address] "+m" (address), [w] "+m" (w) : : "eax", "esi" );
#endif
}
void window_event_close_call(rct_window* w)
{
window_event_call_address(w->event_handlers[WE_CLOSE], w);
}
void window_event_mouse_up_call(rct_window* w, int widgetIndex)
{
RCT2_CALLPROC_X(w->event_handlers[WE_MOUSE_UP], 0, 0, 0, widgetIndex, (int)w, (int)&(w->event_handlers[widgetIndex]), 0);
@@ -1842,7 +1853,7 @@ void window_event_mouse_up_call(rct_window* w, int widgetIndex)
void window_event_resize_call(rct_window* w)
{
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
window_event_call_address(w->event_handlers[WE_RESIZE], w);
}
void window_event_mouse_down_call(rct_window *w, int widgetIndex)
@@ -1883,31 +1894,14 @@ void window_event_mouse_down_call(rct_window *w, int widgetIndex)
#endif
}
void window_event_invalidate_call(rct_window* w)
void window_event_dropdown_call(rct_window* w, int widgetIndex, int dropdownIndex)
{
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_DROPDOWN], dropdownIndex, 0, 0, widgetIndex, (int)w, 0, 0);
}
static void window_event_call_address(int address, rct_window *w)
void window_event_unknown_05_call(rct_window* w)
{
#ifdef _MSC_VER
__asm {
push address
push w
mov esi, w
call[esp + 4]
add esp, 8
}
#else
__asm__ ( "\
push %[address]\n\
mov eax, %[w] \n\
push eax \n\
mov esi, %[w] \n\
call [esp+4] \n\
add esp, 8 \n\
" : [address] "+m" (address), [w] "+m" (w) : : "eax", "esi" );
#endif
window_event_call_address(w->event_handlers[WE_UNKNOWN_05], w);
}
void window_event_update_call(rct_window *w)
@@ -1915,6 +1909,122 @@ void window_event_update_call(rct_window *w)
window_event_call_address(w->event_handlers[WE_UPDATE], w);
}
void window_event_unknown_07_call(rct_window* w)
{
window_event_call_address(w->event_handlers[WE_UNKNOWN_07], w);
}
void window_event_unknown_08_call(rct_window* w)
{
window_event_call_address(w->event_handlers[WE_UNKNOWN_08], w);
}
void window_event_tool_update_call(rct_window* w, int widgetIndex, int x, int y)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_UPDATE], x, y, 0, widgetIndex, (int)w, 0, 0);
}
void window_event_tool_down_call(rct_window* w, int widgetIndex, int x, int y)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DOWN], x, y, 0, widgetIndex, (int)w, 0, 0);
}
void window_event_tool_drag_call(rct_window* w, int widgetIndex, int x, int y)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DRAG], x, y, 0, widgetIndex, (int)w, 0, 0);
}
void window_event_tool_up_call(rct_window* w, int widgetIndex, int x, int y)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_UP], x, y, 0, widgetIndex, (int)w, 0, 0);
}
void window_event_tool_abort_call(rct_window* w, int widgetIndex)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_ABORT], 0, 0, 0, widgetIndex, (int)w, 0, 0);
}
void window_event_unknown_0E_call(rct_window* w)
{
window_event_call_address(w->event_handlers[WE_UNKNOWN_0E], w);
}
int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *height)
{
rct_widget *widget = window_get_scroll_widget(w, scrollIndex);
int widgetIndex = window_get_widget_index(w, widget);
int eax = scrollIndex, ebx = scrollIndex * sizeof(rct_scroll), ecx = 0, edx = 0, esi = (int)w, edi = widgetIndex * sizeof(rct_widget), ebp = 0;
RCT2_CALLFUNC_X(w->event_handlers[WE_SCROLL_GETSIZE], & eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
*width = ecx;
*height = edx;
return 1;
}
void window_event_scroll_mousedown_call(rct_window* w, int scrollIndex, int x, int y)
{
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEDOWN], scrollIndex, 0, x, y, (int)w, (int)window_get_scroll_widget(w, scrollIndex), 0);
}
void window_event_unknown_11_call(rct_window* w)
{
window_event_call_address(w->event_handlers[WE_UNKNOWN_11], w);
}
void window_event_scroll_mouseover_call(rct_window* w, int scrollIndex, int x, int y)
{
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEOVER], scrollIndex, 0, x, y, (int)w, (int)window_get_scroll_widget(w, scrollIndex), 0);
}
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TEXT_INPUT], 0, 0, text != NULL, widgetIndex, (int)w, (int)text, 0);
}
void window_event_unknown_14_call(rct_window* w)
{
window_event_call_address(w->event_handlers[WE_UNKNOWN_14], w);
}
void window_event_unknown_15_call(rct_window* w)
{
window_event_call_address(w->event_handlers[WE_UNKNOWN_15], w);
}
rct_string_id window_event_tooltip_call(rct_window* w, int widgetIndex)
{
int eax = widgetIndex, ebx, ecx, edx, esi = (int)w, edi, ebp;
RCT2_CALLFUNC_X(w->event_handlers[WE_TOOLTIP], &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return eax & 0xFFFF;
}
int window_event_cursor_call(rct_window* w, int widgetIndex, int x, int y)
{
int eax = widgetIndex, ebx = -1, ecx = x, edx = y, esi = (int)w, edi = &w->widgets[widgetIndex], ebp;
RCT2_CALLFUNC_X(w->event_handlers[WE_CURSOR], &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return ebx;
}
void window_event_moved_call(rct_window* w, int x, int y)
{
RCT2_CALLPROC_X(w->event_handlers[WE_MOVED], 0, 0, x, y, (int)w, 0, 0);
}
void window_event_invalidate_call(rct_window* w)
{
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
}
void window_event_paint_call(rct_window* w, rct_drawpixelinfo *dpi)
{
RCT2_CALLPROC_X(w->event_handlers[WE_PAINT], 0, 0, 0, 0, (int)w, (int)dpi, 0);
}
void window_event_scroll_paint_call(rct_window* w, rct_drawpixelinfo *dpi, int scrollIndex)
{
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_PAINT], scrollIndex, 0, 0, 0, (int)w, (int)dpi, 0);
}
/**
* rct2: New function not from rct2
* Bubbles an item one position up in the window list.
@@ -2327,11 +2437,6 @@ int window_can_resize(rct_window *w)
return (w->flags & WF_RESIZABLE) && (w->min_width != w->max_width || w->min_height != w->max_height);
}
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text)
{
RCT2_CALLPROC_X(w->event_handlers[WE_TEXT_INPUT], 0, 0, text != NULL, widgetIndex, (int)w, (int)text, 0);
}
/**
*
* rct2: 0x006EE3C3

View File

@@ -476,7 +476,6 @@ void widget_invalidate_by_number(rct_windowclass cls, rct_windownumber number, i
void window_init_scroll_widgets(rct_window *w);
void window_update_scroll_widgets(rct_window *w);
int window_get_scroll_data_index(rct_window *w, int widget_index);
int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *height);
rct_window *window_bring_to_front(rct_window *w);
rct_window *window_bring_to_front_by_class(rct_windowclass cls);
@@ -598,12 +597,34 @@ void window_map_tooltip_update_visibility();
void window_staff_list_init_vars();
void window_event_close_call(rct_window* w);
void window_event_mouse_up_call(rct_window* w, int widgetIndex);
void window_event_resize_call(rct_window* w);
void window_event_mouse_down_call(rct_window* w, int widgetIndex);
void window_event_invalidate_call(rct_window* w);
void window_event_mouse_down_call(rct_window *w, int widgetIndex);
void window_event_dropdown_call(rct_window* w, int widgetIndex, int dropdownIndex);
void window_event_unknown_05_call(rct_window* w);
void window_event_update_call(rct_window *w);
void window_event_unknown_07_call(rct_window* w);
void window_event_unknown_08_call(rct_window* w);
void window_event_tool_update_call(rct_window* w, int widgetIndex, int x, int y);
void window_event_tool_down_call(rct_window* w, int widgetIndex, int x, int y);
void window_event_tool_drag_call(rct_window* w, int widgetIndex, int x, int y);
void window_event_tool_up_call(rct_window* w, int widgetIndex, int x, int y);
void window_event_tool_abort_call(rct_window* w, int widgetIndex);
void window_event_unknown_0E_call(rct_window* w);
int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *height);
void window_event_scroll_mousedown_call(rct_window* w, int scrollIndex, int x, int y);
void window_event_unknown_11_call(rct_window* w);
void window_event_scroll_mouseover_call(rct_window* w, int scrollIndex, int x, int y);
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text);
void window_event_unknown_14_call(rct_window* w);
void window_event_unknown_15_call(rct_window* w);
rct_string_id window_event_tooltip_call(rct_window* w, int widgetIndex);
int window_event_cursor_call(rct_window* w, int widgetIndex, int x, int y);
void window_event_moved_call(rct_window* w, int x, int y);
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, int scrollIndex);
void sub_6EA73F();
void textinput_cancel();

View File

@@ -349,14 +349,8 @@ static void window_new_ride_populate_list()
*/
static void window_new_ride_scroll_to_focused_ride(rct_window *w)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
// Get the scroll height
eax = 0;
esi = (int)w;
RCT2_CALLFUNC_X(w->event_handlers[WE_SCROLL_GETSIZE], &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
int scrollHeight = edx;
ebx = 0;
int scrollWidth, scrollHeight;
window_get_scroll_size(w, 0, &scrollWidth, &scrollHeight);
// Find row index of the focused ride type
rct_widget *listWidget = &window_new_ride_widgets[WIDX_RIDE_LIST];

View File

@@ -94,7 +94,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
return;
widget = &widgetWindow->widgets[widgetIndex];
RCT2_CALLPROC_X(widgetWindow->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)widgetWindow, 0, 0);
window_event_invalidate_call(widgetWindow);
if (widget->tooltip == 0xFFFF)
return;
@@ -102,11 +102,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) = widgetWindow->number;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint16) = widgetIndex;
int eax, ebx, ecx, edx, esi, edi, ebp;
eax = widgetIndex;
esi = (int)widgetWindow;
RCT2_CALLFUNC_X(widgetWindow->event_handlers[WE_TOOLTIP], &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if ((eax & 0xFFFF) == 0xFFFF)
if (window_event_tooltip_call(widgetWindow, widgetIndex) == (rct_string_id)STR_NONE)
return;
w = window_find_by_class(WC_ERROR);
@@ -128,7 +124,9 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
tooltip_text_width = 196;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
tooltip_text_width = gfx_wrap_string(buffer, tooltip_text_width + 1, &tooltip_text_height, &ebx);
int fontHeight;
tooltip_text_width = gfx_wrap_string(buffer, tooltip_text_width + 1, &tooltip_text_height, &fontHeight);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TEXT_HEIGHT, sint16) = tooltip_text_height;
width = tooltip_text_width + 3;