Ejemplo n.º 1
0
static void window_multiplayer_groups_mouseup(rct_window *w, sint32 widgetIndex)
{
	switch (widgetIndex) {
	case WIDX_CLOSE:
		window_close(w);
		break;
	case WIDX_TAB1:
	case WIDX_TAB2:
	case WIDX_TAB3:
	case WIDX_TAB4:
		if (w->page != widgetIndex - WIDX_TAB1) {
			window_multiplayer_set_page(w, widgetIndex - WIDX_TAB1);
		}
		break;
	case WIDX_ADD_GROUP:
		game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_MODIFY_GROUPS, 0, 0);
		break;
	case WIDX_REMOVE_GROUP:
		game_do_command(1 | (_selectedGroup << 8), GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_MODIFY_GROUPS, 0, 0);
		break;
	case WIDX_RENAME_GROUP:;
		sint32 groupIndex = network_get_group_index(_selectedGroup);
		const utf8 *groupName = network_get_group_name(groupIndex);
		window_text_input_raw_open(w, widgetIndex, STR_GROUP_NAME, STR_ENTER_NEW_NAME_FOR_THIS_GROUP, (utf8*)groupName, 32);
		break;
	}
}
Ejemplo n.º 2
0
/**
 *
 *  rct2: 0x6ba4d6
 */
static void window_banner_mouseup(rct_window *w, sint32 widgetIndex)
{
	rct_banner* banner = &gBanners[w->number];
	sint32 x = banner->x << 5;
	sint32 y = banner->y << 5;

	rct_map_element* map_element = map_get_first_element_at(x / 32, 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++;
	}

	switch (widgetIndex) {
	case WIDX_CLOSE:
		window_close(w);
		break;
	case WIDX_BANNER_DEMOLISH:
		game_do_command(x, 1, y, map_element->base_height | (map_element->properties.banner.position << 8), GAME_COMMAND_REMOVE_BANNER, 0, 0);
		break;
	case WIDX_BANNER_TEXT:
		window_text_input_open(w, WIDX_BANNER_TEXT, STR_BANNER_TEXT, STR_ENTER_BANNER_TEXT, gBanners[w->number].string_idx, 0, 32);
		break;
	case WIDX_BANNER_NO_ENTRY:
		textinput_cancel();
		game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, banner->colour, GAME_COMMAND_SET_BANNER_STYLE, banner->text_colour, banner->flags ^ BANNER_FLAG_NO_ENTRY);
		break;
	}
}
Ejemplo n.º 3
0
/**
 *
 *  rct2: 0x6ba50c
 */
static void window_banner_textinput(rct_window *w, sint32 widgetIndex, char *text)
{
	if (widgetIndex == WIDX_BANNER_TEXT && text != NULL) {
		game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 0)), GAME_COMMAND_SET_BANNER_NAME, *((sint32*)(text + 8)), *((sint32*)(text + 4)));
		game_do_command(2, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 12)), GAME_COMMAND_SET_BANNER_NAME, *((sint32*)(text + 20)), *((sint32*)(text + 16)));
		game_do_command(0, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 24)), GAME_COMMAND_SET_BANNER_NAME, *((sint32*)(text + 32)), *((sint32*)(text + 28)));
	}
}
Ejemplo n.º 4
0
/**
 * 
 *  rct2: 0x0066C9EA
 */
static void window_game_top_toolbar_dropdown()
{
	short widgetIndex, dropdownIndex;

	__asm mov widgetIndex, dx
	__asm mov dropdownIndex, ax

	if (widgetIndex == WIDX_FILE_MENU) {
		switch (dropdownIndex) {
		case 0:		// load game
			game_do_command(0, 1, 0, 0, 5, 0, 0);
			break;
		case 1:		// save game
			tool_cancel();
			{
				int eax, ebx, ecx, edx, esi, edi, ebp;
				RCT2_CALLFUNC_X(0x006750E9, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
				if (eax == 0) {
					gfx_invalidate_screen();
					break;
				}

				char *src = (char*)0x0141EF67;
				do {
					src++;
				} while (*src != '.' && *src != '\0');
				strcpy(src, ".SV6");
				strcpy(RCT2_ADDRESS_SAVED_GAMES_PATH_2, 0x0141EF68);

				eax = 0;
				if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 8)
					eax |= 1;
				RCT2_CALLPROC_X(0x006754F5, eax, 0, 0, 0, 0, 0, 0);
				// check success?

				game_do_command(0, 1047, 0, -1, 0, 0, 0);
				gfx_invalidate_screen();
			}
			break;
		case 3:		// about
			window_about_open();
			break;
		case 4:		// options
			window_options_open();
			//RCT2_CALLPROC_EBPSAFE(0x006BAC5B);
			break;
		case 5:		// screenshot
			RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
			break;
		case 7:		// quit game
			game_do_command(0, 1, 0, 0, 5, 1, 0);
			break;
		}
	} else if (widgetIndex == WIDX_VIEW_MENU) {
		RCT2_CALLPROC_X(0x0066CF8A, dropdownIndex, 0, 0, 0, 0, 0, 0);
	}
}
Ejemplo n.º 5
0
static void window_multiplayer_groups_text_input(rct_window *w, sint32 widgetIndex, char *text)
{
	if (widgetIndex != WIDX_RENAME_GROUP)
		return;

	if (text == NULL)
		return;

	game_do_command(3 | (_selectedGroup << 8) | (1 << 16), GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 0)), GAME_COMMAND_MODIFY_GROUPS, *((sint32*)(text + 8)), *((sint32*)(text + 4)));
	game_do_command(3 | (_selectedGroup << 8) | (2 << 16), GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 12)), GAME_COMMAND_MODIFY_GROUPS, *((sint32*)(text + 20)), *((sint32*)(text + 16)));
	game_do_command(3 | (_selectedGroup << 8) | (0 << 16), GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 24)), GAME_COMMAND_MODIFY_GROUPS, *((sint32*)(text + 32)), *((sint32*)(text + 28)));
}
Ejemplo n.º 6
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);
}
Ejemplo n.º 7
0
void window_player_overview_mouse_up(rct_window *w, rct_widgetindex widgetIndex)
{
    switch(widgetIndex){
    case WIDX_CLOSE:
        window_close(w);
        break;
    case WIDX_TAB_1:
    case WIDX_TAB_2:
        window_player_set_page(w, widgetIndex - WIDX_TAB_1);
        break;
    case WIDX_LOCATE:{
        rct_window* mainWindow = window_get_main();
        if (mainWindow != nullptr) {
            sint32 player = network_get_player_index((uint8)w->number);
            if (player == -1) {
                return;
            }
            LocationXYZ16 coord = network_get_player_last_action_coord(player);
            if (coord.x || coord.y || coord.z) {
                window_scroll_to_location(mainWindow, coord.x, coord.y, coord.z);
            }
        }
    }break;
    case WIDX_KICK:
        game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_KICK_PLAYER, 0, 0);
        break;
    }
}
Ejemplo n.º 8
0
/**
 *
 *  rct2: 0x006CD811
 */
static void window_maze_construction_close(rct_window *w)
{
    ride_construction_invalidate_current_track();
    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.xy == RCT_XY8_UNDEFINED) {
        sint32 savedPausedState = gGamePaused;
        gGamePaused = 0;
        game_do_command(0, GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED, 0, rideIndex, GAME_COMMAND_DEMOLISH_RIDE, 0, 0);
        gGamePaused = savedPausedState;
    } else {
        window_ride_main_open(rideIndex);
    }
}
Ejemplo n.º 9
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);
}
Ejemplo n.º 10
0
/**
 *
 *  rct2: 0x6ba517
 */
static void window_banner_dropdown(rct_window *w, sint32 widgetIndex, sint32 dropdownIndex)
{
	rct_banner* banner = &gBanners[w->number];

	switch(widgetIndex){
	case WIDX_MAIN_COLOUR:
		if (dropdownIndex == -1)
			break;

		game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, dropdownIndex, GAME_COMMAND_SET_BANNER_STYLE, banner->text_colour, banner->flags);
		break;
	case WIDX_TEXT_COLOUR_DROPDOWN_BUTTON:
		if (dropdownIndex == -1)
			break;

		game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, banner->colour, GAME_COMMAND_SET_BANNER_STYLE, dropdownIndex + 1, banner->flags);
		break;
	}
}
Ejemplo n.º 11
0
/**
*
*  rct2: 0x0066FA38
*/
void window_editor_top_toolbar_dropdown() {
	short widgetIndex, dropdownIndex;
	rct_window* w;

	window_dropdown_get_registers(w, widgetIndex, dropdownIndex);

	if (widgetIndex == WIDX_FILE_MENU) {
		if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
			if (dropdownIndex == DDIDX_TD_ABOUT) {
				window_about_open();
			} else if (dropdownIndex == DDIDX_TD_OPTIONS) {
				window_options_open();
			} else if (dropdownIndex == DDIDX_TD_SCREENSHOT) {
				RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
			} else if (dropdownIndex == DDIDX_TD_QUIT_GAME) {
				window_close_by_number(WC_47, w->number);
				window_close_by_number(WC_48, w->number);
				game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0);
			}
		} else {
			if (dropdownIndex == DDIDX_SE_LOAD_LANDSCAPE) {
				game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
			} else if (dropdownIndex == DDIDX_SE_SAVE_LANDSCAPE) {
				RCT2_CALLPROC(0x0066FE2A);
			} else if (dropdownIndex == DDIDX_SE_ABOUT) {
				window_about_open();
			} else if (dropdownIndex == DDIDX_SE_OPTIONS) {
				window_options_open();
			} else if (dropdownIndex == DDIDX_SE_SCREENSHOT) {
				RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
			} else if (dropdownIndex == DDIDX_SE_QUIT_GAME) {
				window_close_by_number(WC_47, w->number);
				window_close_by_number(WC_48, w->number);
				game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 1, 0);
			}
		}
	} else if (widgetIndex == WIDX_VIEW_MENU) {
		top_toolbar_view_menu_dropdown(dropdownIndex);
	}
}
Ejemplo n.º 12
0
/**
 *
 *  rct2: 0x006C825F
 */
static void window_maze_construction_entrance_tooldown(sint32 x, sint32 y, rct_window* w){
    ride_construction_invalidate_current_track();

    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;
    if (entranceExitType == ENTRANCE_TYPE_RIDE_ENTRANCE) {
        gGameCommandErrorTitle = STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
    } else {
        gGameCommandErrorTitle = 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;
    }
}
Ejemplo n.º 13
0
/**
*
*  rct2: 0x006B4933
*/
static void window_ride_demolish_mouseup(rct_window *w, rct_widgetindex widgetIndex)
{
    switch (widgetIndex) {
    case WIDX_DEMOLISH:
        gGameCommandErrorTitle = STR_CANT_DEMOLISH_RIDE;
        game_do_command(0, 1, 0, w->number, GAME_COMMAND_DEMOLISH_RIDE, 0, 1); // Set ebp to 1 to be used to log demolish from window prompt
        break;
    case WIDX_CANCEL:
    case WIDX_CLOSE:
        window_close(w);
        break;
    }
}
Ejemplo n.º 14
0
void window_player_overview_dropdown(rct_window *w, rct_widgetindex widgetIndex, sint32 dropdownIndex)
{
    sint32 player = network_get_player_index((uint8)w->number);
    if (player == -1) {
        return;
    }
    if (dropdownIndex == -1) {
        return;
    }
    sint32 group = network_get_group_id(dropdownIndex);
    game_do_command(0, GAME_COMMAND_FLAG_APPLY, w->number, group, GAME_COMMAND_SET_PLAYER_GROUP, 0, 0);
    window_invalidate(w);
}
Ejemplo n.º 15
0
/**
 *
 *  rct2: 0x006E08D2
 */
static void viewport_interaction_remove_scenery(rct_tile_element *tileElement, sint32 x, sint32 y)
{
    gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
    game_do_command(
        x,
        (tileElement->type << 8) | 1,
        y,
        (tileElement->properties.scenery.type << 8) | tileElement->base_height,
        GAME_COMMAND_REMOVE_SCENERY,
        0,
        0
    );
}
Ejemplo n.º 16
0
static void window_multiplayer_groups_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
{
	sint32 index;

	index = y / 10;
	if (index >= w->no_list_items)
		return;

	w->selected_list_item = index;
	window_invalidate(w);

	game_do_command(2 | (_selectedGroup << 8), GAME_COMMAND_FLAG_APPLY, index, 0, GAME_COMMAND_MODIFY_GROUPS, 0, 0);
}
Ejemplo n.º 17
0
/**
*
*  rct2: 0x006B4933
*/
static void window_ride_demolish_mouseup(rct_window *w, int widgetIndex)
{
	switch (widgetIndex) {
	case WIDX_DEMOLISH:
		RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_DEMOLISH_RIDE;
		game_do_command(0, 1, 0, w->number, GAME_COMMAND_DEMOLISH_RIDE, 0, 0);
		break;
	case WIDX_CANCEL:
	case WIDX_CLOSE:
		window_close(w);
		break;
	}
}
Ejemplo n.º 18
0
static void window_title_menu_mouseup(rct_window *w, sint32 widgetIndex)
{
	switch (widgetIndex) {
	case WIDX_START_NEW_GAME:
		window_scenarioselect_open(window_title_menu_scenarioselect_callback);
		break;
	case WIDX_CONTINUE_SAVED_GAME:
		game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
		break;
	case WIDX_MULTIPLAYER:
		window_server_list_open();
		break;
	}
}
Ejemplo n.º 19
0
sint32 viewport_interaction_left_click(sint32 x, sint32 y)
{
    viewport_interaction_info info;

    switch (viewport_interaction_get_item_left(x, y, &info)) {
    case VIEWPORT_INTERACTION_ITEM_SPRITE:
        switch (info.sprite->unknown.sprite_identifier) {
        case SPRITE_IDENTIFIER_VEHICLE:
        {
            auto intent = Intent(WD_VEHICLE);
            intent.putExtra(INTENT_EXTRA_VEHICLE, info.vehicle);
            context_open_intent(&intent);
            break;
        }
        case SPRITE_IDENTIFIER_PEEP:
        {
            auto intent = Intent(WC_PEEP);
            intent.putExtra(INTENT_EXTRA_PEEP, info.peep);
            context_open_intent(&intent);
            break;
        }
        case SPRITE_IDENTIFIER_MISC:
            if (game_is_not_paused()) {
                switch (info.sprite->unknown.misc_identifier) {
                case SPRITE_MISC_BALLOON:
                    game_do_command(info.sprite->balloon.sprite_index, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_BALLOON_PRESS, 0, 0);
                    break;
                case SPRITE_MISC_DUCK:
                    duck_press(&info.sprite->duck);
                    break;
                }
            }
            break;
        }
        return 1;
    case VIEWPORT_INTERACTION_ITEM_RIDE:
    {
        auto intent = Intent(WD_TRACK);
        intent.putExtra(INTENT_EXTRA_TILE_ELEMENT, info.tileElement);
        context_open_intent(&intent);
        return true;
    }
    case VIEWPORT_INTERACTION_ITEM_PARK:
        context_open_window(WC_PARK_INFORMATION);
        return 1;
    default:
        return 0;
    }
}
Ejemplo n.º 20
0
/**
*
*  rct2: 0x006B4933
*/
static void window_ride_demolish_mouseup(){
	short widgetIndex;
	rct_window *w;

	window_widget_get_registers(w, widgetIndex);

	switch (widgetIndex){
	case WIDX_DEMOLISH:
		RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = STR_CANT_DEMOLISH_RIDE;
		game_do_command(0, 1, 0, w->number, GAME_COMMAND_7, 0, 0);
		break;
	case WIDX_CANCEL:
	case WIDX_CLOSE:
		window_close(w);
	}
}
Ejemplo n.º 21
0
/**
 *
 *  rct2: 0x00666C0E
 */
void viewport_interaction_remove_park_entrance(rct_tile_element *tileElement, sint32 x, sint32 y)
{
    sint32 rotation = tile_element_get_direction_with_offset(tileElement, 1);
    switch (tileElement->properties.entrance.index & 0x0F) {
    case 1:
        x += CoordsDirectionDelta[rotation].x;
        y += CoordsDirectionDelta[rotation].y;
        break;
    case 2:
        x -= CoordsDirectionDelta[rotation].x;
        y -= CoordsDirectionDelta[rotation].y;
        break;
    }
    gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
    game_do_command(x, GAME_COMMAND_FLAG_APPLY, y, tileElement->base_height / 2, GAME_COMMAND_REMOVE_PARK_ENTRANCE, 0, 0);
}
Ejemplo n.º 22
0
/**
*
*  rct2: 0x006C0B40
*/
static void window_staff_fire_mouseup(){
	short widgetIndex;
	rct_window *w;

	window_widget_get_registers(w, widgetIndex);

	rct_peep* peep = &g_sprite_list[w->number].peep;
	
	switch (widgetIndex){
	case WIDX_YES:
		game_do_command(peep->x, 1, peep->y, w->number, GAME_COMMAND_FIRE_STAFF_MEMBER, 0, 0);
		break;
	case WIDX_CANCEL:
	case WIDX_CLOSE:
		window_close(w);
	}
}
Ejemplo n.º 23
0
static void window_multiplayer_groups_dropdown(rct_window *w, sint32 widgetIndex, sint32 dropdownIndex)
{
	if (dropdownIndex == -1) {
		return;
	}

	switch(widgetIndex){
	case WIDX_DEFAULT_GROUP_DROPDOWN:
		game_do_command(4 | (network_get_group_id(dropdownIndex) << 8), GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_MODIFY_GROUPS, 0, 0);
		break;
	case WIDX_SELECTED_GROUP_DROPDOWN:
		_selectedGroup = network_get_group_id(dropdownIndex);
		break;
	}

	window_invalidate(w);
}
Ejemplo n.º 24
0
/**
 *
 *  rct2: 0x006CD4AB
 */
static void window_maze_construction_construct(sint32 direction)
{
    sint32 x, y, z, flags, mode;

    ride_construction_invalidate_current_track();

    x = _currentTrackBeginX + (TileDirectionDelta[direction].x / 2);
    y = _currentTrackBeginY + (TileDirectionDelta[direction].y / 2);
    z = _currentTrackBeginZ;
    switch (_rideConstructionState) {
    case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
        mode = GC_SET_MAZE_TRACK_BUILD;
        flags = GAME_COMMAND_FLAG_APPLY;
        break;
    case RIDE_CONSTRUCTION_STATE_MAZE_MOVE:
        mode = GC_SET_MAZE_TRACK_MOVE;
        flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED;
        break;
    default:
    case RIDE_CONSTRUCTION_STATE_MAZE_FILL:
        mode = GC_SET_MAZE_TRACK_FILL;
        flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED;
        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 != RIDE_CONSTRUCTION_STATE_MAZE_MOVE) {
        audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);
    }
}
Ejemplo n.º 25
0
/**
 *
 *  rct2: 0x006A61AB
 */
static void viewport_interaction_remove_footpath_item(rct_tile_element *tileElement, sint32 x, sint32 y)
{
    sint32 type;

    type = footpath_element_get_type(tileElement);
    if (footpath_element_is_queue(tileElement))
        type |= 0x80;

    gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
    game_do_command(
        x,
        ((tileElement->properties.path.type & 7) << 8) | 1,
        y,
        (type << 8) | tileElement->base_height,
        GAME_COMMAND_PLACE_PATH,
        0,
        0
    );
}
Ejemplo n.º 26
0
/* rct2: 0x6ba4d6*/
static void window_banner_mouseup()
{
	short widgetIndex;
	rct_window *w;

	window_widget_get_registers(w, widgetIndex);

	rct_banner* banner = &gBanners[w->number];
	int x = banner->x << 5;
	int y = banner->y << 5;

	rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(((y << 8) | x) >> 5);

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

	switch (widgetIndex) {
	case WIDX_CLOSE:
		window_close(w);
		break;
	case WIDX_BANNER_DEMOLISH:
		game_do_command(x, 1, y, map_element->base_height | (map_element->properties.banner.position << 8), GAME_COMMAND_51, 0, 0);
		break;
	case WIDX_BANNER_TEXT:
		window_text_input_open(w, WIDX_BANNER_TEXT, 2982, 2983, gBanners[w->number].string_idx, 0);
		break;
	case WIDX_BANNER_NO_ENTRY:
		RCT2_CALLPROC_EBPSAFE(0x006EE3C3);
		banner->flags ^= BANNER_FLAG_NO_ENTRY;
		window_invalidate(w);

		map_element->properties.banner.flags = 0xFF;
		if (banner->flags & BANNER_FLAG_NO_ENTRY){
			map_element->properties.banner.flags &= ~(1 << map_element->properties.banner.position);
		}
		break;
	}
}
Ejemplo n.º 27
0
/**
 *
 *  rct2: 0x006EA627
 */
void game_handle_input()
{
	rct_window *w;
	int x, y, state;

	if (RCT2_GLOBAL(0x009DEA64, uint16) & 2) {
		RCT2_GLOBAL(0x009DEA64, uint16) &= ~2;
		game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 2, 0);
	}

	if (RCT2_GLOBAL(0x009ABDF2, uint8) != 0) {
		for (w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
			window_event_unknown_07_call(w);

		sub_6EA73F();

		for (;;) {
			game_get_next_input(&x, &y, &state);
			if (state == 0) {
				break;
			}

			game_handle_input_mouse(x, y, state & 0xFF);
		}

		if (gInputFlags & INPUT_FLAG_5) {
			game_handle_input_mouse(x, y, state);
		}
		else if (x != 0x80000000) {
			x = clamp(0, x, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 1);
			y = clamp(0, y, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 1);

			game_handle_input_mouse(x, y, state);
			process_mouse_over(x, y);
			process_mouse_tool(x, y);
		}
	}

	for (w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
		window_event_unknown_08_call(w);
}
Ejemplo n.º 28
0
/**
 *
 *  rct2: 0x006E57A9
 */
static void viewport_interaction_remove_park_wall(rct_tile_element *tileElement, sint32 x, sint32 y)
{
    rct_scenery_entry *sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
    if (sceneryEntry->wall.scrolling_mode != 0xFF)
    {
        context_open_detail_window(WD_SIGN_SMALL, tileElement->properties.wall.banner_index);
    }
    else
    {
        TileCoordsXYZD wallLocation = { x >> 5, y >> 5, tileElement->base_height, tileElement->GetDirection() };
        auto wallRemoveAction = WallRemoveAction(wallLocation);
        GameActions::Execute(&wallRemoveAction);
    }
}

/**
 *
 *  rct2: 0x006B88DC
 */
static void viewport_interaction_remove_large_scenery(rct_tile_element *tileElement, sint32 x, sint32 y)
{
    rct_scenery_entry *sceneryEntry = get_large_scenery_entry(scenery_large_get_type(tileElement));

    if (sceneryEntry->large_scenery.scrolling_mode != 0xFF)
    {
        sint32 id = scenery_large_get_banner_id(tileElement);
        context_open_detail_window(WD_SIGN, id);
    } else {
        gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
        game_do_command(
            x,
            1 | (tile_element_get_direction(tileElement) << 8),
            y,
            tileElement->base_height | (scenery_large_get_sequence(tileElement) << 8),
            GAME_COMMAND_REMOVE_LARGE_SCENERY,
            0,
            0
        );
    }
}
Ejemplo n.º 29
0
static void window_title_menu_mouseup(rct_window *w, rct_widgetindex widgetIndex)
{
    rct_window *windowToOpen = nullptr;

    switch (widgetIndex) {
    case WIDX_START_NEW_GAME:
        windowToOpen = window_find_by_class(WC_SCENARIO_SELECT);
        if (windowToOpen != nullptr) {
            window_bring_to_front(windowToOpen);
        }
        else {
            window_close_by_class(WC_LOADSAVE);
            window_close_by_class(WC_SERVER_LIST);
            window_scenarioselect_open(window_title_menu_scenarioselect_callback, false);
        }
        break;
    case WIDX_CONTINUE_SAVED_GAME:
        windowToOpen = window_find_by_class(WC_LOADSAVE);
        if (windowToOpen != nullptr) {
            window_bring_to_front(windowToOpen);
        }
        else {
            window_close_by_class(WC_SCENARIO_SELECT);
            window_close_by_class(WC_SERVER_LIST);
            game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
        }
        break;
    case WIDX_MULTIPLAYER:
        windowToOpen = window_find_by_class(WC_SERVER_LIST);
        if (windowToOpen != nullptr) {
            window_bring_to_front(windowToOpen);
        }
        else {
            window_close_by_class(WC_SCENARIO_SELECT);
            window_close_by_class(WC_LOADSAVE);
            context_open_window(WC_SERVER_LIST);
        }
        break;
    }
}
Ejemplo n.º 30
0
/**
 *
 *  rct2: 0x0068ABEC
 */
static void set_all_land_owned()
{
	int mapSize = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, sint16);

	game_do_command(64, 1, 64, 2, 56, (mapSize - 2) * 32, (mapSize - 2) * 32);
}