Example #1
0
static void input_update_tooltip(rct_window *w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
{
	if (gTooltipWidget.window_classification == 255) {
		if (gTooltipCursorX == x && gTooltipCursorY == y) {
			_tooltipNotShownTicks++;
			if (_tooltipNotShownTicks > 50) {
				gTooltipTimeout = 0;
				window_tooltip_open(w, widgetIndex, x, y);
			}
		}
	} else {
		reset_tooltip_not_shown();

		if (w == NULL ||
			gTooltipWidget.window_classification != w->classification ||
			gTooltipWidget.window_number != w->number ||
			gTooltipWidget.widget_index != widgetIndex
		) {
			window_tooltip_close();
		}

		gTooltipTimeout += gTicksSinceLastUpdate;
		if (gTooltipTimeout >= 8000) {
			window_close_by_class(WC_TOOLTIP);
		}
	}
}
Example #2
0
static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y)
{
	if (gTooltipWidget.window_classification == 255) {
		if (gTooltipNotShownTicks < 500 || (gTooltipCursorX == x && gTooltipCursorY == y)) {
			gTooltipTimeout = RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, uint16);

			int time = 2000;
			if (gTooltipNotShownTicks >= 1) {
				time = 0;
			}
			if (time > gTooltipTimeout) {
				gTooltipNotShownTicks++;
				return;
			}

			window_tooltip_open(w, widgetIndex, x, y);
		}
	} else {
		if ((
				(w != NULL) &&
				(gTooltipWidget.window_classification != w->classification || gTooltipWidget.window_number != w->number)
			) ||
			gTooltipWidget.widget_index != widgetIndex
		) {
			window_tooltip_close();
		}
		gTooltipTimeout += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, uint16);
		if (gTooltipTimeout >= 8000) {
			window_close_by_class(WC_TOOLTIP);
		}
	}
}
Example #3
0
/**
 * 
 *  rct2: 0x006E9253
 */
static void input_mouseover(int x, int y, rct_window *w, int widgetIndex)
{
	// RCT2_CALLPROC_X(0x006E9253, x, y, state, widgetIndex, w, widget, 0);

	rct_windowclass windowClass = 255;
	rct_windownumber windowNumber = 0;
	rct_widget *widget;

	if (w != NULL) {
		windowClass = w->classification;
		windowNumber = w->number;
		widget = &w->widgets[widgetIndex];
	}

	input_mouseover_widget_check(windowClass, windowNumber, widgetIndex);

	if (w != NULL && widgetIndex != -1 && widget->type == WWT_SCROLL) {
		int eax, ebx, ecx, edx, esi, edi, ebp;
		eax = x;
		ebx = y;
		esi = w;
		edi = widget;
		RCT2_CALLFUNC_X(0x006E9F92, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); // widget_scoll_get_part
		eax &= 0xFFFF;
		ebx &= 0xFFFF;
		ecx &= 0xFFFF;
		edx &= 0xFFFF;
		if (ecx < 0)
			goto showTooltip;
		if (ecx == 0) {
			RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEOVER], edx, 0, eax, ebx, w, 0, 0);
			goto showTooltip;
		} else {

		}
	} else {
		showTooltip:
		if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) == 255) {
			if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, uint16) < 500 ||
				(RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_X, sint16) == x &&
				RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, sint16) == y)
			) {
				RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = RCT2_GLOBAL(0x009DE588, uint16);

				int bp = 2000;
				if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, uint16) <= 1000)
					bp = 0;
				if (bp > RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16))
					return;

				window_tooltip_open(w, widgetIndex, x, y);
				// RCT2_CALLPROC_X(0x006EA10D, x, y, 0, widgetIndex, w, widget, 0); // window_tooltip_open();
			}
		} else {
			if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) != w->classification ||
				RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) != w->number ||
				RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint16) != widgetIndex
			) {
				window_tooltip_close();
			}
			RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) += RCT2_GLOBAL(0x009DE588, uint16);
			if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) < 8000)
				return;
			window_close_by_id(WC_TOOLTIP, 0);
		}
	}

	RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = 0;
	RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_X, sint16) = x;
	RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, sint16) = y;
}