diff --git a/distribution/changelog.txt b/distribution/changelog.txt index e1e37c456b..3600d26151 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -10,6 +10,7 @@ - Feature: [#13512] [Plugin] Add item separators to list view. - Feature: [#13583] Add allowed_hosts to plugin section of config. - Feature: [#13587] Enhanced track designer with ability to add/remove scenery and footpaths. +- Feature: [#13614] Add terrain surfaces from RollerCoaster Tycoon 1. - Change: [#13346] Change FootpathScenery to FootpathAddition in all occurrences. - Fix: [#12895] Mechanics are called to repair rides that have already been fixed. - Fix: [#13257] Rides that are exactly the minimum objective length are not counted. diff --git a/src/openrct2-ui/interface/LandTool.cpp b/src/openrct2-ui/interface/LandTool.cpp index 194fbcdf3a..62765f009d 100644 --- a/src/openrct2-ui/interface/LandTool.cpp +++ b/src/openrct2-ui/interface/LandTool.cpp @@ -65,7 +65,7 @@ void LandTool::ShowSurfaceStyleDropdown(rct_window* w, rct_widget* widget, uint8 for (size_t i = 0; i < MAX_TERRAIN_SURFACE_OBJECTS; i++) { const auto surfaceObj = static_cast(objManager.GetLoadedObject(ObjectType::TerrainSurface, i)); - if (surfaceObj != nullptr) + if (surfaceObj != nullptr && surfaceObj->NumImagesLoaded > 1) { gDropdownItemsFormat[itemIndex] = Dropdown::FormatLandPicker; gDropdownItemsArgs[itemIndex] = surfaceObj->IconImageId; diff --git a/src/openrct2/object/ObjectLimits.h b/src/openrct2/object/ObjectLimits.h index 790844d215..7c4c81c0b2 100644 --- a/src/openrct2/object/ObjectLimits.h +++ b/src/openrct2/object/ObjectLimits.h @@ -22,7 +22,7 @@ constexpr const uint16_t MAX_SCENERY_GROUP_OBJECTS = 19; constexpr const uint16_t MAX_PARK_ENTRANCE_OBJECTS = 1; constexpr const uint16_t MAX_WATER_OBJECTS = 1; constexpr const uint16_t MAX_SCENARIO_TEXT_OBJECTS = 1; -constexpr const uint16_t MAX_TERRAIN_SURFACE_OBJECTS = 14; +constexpr const uint16_t MAX_TERRAIN_SURFACE_OBJECTS = 18; constexpr const uint16_t MAX_TERRAIN_EDGE_OBJECTS = 255; constexpr const uint16_t MAX_STATION_OBJECTS = 255; constexpr const uint16_t MAX_MUSIC_OBJECTS = 0; diff --git a/src/openrct2/object/ObjectManager.cpp b/src/openrct2/object/ObjectManager.cpp index c93368e79c..fa10a29406 100644 --- a/src/openrct2/object/ObjectManager.cpp +++ b/src/openrct2/object/ObjectManager.cpp @@ -248,6 +248,10 @@ public: LoadObject("rct2.surface.gridgreen"); LoadObject("rct2.surface.sandred"); LoadObject("rct2.surface.sandbrown"); + LoadObject("rct1.aa.surface.roofred"); + LoadObject("rct1.ll.surface.roofgrey"); + LoadObject("rct1.ll.surface.rust"); + LoadObject("rct1.ll.surface.wood"); // Edges LoadObject("rct2.edge.rock"); diff --git a/src/openrct2/object/TerrainSurfaceObject.cpp b/src/openrct2/object/TerrainSurfaceObject.cpp index 2c67cf9963..26dda7ca95 100644 --- a/src/openrct2/object/TerrainSurfaceObject.cpp +++ b/src/openrct2/object/TerrainSurfaceObject.cpp @@ -122,6 +122,8 @@ void TerrainSurfaceObject::ReadJson(IReadObjectContext* context, json_t& root) } PopulateTablesFromJson(context, root); + + NumImagesLoaded = GetImageTable().GetCount(); } uint32_t TerrainSurfaceObject::GetImageId( diff --git a/src/openrct2/object/TerrainSurfaceObject.h b/src/openrct2/object/TerrainSurfaceObject.h index d9fc29aa93..0b93f34dad 100644 --- a/src/openrct2/object/TerrainSurfaceObject.h +++ b/src/openrct2/object/TerrainSurfaceObject.h @@ -54,6 +54,8 @@ public: money32 Price{}; TERRAIN_SURFACE_FLAGS Flags{}; + uint32_t NumImagesLoaded; + explicit TerrainSurfaceObject(const rct_object_entry& entry) : Object(entry) { diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index e3d24a3d44..c9631ceca1 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -307,6 +307,14 @@ static uint32_t get_surface_image( const paint_session* session, uint8_t index, int32_t offset, uint8_t rotation, int32_t grassLength, bool grid, bool underground) { + if (!is_csg_loaded() && index >= TERRAIN_RCT2_COUNT) + { + if (index == TERRAIN_ROOF_GREY) + index = TERRAIN_ROCK; + else + index = TERRAIN_DIRT; + } + auto image = static_cast(SPR_NONE); auto obj = get_surface_object(index); if (obj != nullptr) diff --git a/src/openrct2/rct1/Tables.cpp b/src/openrct2/rct1/Tables.cpp index 0982ebd626..3506e7d13f 100644 --- a/src/openrct2/rct1/Tables.cpp +++ b/src/openrct2/rct1/Tables.cpp @@ -125,11 +125,11 @@ namespace RCT1 TERRAIN_MARTIAN, TERRAIN_CHECKERBOARD, TERRAIN_GRASS_CLUMPS, - TERRAIN_DIRT, // Originally TERRAIN_ROOF_BROWN + TERRAIN_ROOF_BROWN, TERRAIN_ICE, - TERRAIN_DIRT, // Originally TERRAIN_ROOF_LOG - TERRAIN_DIRT, // Originally TERRAIN_ROOF_IRON - TERRAIN_ROCK, // Originally TERRAIN_ROOF_GREY + TERRAIN_ROOF_LOG, + TERRAIN_ROOF_IRON, + TERRAIN_ROOF_GREY, TERRAIN_GRID_RED, TERRAIN_GRID_YELLOW, TERRAIN_GRID_BLUE, diff --git a/src/openrct2/world/Surface.h b/src/openrct2/world/Surface.h index 177b7355eb..a63ee5e1c8 100644 --- a/src/openrct2/world/Surface.h +++ b/src/openrct2/world/Surface.h @@ -28,8 +28,15 @@ enum TERRAIN_GRID_GREEN, TERRAIN_SAND_DARK, TERRAIN_SAND_LIGHT, - TERRAIN_COUNT_REGULAR = 14, // The amount of surface types the user can actually select - what follows are technical types - TERRAIN_CHECKERBOARD_INVERTED = 14, + + TERRAIN_RCT2_COUNT, + + TERRAIN_ROOF_BROWN = TERRAIN_RCT2_COUNT, + TERRAIN_ROOF_GREY, + TERRAIN_ROOF_IRON, + TERRAIN_ROOF_LOG, + TERRAIN_COUNT_REGULAR, // The amount of surface types the user can actually select - what follows are technical types + TERRAIN_CHECKERBOARD_INVERTED = TERRAIN_COUNT_REGULAR, TERRAIN_UNDERGROUND_VIEW, };