Beispiel #1
0
/**
 *
*  rct2: 0x006ED833
 */
void process_mouse_over(sint32 x, sint32 y)
{
	rct_window* window;

	sint32 cursorId;

	cursorId = CURSOR_ARROW;
	set_map_tooltip_format_arg(0, rct_string_id, STR_NONE);
	window = window_find_from_point(x, y);

	if (window != NULL) {
		sint32 ebx, edi;
		rct_window* subWindow;
		rct_widgetindex widgetId = window_find_widget_from_point(window, x, y);
		if (widgetId != -1) {
			switch (window->widgets[widgetId].type){

			case WWT_VIEWPORT:
				if (!(_inputFlags & INPUT_FLAG_TOOL_ACTIVE)) {
					if (viewport_interaction_left_over(x, y)) {
						sub_6ED990(CURSOR_HAND_POINT);
						return;
					}
					break;
				}
				cursorId = gCurrentToolId;
				subWindow = window_find_by_number(
					gCurrentToolWidget.window_classification,
					gCurrentToolWidget.window_number
					);
				if (subWindow == NULL)
					break;

				ebx = 0;
				edi = cursorId;
				// Window event WE_UNKNOWN_0E was called here, but no windows actually implemented a handler and
				// its not known what it was for
				cursorId = edi;
				if ((ebx & 0xFF) != 0)
				{
					sub_6ED990(cursorId);
					return;
				}
				break;

			case WWT_FRAME:
			case WWT_RESIZE:
				if (!(window->flags & WF_RESIZABLE))
					break;

				if (window->min_width == window->max_width && window->min_height == window->max_height)
					break;

				if (x < window->x + window->width - 0x13)
					break;

				if (y < window->y + window->height - 0x13)
					break;

				cursorId = CURSOR_DIAGONAL_ARROWS;
				break;

			case WWT_SCROLL:
			{
				sint32 output_scroll_area, scroll_id;
				sint32 scroll_x, scroll_y;
				widget_scroll_get_part(window, &window->widgets[widgetId], x, y, &scroll_x, &scroll_y, &output_scroll_area, &scroll_id);
				cursorId = scroll_id;
				if (output_scroll_area != SCROLL_PART_VIEW)
				{
					cursorId = CURSOR_ARROW;
					break;
				}
				// Same as default but with scroll_x/y
				cursorId = window_event_cursor_call(window, widgetId, scroll_x, scroll_y);
				if (cursorId == -1)
					cursorId = CURSOR_ARROW;
				break;
			}
			default:
				cursorId = window_event_cursor_call(window, widgetId, x, y);
				if (cursorId == -1)
					cursorId = CURSOR_ARROW;
				break;
			}
		}
	}

	viewport_interaction_right_over(x, y);
	sub_6ED990(cursorId);
}
Beispiel #2
0
/**
 *
*  rct2: 0x006ED833
 */
void process_mouse_over(int x, int y)
{
	rct_window* window;
	rct_window* subWindow;

	int widgetId;
	int cursorId;
	int ebx, esi, edi, ebp;

	cursorId = CURSOR_ARROW;
	RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS, sint16) = -1;
	window = window_find_from_point(x, y);

	if (window != NULL) {
		widgetId = window_find_widget_from_point(window, x, y);
		RCT2_GLOBAL(0x1420046, sint16) = (widgetId & 0xFFFF);
		if (widgetId != -1) {
			switch (window->widgets[widgetId].type){

			case WWT_VIEWPORT:
				if (!(gInputFlags & INPUT_FLAG_TOOL_ACTIVE)) {
					if (viewport_interaction_left_over(x, y)) {
						sub_6ED990(CURSOR_HAND_POINT);
						return;
					}
					break;
				}
				cursorId = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8);
				subWindow = window_find_by_number(
					RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass),
					RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
					);
				ebp = (int)subWindow;
				if (subWindow == NULL)
					break;

				ebx = 0;
				edi = cursorId;
				esi = (int)subWindow;
				// Window event WE_UNKNOWN_0E was called here, but no windows actually implemented a handler and
				// its not known what it was for
				cursorId = edi;
				if ((ebx & 0xFF) != 0)
				{
					sub_6ED990(cursorId);
					return;
				}
				break;

			case WWT_FRAME:
			case WWT_RESIZE:
				if (!(window->flags & 0x100))
					break;

				if (window->min_width == window->max_width && window->min_height == window->max_height)
					break;

				if (x < window->x + window->width - 0x13)
					break;

				if (y < window->y + window->height - 0x13)
					break;

				cursorId = CURSOR_DIAGONAL_ARROWS;
				break;

			case WWT_SCROLL:
				RCT2_GLOBAL(0x9DE558, uint16) = x;
				RCT2_GLOBAL(0x9DE55A, uint16) = y;
				int output_scroll_area, scroll_id;
				int scroll_x, scroll_y;
				widget_scroll_get_part(window, &window->widgets[widgetId], x, y, &scroll_x, &scroll_y, &output_scroll_area, &scroll_id);
				cursorId = scroll_id;
				if (output_scroll_area != SCROLL_PART_VIEW)
				{
					cursorId = CURSOR_ARROW;
					break;
				}
				// Same as default but with scroll_x/y
				cursorId = window_event_cursor_call(window, widgetId, scroll_x, scroll_y);
				if (cursorId == -1)
					cursorId = CURSOR_ARROW;
				break;
			default:
				cursorId = window_event_cursor_call(window, widgetId, x, y);
				if (cursorId == -1)
					cursorId = CURSOR_ARROW;
				break;
			}
		}
	}

	viewport_interaction_right_over(x, y);
	sub_6ED990(cursorId);
}