From ce812fe403e21e4cc9174fb11a9820b757e48830 Mon Sep 17 00:00:00 2001 From: hexdec Date: Mon, 11 Aug 2014 22:57:45 +0200 Subject: [PATCH] Added window_resize_gui_scenario_editor (0x0066F0DD). --- src/window.c | 42 ++++++++++++++++++++++++++++++++++++++++-- src/window.h | 1 + 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/window.c b/src/window.c index d7fa7cd63f..3e34e4fd35 100644 --- a/src/window.c +++ b/src/window.c @@ -1310,8 +1310,7 @@ void window_bubble_list_item(rct_window* w, int item_position){ void window_resize_gui(int width, int height) { if (RCT2_GLOBAL(0x9DEA68, uint8) & 0xE){ - //Scenario editor version - RCT2_CALLPROC_EBPSAFE(0x66F0DD); + return window_resize_gui_scenario_editor(width, height); } rct_window* mainWind = window_get_main(); if (mainWind){ @@ -1363,3 +1362,42 @@ void window_resize_gui(int width, int height) exitWind->y = height - 64; } } + +/** +* rct2: 0x0066F0DD +*/ +void window_resize_gui_scenario_editor(int width, int height) +{ + rct_window* mainWind = window_get_main(); + if (mainWind) { + rct_viewport* viewport = mainWind->viewport; + mainWind->width = width; + mainWind->height = height; + RCT2_GLOBAL(0x9A9834, uint16) = width - 1; + RCT2_GLOBAL(0x9A9838, uint16) = height - 1; + viewport->width = width; + viewport->height = height; + viewport->view_width = width << viewport->zoom; + viewport->view_height = height << viewport->zoom; + if (mainWind->widgets != NULL && mainWind->widgets[0].type == WWT_VIEWPORT){ + mainWind->widgets[0].right = width; + mainWind->widgets[0].bottom = height; + } + } + + rct_window* topWind = window_find_by_id(WC_TOP_TOOLBAR, 0); + if (topWind){ + topWind->width = max(640, width); + } + + rct_window* bottomWind = window_find_by_id(WC_BOTTOM_TOOLBAR, 0); + if (bottomWind){ + bottomWind->y = height - 32; + bottomWind->width = max(640, width); + RCT2_GLOBAL(0x9A997C, uint16) = bottomWind->width - 1; + RCT2_GLOBAL(0x9A997A, uint16) = bottomWind->width - 200; + RCT2_GLOBAL(0x9A998A, uint16) = bottomWind->width - 198; + RCT2_GLOBAL(0x9A998C, uint16) = bottomWind->width - 3; + } + +} diff --git a/src/window.h b/src/window.h index 6aebd03301..cc6c286083 100644 --- a/src/window.h +++ b/src/window.h @@ -346,6 +346,7 @@ void tool_cancel(); // Open window functions void window_main_open(); void window_resize_gui(int width, int height); +void window_resize_gui_scenario_editor(int width, int height); void window_game_top_toolbar_open(); void window_game_bottom_toolbar_open(); void window_about_open();