Exemple #1
0
/**
 *
 *  rct2: 0x0066E464
 */
rct_window * window_news_open()
{
    rct_window* window;

    // Check if window is already open
    window = window_bring_to_front_by_class(WC_RECENT_NEWS);
    if (window == nullptr) {
        window = window_create_auto_pos(
            400,
            300,
            &window_news_events,
            WC_RECENT_NEWS,
            0
        );
        window->widgets = window_news_widgets;
        window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_SETTINGS);
        window_init_scroll_widgets(window);
        window->news.var_480 = -1;
    }

// sub_66E4BA:
    rct_widget *widget;

    sint32 width = 0;
    sint32 height = 0;
    window_get_scroll_size(window, 0, &width, &height);
    widget = &window_news_widgets[WIDX_SCROLL];
    window->scrolls[0].v_top = Math::Max(0, height - (widget->bottom - widget->top - 1));
    widget_scroll_update_thumbs(window, WIDX_SCROLL);

    return window;
}
Exemple #2
0
/**
 *
 *  rct2: 0x006B7220
 */
static void window_new_ride_scroll_to_focused_ride(rct_window *w)
{
	int scrollWidth = 0;
	int scrollHeight = 0;
	window_get_scroll_size(w, 0, &scrollWidth, &scrollHeight);

	// Find row index of the focused ride type
	rct_widget *listWidget = &window_new_ride_widgets[WIDX_RIDE_LIST];
	int focusRideType = _windowNewRideHighlightedItem[_windowNewRideCurrentTab].ride_type_and_entry;
	int count = 0, row = 0;
	ride_list_item *listItem = _windowNewRideListItems;
	while (listItem->type != 255 || listItem->entry_index != 255) {
		if (listItem->type == focusRideType) {
			row = count / 5;
			break;
		}

		count++;
		listItem++;
	};

	// Update the Y scroll position
	int listWidgetHeight = listWidget->bottom - listWidget->top - 1;
	scrollHeight = max(0, scrollHeight - listWidgetHeight);
	w->scrolls[0].v_top = min(row * 116, scrollHeight);
	widget_scroll_update_thumbs(w, WIDX_RIDE_LIST);
}
Exemple #3
0
/**
 * 
 *  rct2: 0x0066E464
 */
void window_news_open()
{
	rct_window* window;

	// Check if window is already open
	window = window_bring_to_front_by_id(WC_RECENT_NEWS, 0);
	if (window == NULL) {
		window = window_create_auto_pos(
			400,
			300,
			(uint32*)window_news_events,
			WC_RECENT_NEWS,
			0
		);
		window->widgets = window_news_widgets;
		window->enabled_widgets = (1 << WIDX_CLOSE);
		window_init_scroll_widgets(window);
		window->colours[0] = 1;
		window->colours[1] = 1;
		window->colours[2] = 0;
		window->var_480 = -1;
	}

// sub_66E4BA:
	int width, height;
	rct_widget *widget;

	window_get_scroll_size(window, 0, &width, &height);
	widget = &window_news_widgets[WIDX_SCROLL];
	window->scrolls[0].v_top = max(0, height - (widget->bottom - widget->top - 1));
	widget_scroll_update_thumbs(window, WIDX_SCROLL);
}