From c9543005de21f5d4e4aad3de9eac16c73f9247d5 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Wed, 3 Jun 2015 20:54:28 +0100 Subject: [PATCH] Fix small issues with scrolling. I've found the cause of the cursors not correctly changing. It would appear ebx is popped to its previous value as the call function returns. This causes the cursor value to never change. This can be solved when all windows are complete. Fixes points i, ii, iii, iv of #1127 (Fixed by reseting scroll positions when the height is 0. And actually passing the scroll index to the calling function) --- src/input.c | 2 +- src/interface/window.c | 8 +++++++- src/windows/editor_inventions_list.c | 11 +++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/input.c b/src/input.c index 60dfdf676a..f8c107e6ae 100644 --- a/src/input.c +++ b/src/input.c @@ -861,7 +861,7 @@ void process_mouse_over(int x, int y) RCT2_GLOBAL(0x9DE558, uint16) = x; RCT2_GLOBAL(0x9DE55A, uint16) = y; int output_x, output_y, output_scroll_area, scroll_id; - widget_scroll_get_part(window, window->widgets, x, y, &output_x, &output_y, &output_scroll_area, &scroll_id); + widget_scroll_get_part(window, window->widgets, x, y, &x, &y, &output_scroll_area, &scroll_id); cursorId = scroll_id; if (output_scroll_area != SCROLL_PART_VIEW) { diff --git a/src/interface/window.c b/src/interface/window.c index 0c79b4257a..3a515c54dc 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -845,6 +845,12 @@ void window_update_scroll_widgets(rct_window *w) scroll = &w->scrolls[scrollIndex]; window_get_scroll_size(w, scrollIndex, &width, &height); + if (height == 0){ + scroll->v_top = 0; + } + else if (width == 0){ + scroll->h_left = 0; + } width++; height++; @@ -872,7 +878,7 @@ int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *heig rct_widget *widget = window_get_scroll_widget(w, scrollIndex); int widgetIndex = window_get_widget_index(w, widget); - int eax = 0, ebx = scrollIndex * sizeof(rct_scroll), ecx = 0, edx = 0, esi = (int)w, edi = widgetIndex * sizeof(rct_widget), ebp = 0; + 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; diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c index 9ed35c7ee6..f89ac18ce5 100644 --- a/src/windows/editor_inventions_list.c +++ b/src/windows/editor_inventions_list.c @@ -119,7 +119,7 @@ static void* window_editor_inventions_list_events[] = { window_editor_inventions_list_scrollpaint }; -// 0x0098177C +// 0x009817EC static void* window_editor_inventions_list_drag_events[] = { window_editor_inventions_list_emptysub, window_editor_inventions_list_emptysub, @@ -170,7 +170,14 @@ static int research_item_is_always_researched(rct_research_item *researchItem) */ static void sub_685901() { - RCT2_CALLPROC_EBPSAFE(0x00685901); + for (rct_research_item* research = gResearchItems; + research->entryIndex != -3; + research++){ + + if (research->entryIndex < -3){ + research->entryIndex &= 0x00FFFFFF; + } + } } /**