Added sub_6E9F92 determines scroll action type

This commit is contained in:
Duncan Frost 2014-07-13 10:03:50 +01:00
parent d8727e8998
commit 16860a8817
1 changed files with 68 additions and 2 deletions

View File

@ -343,7 +343,7 @@ static void input_mouseover(int x, int y, rct_window *w, int widgetIndex);
static void input_mouseover_widget_check(rct_windowclass windowClass, rct_windownumber windowNumber, int widgetIndex);
static void input_mouseover_widget_flatbutton_invalidate();
static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex);
int sub_0x6E9F92(int* x, int* y, int state, rct_window* w, rct_widget* widget);
/**
*
@ -546,7 +546,7 @@ static void game_handle_input_mouse(int x, int y, int state)
if (RCT2_GLOBAL(0x9DE548, uint16) == 10){
//Jump 0x6e874E
}
int cx = sub_0x6E9F92(&x, &y, state, w, widget);
//Call 0x6E9F92
//0x6E86D3
break;
@ -590,6 +590,72 @@ static void game_handle_input_mouse(int x, int y, int state)
}
}
/**
* rct: 0x6E9F92
* eax: x
* ebx: y
* ecx: state
* esi: w
* edi: widget
*/
int sub_0x6E9F92(int* x, int* y, int state, rct_window* w, rct_widget* widget){
int scrolls_no = 0;
for (rct_widget* widg = w->widgets; widg != widget; widg++){
if (widg->type == WWT_SCROLL){
scrolls_no ++;
}
}
if ((w->scrolls[scrolls_no].flags & 1) && (*y >= widget->bottom + w->y - 11)){//Horizontal
if (*x < widget->left + 11 + w->x) return 1;
int x_pos = widget->right + w->x;
if (w->scrolls[scrolls_no].flags & 0x10)x_pos -= 11;
if (*x >= x_pos)return -1;
x_pos -= 10;
if (*x >= x_pos)return 2;
if (*x < w->scrolls[scrolls_no].h_thumb_left + widget->left + w->x)return 3;
if (*x > w->scrolls[scrolls_no].h_thumb_right + widget->left + w->x) return 4;
return 5;
}
else if ((w->scrolls[scrolls_no].flags & 0x10) && (*x >= widget->right + w->x - 11)){//Vertical
if (*y < widget->top + 11 + w->y)return 6;
int y_pos = widget->bottom + w->y;
if (w->scrolls[scrolls_no].flags & 0x01)y_pos -= 11;
if (*y >= y_pos)return -1;
y_pos -= 10;
if (*y >= y_pos)return 7;
if (*y < w->scrolls[scrolls_no].v_thumb_top + widget->top + w->y)return 8;
if (*y > w->scrolls[scrolls_no].v_thumb_bottom + widget->top + w->y)return 9;
return 10;
}
else{
*x -= widget->left + w->x;
*y -= widget->top + w->y;
(*x)--;
if (*x < 0) return -1;
(*y)--;
if (*y < 0) return -1;
*x += w->scrolls[scrolls_no].h_left;
*y += w->scrolls[scrolls_no].v_top;
return 0;
}
}
/**
*
* rct2: 0x006E9253