Exemple #1
0
/**
 * 
 *  rct2: 0x0066D2AC
 */
void window_about_open()
{
	rct_window* window;

	// Check if window is already open
	window = window_bring_to_front_by_id(WC_ABOUT, 0);
	if (window != NULL)
		return;

	window = window_create(
		RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 200,
		max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 165),
		400,
		330,
		(uint32*)window_about_events,
		WC_ABOUT,
		0
	);
	window->widgets = window_about_widgets;
	window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_MUSIC_CREDITS) | (1 << WIDX_PUBLISHER_CREDITS);

	window_init_scroll_widgets(window);
	window->colours[0] = 7;
	window->colours[1] = 7;
	window->colours[2] = 7;
}
/**
 * 
 *  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);
}
Exemple #3
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);
}
/**
* Creates the main editor top toolbar window.
* rct2: 0x0066EFC8 (part of 0x0066EF38)
*/
void window_editor_top_toolbar_open()
{
	rct_window* window;

	window = window_create(0, 0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 28,
		(uint32*)window_editor_top_toolbar_events,
		WC_TOP_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5);
	window->widgets = window_editor_top_toolbar_widgets;

	window->enabled_widgets |=
		(1 << WIDX_ZOOM_IN) |
		(1 << WIDX_ZOOM_OUT) |
		(1 << WIDX_ROTATE) |
		(1 << WIDX_FILE_MENU) |
		(1 << WIDX_LAND) |
		(1 << WIDX_VIEW_MENU) |
		(1 << WIDX_SCENERY) |
		(1 << WIDX_WATER) |
		(1 << WIDX_PATH) |
		(1 << WIDX_MAP) |
		(1 << WIDX_CONSTRUCT_RIDE) |
		(1 << WIDX_CLEAR_SCENERY);

	window_init_scroll_widgets(window);
	window->colours[0] = 7;
	window->colours[1] = 12;
	window->colours[2] = 24;
	window->colours[3] = 1;
}
Exemple #5
0
void window_tile_inspector_open()
{
	rct_window* window;

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

	window = window_create(
		0,
		29,
		WW,
		WH,
		(uint32*)window_tile_inspector_events,
		WC_TILE_INSPECTOR,
		WF_RESIZABLE
	);
	window->widgets = window_tile_inspector_widgets;
	window->enabled_widgets = (1 << WIDX_CLOSE);

	window_init_scroll_widgets(window);
	window->colours[0] = 7;
	window->colours[1] = 7;
	window->colours[2] = 7;
	window->min_width = WW;
	window->min_height = MIN_WH;
	window->max_width = WW;
	window->max_height = MAX_WH;

	window_tile_inspector_tile_x = -1;
	window_tile_inspector_tile_y = -1;

	tool_set(window, WIDX_BACKGROUND, 12);
}
Exemple #6
0
/**
 *
 *  rct2: 0x00663E7D
 */
void window_land_open()
{
	rct_window* window;

	// Check if window is already open
	if (window_find_by_class(WC_LAND) != NULL)
		return;

	window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 126, (uint32*)window_land_events, WC_LAND, 0);
	window->widgets = window_land_widgets;
	window->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_DECREMENT) |
		(1 << WIDX_INCREMENT) |
		(1 << WIDX_FLOOR) |
		(1 << WIDX_WALL) |
		(1 << WIDX_PAINTMODE) |
		(1 << WIDX_PREVIEW);
	window_init_scroll_widgets(window);
	window_push_others_below(window);

	RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;
	RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;
	LandPaintMode = false;
	_selectedFloorTexture = 0;
	_selectedWallTexture = 0;
	RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = MONEY32_UNDEFINED;
	RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = MONEY32_UNDEFINED;
}
Exemple #7
0
/**
 *
 *  rct2: 0x00663E7D
 */
void window_land_open()
{
	rct_window* window;

	// Check if window is already open
	if (window_find_by_id(WC_LAND, 0) != NULL)
		return;

	window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 126, window_land_events, WC_LAND, 0);
	window->widgets = window_land_widgets;
	window->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_DECREMENT) |
		(1 << WIDX_INCREMENT) |
		(1 << WIDX_FLOOR) |
		(1 << WIDX_WALL);
	window_init_scroll_widgets(window);
	window_push_others_below(window);

	RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;
	RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;
	_selectedFloorTexture = 0;
	_selectedWallTexture = 0;
	RCT2_GLOBAL(0x009E2E1C, sint32) = 0x80000000;
	RCT2_GLOBAL(0x009E2E20, sint32) = 0x80000000;
	window->colours[0] = 24;
	window->colours[1] = 24;
	window->colours[2] = 24;
}
Exemple #8
0
rct_window * custom_currency_window_open()
{
    rct_window* window;

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

    window = window_create_centred(
        400,
        100,
        &_windowCustomCurrencyEvents,
        WC_CUSTOM_CURRENCY_CONFIG,
        0
    );
    window->widgets = window_custom_currency_widgets;
    window->enabled_widgets =
        (1 << WIDX_CLOSE) |
        (1 << WIDX_RATE) |
        (1 << WIDX_RATE_UP) |
        (1 << WIDX_RATE_DOWN) |
        (1 << WIDX_SYMBOL_TEXT) |
        (1 << WIDX_AFFIX_DROPDOWN) |
        (1 << WIDX_AFFIX_DROPDOWN_BUTTON);

    window->hold_down_widgets = (1 << WIDX_RATE_UP) | (1 << WIDX_RATE_DOWN);
    window_init_scroll_widgets(window);
    window->colours[0] = COLOUR_LIGHT_BROWN;
    window->colours[1] = COLOUR_LIGHT_BROWN;
    window->colours[2] = COLOUR_LIGHT_BROWN;

    return window;
}
Exemple #9
0
rct_window * window_news_options_open()
{
    rct_window* window;

    // Check if window is already open
    window = window_bring_to_front_by_class(WC_NOTIFICATION_OPTIONS);
    if (window == nullptr) {
        window = window_create_centred(
            400,
            300,
            &window_news_options_events,
            WC_NOTIFICATION_OPTIONS,
            0
        );
        window->widgets = window_news_options_widgets;
        window->enabled_widgets =
            (1 << WIDX_CLOSE) |
            (1 << WIDX_TAB_PARK) |
            (1 << WIDX_TAB_RIDE) |
            (1 << WIDX_TAB_GUEST);
        window_init_scroll_widgets(window);
        window->colours[0] = COLOUR_GREY;
        window->colours[1] = COLOUR_LIGHT_BLUE;
        window->colours[2] = COLOUR_LIGHT_BLUE;
    }

    return window;
}
Exemple #10
0
void window_player_statistics_invalidate(rct_window *w)
{
	if (window_player_page_widgets[w->page] != w->widgets) {
		w->widgets = window_player_page_widgets[w->page];
		window_init_scroll_widgets(w);
	}

	colour_scheme_update(w);

	w->pressed_widgets &= ~(WIDX_TAB_1);
	w->pressed_widgets &= ~(WIDX_TAB_2);
	w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);

	RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = w->error.var_480; // set title caption to player name

	w->widgets[WIDX_BACKGROUND].right = w->width - 1;
	w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
	w->widgets[WIDX_PAGE_BACKGROUND].right = w->width - 1;
	w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
	w->widgets[WIDX_TITLE].right = w->width - 2;
	w->widgets[WIDX_CLOSE].left = w->width - 13;
	w->widgets[WIDX_CLOSE].right = w->width - 3;

	window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_2);
}
Exemple #11
0
static void window_loadsave_scrollmousedown(rct_window *w, int scrollIndex, int x, int y)
{
	int selectedItem;

	selectedItem = y / 10;
	if (selectedItem >= w->no_list_items)
		return;
	if (_listItems[selectedItem].type == TYPE_DIRECTORY){
		// The selected item is a folder
		int includeNewItem;

		w->no_list_items = 0;
		w->selected_list_item = -1;
		includeNewItem = (_type & 1) == LOADSAVETYPE_SAVE;

		char directory[MAX_PATH];
		safe_strcpy(directory, _listItems[selectedItem].path, sizeof(directory));

		window_loadsave_populate_list(w, includeNewItem, directory, _extension);
		window_init_scroll_widgets(w);

		w->no_list_items = _listItemsCount;
	} else {
		// TYPE_FILE
		// Load or overwrite
		if ((_loadsaveType & 0x01) == LOADSAVETYPE_SAVE)
			window_overwrite_prompt_open(_listItems[selectedItem].name, _listItems[selectedItem].path);
		else
			window_loadsave_select(w, _listItems[selectedItem].path);
	}
}
Exemple #12
0
/**
 * Creates the window containing the menu buttons on the title screen.
 *  rct2: 0x0066B5C0 (part of 0x0066B3E8)
 */
void window_title_menu_open()
{
	rct_window* window;

	window = window_create(
		(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 328) / 2, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 142,
		328, 100,
		&window_title_menu_events,
		WC_TITLE_MENU,
		WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND
	);
	window->widgets = window_title_menu_widgets;
	window->enabled_widgets = (
		(1 << WIDX_START_NEW_GAME) |
		(1 << WIDX_CONTINUE_SAVED_GAME) |
		(1 << WIDX_SHOW_TUTORIAL) |
		(1 << WIDX_GAME_TOOLS) |
		(1 << WIDX_MULTIPLAYER)
	);

	// Disable tutorial button
	window->disabled_widgets = (1 << WIDX_SHOW_TUTORIAL);

#if DISABLE_NETWORK
	// Disable multiplayer
	window->widgets[WIDX_MULTIPLAYER].type = WWT_EMPTY;
#endif

	window_init_scroll_widgets(window);
}
/**
 *
 *  rct2: 0x00684E04
 */
rct_window* window_editor_inventions_list_open()
{
    rct_window* w;

    w = window_bring_to_front_by_class(WC_EDITOR_INVENTION_LIST);
    if (w != nullptr)
        return w;

    research_rides_setup();

    w = window_create_centred(
        WW, WH, &window_editor_inventions_list_events, WC_EDITOR_INVENTION_LIST, WF_NO_SCROLLING | WF_RESIZABLE);
    w->widgets = window_editor_inventions_list_widgets;
    w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RESIZE) | (1 << WIDX_TAB_1) | (1 << WIDX_RANDOM_SHUFFLE)
        | (1 << WIDX_MOVE_ITEMS_TO_BOTTOM) | (1 << WIDX_MOVE_ITEMS_TO_TOP);
    window_init_scroll_widgets(w);
    w->var_4AE = 0;
    w->selected_tab = 0;
    w->research_item = nullptr;
    _editorInventionsListDraggedItem = nullptr;

    w->min_width = WW;
    w->min_height = WH;
    w->max_width = WW * 2;
    w->max_height = WH * 2;

    return w;
}
rct_window * window_ride_refurbish_prompt_open(sint32 rideIndex)
{
    rct_window *w;

    w = window_find_by_class(WC_DEMOLISH_RIDE_PROMPT);
    if (w != nullptr)
    {
        int x = w->x;
        int y = w->y;
        window_close(w);
        w = window_create(x, y, WW, WH, &window_ride_refurbish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);
    }
    else
    {
        w = window_create_centred(WW, WH, &window_ride_refurbish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT);
    }

    w->widgets = window_ride_refurbish_widgets;
    w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_REFURBISH);
    window_init_scroll_widgets(w);
    w->number = rideIndex;
    _demolishRideCost = -ride_get_refund_price(rideIndex);

    return w;
}
Exemple #15
0
void window_debug_paint_open()
{
	rct_window * window;

	// Check if window is already open
	if (window_find_by_class(WC_DEBUG_PAINT) != NULL)
		return;

	window = window_create(
		16,
		gScreenHeight - 16 - 33 - WINDOW_HEIGHT,
		WINDOW_WIDTH,
		WINDOW_HEIGHT,
		&window_debug_paint_events,
		WC_DEBUG_PAINT,
		WF_STICK_TO_FRONT | WF_TRANSPARENT
	);

	window->widgets = window_debug_paint_widgets;
	window->enabled_widgets = (1 << WIDX_TOGGLE_OLD_DRAWING) | (1 << WIDX_TOGGLE_SHOW_BOUND_BOXES) | (1 << WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS);
	window_init_scroll_widgets(window);
	window_push_others_below(window);

	window->colours[0] = TRANSLUCENT(COLOUR_BLACK);
	window->colours[1] = COLOUR_GREY;
}
Exemple #16
0
/**
 *
 *  rct2: 0x006E6A40
 */
void window_water_open()
{
    rct_window* window;

    // Check if window is already open
    if (window_find_by_class(WC_WATER) != NULL)
        return;

    window = window_create(
        context_get_width() - 76,
        29,
        76,
        77,
        &window_water_events,
        WC_WATER,
        0
    );
    window->widgets = window_water_widgets;
    window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_PREVIEW);
    window->hold_down_widgets = (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT);
    window_init_scroll_widgets(window);
    window_push_others_below(window);

    gLandToolSize = 1;
    gWaterToolRaiseCost = MONEY32_UNDEFINED;
    gWaterToolLowerCost = MONEY32_UNDEFINED;
}
Exemple #17
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 #18
0
rct_window *window_changelog_open()
{
	rct_window* window;

	window = window_bring_to_front_by_class(WC_CHANGELOG);
	if (window != NULL)
		return window;

	if (!window_changelog_read_file())
		return NULL;

	sint32 screenWidth = gScreenWidth;
	sint32 screenHeight = gScreenHeight;

	window = window_create_centred(
		screenWidth * 4 / 5,
		screenHeight * 4 / 5,
		&window_changelog_events,
		WC_CHANGELOG,
		WF_RESIZABLE
	);
	window->widgets = window_changelog_widgets;
	window->enabled_widgets = (1 << WIDX_CLOSE);

	window_init_scroll_widgets(window);
	window->min_width = MIN_WW;
	window->min_height = MIN_WH;
	window->max_width = MIN_WW;
	window->max_height = MIN_WH;
	return window;
}
Exemple #19
0
/**
*
*  rct2: 0x0066D55B
*/
void window_music_credits_open()
{
	rct_window* window;

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

	window = window_create_centred(
		510,
		314,
		&window_music_credits_events,
		WC_MUSIC_CREDITS,
		0
	);

	window->widgets = window_music_credits_widgets;
	window->enabled_widgets = 1 << WIDX_CLOSE;

	window_init_scroll_widgets(window);
	window->colours[0] = COLOUR_LIGHT_BLUE;
	window->colours[1] = COLOUR_LIGHT_BLUE;
	window->colours[2] = COLOUR_LIGHT_BLUE;

}
Exemple #20
0
/**
 *
 *  rct2: 0x006D348F
 */
void window_track_manage_open()
{
	// RCT2_CALLPROC_EBPSAFE(0x006D348F);

	rct_window *w, *trackDesignListWindow;

	window_close_by_class(WC_MANAGE_TRACK_DESIGN);

	w = window_create(
		max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2),
		(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 44) / 2,
		250,
		44,
		(uint32*)window_track_manage_events,
		WC_MANAGE_TRACK_DESIGN,
		WF_STICK_TO_FRONT
	);
	w->widgets = window_track_manage_widgets;
	w->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_RENAME) |
		(1 << WIDX_DELETE);
	window_init_scroll_widgets(w);
	w->flags |= WF_TRANSPARENT;
	w->colours[0] = 1;
	w->colours[1] = 1;
	w->colours[2] = 1;

	trackDesignListWindow = window_find_by_class(WC_TRACK_DESIGN_LIST);
	if (trackDesignListWindow != NULL)
		trackDesignListWindow->track_list.var_484 |= 1;
}
/**
 *
 *  rct2: 0x006781B5
 */
void window_scenarioselect_open()
{
	rct_window* window;

	if (window_bring_to_front_by_class(WC_SCENARIO_SELECT) != NULL)
		return;

	// Load scenario list
	scenario_load_list();

	window = window_create_centred(
		610,
		334,
		&window_scenarioselect_events,
		WC_SCENARIO_SELECT,
		WF_10
	);
	window->widgets = window_scenarioselect_widgets;

	window->enabled_widgets = 0x04 | 0x10 | 0x20 | 0x40 | 0x80 | 0x100;
	window_init_scroll_widgets(window);
	window->viewport_focus_coordinates.var_480 = -1;
	window->var_494 = 0;

	window_scenarioselect_init_tabs();

	window->selected_tab = 0;
}
Exemple #22
0
/**
 *
 *  rct2: 0x006D35CD
 */
static void window_track_delete_prompt_open()
{
	rct_window *w;

	window_close_by_class(WC_TRACK_DELETE_PROMPT);

	w = window_create(
		max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2),
		(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 44) / 2,
		250,
		74,
		(uint32*)window_track_delete_prompt_events,
		WC_TRACK_DELETE_PROMPT,
		WF_STICK_TO_FRONT
	);
	w->widgets = window_track_delete_prompt_widgets;
	w->enabled_widgets =
		(1 << WIDX_CLOSE) |
		(1 << WIDX_RENAME) |
		(1 << WIDX_DELETE);
	window_init_scroll_widgets(w);
	w->flags |= WF_TRANSPARENT;
	w->colours[0] = 26;
	w->colours[1] = 26;
	w->colours[2] = 26;
}
Exemple #23
0
rct_window *window_changelog_open()
{
	rct_window* window;

	window = window_bring_to_front_by_class(WC_CHANGELOG);
	if (window != NULL)
		return window;

	if (!window_changelog_read_file())
		return NULL;

	int screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16);
	int screenHeight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16);

	window = window_create_centred(
		screenWidth * 4 / 5,
		screenHeight * 4 / 5,
		&window_changelog_events,
		WC_CHANGELOG,
		WF_RESIZABLE
	);
	window->widgets = window_changelog_widgets;
	window->enabled_widgets = (1 << WIDX_CLOSE);

	window_init_scroll_widgets(window);
	window->min_width = MIN_WW;
	window->min_height = MIN_WH;
	window->max_width = MIN_WW;
	window->max_height = MIN_WH;
	return window;
}
Exemple #24
0
/**
 * Creates the window containing the logo and the expansion packs on the title screen.
 *  rct2: 0x0066B679 (part of 0x0066B3E8)
 */
void window_title_logo_open()
{
    int i, packs;
    rct_window *window;

    // Count number of expansion packs
    packs = 0;
    for (i = 0; i < 16; i++)
        if (RCT2_GLOBAL(RCT2_ADDRESS_EXPANSION_FLAGS, uint16) & (1 << i))
            packs++;

    // Create the window
    window = window_create(
                 0,
                 0,
                 200,
                 106 + (10 * packs),
                 &window_title_logo_events,
                 WC_TITLE_LOGO,
                 WF_STICK_TO_BACK | WF_TRANSPARENT
             );
    window->widgets = (rct_widget*)0x009A9658; // mouse move bug in original game, keep this address and no crash happens
    window_init_scroll_widgets(window);
    window->colours[0] = 129;
    window->colours[1] = 129;
    window->colours[2] = 129;
}
Exemple #25
0
void window_text_input_raw_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, int maxLength)
{
	_maxInputLength = maxLength;

	window_close_by_class(WC_TEXTINPUT);

	// Clear the text input buffer
	memset(text_input, 0, maxLength);

	// Enter in the the text input buffer any existing
	// text.
	if (existing_text != NULL)
		safe_strcpy(text_input, existing_text, maxLength);

	// In order to prevent strings that exceed the maxLength
	// from crashing the game.
	text_input[maxLength - 1] = '\0';

	// This is the text displayed above the input box
	input_text_description = description;

	// Work out the existing size of the window
	char wrapped_string[512];
	safe_strcpy(wrapped_string, text_input, 512);

	int no_lines = 0, font_height = 0;

	// String length needs to add 12 either side of box
	// +13 for cursor when max length.
	gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height);

	int height = no_lines * 10 + WH;

	// Window will be in the center of the screen
	rct_window* w = window_create_centred(
		WW,
		height,
		&window_text_input_events,
		WC_TEXTINPUT,
		WF_STICK_TO_FRONT
		);

	w->widgets = window_text_input_widgets;
	w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_OKAY);

	window_text_input_widgets[WIDX_TITLE].image = title;

	// Save calling window details so that the information
	// can be passed back to the correct window & widget
	calling_class = call_w->classification;
	calling_number = call_w->number;
	calling_widget = call_widget;

	platform_start_text_input(text_input, maxLength);

	window_init_scroll_widgets(w);
	w->colours[0] = call_w->colours[0];
	w->colours[1] = call_w->colours[1];
	w->colours[2] = call_w->colours[2];
}
Exemple #26
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;
}
Exemple #27
0
rct_window *window_mapgen_open()
{
	rct_window *w;

	w = window_bring_to_front_by_class(WC_MAPGEN);
	if (w == NULL) {
		w = window_create_centred(
			300,
			200,
			window_mapgen_page_events[0],
			WC_MAPGEN,
			WF_10
		);
		w->number = 0;
		w->frame_no = 0;
	}

	w->page = WINDOW_MAPGEN_PAGE_BASE;
	window_invalidate(w);
	w->widgets = window_mapgen_page_widgets[WINDOW_MAPGEN_PAGE_BASE];
	w->enabled_widgets = window_mapgen_page_enabled_widgets[WINDOW_MAPGEN_PAGE_BASE];
	w->hold_down_widgets = window_mapgen_page_hold_down_widgets[WINDOW_MAPGEN_PAGE_BASE];
	w->event_handlers = window_mapgen_page_events[WINDOW_MAPGEN_PAGE_BASE];
	w->pressed_widgets = 0;
	w->disabled_widgets = 0;
	window_init_scroll_widgets(w);

	return w;
}
Exemple #28
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);
}
Exemple #29
0
void window_network_status_open(const char* text)
{
	rct_window* window;

	safe_strncpy(window_network_status_text, text, sizeof(window_network_status_text));

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

	window = window_create_centred(320, 90, &window_network_status_events, WC_NETWORK_STATUS, WF_10 | WF_TRANSPARENT);

	window->widgets = window_network_status_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 = 90;
	window->max_width = window->min_width;
	window->max_height = window->min_height;

	window->page = 0;
	window->list_information_type = 0;
	window->colours[0] = 7;
	window->colours[1] = 7;
	window->colours[2] = 7;
}
Exemple #30
0
/**
 * 
 * rct2: 0x006ACC28
 */
void window_ride_main_open(int rideIndex)
{
	rct_window *w;

	w = window_bring_to_front_by_id(WC_RIDE, rideIndex);
	if (w == NULL) {
		w = window_ride_open(rideIndex);
		w->ride.var_482 = -1;
	}

	if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) {
		if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) &&
			w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
		) {
			tool_cancel();
		}
	}

	w->page = 0;
	w->width = 316;
	w->height = 180;
	window_invalidate(w);
	w->widgets = window_ride_page_widgets[0];
	w->enabled_widgets = 0x007DBFF4;
	w->var_020 = 0;
	w->event_handlers = window_ride_page_events[0];
	w->pressed_widgets = 0;
	RCT2_CALLPROC_X(0x006AEB9F, 0, 0, 0, 0, (int)w, 0, 0);
	window_init_scroll_widgets(w);
	w->ride.var_480 = 0;
	RCT2_CALLPROC_X(0x006AF994, 0, 0, 0, 0, (int)w, 0, 0);
}