Esempio n. 1
0
/**
 *
 *  rct2: 0x006CD811
 */
static void window_maze_construction_close(rct_window *w)
{
	sub_6C9627();
	viewport_set_visibility(0);

	map_invalidate_map_selection_tiles();
	gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;

	// In order to cancel the yellow arrow correctly the
	// selection tool should be cancelled.
	tool_cancel();

	hide_gridlines();

	uint8 rideIndex = _currentRideIndex;
	rct_ride* ride = get_ride(rideIndex);
	if (ride->overall_view == 0xFFFF) {
		sint32 savedPausedState = gGamePaused;
		gGamePaused = 0;
		game_do_command(0, 9, 0, rideIndex, GAME_COMMAND_DEMOLISH_RIDE, 0, 0);
		gGamePaused = savedPausedState;
	} else {
		window_ride_main_open(rideIndex);
	}
}
Esempio n. 2
0
/* rct2: 0x006C9BA5 */
void window_construction_mouseup_demolish(rct_window* w){
	RCT2_CALLPROC_X(0x6C9BA5, 0, 0, 0, 0, (int)w, 0, 0);
	return;

	RCT2_GLOBAL(0xF44070, uint32) = 0x80000000;
	sub_6C9627();

	RCT2_GLOBAL(0xF440B8, uint8) = 3;
	if (RCT2_GLOBAL(0xF440A6, uint8) == 1){
		//6C9C4F
	}

	if (RCT2_GLOBAL(0xF440A6, uint8) != 2){
		//6c9cc4
		int eax = RCT2_GLOBAL(0xF440A8, uint16),
			ebx = RCT2_GLOBAL(0xF440AF, uint8) || (RCT2_GLOBAL(0xF440AE, uint8) << 8),
			ecx = RCT2_GLOBAL(0xF440AA, uint16),
			edx = RCT2_GLOBAL(0xF440AC, uint16);

		sub_6C683D(&eax, &ecx, edx, RCT2_GLOBAL(0xF440AE, uint8), RCT2_GLOBAL(0xF440AF, uint8) & 0x3FF, 0, 0, 0);
	}

	int ride_id = RCT2_GLOBAL(0xF440A7, uint8);
	RCT2_GLOBAL(0xF441D2, uint8) = ride_id;
	//6c9BFE
}
Esempio n. 3
0
void window_construction_maze_close(){
	rct_window *w;

	window_get_register(w);

	sub_6C9627();
	viewport_set_visibility(0);

	map_invalidate_map_selection_tiles();
	RCT2_GLOBAL(0x9DE58A, uint16) &= 0xFFFD;

	hide_gridlines();
	
	uint8 ride_id = RCT2_GLOBAL(0xF440A7, uint8);

	rct_ride* ride = GET_RIDE(ride_id);

	if (ride->overall_view == 0xFFFF){
		int eax = RCT2_GLOBAL(0x009DEA6E, uint8);

		RCT2_GLOBAL(0x009DEA6E, uint8) = 0;
		game_do_command(0, 9, 0, ride_id, GAME_COMMAND_7, 0, 0);

		RCT2_GLOBAL(0x009DEA6E, uint8) = eax;
		return;
	}

	window_ride_main_open(ride_id);
}
Esempio n. 4
0
void window_construction_close(){
	rct_window *w;

	window_get_register(w);

	sub_6C9627();
	viewport_set_visibility(0);

	map_invalidate_map_selection_tiles();
	RCT2_GLOBAL(0x9DE58A, uint16) &= 0xFFFD;

	hide_gridlines();

	int x, y;
	uint8 ride_id = RCT2_GLOBAL(0xF440A7, uint8);
	rct_map_element* map_element = sub_6CAF80(ride_id, &x, &y);

	if ((int)map_element == -1){
		int eax = RCT2_GLOBAL(0x009DEA6E, uint8);

		RCT2_GLOBAL(0x009DEA6E, uint8) = 0;
		game_do_command(0, 9, 0, ride_id, GAME_COMMAND_7, 0, 0);

		RCT2_GLOBAL(0x009DEA6E, uint8) = eax;
		return;
	}

	window_ride_main_open(ride_id);
}
Esempio n. 5
0
/**
 *
 *  rct2: 0x006C825F
 */
static void window_maze_construction_entrance_tooldown(sint32 x, sint32 y, rct_window* w){
	sub_6C9627();

	map_invalidate_selection_rect();

	gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
	gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;

	sint32 direction = 0;
	ride_get_entrance_or_exit_position_from_screen_position(x, y, &x, &y, &direction);

	if (gRideEntranceExitPlaceDirection == 0xFF)
		return;

	uint8 rideIndex = gRideEntranceExitPlaceRideIndex;
	uint8 entranceExitType = gRideEntranceExitPlaceType;
	gGameCommandErrorTitle = entranceExitType ? STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION : STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION;

	money32 cost = game_do_command(
		x,
		GAME_COMMAND_FLAG_APPLY | ((direction ^ 2) << 8),
		y,
		rideIndex | (entranceExitType << 8),
		GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,
		gRideEntranceExitPlaceStationIndex,
		0);

	if (cost == MONEY32_UNDEFINED)
		return;

	audio_play_sound_at_location(
		SOUND_PLACE_ITEM,
		gCommandPosition.x,
		gCommandPosition.y,
		gCommandPosition.z);

	rct_ride* ride = get_ride(rideIndex);
	if (ride_are_all_possible_entrances_and_exits_built(ride)){
		tool_cancel();
		if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_NO_TRACK))
			window_close(w);
	}
	else{
		gRideEntranceExitPlaceType = entranceExitType ^ 1;
		window_invalidate_by_class(WC_RIDE_CONSTRUCTION);
		gCurrentToolWidget.widget_index = entranceExitType ? WIDX_MAZE_ENTRANCE : WIDX_MAZE_EXIT;
	}
}
Esempio n. 6
0
/**
 *
 *  rct2: 0x006CD4AB
 */
static void window_maze_construction_construct(sint32 direction)
{
	sint32 x, y, z, flags, mode;

	sub_6C9627();

	x = _currentTrackBeginX + (TileDirectionDelta[direction].x / 2);
	y = _currentTrackBeginY + (TileDirectionDelta[direction].y / 2);
	z = _currentTrackBeginZ;
	switch (_rideConstructionState) {
	case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
		mode = 0;
		flags = 1;
		break;
	case RIDE_CONSTRUCTION_STATE_MAZE_MOVE:
		mode = 1;
		flags = 1 | 8;
		break;
	default:
	case RIDE_CONSTRUCTION_STATE_MAZE_FILL:
		mode = 2;
		flags = 1 | 8;
		break;
	}

	gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
	money32 cost = game_do_command(
		x,
		flags | (direction << 8),
		y,
		_currentRideIndex | (mode << 8),
		GAME_COMMAND_SET_MAZE_TRACK,
		z,
		0
	);
	if (cost == MONEY32_UNDEFINED) {
		return;
	}

	_currentTrackBeginX = x;
	_currentTrackBeginY = y;
	if (_rideConstructionState != 7) {
		audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);
	}
}
Esempio n. 7
0
static void window_maze_construction_entrance_mouseup(rct_window *w, sint32 widgetIndex){
	if (tool_set(w, widgetIndex, 12))
		return;

	gRideEntranceExitPlaceType = widgetIndex == WIDX_MAZE_ENTRANCE ? ENTRANCE_TYPE_RIDE_ENTRANCE : ENTRANCE_TYPE_RIDE_EXIT;
	gRideEntranceExitPlaceRideIndex = (uint8)w->number;
	gRideEntranceExitPlaceStationIndex = 0;
	gInputFlags |= INPUT_FLAG_6;

	sub_6C9627();

	// ???
	uint8 old_state = _rideConstructionState;
	_rideConstructionState = 5;
	if (old_state != 5)
		_rideConstructionState = old_state;
	window_maze_construction_update_pressed_widgets();
}