From 3bca6b699abcb16fa05067c99398b3a5d875e8e1 Mon Sep 17 00:00:00 2001 From: Angelo Geels Date: Fri, 11 Jul 2014 21:21:17 +0200 Subject: [PATCH] Implemented input_hscrollbar_left_trough --- src/game.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/game.c b/src/game.c index 181d56f37b..e460e2ec86 100644 --- a/src/game.c +++ b/src/game.c @@ -775,6 +775,51 @@ static void input_hscrollbar_rightbutton(rct_window* w) window_invalidate_by_id(widgetIndex, windowClass); } +/** + * Horizontal scrollbar's left trough was clicked + * rct2: 0x006E9B47 + */ +static void input_hscrollbar_left_trough(rct_window* w) +{ + rct_windowclass windowClass; + rct_windownumber windowNumber; + rct_window* w2; + rct_widget* widget; + rct_scroll* scroll; + uint16 widgetIndex; + sint16 left, widgetWidth; + + windowClass = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass); + windowNumber = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber); + w2 = window_find_by_id(windowClass, windowNumber); + + if (w2 == NULL) + return; + + widgetIndex = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint16); + + widget = &w->widgets[widgetIndex]; + scroll = w->scrolls + RCT2_GLOBAL(0x009DE54C, uint32); + + left = scroll->h_left; + + widgetWidth = widget->right - widget->left - 1; + if (scroll->flags & 0x0010) + widgetWidth -= 11; + left -= widgetWidth; + if (left < 0) + left = 0; + scroll->h_left = left; + + widget_scroll_update_thumbs(w, widgetIndex); + + widgetIndex = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint8); + windowClass = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, uint8); + windowClass |= 0x80; + + window_invalidate_by_id(widgetIndex, windowClass); +} + /** * Vertical scrollbar's "top" button held down, scroll it upwards * rct2: 0x006E9C37 @@ -969,7 +1014,7 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex) break; case SCROLL_PART_HSCROLLBAR_LEFT_TROUGH: // 0x006E9B47 - RCT2_CALLPROC_X(0x006E9B47, 0, 0, 0, 0, (int)w, 0, 0); + input_hscrollbar_left_trough(w); break; case SCROLL_PART_HSCROLLBAR_RIGHT_TROUGH: // 0x006E9BB7