Merge pull request #244 from duncanspumpkin/fix_cursor

Fixes cursor error when main window is at increased size.
This commit is contained in:
Ted John 2014-07-29 23:37:29 +01:00
commit 4abd782497
4 changed files with 68 additions and 3 deletions

View File

@ -107,9 +107,8 @@ void process_mouse_over(int x, int y)
if (window != NULL)
{
widgetId = window_find_widget_from_point(window, x, y);
RCT2_GLOBAL(0x1420046, sint16) = (widgetId & 0xFFFF);
if (widgetId != 0xFFFF)
if (widgetId != -1)
{
switch (window->widgets[widgetId].type){

View File

@ -28,6 +28,7 @@
#include "addresses.h"
#include "gfx.h"
#include "osinterface.h"
#include "window.h"
#include "rct2.h"
#include "cursors.h"
@ -192,6 +193,7 @@ static void osinterface_create_window()
osinterface_resize(width, height);
}
static void osinterface_resize(int width, int height)
{
rct_drawpixelinfo *screenDPI;
@ -249,7 +251,9 @@ static void osinterface_resize(int width, int height)
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) = (width >> 6) + 1;
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32) = (height >> 3) + 1;
RCT2_CALLPROC_EBPSAFE(0x0066B905); // resize_gui()
window_resize_gui(width, height);
//RCT2_CALLPROC_EBPSAFE(0x0066B905); // resize_gui()
gfx_invalidate_screen();
}

View File

@ -1300,3 +1300,64 @@ void window_bubble_list_item(rct_window* w, int item_position){
w->list_item_positions[item_position] = w->list_item_positions[item_position + 1];
w->list_item_positions[item_position + 1] = swap;
}
/**
* rct2: 0x0066B905
*/
void window_resize_gui(int width, int height)
{
if (RCT2_GLOBAL(0x9DEA68, uint8) & 0xE){
//Scenario editor version
RCT2_CALLPROC_EBPSAFE(0x66F0DD);
}
rct_window* mainWind = window_get_main();
if (mainWind){
rct_viewport* viewport = mainWind->viewport;
mainWind->width = width;
mainWind->height = height;
RCT2_GLOBAL(0x9A9418, uint16) = width - 1;
RCT2_GLOBAL(0x9A941C, 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(0x9A95D0, uint16) = width - 1;
RCT2_GLOBAL(0x9A95E0, uint16) = width - 3;
RCT2_GLOBAL(0x9A95DE, uint16) = width - 118;
RCT2_GLOBAL(0x9A95CE, uint16) = width - 120;
RCT2_GLOBAL(0x9A9590, uint16) = width - 121;
RCT2_GLOBAL(0x9A95A0, uint16) = width - 123;
RCT2_GLOBAL(0x9A95C0, uint16) = width - 126;
RCT2_GLOBAL(0x9A95BE, uint16) = width - 149;
RCT2_GLOBAL(0x9A95EE, uint16) = width - 118;
RCT2_GLOBAL(0x9A95F0, uint16) = width - 3;
}
rct_window* titleWind = window_find_by_id(WC_TITLE_MENU, 0);
if (titleWind){
titleWind->x = width / 2 - 164;
titleWind->y = height - 142;
}
rct_window* exitWind = window_find_by_id(WC_TITLE_EXIT, 0);
if (exitWind){
exitWind->x = width - 40;
exitWind->y = height - 64;
}
}

View File

@ -345,6 +345,7 @@ void tool_cancel();
// Open window functions
void window_main_open();
void window_resize_gui(int width, int height);
void window_game_top_toolbar_open();
void window_game_bottom_toolbar_open();
void window_about_open();