mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +01:00
Merge pull request #13614 from Gymnasiast/feature/rct1-surfaces
Feature/rct1 surfaces
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -65,7 +65,8 @@ 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<TerrainSurfaceObject*>(objManager.GetLoadedObject(ObjectType::TerrainSurface, i));
|
||||
if (surfaceObj != nullptr)
|
||||
// NumImagesLoaded can be 1 for RCT1 surfaces if the user does not have RCT1 linked.
|
||||
if (surfaceObj != nullptr && surfaceObj->NumImagesLoaded > 1)
|
||||
{
|
||||
gDropdownItemsFormat[itemIndex] = Dropdown::FormatLandPicker;
|
||||
gDropdownItemsArgs[itemIndex] = surfaceObj->IconImageId;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -122,6 +122,8 @@ void TerrainSurfaceObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
}
|
||||
|
||||
PopulateTablesFromJson(context, root);
|
||||
|
||||
NumImagesLoaded = GetImageTable().GetCount();
|
||||
}
|
||||
|
||||
uint32_t TerrainSurfaceObject::GetImageId(
|
||||
|
||||
@@ -54,6 +54,8 @@ public:
|
||||
money32 Price{};
|
||||
TERRAIN_SURFACE_FLAGS Flags{};
|
||||
|
||||
uint32_t NumImagesLoaded;
|
||||
|
||||
explicit TerrainSurfaceObject(const rct_object_entry& entry)
|
||||
: Object(entry)
|
||||
{
|
||||
|
||||
@@ -307,6 +307,15 @@ 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)
|
||||
{
|
||||
// Provide fallback for RCT1 surfaces if the user does have RCT1 linked.
|
||||
if (!is_csg_loaded() && index >= TERRAIN_RCT2_COUNT)
|
||||
{
|
||||
if (index == TERRAIN_ROOF_GREY)
|
||||
index = TERRAIN_ROCK;
|
||||
else
|
||||
index = TERRAIN_DIRT;
|
||||
}
|
||||
|
||||
auto image = static_cast<uint32_t>(SPR_NONE);
|
||||
auto obj = get_surface_object(index);
|
||||
if (obj != nullptr)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -79,8 +79,7 @@ uint8_t RCT12SurfaceElement::GetSlope() const
|
||||
uint32_t RCT12SurfaceElement::GetSurfaceStyle() const
|
||||
{
|
||||
uint32_t retVal = (terrain >> 5) & 7;
|
||||
if (type & 1)
|
||||
retVal |= (1 << 3);
|
||||
retVal |= (type & RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK) << 3;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -557,11 +556,9 @@ void RCT12LargeSceneryElement::SetBannerIndex(uint8_t newIndex)
|
||||
|
||||
void RCT12SurfaceElement::SetSurfaceStyle(uint32_t newStyle)
|
||||
{
|
||||
// Bit 3 for terrain is stored in element.type bit 0
|
||||
if (newStyle & 8)
|
||||
type |= 1;
|
||||
else
|
||||
type &= ~1;
|
||||
// Bits 3, 4 for terrain are stored in element.type bit 0, 1
|
||||
type &= ~RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK;
|
||||
type |= (newStyle >> 3) & RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK;
|
||||
|
||||
// Bits 0, 1, 2 for terrain are stored in element.terrain bit 5, 6, 7
|
||||
terrain &= ~0xE0;
|
||||
|
||||
@@ -89,6 +89,12 @@ enum class RCT12TrackDesignVersion : uint8_t
|
||||
unknown
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RCT12_SURFACE_ELEMENT_TYPE_SURFACE_MASK = 0b00000011,
|
||||
RCT12_SURFACE_ELEMENT_TYPE_EDGE_MASK = 0b01000000,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
RCT12_TILE_ELEMENT_FLAG_GHOST = (1 << 4),
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user