diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 628d84d024..433a1dbbac 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -820,6 +820,7 @@ namespace OpenRCT2 _objectManager->LoadObjects(result.RequiredObjects, true); SetProgress(90, 100, STR_STRING_M_PERCENT); + MapAnimation::ClearAll(); // TODO: Have a separate GameState and exchange once loaded. auto& gameState = ::getGameState(); parkImporter->Import(gameState); diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 2bfa1122d5..d80e797ec0 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -2848,6 +2848,7 @@ bool NetworkBase::LoadMap(IStream* stream) auto loadResult = importer->LoadFromStream(stream, false); objManager.LoadObjects(loadResult.RequiredObjects); + MapAnimation::ClearAll(); // TODO: Have a separate GameState and exchange once loaded. auto& gameState = getGameState(); importer->Import(gameState); diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 16489a0740..5a89f49688 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -194,6 +194,7 @@ namespace OpenRCT2::RCT1 ImportRideMeasurements(); ImportEntities(); ImportTileElements(gameState); + ImportMapAnimations(); ImportPeepSpawns(gameState); ImportFinance(gameState); ImportResearch(gameState); @@ -1460,6 +1461,26 @@ namespace OpenRCT2::RCT1 dst->z = src->z; } + void ImportMapAnimations() + { + for (const auto& mapAnimation : std::span(_s4.MapAnimations, _s4.NumMapAnimations)) + { + switch (mapAnimation.Type) + { + case kRCT12MapAnimationTypeOnRidePhoto: + MapAnimation::CreateTemporary( + { mapAnimation.x, mapAnimation.y, (mapAnimation.BaseZ / 2) * kCoordsZStep }, + MapAnimation::TemporaryType::onRidePhoto); + break; + case kRCT12MapAnimationTypeLandEdgeDoor: + MapAnimation::CreateTemporary( + { mapAnimation.x, mapAnimation.y, (mapAnimation.BaseZ / 2) * kCoordsZStep }, + MapAnimation::TemporaryType::landEdgeDoor); + break; + } + } + } + void ImportPeepSpawns(GameState_t& gameState) { gameState.peepSpawns.clear(); diff --git a/src/openrct2/rct12/RCT12.h b/src/openrct2/rct12/RCT12.h index 4a431c637b..c5032d8e62 100644 --- a/src/openrct2/rct12/RCT12.h +++ b/src/openrct2/rct12/RCT12.h @@ -1165,6 +1165,9 @@ struct RCT12MapAnimation }; static_assert(sizeof(RCT12MapAnimation) == 6); +static constexpr uint8_t kRCT12MapAnimationTypeOnRidePhoto = 6; +static constexpr uint8_t kRCT12MapAnimationTypeLandEdgeDoor = 9; + struct RCT12ResearchItem { // Bit 16 (0: scenery entry, 1: ride entry) diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 0060afec6b..ac19bf9dd5 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -472,8 +472,6 @@ void MapAnimation::CreateTemporary(const CoordsXYZ& coords, const TemporaryType void MapAnimation::CreateAll() { - ClearAll(); - TileElementIterator it; TileElementIteratorBegin(&it); while (TileElementIteratorNext(&it)) diff --git a/test/tests/PlayTests.cpp b/test/tests/PlayTests.cpp index e8752f7841..84617109bf 100644 --- a/test/tests/PlayTests.cpp +++ b/test/tests/PlayTests.cpp @@ -51,6 +51,7 @@ static std::unique_ptr localStartGame(const std::string& parkPath) auto loadResult = importer->LoadSavedGame(parkPath.c_str(), false); context->GetObjectManager().LoadObjects(loadResult.RequiredObjects); + MapAnimation::ClearAll(); // TODO: Have a separate GameState and exchange once loaded. auto& gameState = getGameState(); importer->Import(gameState); diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index f8cb1808ca..b6a4702fc5 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -83,6 +83,7 @@ static bool ImportS6(MemoryStream& stream, std::unique_ptr& context, b auto loadResult = importer->LoadFromStream(&stream, false); objManager.LoadObjects(loadResult.RequiredObjects); + MapAnimation::ClearAll(); // TODO: Have a separate GameState and exchange once loaded. auto& gameState = getGameState(); importer->Import(gameState);