Esempio n. 1
0
/**
 *
 *  rct2: 0x006D386D
 */
rct_window* window_install_track_open(const utf8* path)
{
    _trackDesign = track_design_open(path);
    if (_trackDesign == nullptr)
    {
        context_show_error(STR_UNABLE_TO_LOAD_FILE, STR_NONE);
        return nullptr;
    }

    object_manager_unload_all_objects();
    if (_trackDesign->type == RIDE_TYPE_NULL)
    {
        log_error("Failed to load track (ride type null): %s", path);
        return nullptr;
    }
    if (object_manager_load_object(&_trackDesign->vehicle_object) == nullptr)
    {
        log_error("Failed to load track (vehicle load fail): %s", path);
        return nullptr;
    }

    window_close_by_class(WC_EDITOR_OBJECT_SELECTION);
    window_close_construction_windows();

    gTrackDesignSceneryToggle = false;
    _currentTrackPieceDirection = 2;

    int32_t screenWidth = context_get_width();
    int32_t screenHeight = context_get_height();
    int32_t x = screenWidth / 2 - 201;
    int32_t y = std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200);

    rct_window* w = window_create(x, y, WW, WH, &window_install_track_events, WC_INSTALL_TRACK, 0);
    w->widgets = window_install_track_widgets;
    w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_INSTALL)
        | (1 << WIDX_CANCEL);
    window_init_scroll_widgets(w);
    w->track_list.track_list_being_updated = false;
    window_push_others_right(w);

    _trackPath = path;
    _trackName = GetNameFromTrackPath(path);
    _trackDesignPreviewPixels.resize(4 * TRACK_PREVIEW_IMAGE_SIZE);

    window_install_track_update_preview();
    window_invalidate(w);

    return w;
}
Esempio n. 2
0
/**
 *
 *  rct2: 0x006A7C43
 */
void window_footpath_open()
{
    rct_window* window;

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

    window = window_create(
                 0,
                 29,
                 106,
                 381,
                 (uint32*)window_footpath_events,
                 WC_FOOTPATH,
                 0
             );
    window->widgets = window_footpath_widgets;
    window->enabled_widgets =
        (1 << WIDX_CLOSE) |
        (1 << WIDX_FOOTPATH_TYPE) |
        (1 << WIDX_QUEUELINE_TYPE) |
        (1 << WIDX_DIRECTION_NW) |
        (1 << WIDX_DIRECTION_NE) |
        (1 << WIDX_DIRECTION_SW) |
        (1 << WIDX_DIRECTION_SE) |
        (1 << WIDX_SLOPEDOWN) |
        (1 << WIDX_LEVEL) |
        (1 << WIDX_SLOPEUP) |
        (1 << WIDX_CONSTRUCT) |
        (1 << WIDX_REMOVE) |
        (1 << WIDX_CONSTRUCT_ON_LAND) |
        (1 << WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL);

    window_init_scroll_widgets(window);
    window_push_others_right(window);
    show_gridlines();
    window->colours[0] = 24;
    window->colours[1] = 24;
    window->colours[2] = 24;

    tool_cancel();
    RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND;
    tool_set(window, WIDX_CONSTRUCT_ON_LAND, 17);
    RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
    RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0;
    RCT2_CALLPROC_EBPSAFE(0x006A855C);
}
Esempio n. 3
0
/**
 *
 *  rct2: 0x006CB481
 */
rct_window *window_maze_construction_open()
{
	rct_window *w = window_create(0, 29, 166, 200, &window_maze_construction_events, WC_RIDE_CONSTRUCTION, WF_NO_AUTO_CLOSE);
	w->widgets = window_maze_construction_widgets;
	w->enabled_widgets = 0x6F0001C4;

	window_init_scroll_widgets(w);
	colour_scheme_update(w);

	w->number = _currentRideIndex;

	window_push_others_right(w);
	show_gridlines();
	return w;
}
Esempio n. 4
0
/**
 *
 *  rct2: 0x006CF1A2
 */
void window_track_list_open(ride_list_item item)
{
	rct_window *w;
	int x, y;
	void *mem;

	window_close_construction_windows();
	_window_track_list_item = item;

	if (RCT2_GLOBAL(0x00F635ED, uint8) & 1)
		window_error_open(STR_WARNING, STR_TOO_MANY_TRACK_DESIGNS_OF_THIS_TYPE);

	mem = malloc(1285292);
	if (mem == NULL)
		return;

	RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_CACHE, void*) = mem;
	reset_track_list_cache();

	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
		x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 300;
		y = max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 200);
	} else {
		x = 0;
		y = 29;
	}
	w = window_create(
		x,
		y,
		600,
		400,
		&window_track_list_events,
		WC_TRACK_DESIGN_LIST,
		0
	);
	w->widgets = window_track_list_widgets;
	w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_BACK);
	window_init_scroll_widgets(w);
	w->track_list.var_480 = 0xFFFF;
	w->track_list.var_482 = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 1;
	w->track_list.var_484 = 0;
	RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 0;
	window_push_others_right(w);
	RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 2;
}
Esempio n. 5
0
/**
 *
 *  rct2: 0x006CF1A2
 */
void window_track_list_open(ride_list_item item)
{
    window_close_construction_windows();
    _window_track_list_item = item;
    track_list_load_designs(item);

    sint32 x, y;
    if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {
        sint32 screenWidth = context_get_width();
        sint32 screenHeight = context_get_height();
        x = screenWidth / 2 - 300;
        y = max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200);
    } else {
        x = 0;
        y = TOP_TOOLBAR_HEIGHT + 2;
    }
    rct_window *w = window_create(
        x,
        y,
        600,
        400,
        &window_track_list_events,
        WC_TRACK_DESIGN_LIST,
        0
    );
    w->widgets = window_track_list_widgets;
    w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY) | (1 << WIDX_BACK);
    window_init_scroll_widgets(w);
    w->track_list.var_480 = 0xFFFF;
    w->track_list.var_484 = 0;
    w->track_list.reload_track_designs = false;
    w->selected_list_item = 0;
    if (_trackDesignsCount != 0 && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
        w->selected_list_item = 1;
    }
    gTrackDesignSceneryToggle = false;
    window_push_others_right(w);
    _currentTrackPieceDirection = 2;

    _trackDesignPreviewPixels = calloc(4, TRACK_PREVIEW_IMAGE_SIZE);

    _loadedTrackDesign = NULL;
    _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED;
}
Esempio n. 6
0
/**
 *
 *  rct2: 0x006CFCA0
 */
rct_window * window_track_place_open(const track_design_file_ref *tdFileRef)
{
    rct_track_td6 *td6 = track_design_open(tdFileRef->path);
    if (td6 == nullptr) {
        return nullptr;
    }

    window_close_construction_windows();

    _window_track_place_mini_preview.resize(TRACK_MINI_PREVIEW_SIZE);

    rct_window *w = window_create(
        0,
        29,
        200,
        124,
        &window_track_place_events,
        WC_TRACK_DESIGN_PLACE,
        0
    );
    w->widgets = window_track_place_widgets;
    w->enabled_widgets = 1 << WIDX_CLOSE
        | 1 << WIDX_ROTATE
        | 1 << WIDX_MIRROR
        | 1 << WIDX_SELECT_DIFFERENT_DESIGN;
    window_init_scroll_widgets(w);
    tool_set(w, WIDX_PRICE, TOOL_CROSSHAIR);
    input_set_flag(INPUT_FLAG_6, true);
    window_push_others_right(w);
    show_gridlines();
    _window_track_place_last_cost = MONEY32_UNDEFINED;
    _window_track_place_last_x = -1;
    _currentTrackPieceDirection = (2 - get_current_rotation()) & 3;

    window_track_place_clear_mini_preview();
    window_track_place_draw_mini_preview(td6);

    _trackDesign = td6;

    return w;
}
Esempio n. 7
0
/**
 *
 *  rct2: 0x006CF1A2
 */
void window_track_list_open(ride_list_item item)
{
	rct_window *w;
	int x, y;
	void *mem;

	window_close_construction_windows();
	_window_track_list_item = item;

	if (RCT2_GLOBAL(0x00F635ED, uint8) & 1)
		window_error_open(STR_WARNING, STR_TOO_MANY_TRACK_DESIGNS_OF_THIS_TYPE);

	mem = malloc(1285292);
	if (mem == NULL)
		return;

	RCT2_GLOBAL(0x00F44105, void*) = mem;
	RCT2_CALLPROC_EBPSAFE(0x006D1DCE);

	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
		x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 300;
		y = max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 200);
	} else {
		x = 0;
		y = 29;
	}
	w = window_create(0, 29, 600, 400, (uint32*)window_track_list_events, WC_TRACK_DESIGN_LIST, 0);
	w->widgets = window_track_list_widgets;
	w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY);
	window_init_scroll_widgets(w);
	w->colours[0] = 26;
	w->colours[1] = 26;
	w->colours[2] = 26;
	w->track_list.var_480 = 0xFFFF;
	w->track_list.var_482 = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 1 : 0;
	w->track_list.var_484 = 0;
	RCT2_GLOBAL(0x00F44152, uint8) = 0;
	window_push_others_right(w);
	RCT2_GLOBAL(0x00F440AE, uint8) = 2;
}
Esempio n. 8
0
/**
 *
 *  rct2: 0x006CB481
 */
rct_window *window_maze_construction_open()
{
    rct_window *w = window_create(0, 29, 166, 200, &window_maze_construction_events, WC_RIDE_CONSTRUCTION, WF_NO_AUTO_CLOSE);
    w->widgets = window_maze_construction_widgets;
    w->enabled_widgets = (1ULL << WIDX_CLOSE) |
        (1ULL << WIDX_MAZE_BUILD_MODE) |
        (1ULL << WIDX_MAZE_MOVE_MODE) |
        (1ULL << WIDX_MAZE_FILL_MODE) |
        (1ULL << WIDX_MAZE_DIRECTION_NW) |
        (1ULL << WIDX_MAZE_DIRECTION_NE) |
        (1ULL << WIDX_MAZE_DIRECTION_SW) |
        (1ULL << WIDX_MAZE_DIRECTION_SE) |
        (1ULL << WIDX_MAZE_ENTRANCE) |
        (1ULL << WIDX_MAZE_EXIT);

    window_init_scroll_widgets(w);

    w->number = _currentRideIndex;

    window_push_others_right(w);
    show_gridlines();
    return w;
}
Esempio n. 9
0
/**
 * 
 * rct2: 0x006CB481
 */
rct_window *window_construction_open()
{
	//int eax, ebx, ecx, edx, esi, edi, ebp;
	//RCT2_CALLFUNC_X(0x006CB481, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
	//return (rct_window*)esi;

	int ride_id = RCT2_GLOBAL(0xF440A7, uint8);
	sub_6b2fa9(ride_id);

	rct_window *w;
	rct_ride* ride = GET_RIDE(ride_id);
	if (ride->type == RIDE_TYPE_MAZE){
		w = window_create(0, 29, 166, 200, (uint32*)window_construction_maze_events, WC_RIDE_CONSTRUCTION, WF_9);

		w->widgets = (rct_widget*)0x9D7D04;
		w->enabled_widgets = 0x6F0001C4;

		window_init_scroll_widgets(w);

		w->colours[0] = 24;
		w->colours[1] = 24;
		w->colours[2] = 24;

		w->number = ride_id;

		window_push_others_right(w);
		show_gridlines();
		return w;
	}

	w = window_create(0, 29, 166, 394, (uint32*)window_construction_events, WC_RIDE_CONSTRUCTION, WF_9);

	w->widgets = (rct_widget*)0x9D7A90;
	w->enabled_widgets = 0x67EFFFFFC4;

	window_init_scroll_widgets(w);

	w->colours[0] = 24;
	w->colours[1] = 24;
	w->colours[2] = 24;

	w->number = ride_id;

	window_push_others_right(w);
	show_gridlines();

	RCT2_GLOBAL(0xF44070, uint32) = 0x80000000;
	RCT2_GLOBAL(0xF440CD, uint8) = 8;
	RCT2_GLOBAL(0xF440CE, uint8) = 18;
	RCT2_GLOBAL(0xF440CF, uint8) = 4;

	if (ride->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER){
		RCT2_GLOBAL(0xF440CE, uint8) = 30;
	}

	if (ride->type == RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER){
		RCT2_GLOBAL(0xF440CE, uint8) = 30;
	}

	RCT2_GLOBAL(0xF440A0,uint16) = RCT2_ADDRESS(0x0097CC68, uint8)[ride->type * 2] | 0x100;
	RCT2_GLOBAL(0x00F440B2, uint8) = 0;
	RCT2_GLOBAL(0x00F440B3, uint8) = 0;
	RCT2_GLOBAL(0x00F440B4, uint8) = 0;
	RCT2_GLOBAL(0x00F440B5, uint8) = 0;

	if (RCT2_ADDRESS(0x0097D4F2, uint16)[ride->type * 4] & 0x8000)
		RCT2_GLOBAL(0x00F440B5, uint8) |= 2;

	RCT2_GLOBAL(0x00F440B6, uint8) = 0;
	RCT2_GLOBAL(0x00F440B7, uint8) = 0;

	RCT2_GLOBAL(0x00F440AE, uint8) = 0;
	RCT2_GLOBAL(0x00F440A6, uint8) = 4;
	RCT2_GLOBAL(0x00F440B0, uint8) = 0;
	RCT2_GLOBAL(0x00F440B1, uint8) = 0;
	RCT2_GLOBAL(0x00F44159, uint8) = 0;
	RCT2_GLOBAL(0x00F4415C, uint8) = 0;
	return w;
}