From aff920c8748e5d31a288f41db976fe8df76a76ce Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sat, 13 Jun 2020 20:10:43 +0200 Subject: [PATCH] Add support for importing RCT Modified ride entrances (#11938) --- src/openrct2/rct12/RCT12.h | 18 ++++++++++++++++++ src/openrct2/rct2/S6Importer.cpp | 16 +++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/openrct2/rct12/RCT12.h b/src/openrct2/rct12/RCT12.h index d04e3113d2..5a6c033b4a 100644 --- a/src/openrct2/rct12/RCT12.h +++ b/src/openrct2/rct12/RCT12.h @@ -133,6 +133,24 @@ enum RCT12_FOOTPATH_PROPERTIES_ADDITIONS_FLAG_GHOST = (1 << 7), }; +enum +{ + RCT12_STATION_STYLE_PLAIN, + RCT12_STATION_STYLE_WOODEN, + RCT12_STATION_STYLE_CANVAS_TENT, + RCT12_STATION_STYLE_CASTLE_GREY, + RCT12_STATION_STYLE_CASTLE_BROWN, + RCT12_STATION_STYLE_JUNGLE, + RCT12_STATION_STYLE_LOG_CABIN, + RCT12_STATION_STYLE_CLASSICAL, + RCT12_STATION_STYLE_ABSTRACT, + RCT12_STATION_STYLE_SNOW, + RCT12_STATION_STYLE_PAGODA, + RCT12_STATION_STYLE_SPACE, + + RCT12_STATION_STYLE_INVISIBLE, // Added by OpenRCT2 +}; + #pragma pack(push, 1) struct RCT12xy8 diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 0ab01c42de..aef0c4fe74 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -66,6 +66,7 @@ private: const utf8* _s6Path = nullptr; rct_s6_data _s6{}; uint8_t _gameVersion = 0; + bool _isSV7 = false; public: S6Importer(IObjectRepository& objectRepository) @@ -147,6 +148,12 @@ public: _objectRepository.ExportPackedObject(stream); } + if (path) + { + auto extension = path_get_extension(path); + _isSV7 = _stricmp(extension, ".sv7") == 0; + } + if (isScenario) { chunkReader.ReadChunk(&_s6.objects, sizeof(_s6.objects)); @@ -754,7 +761,14 @@ public: } dst->music = src->music; - dst->entrance_style = src->entrance_style; + + auto entranceStyle = src->entrance_style; + // In SV7, "plain" entrances are invisible. + if (_isSV7 && entranceStyle == RCT12_STATION_STYLE_PLAIN) + { + entranceStyle = RCT12_STATION_STYLE_INVISIBLE; + } + dst->entrance_style = entranceStyle; dst->vehicle_change_timeout = src->vehicle_change_timeout; dst->num_block_brakes = src->num_block_brakes; dst->lift_hill_speed = src->lift_hill_speed;