static sint32 map_element_get_total_element_count(rct_map_element *mapElement) { sint32 elementCount; rct_scenery_entry *sceneryEntry; rct_large_scenery_tile *tile; switch (map_element_get_type(mapElement)) { case MAP_ELEMENT_TYPE_PATH: case MAP_ELEMENT_TYPE_SCENERY: case MAP_ELEMENT_TYPE_WALL: return 1; case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE: sceneryEntry = get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF); tile = sceneryEntry->large_scenery.tiles; elementCount = 0; do { tile++; elementCount++; } while (tile->x_offset != (sint16)(uint16)0xFFFF); return elementCount; default: return 0; } }
static sint32 tile_element_get_total_element_count(rct_tile_element *tileElement) { sint32 elementCount; rct_scenery_entry *sceneryEntry; rct_large_scenery_tile *tile; switch (tileElement->GetType()) { case TILE_ELEMENT_TYPE_PATH: case TILE_ELEMENT_TYPE_SMALL_SCENERY: case TILE_ELEMENT_TYPE_WALL: return 1; case TILE_ELEMENT_TYPE_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(scenery_large_get_type(tileElement)); tile = sceneryEntry->large_scenery.tiles; elementCount = 0; do { tile++; elementCount++; } while (tile->x_offset != (sint16)(uint16)0xFFFF); return elementCount; default: return 0; } }
static void track_design_save_add_large_scenery(sint32 x, sint32 y, rct_tile_element *tileElement) { rct_large_scenery_tile *sceneryTiles, *tile; sint32 x0, y0, z0, z; sint32 direction, sequence; sint32 entryType = scenery_large_get_type(tileElement); auto entry = object_entry_get_entry(OBJECT_TYPE_LARGE_SCENERY, entryType); sceneryTiles = get_large_scenery_entry(entryType)->large_scenery.tiles; z = tileElement->base_height; direction = tileElement->type & 3; sequence = scenery_large_get_sequence(tileElement); if (!map_large_scenery_get_origin(x, y, z, direction, sequence, &x0, &y0, &z0, NULL)) { return; } // Iterate through each tile of the large scenery element sequence = 0; for (tile = sceneryTiles; tile->x_offset != -1; tile++, sequence++) { sint16 offsetX = tile->x_offset; sint16 offsetY = tile->y_offset; rotate_map_coordinates(&offsetX, &offsetY, direction); x = x0 + offsetX; y = y0 + offsetY; z = (z0 + tile->z_offset) / 8; tileElement = map_get_large_scenery_segment(x, y, z, direction, sequence); if (tileElement != nullptr) { if (sequence == 0) { uint8 flags = tileElement->type & 3; uint8 primaryColour = scenery_large_get_primary_colour(tileElement); uint8 secondaryColour = scenery_large_get_secondary_colour(tileElement); track_design_save_push_tile_element_desc(entry, x, y, z, flags, primaryColour, secondaryColour); } track_design_save_push_tile_element(x, y, tileElement); } } }
static void track_design_save_add_large_scenery(sint32 x, sint32 y, rct_map_element *mapElement) { rct_large_scenery_tile *sceneryTiles, *tile; sint32 x0, y0, z0, z; sint32 direction, sequence; sint32 entryType = mapElement->properties.scenerymultiple.type & 0x3FF; rct_object_entry *entry = (rct_object_entry*)&object_entry_groups[OBJECT_TYPE_LARGE_SCENERY].entries[entryType]; sceneryTiles = get_large_scenery_entry(entryType)->large_scenery.tiles; z = mapElement->base_height; direction = mapElement->type & 3; sequence = mapElement->properties.scenerymultiple.type >> 10; if (!map_large_scenery_get_origin(x, y, z, direction, sequence, &x0, &y0, &z0, NULL)) { return; } // Iterate through each tile of the large scenery element sequence = 0; for (tile = sceneryTiles; tile->x_offset != -1; tile++, sequence++) { sint16 offsetX = tile->x_offset; sint16 offsetY = tile->y_offset; rotate_map_coordinates(&offsetX, &offsetY, direction); x = x0 + offsetX; y = y0 + offsetY; z = (z0 + tile->z_offset) / 8; mapElement = map_get_large_scenery_segment(x, y, z, direction, sequence); if (mapElement != NULL) { if (sequence == 0) { uint8 flags = mapElement->type & 3; uint8 primaryColour = mapElement->properties.scenerymultiple.colour[0] & 0x1F; uint8 secondaryColour = mapElement->properties.scenerymultiple.colour[1] & 0x1F; track_design_save_push_map_element_desc(entry, x, y, z, flags, primaryColour, secondaryColour); } track_design_save_push_map_element(x, y, mapElement); } } }
/** * * 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 ); } }
/** * * rct2: 0x006EDE88 */ sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interaction_info *info) { rct_tile_element *tileElement; rct_scenery_entry *sceneryEntry; rct_banner *banner; Ride *ride; sint32 i, stationIndex; // No click input for title screen or track manager if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_MANAGER)) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; // if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; LocationXY16 mapCoord = {}; get_map_coordinates_from_pos(x, y, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER), &mapCoord.x, &mapCoord.y, &info->type, &info->tileElement, nullptr); info->x = mapCoord.x; info->y = mapCoord.y; tileElement = info->tileElement; switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SPRITE: if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || tileElement->type != 0) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; tileElement += 6; ride = get_ride(tileElement->type); if (ride->status == RIDE_STATUS_CLOSED) { set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, ride->name); set_map_tooltip_format_arg(4, uint32, ride->name_arguments); } return info->type; case VIEWPORT_INTERACTION_ITEM_RIDE: if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; ride = get_ride(tile_element_get_ride_index(tileElement)); if (ride->status != RIDE_STATUS_CLOSED) return info->type; set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE) { rct_string_id stringId; if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) { if (ride->num_stations > 1) { stringId = STR_RIDE_STATION_X_ENTRANCE; } else { stringId = STR_RIDE_ENTRANCE; } } else { if (ride->num_stations > 1) { stringId = STR_RIDE_STATION_X_EXIT; } else { stringId = STR_RIDE_EXIT; } } set_map_tooltip_format_arg(2, rct_string_id, stringId); } else if (track_element_is_station(tileElement)) { rct_string_id stringId; if (ride->num_stations > 1) { stringId = STR_RIDE_STATION_X; } else { stringId = STR_RIDE_STATION; } set_map_tooltip_format_arg(2, rct_string_id, stringId); } else { if (!gCheatsSandboxMode && !map_is_location_owned(info->x, info->y, tileElement->base_height << 4)) { return info->type = VIEWPORT_INTERACTION_ITEM_NONE; } set_map_tooltip_format_arg(2, rct_string_id, ride->name); set_map_tooltip_format_arg(4, uint32, ride->name_arguments); return info->type; } set_map_tooltip_format_arg(4, rct_string_id, ride->name); set_map_tooltip_format_arg(6, uint32, ride->name_arguments); set_map_tooltip_format_arg(10, rct_string_id, RideComponentNames[RideNameConvention[ride->type].station].capitalised); stationIndex = tile_element_get_station(tileElement); for (i = stationIndex; i >= 0; i--) if (ride->station_starts[i].xy == RCT_XY8_UNDEFINED) stationIndex--; stationIndex++; set_map_tooltip_format_arg(12, uint16, stationIndex); return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = get_wall_entry(tileElement->properties.scenery.type); if (sceneryEntry->wall.scrolling_mode != 255) { set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } break; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(scenery_large_get_type(tileElement)); if (sceneryEntry->large_scenery.scrolling_mode != 255) { set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } break; case VIEWPORT_INTERACTION_ITEM_BANNER: banner = &gBanners[tileElement->properties.banner.index]; sceneryEntry = get_banner_entry(banner->type); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } if (!(input_test_flag(INPUT_FLAG_6)) || !(input_test_flag(INPUT_FLAG_TOOL_ACTIVE))) { if (window_find_by_class(WC_RIDE_CONSTRUCTION) == nullptr && window_find_by_class(WC_FOOTPATH) == nullptr) { return info->type = VIEWPORT_INTERACTION_ITEM_NONE; } } switch (info->type) { case VIEWPORT_INTERACTION_ITEM_SCENERY: sceneryEntry = get_small_scenery_entry(tileElement->properties.scenery.type); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; case VIEWPORT_INTERACTION_ITEM_FOOTPATH: set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, STR_FOOTPATH_MAP_TIP); if (footpath_element_is_queue(tileElement)) set_map_tooltip_format_arg(2, rct_string_id, STR_QUEUE_LINE_MAP_TIP); return info->type; case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM: sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) { set_map_tooltip_format_arg(2, rct_string_id, STR_BROKEN); set_map_tooltip_format_arg(4, rct_string_id, sceneryEntry->name); } else { set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); } return info->type; case VIEWPORT_INTERACTION_ITEM_PARK: if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) break; if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) break; set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, STR_OBJECT_SELECTION_PARK_ENTRANCE); return info->type; case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = get_wall_entry(tileElement->properties.scenery.type); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY: sceneryEntry = get_large_scenery_entry(tileElement->properties.scenery.type & 0x3FF); set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; } return info->type = VIEWPORT_INTERACTION_ITEM_NONE; }