mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 07:14:31 +01:00
Load temporary map animations from S4 files
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -472,8 +472,6 @@ void MapAnimation::CreateTemporary(const CoordsXYZ& coords, const TemporaryType
|
||||
|
||||
void MapAnimation::CreateAll()
|
||||
{
|
||||
ClearAll();
|
||||
|
||||
TileElementIterator it;
|
||||
TileElementIteratorBegin(&it);
|
||||
while (TileElementIteratorNext(&it))
|
||||
|
||||
@@ -51,6 +51,7 @@ static std::unique_ptr<IContext> 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);
|
||||
|
||||
@@ -83,6 +83,7 @@ static bool ImportS6(MemoryStream& stream, std::unique_ptr<IContext>& 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);
|
||||
|
||||
Reference in New Issue
Block a user