Example #1
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);
}
Example #2
0
void window_player_list_open()
{
	rct_window* window;

	// Check if window is already open
	window = window_bring_to_front_by_class(WC_PLAYER_LIST);
	if (window != NULL)
		return;

	window = window_create_auto_pos(320, 144, &window_player_list_events, WC_PLAYER_LIST, WF_10 | WF_RESIZABLE);

	window->widgets = window_player_list_widgets;
	window->enabled_widgets = 1 << WIDX_CLOSE;
	window_init_scroll_widgets(window);
	window->no_list_items = 0;
	window->selected_list_item = -1;
	window->frame_no = 0;
	window->min_width = 320;
	window->min_height = 124;
	window->max_width = 500;
	window->max_height = 450;

	window->page = 0;
	window->list_information_type = 0;
	window->colours[0] = 7;
	window->colours[1] = 7;
	window->colours[2] = 7;
}
Example #3
0
/**
*
*  rct2: 0x006BEE98
*/
void window_staff_open(rct_peep* peep)
{
	rct_window* w = window_bring_to_front_by_number(WC_PEEP, peep->sprite_index);
	if (w == NULL) {
		w = window_create_auto_pos(WW, WH, (uint32*)window_staff_overview_events, WC_PEEP, (uint16)0x400);

		w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*);
		w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32);
		w->number = peep->sprite_index;
		w->page = 0;
		w->viewport_focus_coordinates.y = 0;
		w->frame_no = 0;

		RCT2_GLOBAL((int*)w + 0x496, uint16) = 0; // missing, var_494 should perhaps be uint16?

		window_staff_disable_widgets(w);

		w->min_width = WW;
		w->min_height = WH;
		w->max_width = 500;
		w->max_height = 450;

		w->flags = 1 << 8;

		w->colours[0] = 1;
		w->colours[1] = 4;
		w->colours[2] = 4;
	}
Example #4
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;
}
Example #5
0
/**
 * 
 *  rct2: 0x0069E16F
 */
void window_new_campaign_open(sint16 campaignType)
{
	// RCT2_CALLPROC_X(0x0069E16F, campaignType, 0, 0, 0, 0, 0, 0);

	rct_window *w;
	rct_ride *ride;
	int i, numApplicableRides;
	
	w = window_bring_to_front_by_id(WC_NEW_CAMPAIGN, 0);
	if (w != NULL) {
		if (w->campaign.campaign_type == campaignType)
			return;

		window_close(w);
	}

	w = window_create_auto_pos(350, 107, (uint32*)window_new_campaign_events, WC_NEW_CAMPAIGN, 0);
	w->widgets = window_new_campaign_widgets;
	w->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_RIDE_DROPDOWN) |
		(1 << WIDX_RIDE_DROPDOWN_BUTTON) |
		(1 << WIDX_WEEKS_INCREASE_BUTTON) |
		(1 << WIDX_WEEKS_DECREASE_BUTTON) |
		(1 << WIDX_START_BUTTON);
	w->var_020 = 0x300;
	window_init_scroll_widgets(w);
	w->colours[0] = 19;
	w->colours[1] = 19;
	w->colours[2] = 19;

	window_new_campaign_widgets[WIDX_TITLE].image = STR_MARKETING_VOUCHERS_FOR_FREE_ENTRY_TO_THE_PARK + campaignType;

	// Campaign type
	w->campaign.campaign_type = campaignType;

	// Number of weeks
	w->campaign.no_weeks = 2;

	// Currently selected ride
	w->campaign.ride_id = SELECTED_RIDE_UNDEFINED;

	// Get all applicable rides
	numApplicableRides = 0;
	window_new_campaign_rides[0] = 255;
	FOR_ALL_RIDES(i, ride) {
		if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x03820000))
			window_new_campaign_rides[numApplicableRides++] = i;
	}
	window_new_campaign_rides[numApplicableRides] = 255;

	// Take top 40 most reliable rides
	if (numApplicableRides > 40) {
		qsort(window_new_campaign_rides, countof(window_new_campaign_rides), sizeof(uint8), ride_reliability_compare);
		numApplicableRides = 40;
	}

	// Sort rides by name
	qsort(window_new_campaign_rides, numApplicableRides, sizeof(uint8), ride_name_compare);
}
Example #6
0
rct_window* window_themes_open()
{
    rct_window* window;

    // Check if window is already open
    window = window_bring_to_front_by_class(WC_THEMES);
    if (window != nullptr)
        return window;

    window = window_create_auto_pos(320, 107, &window_themes_events, WC_THEMES, WF_10 | WF_RESIZABLE);
    window->widgets = window_themes_widgets;
    window->enabled_widgets = (1 << WIDX_THEMES_CLOSE) | (1 << WIDX_THEMES_SETTINGS_TAB) | (1 << WIDX_THEMES_MAIN_UI_TAB)
        | (1 << WIDX_THEMES_PARK_TAB) | (1 << WIDX_THEMES_TOOLS_TAB) | (1 << WIDX_THEMES_RIDE_PEEPS_TAB)
        | (1 << WIDX_THEMES_EDITORS_TAB) | (1 << WIDX_THEMES_MISC_TAB) | (1 << WIDX_THEMES_PROMPTS_TAB)
        | (1 << WIDX_THEMES_FEATURES_TAB) | (1 << WIDX_THEMES_COLOURBTN_MASK) | (1 << WIDX_THEMES_PRESETS)
        | (1 << WIDX_THEMES_PRESETS_DROPDOWN) | (1 << WIDX_THEMES_DUPLICATE_BUTTON) | (1 << WIDX_THEMES_DELETE_BUTTON)
        | (1 << WIDX_THEMES_RENAME_BUTTON) | (1 << WIDX_THEMES_RCT1_RIDE_LIGHTS) | (1 << WIDX_THEMES_RCT1_PARK_LIGHTS)
        | (1 << WIDX_THEMES_RCT1_SCENARIO_FONT) | (1 << WIDX_THEMES_RCT1_BOTTOM_TOOLBAR);

    window_themes_init_vars();

    window_init_scroll_widgets(window);
    window->list_information_type = 0;
    _colour_index_1 = -1;
    _colour_index_2 = -1;
    window->min_width = 320;
    window->min_height = 107;
    window->max_width = 320;
    window->max_height = 107;

    return window;
}
Example #7
0
void window_research_open()
{
    rct_window *w;

    w = window_bring_to_front_by_class(WC_RESEARCH);
    if (w == NULL) {
        w = window_create_auto_pos(530, 257, window_research_page_events[0], WC_RESEARCH, WF_10);
        w->widgets = window_research_page_widgets[0];
        w->enabled_widgets = window_research_page_enabled_widgets[0];
        w->number = 0;
        w->page = 0;
        w->frame_no = 0;
        w->disabled_widgets = 0;
        research_update_uncompleted_types();
    }

    w->page = 0;
    window_invalidate(w);
    w->width = 300;
    w->height = 196;
    window_invalidate(w);

    w->widgets = window_research_page_widgets[0];
    w->enabled_widgets = window_research_page_enabled_widgets[0];
    w->hold_down_widgets = 0;
    w->event_handlers = window_research_page_events[0];
    w->pressed_widgets = 0;
    w->disabled_widgets = 0;
    window_init_scroll_widgets(w);
}
Example #8
0
void window_multiplayer_open()
{
	// Check if window is already open
	rct_window *window = window_bring_to_front_by_class(WC_MULTIPLAYER);
	if (window == NULL) {
		window = window_create_auto_pos(320, 144, &window_multiplayer_players_events, WC_MULTIPLAYER, WF_10 | WF_RESIZABLE);
		window_multiplayer_set_page(window, WINDOW_MULTIPLAYER_PAGE_INFORMATION);
	}
}
void window_shortcut_change_open(int selected_key){
	// Move this to window_shortcut_change_open
	window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
	// Save the item we are selecting for new window
	RCT2_GLOBAL(0x9DE511, uint8) = selected_key;
	rct_window* w = window_create_auto_pos(WW, WH, (uint32*)window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0);

	w->widgets = window_shortcut_change_widgets;
	w->enabled_widgets = (1 << 2);
	window_init_scroll_widgets(w);
	w->colours[0] = 7;
	w->colours[1] = 7;
	w->colours[2] = 7;
}
Example #10
0
/**
*
*  rct2: 0x0068C88A
*/
void window_map_open()
{
	rct_window* w;
	int* var;

	// Check if window is already open
	w = window_bring_to_front_by_id(WC_MAP, 0);
	if (w != NULL) {
		w->selected_tab = 0;
		w->var_490 = 0;
		return;
	}

	var = (int*)rct2_malloc(0x40000);
	if (var == NULL)
		return;

	RCT2_GLOBAL(0x00F1AD68, uint32) = (uint32)var;
	w = window_create_auto_pos(245, 259, (uint32*)window_map_events, WC_MAP, 0x0400);
	w->widgets = window_map_widgets;
	w->enabled_widgets =
		(1 << 2) |
		(1 << 4) |
		(1 << 5) |
		(1 << 8) |
		(1 << 9) |
		(1 << 14) |
		(1 << 15) |
		(1 << 10) |
		(1 << 16) |
		(1 << 17) |
		(1 << 18) |
		(1 << 19) |
		(1 << 11) |
		(1 << 20) |
		(1 << 12);
	//TODO: .text:0068C943                 or      dword ptr [esi+20h], 300h

	window_init_scroll_widgets(w);
	w->var_480 = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint16);

	RCT2_CALLPROC_EBPSAFE(0x0068CA6C);
	RCT2_GLOBAL(0x00F64F05, uint8) = 0;
	RCT2_CALLPROC_EBPSAFE(0x0068C990);

	w->colours[0] = 12;
	w->colours[1] = 24;
}
Example #11
0
/**
 * 
 * rct2: 0x006AEAB4
 */
rct_window *window_ride_open(int rideIndex)
{
	rct_window *w;

	w = window_create_auto_pos(316, 180, window_ride_page_events[0], WC_RIDE, 0x400);
	w->widgets = window_ride_page_widgets[0];
	w->enabled_widgets = 0x007DBFF4;
	w->number = rideIndex;

	w->page = 0;
	w->var_48C = 0;
	w->frame_no = 0;
	w->list_information_type = 0;
	w->var_492 = 0;
	w->var_494 = 0;
	RCT2_CALLPROC_X(0x006AEB9F, 0, 0, 0, 0, (int)w, 0, 0);
	w->min_width = 316;
	w->min_height = 180;
	w->max_width = 500;
	w->max_height = 450;
	w->flags |= WF_RESIZABLE;
	w->colours[0] = 1;
	w->colours[1] = 26;
	w->colours[2] = 11;

	rct_ride *ride = &g_ride_list[rideIndex];
	uint8 *edx = (uint8*)0x009E32F8;
	if (ride->type != RIDE_TYPE_NULL) {
		int rideType = ride->type;
		do {
			edx++;
			if (*(edx - 1) != 0xFF)
				continue;
		} while (rideType-- != 0);
	}

	int eax, ebx = 0, ecx;
	while (*edx != 0xFF) {
		eax = *edx++;
		ecx = eax >> 5;
		eax &= 0x1F;
		if (!(RCT2_ADDRESS(0x001357424, uint32)[ecx] & (1 << eax)))
			continue;
		ebx++;
	}
	RCT2_GLOBAL((int)w + 496, uint16) = ebx;
}
Example #12
0
/**
 * rct2: 0x006989E9
 *
 */
void window_peep_open(rct_peep* peep){
	
	if (peep->type == PEEP_TYPE_STAFF){
		RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, (int)peep, 0, 0, 0);
	}

	rct_window* window;

	window = window_bring_to_front_by_id(WC_PEEP, peep->sprite_index);
	if (window == NULL){
		window = window_create_auto_pos(192, 157, (uint32*)window_peep_overview_events, WC_PEEP, 0);
		window->widgets = window_peep_overview_widgets;
		window->enabled_widgets = window_peep_page_enabled_widgets[0];
		window->number = peep->sprite_index;
		window->page = 0;
		window->var_482 = 0;
		window->frame_no = 0;
		window->list_information_type = 0;
		window->var_492 = 0;
		window->var_494 = 0;
		RCT2_CALLPROC_X(0x006987A6, 0, 0, 0, 0, (int)window, 0, 0);
		window->min_width = 192;
		window->min_height = 157;
		window->max_width = 500;
		window->max_height = 450;
		window->flags = 8;
		window->no_list_items = 0;
		window->selected_list_item = -1;
		window->colours[0] = 1;
		window->colours[1] = 15;
		window->colours[2] = 15;
		window->var_482 = -1;
	}
	
	window->page = 0;
	RCT2_CALLPROC_X(0x006EB13A, 0, 0, 0, 0, (int)window, 0, 0);
	
	window->widgets = RCT2_GLOBAL(0x981D0C, rct_widget*);
	window->enabled_widgets = RCT2_GLOBAL(0x981D3C,uint32);
	window->var_020 = RCT2_GLOBAL(0x981D54,uint32);
	window->event_handlers = RCT2_GLOBAL(0x981D24,uint32*);
	window->pressed_widgets = 0;
	
	RCT2_CALLPROC_X(0x006987A6, 0, 0, 0, 0, (int)window, 0, 0);
	window_init_scroll_widgets(window);
	RCT2_CALLPROC_X(0x0069883C, 0, 0, 0, 0, (int)window, 0, 0);
}
Example #13
0
/**
 *
 *  rct2: 0x006B3CFF
 */
rct_window *window_new_ride_open()
{
	rct_window *w;

	w = window_bring_to_front_by_class(WC_CONSTRUCT_RIDE);
	if (w != NULL)
		return w;

	// Not sure what these windows are
	window_close_by_class(WC_TRACK_DESIGN_LIST);
	window_close_by_class(WC_TRACK_DESIGN_PLACE);

	w = window_create_auto_pos(601, 370, &window_new_ride_events, WC_CONSTRUCT_RIDE, WF_10);
	w->widgets = window_new_ride_widgets;
	w->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_TAB_1) |
		(1 << WIDX_TAB_2) |
		(1 << WIDX_TAB_3) |
		(1 << WIDX_TAB_4) |
		(1 << WIDX_TAB_5) |
		(1 << WIDX_TAB_6) |
		(1 << WIDX_TAB_7) |
		(1 << 14) |
		(1 << 15);
	window_init_scroll_widgets(w);

	w->frame_no = 0;

	w->new_ride.selected_ride_id = -1;
	w->new_ride.highlighted_ride_id = -1;
	_lastTrackDesignCountRideType.type = 255;
	_lastTrackDesignCountRideType.entry_index = 255;

	window_new_ride_populate_list();

	w->new_ride.highlighted_ride_id = _windowNewRideHighlightedItem[_windowNewRideCurrentTab].ride_type_and_entry;
	if (w->new_ride.highlighted_ride_id == -1)
		w->new_ride.highlighted_ride_id = _windowNewRideListItems[0].ride_type_and_entry;

	w->width = 1;
	window_new_ride_refresh_widget_sizing(w);
	window_new_ride_scroll_to_focused_ride(w);

	return w;
}
Example #14
0
/**
 *
 *  rct2: 0x006992E3
 */
rct_window * window_guest_list_open()
{
    rct_window* window;

    // Check if window is already open
    window = window_bring_to_front_by_class(WC_GUEST_LIST);
    if (window != nullptr)
        return window;

    window = window_create_auto_pos(350, 330, &window_guest_list_events, WC_GUEST_LIST, WF_10 | WF_RESIZABLE);
    window->widgets = window_guest_list_widgets;
    window->enabled_widgets =
        (1 << WIDX_CLOSE) |
        (1 << WIDX_PAGE_DROPDOWN) |
        (1 << WIDX_PAGE_DROPDOWN_BUTTON) |
        (1 << WIDX_INFO_TYPE_DROPDOWN) |
        (1 << WIDX_INFO_TYPE_DROPDOWN_BUTTON) |
        (1 << WIDX_MAP) |
        (1 << WIDX_TRACKING) |
        (1 << WIDX_TAB_1) |
        (1 << WIDX_TAB_2) |
        (1 << WIDX_FILTER_BY_NAME);

    window_init_scroll_widgets(window);
    _window_guest_list_highlighted_index = -1;
    window->list_information_type = 0;
    _window_guest_list_selected_tab = PAGE_INDIVIDUAL;
    _window_guest_list_selected_filter = -1;
    _window_guest_list_selected_page = 0;
    _window_guest_list_num_pages = 1;
    _window_guest_list_tracking_only = false;
    _window_guest_list_filter_name[0] = '\0';
    window_guest_list_widgets[WIDX_TRACKING].type = WWT_FLATBTN;
    window_guest_list_widgets[WIDX_FILTER_BY_NAME].type = WWT_FLATBTN;
    window_guest_list_widgets[WIDX_PAGE_DROPDOWN].type = WWT_EMPTY;
    window_guest_list_widgets[WIDX_PAGE_DROPDOWN_BUTTON].type = WWT_EMPTY;
    window->var_492 = 0;
    window->min_width = 350;
    window->min_height = 330;
    window->max_width = 500;
    window->max_height = 450;

    return window;
}
Example #15
0
/**
*
*  rct2: 0x006BEE98
*/
rct_window *window_staff_open(rct_peep* peep)
{
	rct_window* w = window_bring_to_front_by_number(WC_PEEP, peep->sprite_index);
	if (w == NULL) {
		w = window_create_auto_pos(WW, WH, &window_staff_overview_events, WC_PEEP, WF_10 | WF_RESIZABLE);

		w->widgets = RCT2_GLOBAL(0x9AF81C, rct_widget*);
		w->enabled_widgets = RCT2_GLOBAL(0x9929B0, uint32);
		w->number = peep->sprite_index;
		w->page = 0;
		w->viewport_focus_coordinates.y = 0;
		w->frame_no = 0;
		w->highlighted_item = 0;

		window_staff_disable_widgets(w);

		w->min_width = WW;
		w->min_height = WH;
		w->max_width = 500;
		w->max_height = 450;
	}
Example #16
0
rct_window* window_player_open(uint8_t id)
{
    rct_window* window;

    window = window_bring_to_front_by_number(WC_PLAYER, id);
    if (window == nullptr)
    {
        window = window_create_auto_pos(240, 170, &window_player_overview_events, WC_PLAYER, WF_RESIZABLE);
        window->number = id;
        window->page = 0;
        window->viewport_focus_coordinates.y = 0;
        window->frame_no = 0;
        window->list_information_type = 0;
        window->picked_peep_frame = 0;
        window->highlighted_item = 0;
        window->min_width = 210;
        window->min_height = 134;
        window->max_width = 500;
        window->max_height = 450;
        window->no_list_items = 0;
        window->selected_list_item = -1;

        window->viewport_focus_coordinates.y = -1;
    }

    window->page = 0;
    window_invalidate(window);

    window->widgets = window_player_page_widgets[WINDOW_PLAYER_PAGE_OVERVIEW];
    window->enabled_widgets = window_player_page_enabled_widgets[WINDOW_PLAYER_PAGE_OVERVIEW];
    window->hold_down_widgets = 0;
    window->event_handlers = window_player_page_events[WINDOW_PLAYER_PAGE_OVERVIEW];
    window->pressed_widgets = 0;

    window_init_scroll_widgets(window);
    window_player_set_page(window, WINDOW_PLAYER_PAGE_OVERVIEW);

    return window;
}
Example #17
0
void window_player_open(uint8 id)
{
	rct_window* window;

	int player = network_get_player_index(id);
	window = window_bring_to_front_by_number(WC_PLAYER, id);
	if (window == NULL) {
		window = window_create_auto_pos(240, 170, &window_player_overview_events, WC_PLAYER, WF_RESIZABLE);
		window->number = id;
		window->page = 0;
		window->viewport_focus_coordinates.y = 0;
		window->frame_no = 0;
		window->list_information_type = 0;
		window->picked_peep_frame = 0;
		window->highlighted_item = 0;
		window->min_width = 210;
		window->min_height = 134;
		window->max_width = 500;
		window->max_height = 450;
		window->no_list_items = 0;
		window->selected_list_item = -1;

		window->viewport_focus_coordinates.y = -1;
		window->error.var_480 = user_string_allocate(128, network_get_player_name(player)); // repurposing var_480 to store this
	}

	window->page = 0;
	window_invalidate(window);

	window->widgets = window_player_page_widgets[WINDOW_PLAYER_PAGE_OVERVIEW];
	window->enabled_widgets = window_player_page_enabled_widgets[WINDOW_PLAYER_PAGE_OVERVIEW];
	window->hold_down_widgets = 0;
	window->event_handlers = window_player_page_events[WINDOW_PLAYER_PAGE_OVERVIEW];
	window->pressed_widgets = 0;

	window_init_scroll_widgets(window);
	window_player_set_page(window, WINDOW_PLAYER_PAGE_OVERVIEW);
}
Example #18
0
/**
 *
 *  rct2: 0x0069E16F
 */
rct_window* window_new_campaign_open(int16_t campaignType)
{
    rct_window* w;
    Ride* ride;
    int32_t i, numApplicableRides;

    w = window_bring_to_front_by_class(WC_NEW_CAMPAIGN);
    if (w != nullptr)
    {
        if (w->campaign.campaign_type == campaignType)
            return w;

        window_close(w);
    }

    w = window_create_auto_pos(350, 107, &window_new_campaign_events, WC_NEW_CAMPAIGN, 0);
    w->widgets = window_new_campaign_widgets;
    w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RIDE_DROPDOWN) | (1 << WIDX_RIDE_DROPDOWN_BUTTON)
        | (1 << WIDX_WEEKS_INCREASE_BUTTON) | (1 << WIDX_WEEKS_DECREASE_BUTTON) | (1 << WIDX_START_BUTTON);
    w->hold_down_widgets = (1 << WIDX_WEEKS_INCREASE_BUTTON) | (1 << WIDX_WEEKS_DECREASE_BUTTON);
    window_init_scroll_widgets(w);

    window_new_campaign_widgets[WIDX_TITLE].text = MarketingCampaignNames[campaignType][0];

    // Campaign type
    w->campaign.campaign_type = campaignType;

    // Number of weeks
    w->campaign.no_weeks = 2;

    // Currently selected ride
    w->campaign.ride_id = SELECTED_RIDE_UNDEFINED;

    // Get all applicable rides
    numApplicableRides = 0;
    window_new_campaign_rides[0] = RIDE_ID_NULL;
    FOR_ALL_RIDES (i, ride)
    {
        if (ride->status != RIDE_STATUS_OPEN)
        {
            continue;
        }
        if (ride_type_has_flag(
                ride->type,
                RIDE_TYPE_FLAG_IS_SHOP | RIDE_TYPE_FLAG_SELLS_FOOD | RIDE_TYPE_FLAG_SELLS_DRINKS | RIDE_TYPE_FLAG_IS_BATHROOM))
        {
            continue;
        }

        window_new_campaign_rides[numApplicableRides++] = i;
    }

    // Take top 128 most valuable rides
    if (numApplicableRides > DROPDOWN_ITEMS_MAX_SIZE)
    {
        qsort(window_new_campaign_rides, numApplicableRides, sizeof(uint8_t), ride_value_compare);
        numApplicableRides = DROPDOWN_ITEMS_MAX_SIZE;
    }

    // Sort rides by name
    qsort(window_new_campaign_rides, numApplicableRides, sizeof(uint8_t), ride_name_compare);

    window_new_campaign_rides[numApplicableRides] = RIDE_ID_NULL;

    return w;
}
Example #19
0
/**
*
*  rct2: 0x006BA305
*/
void window_banner_open(rct_windownumber number)
{
	rct_window* w;
	rct_widget *viewportWidget;


	// Check if window is already open
	w = window_bring_to_front_by_number(WC_BANNER, number);
	if (w != NULL)
		return;

	w = window_create_auto_pos(WW, WH, (uint32*)window_banner_events, WC_BANNER, 0);
	w->widgets = window_banner_widgets;
	w->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_BANNER_TEXT) |
		(1 << WIDX_BANNER_NO_ENTRY) |
		(1 << WIDX_BANNER_DEMOLISH) |
		(1 << WIDX_MAIN_COLOR) |
		(1 << WIDX_TEXT_COLOR_DROPDOWN) |
		(1 << WIDX_TEXT_COLOR_DROPDOWN_BUTTON);

	w->number = number;
	window_init_scroll_widgets(w);
	w->colours[0] = 24;
	w->colours[1] = 24;
	w->colours[2] = 24;

	int view_x = gBanners[w->number].x << 5;
	int view_y = gBanners[w->number].y << 5;
	int ebp = ((view_y << 8) | view_x) >> 5;
	
	rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(ebp);

	while(1){
		if (((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_BANNER) &&
			(map_element->properties.banner.index == w->number)) break;

		map_element++;
	}

	int view_z = map_element->base_height<<3;
	w->frame_no = view_z;

	view_x += 16;
	view_y += 16;

	// Create viewport
	viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
	viewport_create(
		w,
		w->x + viewportWidget->left + 1,
		w->y + viewportWidget->top + 1,
		(viewportWidget->right - viewportWidget->left) - 2,
		(viewportWidget->bottom - viewportWidget->top) - 2,
		0,
		view_x,
		view_y,
		view_z,
		0,
		-1
	);

	w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
	w->flags |= WF_2;
	window_invalidate(w);
}
Example #20
0
/**
*
*  rct2: 0x006BA305
*/
void window_banner_open(rct_windownumber number)
{
	rct_window* w;
	rct_widget *viewportWidget;


	// Check if window is already open
	w = window_bring_to_front_by_number(WC_BANNER, number);
	if (w != NULL)
		return;

	w = window_create_auto_pos(WW, WH, &window_banner_events, WC_BANNER, WF_NO_SCROLLING);
	w->widgets = window_banner_widgets;
	w->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_BANNER_TEXT) |
		(1 << WIDX_BANNER_NO_ENTRY) |
		(1 << WIDX_BANNER_DEMOLISH) |
		(1 << WIDX_MAIN_COLOUR) |
		(1 << WIDX_TEXT_COLOUR_DROPDOWN) |
		(1 << WIDX_TEXT_COLOUR_DROPDOWN_BUTTON);

	w->number = number;
	window_init_scroll_widgets(w);

	sint32 view_x = gBanners[w->number].x << 5;
	sint32 view_y = gBanners[w->number].y << 5;

	rct_map_element* map_element = map_get_first_element_at(view_x / 32, view_y / 32);
	while(1) {
		if (
			(map_element_get_type(map_element) == MAP_ELEMENT_TYPE_BANNER) &&
			(map_element->properties.banner.index == w->number)
		) {
			break;
		}

		map_element++;
	}

	sint32 view_z = map_element->base_height<<3;
	w->frame_no = view_z;

	view_x += 16;
	view_y += 16;

	// Create viewport
	viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
	viewport_create(
		w,
		w->x + viewportWidget->left + 1,
		w->y + viewportWidget->top + 1,
		(viewportWidget->right - viewportWidget->left) - 2,
		(viewportWidget->bottom - viewportWidget->top) - 2,
		0,
		view_x,
		view_y,
		view_z,
		0,
		-1
	);

	w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
	window_invalidate(w);
}
Example #21
0
void window_title_editor_open(sint32 tab)
{
    rct_window * window;

    // Check if window is already open
    window = window_bring_to_front_by_class(WC_TITLE_EDITOR);
    if (window != nullptr)
        return;

    if (_selectedTitleSequence == SIZE_MAX)
        _selectedTitleSequence = title_get_config_sequence();

    window = window_create_auto_pos(WW, WH2, &window_title_editor_events, WC_TITLE_EDITOR, WF_10 | WF_RESIZABLE);
    window->widgets = window_title_editor_widgets;
    window->enabled_widgets =
        (1 << WIDX_TITLE_EDITOR_CLOSE) |
        (1 << WIDX_TITLE_EDITOR_PRESETS_TAB) |
        (1 << WIDX_TITLE_EDITOR_SAVES_TAB) |
        (1 << WIDX_TITLE_EDITOR_SCRIPT_TAB) |

        (1 << WIDX_TITLE_EDITOR_PRESETS) |
        (1 << WIDX_TITLE_EDITOR_PRESETS_DROPDOWN) |
        (1 << WIDX_TITLE_EDITOR_NEW_BUTTON) |
        (1 << WIDX_TITLE_EDITOR_DUPLICATE_BUTTON) |
        (1 << WIDX_TITLE_EDITOR_DELETE_BUTTON) |
        (1 << WIDX_TITLE_EDITOR_RENAME_BUTTON) |

        (1 << WIDX_TITLE_EDITOR_ADD_SAVE) |
        (1 << WIDX_TITLE_EDITOR_REMOVE_SAVE) |
        (1 << WIDX_TITLE_EDITOR_RENAME_SAVE) |
        (1 << WIDX_TITLE_EDITOR_LOAD_SAVE) |

        (1 << WIDX_TITLE_EDITOR_INSERT) |
        (1 << WIDX_TITLE_EDITOR_EDIT) |
        (1 << WIDX_TITLE_EDITOR_DELETE) |
        //(1 << WIDX_TITLE_EDITOR_RELOAD) |
        (1 << WIDX_TITLE_EDITOR_SKIP_TO) |
        (1 << WIDX_TITLE_EDITOR_MOVE_DOWN) |
        (1 << WIDX_TITLE_EDITOR_MOVE_UP) |

        (1 << WIDX_TITLE_EDITOR_PLAY) |
        (1 << WIDX_TITLE_EDITOR_STOP) |
        (1 << WIDX_TITLE_EDITOR_REPLAY) |
        (1 << WIDX_TITLE_EDITOR_SKIP);

    window_init_scroll_widgets(window);
    window->list_information_type = 0;

    window->selected_tab = tab;
    window->selected_list_item = -1;
    _window_title_editor_highlighted_index = -1;
    window->scrolls[0].v_top = 0;
    window->scrolls[0].h_left = 0;

    window->min_width = WW;
    window->min_height = WH;
    window->max_width = 500;
    window->max_height = 450;

    if (_selectedTitleSequence >= title_sequence_manager_get_count())
        _selectedTitleSequence = 0;

    window_title_editor_load_sequence(_selectedTitleSequence);
}