Beispiel #1
0
/**
 *
 *  rct2: 0x006CFB82
 */
static void window_track_list_select(rct_window *w, int index)
{
	uint8 *trackDesignItem, *trackDesignList = RCT2_ADDRESS(RCT2_ADDRESS_TRACK_LIST, uint8);
	rct_track_design *trackDesign;

	w->track_list.var_480 = index;

	sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) && index == 0) {
		window_close(w);
		ride_construct_new(_window_track_list_item);
		return;
	}

	if (RCT2_GLOBAL(0x00F44153, uint8) != 0)
		RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 1;

	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER))
		index--;

	trackDesignItem = trackDesignList + (index * 128);
	RCT2_GLOBAL(0x00F4403C, uint8*) = trackDesignItem;

	window_track_list_format_name(
		(char*)0x009BC313,
		trackDesignItem,
		RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ?
		0 :
		FORMAT_WHITE,
		1);

	char track_path[MAX_PATH] = { 0 };
	subsitute_path(track_path, (char*)RCT2_ADDRESS_TRACKS_PATH, trackDesignItem);

	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
		window_track_manage_open();
		return;
	}

	if (!load_track_design(track_path)) {
		w->track_list.var_480 = 0xFFFF;
		window_invalidate(w);
		return;
	}

	trackDesign = track_get_info(index, NULL);
	if (trackDesign == NULL) return;
	if (trackDesign->track_td6.track_flags & 4)
		window_error_open(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, -1);

	window_close(w);
	window_track_place_open();
}
Beispiel #2
0
/**
 *
 *  rct2: 0x006CFB82
 */
static void window_track_list_select(rct_window *w, int index)
{
	uint8 *trackDesignItem, *trackDesignList = (uint8*)0x00F441EC;
	rct_track_design *trackDesign;

	w->track_list.var_480 = index;

	sound_play_panned(SOUND_CLICK_1, w->x + (w->width / 2), 0, 0, 0);
	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8) && index == 0) {
		window_close(w);
		ride_construct_new(_window_track_list_item);
		return;
	}

	if (RCT2_GLOBAL(0x00F44153, uint8) != 0)
		RCT2_GLOBAL(0x00F44152, uint8) = 1;

	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8))
		index--;

	trackDesignItem = trackDesignList + (index * 128);;
	RCT2_GLOBAL(0x00F4403C, uint8*) = trackDesignItem;

	window_track_list_format_name(
		(char*)0x009BC313,
		trackDesignItem,
		RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8 ?
			0 :
			FORMAT_WHITE
	);

	subsitute_path((char*)0x0141EF68, (char*)RCT2_ADDRESS_TRACKS_PATH, trackDesignItem);

	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER & 8) {
		window_track_manage_open();
		return;
	}

	if (!RCT2_CALLPROC_X(0x0067726A, 0, 0, 0, 0, 0, 0, 0)) {
		w->track_list.var_480 = 0xFFFF;
		window_invalidate(w);
		return;
	}

	trackDesign = track_get_info(index, NULL);
	if (trackDesign->var_06 & 4)
		window_error_open(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, -1);

	window_close(w);
	window_track_place_open();
}