1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Started switch over to c based window event handlers with backwards compatibility

This commit is contained in:
Duncan Frost
2014-05-18 20:32:50 +01:00
parent afeef14feb
commit aaca1d2ece
3 changed files with 39 additions and 8 deletions

View File

@@ -180,6 +180,22 @@ void game_logic_update()
static void game_handle_input_mouse();
static void game_get_next_input(int *x, int *y, int *state);
static void RCT2_CALLPROC_EVENT_HANDLER(int address, rct_window* w)
{
__asm {
push address
push w
mov eax, 0
mov ebx, 0
mov ecx, 0
mov edx, 0
mov esi, w
mov edi, 0
mov ebp, 0
call[esp+4]
add esp, 8
}
}
/**
*
* rct2: 0x006EA627
@@ -195,7 +211,7 @@ void game_handle_input()
if (RCT2_GLOBAL(0x009ABDF2, uint8) != 0) {
for (w = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); 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);
RCT2_CALLPROC_EVENT_HANDLER(w->event_handlers[WE_UNKNOWN_07], w);
RCT2_CALLPROC_EBPSAFE(0x006EA73F);
RCT2_CALLPROC_EBPSAFE(0x006E8346); // update_cursor_position
@@ -229,7 +245,7 @@ void game_handle_input()
}
for (w = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); 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);
RCT2_CALLPROC_EVENT_HANDLER(w->event_handlers[WE_UNKNOWN_08],w);
}
/**

View File

@@ -99,7 +99,22 @@ rct_widget *window_get_scroll_widget(rct_window *w, int scrollIndex)
return NULL;
}
static void RCT2_CALLPROC_EVENT_HANDLER(int address, rct_window* w)
{
__asm {
push address
push w
mov eax, 0
mov ebx, 0
mov ecx, 0
mov edx, 0
mov esi, w
mov edi, 0
mov ebp, 0
call[esp + 4]
add esp, 8
}
}
/**
*
* rct2: 0x006ED7B0
@@ -111,7 +126,7 @@ void window_dispatch_update_all()
RCT2_GLOBAL(0x01423604, sint32)++;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16)++;
for (w = RCT2_LAST_WINDOW; w >= RCT2_FIRST_WINDOW; w--)
RCT2_CALLPROC_X(w->event_handlers[WE_UPDATE], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_EVENT_HANDLER(w->event_handlers[WE_UPDATE], w);
RCT2_CALLPROC_EBPSAFE(0x006EE411); // handle_text_input
}
@@ -142,7 +157,7 @@ void window_update_all()
if (RCT2_GLOBAL(0x009DEB7C, sint16) >= 1000) {
RCT2_GLOBAL(0x009DEB7C, sint16) = 0;
for (w = RCT2_LAST_WINDOW; w >= RCT2_FIRST_WINDOW; w--)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_EVENT_HANDLER(w->event_handlers[WE_UNKNOWN_07],w);
}
// Border flash invalidation

View File

@@ -241,11 +241,11 @@ static void window_cheats_guests_mouseup()
}
}
static void window_cheats_update()
static void window_cheats_update(rct_window *w)
{
rct_window *w;
rct_window *w2;
__asm mov w, esi
__asm mov w2, esi
w->var_48E++;
widget_invalidate(w->classification, w->number, WIDX_TAB_1+w->page);