diff --git a/src/input.c b/src/input.c index 6ab1b33776..2b11d0ecfe 100644 --- a/src/input.c +++ b/src/input.c @@ -600,6 +600,8 @@ void input_state_widget_pressed( int x, int y, int state, int widgetIndex, rct_w cursor_w_number = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber); //6e8e04 if (w) { + int dropdown_index = 0; + if (w->classification == WC_DROPDOWN){ int left = x - w->x; if (left < 0); //6e8fb7; @@ -623,20 +625,21 @@ void input_state_widget_pressed( int x, int y, int state, int widgetIndex, rct_w if (row_no >= RCT2_GLOBAL(0x009DED48, sint32)); //6e8fb7; // _dropdown_no_columns - int item_no = row_no * RCT2_GLOBAL(0x009DED44, sint32) + column_no; + dropdown_index = row_no * RCT2_GLOBAL(0x009DED44, sint32) + column_no; // _dropdown_no_items - if (item_no >= RCT2_GLOBAL(0x009DEBA0, sint16)); //6e8fb7; + if (dropdown_index >= RCT2_GLOBAL(0x009DEBA0, sint16)); //6e8fb7; // _dropdown_unknown?? highlighted? - if (item_no < 32 && RCT2_GLOBAL(0x009DED34, sint32) & (1 << item_no)); //6e8fb7; + if (dropdown_index < 32 && RCT2_GLOBAL(0x009DED34, sint32) & (1 << dropdown_index)); //6e8fb7; - if (gDropdownItemsFormat[item_no] == 0); //6e8fb7; + if (gDropdownItemsFormat[dropdown_index] == 0); //6e8fb7; } else{ //6e8ed3 if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint32)); - //6e8fb7 ax = -1 + //6e8fb7 + dropdown_index = -1; if (RCT2_GLOBAL(0x9DE518, uint32) & 2){ if (!(RCT2_GLOBAL(0x9DE518, uint32) & 4)){ RCT2_GLOBAL(0x9DE518, uint32) |= (1 << 2); @@ -660,13 +663,10 @@ void input_state_widget_pressed( int x, int y, int state, int widgetIndex, rct_w RCT2_GLOBAL(0x9DE536, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint32); RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass); RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber); - window_event_helper(w, widgetIndex, WE_DROPDOWN); - - //6e8fb7 - window_close_by_id(WC_DROPDOWN, 0); + RCT2_CALLPROC_X(temp_w->event_handlers[WE_DROPDOWN], dropdown_index, 0, 0, RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint8), (int)w, 0, 0); } - RCT2_CALLPROC_X(0x006E8DA7, x, y, state, widgetIndex, (int)w, (int)widget, 0); - return; + //6e8fb7 + window_close_by_id(WC_DROPDOWN, 0); } if (state == 3) return;