From e8251daad596d936ad9a60ed888baa9ec161dbb5 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Tue, 9 Sep 2014 18:08:34 +0100 Subject: [PATCH] Added peep_text_input --- src/window.h | 12 ++++++++++++ src/window_peep.c | 29 +++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/window.h b/src/window.h index 6b638dbe1f..9c534d6771 100644 --- a/src/window.h +++ b/src/window.h @@ -491,6 +491,12 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct __asm mov dropdownIndex, ax \ __asm mov widgetIndex, dx \ __asm mov w, esi + + #define window_text_input_get_registers(w, widgetIndex, _cl, text) \ + __asm mov widgetIndex, dx \ + __asm mov _cl, cl \ + __asm mov w, esi \ + __asm mov text, edi #define window_scrollmouse_get_registers(w, x, y) \ __asm mov x, cx \ @@ -519,6 +525,12 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct __asm__ ( "mov %["#widgetIndex"], dx " : [widgetIndex] "+m" (widgetIndex) ); \ __asm__ ( "mov %["#w"], esi " : [w] "+m" (w) ); + #define window_text_input_get_registers(w, widgetIndex, _cl, text) \ + __asm__ ( "mov %[_cl], cl " : [_cl] "+m" (_cl) ); \ + __asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) ); \ + __asm__ ( "mov %[w], esi " : [w] "+m" (w) ); \ + __asm__ ( "mov %[text], edi " : [text] "+m" (text) ); + #define window_scrollmouse_get_registers(w, x, y) \ __asm__ ( "mov %["#x"], cx " : [x] "+m" (x) ); \ __asm__ ( "mov %["#y"], dx " : [y] "+m" (y) ); \ diff --git a/src/window_peep.c b/src/window_peep.c index 3eab4b2ae0..90c9378124 100644 --- a/src/window_peep.c +++ b/src/window_peep.c @@ -180,6 +180,7 @@ void window_peep_overview_paint(); void window_peep_overview_invalidate(); void window_peep_overview_viewport_init_wrapper(); void window_peep_overview_update(rct_window* w); +void window_peep_overview_text_input(); static void* window_peep_overview_events[] = { window_peep_close, @@ -191,17 +192,17 @@ static void* window_peep_overview_events[] = { window_peep_overview_update, window_peep_emptysub, window_peep_emptysub, - (void*)0x696A5F, - (void*)0x696A54, + (void*)0x696A5F,//tool_update + (void*)0x696A54,//tool_down window_peep_emptysub, window_peep_emptysub, - (void*)0x696A49, + (void*)0x696A49,//tool_abort window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, window_peep_emptysub, - (void*)0x696A6A, + window_peep_overview_text_input,//text_input window_peep_overview_viewport_init_wrapper, window_peep_emptysub, window_peep_emptysub, @@ -1065,3 +1066,23 @@ void window_peep_overview_update(rct_window* w){ } } + +/* rct2:0x696A6A */ +void window_peep_overview_text_input(){ + short widgetIndex; + rct_window *w; + char _cl; + uint32* text; + + window_text_input_get_registers(w, widgetIndex, _cl, text); + + if (widgetIndex != WIDX_RENAME)return; + + if (!_cl) return; + + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, uint16) = 0x5AE; + + game_do_command(1, 1, w->number, *text, 22, *(text + 2), *(text + 1)); + game_do_command(2, 1, 0, *(text + 3), 22, *(text + 5), *(text + 4)); + game_do_command(0, 1, 0, *(text + 6), 22, *(text + 8), *(text + 7)); +} \ No newline at end of file