1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 18:25:16 +01:00

Implement S4 restricted scenery

This commit is contained in:
Ted John
2021-04-29 01:07:32 +01:00
parent 37725ae566
commit 5c8512f51c
7 changed files with 192 additions and 2 deletions

View File

@@ -84,6 +84,7 @@ namespace OpenRCT2
constexpr uint32_t BANNERS = 0x33;
// constexpr uint32_t STAFF = 0x35;
constexpr uint32_t CHEATS = 0x36;
constexpr uint32_t RESTRICTED_OBJECTS = 0x37;
constexpr uint32_t PACKED_OBJECTS = 0x80;
// clang-format on
}; // namespace ParkFileChunkType
@@ -128,6 +129,7 @@ namespace OpenRCT2
ReadWriteNotificationsChunk(os);
ReadWriteInterfaceChunk(os);
ReadWriteCheatsChunk(os);
ReadWriteRestrictedObjectsChunk(os);
// Initial cash will eventually be removed
gInitialCash = gCash;
@@ -156,6 +158,7 @@ namespace OpenRCT2
ReadWriteNotificationsChunk(os);
ReadWriteInterfaceChunk(os);
ReadWriteCheatsChunk(os);
ReadWriteRestrictedObjectsChunk(os);
ReadWritePackedObjectsChunk(os);
}
@@ -438,6 +441,28 @@ namespace OpenRCT2
});
}
void ReadWriteRestrictedObjectsChunk(OrcaStream& os)
{
os.ReadWriteChunk(ParkFileChunkType::RESTRICTED_OBJECTS, [](OrcaStream::ChunkStream& cs) {
auto& restrictedScenery = GetRestrictedScenery();
// We are want to support all object types in the future, so convert scenery type
// to object type when we write the list
cs.ReadWriteVector(restrictedScenery, [&cs](ScenerySelection& item) {
if (cs.GetMode() == OrcaStream::Mode::READING)
{
item.SceneryType = GetSceneryTypeFromObjectType(static_cast<ObjectType>(cs.Read<uint16_t>()));
item.EntryIndex = cs.Read<ObjectEntryIndex>();
}
else
{
cs.Write(static_cast<uint16_t>(GetObjectTypeFromSceneryType(item.SceneryType)));
cs.Write(item.EntryIndex);
}
});
});
}
void ReadWritePackedObjectsChunk(OrcaStream& os)
{
static constexpr uint8_t DESCRIPTOR_DAT = 0;