diff --git a/CMakeLists.txt b/CMakeLists.txt index eba549e5f0..57f4b6112a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,9 +64,17 @@ set(TITLE_SEQUENCE_VERSION "0.4.0") set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v${TITLE_SEQUENCE_VERSION}/title-sequences.zip") set(TITLE_SEQUENCE_SHA1 "4ab0065e5a4d9f9c77d94718bbdfcfcd5a389da0") -set(OBJECTS_VERSION "1.3.5") +set(OBJECTS_VERSION "1.3.6") set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip") -set(OBJECTS_SHA1 "58bddc5f845d8c7eb5d9fd25e52ab1fed24c85db") +set(OBJECTS_SHA1 "20e0eb1389918ea1a90ec891f46ef03100b3e935") + +set(OPENSFX_VERSION "1.0.1") +set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip") +set(OPENSFX_SHA1 "8f04aea33f8034131c3069f6accacce0d94f80c1") + +set(OPENMSX_VERSION "1.0.1") +set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip") +set(OPENMSX_SHA1 "8ff94490180e2fbfdd13a4130eb300da726ca406") set(REPLAYS_VERSION "0.0.70") set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip") @@ -436,6 +444,26 @@ if (NOT MACOS_BUNDLE OR (MACOS_BUNDLE AND WITH_TESTS)) SHA1 ${OBJECTS_SHA1} )") endif () + if (DOWNLOAD_OPENSFX) + install(CODE " + include(${ROOT_DIR}/cmake/download.cmake) + download_openrct2_zip( + ZIP_VERSION ${OPENSFX_VERSION} + DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/ + ZIP_URL ${OPENSFX_URL} + SHA1 ${OPENSFX_SHA1} + )") + endif () + if (DOWNLOAD_OPENMSX) + install(CODE " + include(${ROOT_DIR}/cmake/download.cmake) + download_openrct2_zip( + ZIP_VERSION ${OPENMSX_VERSION} + DOWNLOAD_DIR \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/ + ZIP_URL ${OPENMSX_URL} + SHA1 ${OPENMSX_SHA1} + )") + endif () if (DOWNLOAD_REPLAYS) # Checks if this version of the replays are already installed, updates if necessary install(CODE " diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 28cf7a7fae..7e5098898b 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,9 @@ 0.4.3 (in development) ------------------------------------------------------------------------ - Feature: [#17782] The Flying Coaster now has access to boosters and can draw outside loops. +- Feature: [#18312, objects#220, OpenSFX#13] New sound effects for the Hybrid and Single Rail roller coasters. +- Feature: [objects#221] Add two extra jungle walls. +- Feature: [OpenMusic#14, OpenMusic#15, OpenMusic#18] Added Galaxy, Acid and Dodgems ride music styles. - Improved: [#18192] Tycoon Park has been added Extras tab. - Improved: [#18214] Competition scenarios have received their own section. - Improved: [#18250] Added modern style file and folder pickers on Windows. @@ -13,6 +16,7 @@ - Change: [#17998] Show cursor when using inverted mouse dragging. - Change: [#18230] Make the large flat to steep pieces available on the corkscrew roller coaster without cheats. - Change: [#18381] Convert custom invisible paths to the built-in ones. +- Change: [OpenSFX#11, OpenMusic#19] First implementation of official replacement asset packs for sound effects & music. - Fix: [#1519] “See-through rides” doesn't affect all rides (original bug). - Fix: [#11679] Facilities clipping issues. - Fix: [#14312] Research ride type message incorrect. diff --git a/openrct2.proj b/openrct2.proj index 43ae29076a..7d5f6588ea 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -45,8 +45,12 @@ f3a03c2e7b610fefa28d6962da10144f6324078d https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.0/title-sequences.zip 4ab0065e5a4d9f9c77d94718bbdfcfcd5a389da0 - https://github.com/OpenRCT2/objects/releases/download/v1.3.5/objects.zip - 58bddc5f845d8c7eb5d9fd25e52ab1fed24c85db + https://github.com/OpenRCT2/objects/releases/download/v1.3.6/objects.zip + 20e0eb1389918ea1a90ec891f46ef03100b3e935 + https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.1/opensound.zip + 8f04aea33f8034131c3069f6accacce0d94f80c1 + https://github.com/OpenRCT2/OpenMusic/releases/download/v1.0.1/openmusic.zip + 8ff94490180e2fbfdd13a4130eb300da726ca406 https://github.com/OpenRCT2/replays/releases/download/v0.0.70/replays.zip 09B339E86AAE81580C5AC3E23AC4BC9E030DA076 @@ -128,6 +132,24 @@ OutputDirectory="$(TargetDir)data\object" /> + + + + + + + + + + GetPlatformEnvironment(); - auto assetPackDirectory = fs::u8path(env->GetDirectoryPath(DIRBASE::USER, DIRID::ASSET_PACK)); - Platform::EnsureDirectoryExists(assetPackDirectory.u8string()); + auto openrct2Dir = fs::u8path(env->GetDirectoryPath(DIRBASE::OPENRCT2, DIRID::ASSET_PACK)); + Scan(openrct2Dir); + + auto userDirectory = fs::u8path(env->GetDirectoryPath(DIRBASE::USER, DIRID::ASSET_PACK)); + Platform::EnsureDirectoryExists(userDirectory.u8string()); + Scan(userDirectory); +} + +void AssetPackManager::Scan(const fs::path& directory) +{ // Recursively scan for .parkap files std::error_code ec; - for (const fs::directory_entry& entry : fs::recursive_directory_iterator(assetPackDirectory, ec)) + for (const fs::directory_entry& entry : fs::recursive_directory_iterator(directory, ec)) { if (!entry.is_directory()) { diff --git a/src/openrct2/AssetPackManager.h b/src/openrct2/AssetPackManager.h index f345cf68b5..c33344025d 100644 --- a/src/openrct2/AssetPackManager.h +++ b/src/openrct2/AssetPackManager.h @@ -36,6 +36,7 @@ namespace OpenRCT2 size_t GetAssetPackIndex(std::string_view id); void Scan(); + void Scan(const fs::path& directory); void Reload(); void Swap(size_t index, size_t otherIndex); diff --git a/src/openrct2/audio/Audio.cpp b/src/openrct2/audio/Audio.cpp index 446c9cc253..63430a8305 100644 --- a/src/openrct2/audio/Audio.cpp +++ b/src/openrct2/audio/Audio.cpp @@ -50,6 +50,7 @@ namespace OpenRCT2::Audio static std::vector _audioDevices; static int32_t _currentAudioDevice = -1; static ObjectEntryIndex _soundsAudioObjectEntryIndex = OBJECT_ENTRY_INDEX_NULL; + static ObjectEntryIndex _soundsAdditionalAudioObjectEntryIndex = OBJECT_ENTRY_INDEX_NULL; static ObjectEntryIndex _titleAudioObjectEntryIndex = OBJECT_ENTRY_INDEX_NULL; bool gGameSoundsOff = false; @@ -123,6 +124,9 @@ namespace OpenRCT2::Audio } } + objManager.LoadObject(AudioObjectIdentifiers::OpenRCT2Additional); + _soundsAdditionalAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex( + AudioObjectIdentifiers::OpenRCT2Additional); objManager.LoadObject(AudioObjectIdentifiers::Rct2Circus); } @@ -195,12 +199,23 @@ namespace OpenRCT2::Audio return params; } - AudioObject* GetBaseAudioObject() + static std::tuple GetAudioObjectAndSampleIndex(SoundId id) { auto& objManager = GetContext()->GetObjectManager(); - auto* baseAudioObject = static_cast( - objManager.GetLoadedObject(ObjectType::Audio, _soundsAudioObjectEntryIndex)); - return baseAudioObject; + AudioObject* audioObject{}; + uint32_t sampleIndex = EnumValue(id); + if (id >= SoundId::LiftRMC) + { + audioObject = static_cast( + objManager.GetLoadedObject(ObjectType::Audio, _soundsAdditionalAudioObjectEntryIndex)); + sampleIndex -= EnumValue(SoundId::LiftRMC); + } + else + { + audioObject = static_cast( + objManager.GetLoadedObject(ObjectType::Audio, _soundsAudioObjectEntryIndex)); + } + return std::make_tuple(audioObject, sampleIndex); } static void Play(IAudioSource* audioSource, int32_t volume, int32_t pan) @@ -222,13 +237,13 @@ namespace OpenRCT2::Audio return; // Get sound from base object - auto* baseAudioObject = GetBaseAudioObject(); + auto [baseAudioObject, sampleIndex] = GetAudioObjectAndSampleIndex(soundId); if (baseAudioObject != nullptr) { - auto params = GetParametersFromLocation(baseAudioObject, EnumValue(soundId), loc); + auto params = GetParametersFromLocation(baseAudioObject, sampleIndex, loc); if (params.in_range) { - auto source = baseAudioObject->GetSample(EnumValue(soundId)); + auto source = baseAudioObject->GetSample(sampleIndex); if (source != nullptr) { Play(source, params.volume, params.pan); @@ -243,10 +258,10 @@ namespace OpenRCT2::Audio return; // Get sound from base object - auto* baseAudioObject = GetBaseAudioObject(); + auto [baseAudioObject, sampleIndex] = GetAudioObjectAndSampleIndex(soundId); if (baseAudioObject != nullptr) { - auto source = baseAudioObject->GetSample(EnumValue(soundId)); + auto source = baseAudioObject->GetSample(sampleIndex); if (source != nullptr) { Play(source, volume, pan); @@ -440,10 +455,10 @@ namespace OpenRCT2::Audio SoundId id, bool loop, int32_t volume, float pan, double rate, bool forget) { // Get sound from base object - auto baseAudioObject = GetBaseAudioObject(); + auto [baseAudioObject, sampleIndex] = GetAudioObjectAndSampleIndex(id); if (baseAudioObject != nullptr) { - auto source = baseAudioObject->GetSample(EnumValue(id)); + auto source = baseAudioObject->GetSample(sampleIndex); if (source != nullptr) { return CreateAudioChannel(source, MixerGroup::Sound, loop, volume, pan, rate, forget); diff --git a/src/openrct2/audio/audio.h b/src/openrct2/audio/audio.h index 560bfeefc8..fa3e8c527f 100644 --- a/src/openrct2/audio/audio.h +++ b/src/openrct2/audio/audio.h @@ -127,6 +127,8 @@ namespace OpenRCT2::Audio DoorClose, Portcullis, CrowdAmbience, + LiftRMC, + TrackFrictionRMC, NoScream = 254, Null = 255 }; @@ -140,6 +142,7 @@ namespace OpenRCT2::Audio constexpr std::string_view Rct2cBase = "rct2.audio.base.rctc"; constexpr std::string_view Rct2Title = "rct2.audio.title"; constexpr std::string_view Rct2Circus = "rct2.audio.circus"; + constexpr std::string_view OpenRCT2Additional = "openrct2.audio.additional"; } // namespace AudioObjectIdentifiers extern bool gGameSoundsOff; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index f86b989254..568181b484 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -91,72 +91,6 @@ static constexpr const OpenRCT2::Audio::SoundId _screamSet2[] = { OpenRCT2::Audio::SoundId::Scream6, }; -static constexpr const uint8_t _soundParams[OpenRCT2::Audio::RCT2SoundCount][2] = { - { 1, 0 }, // LiftClassic - { 1, 0 }, // TrackFrictionClassicWood - { 1, 0 }, // FrictionClassic - { 0, 1 }, // Scream1 - { 0, 0 }, // Click1 - { 0, 0 }, // Click2 - { 0, 0 }, // PlaceItem - { 0, 1 }, // Scream2 - { 0, 1 }, // Scream3 - { 0, 1 }, // Scream4 - { 0, 1 }, // Scream5 - { 0, 1 }, // Scream6 - { 1, 0 }, // LiftFrictionWheels - { 0, 0 }, // Purchase - { 0, 0 }, // Crash - { 0, 0 }, // LayingOutWater - { 0, 0 }, // Water1 - { 0, 0 }, // Water2 - { 0, 1 }, // TrainWhistle - { 0, 1 }, // TrainDeparting - { 0, 0 }, // WaterSplash - { 1, 0 }, // GoKartEngine - { 0, 0 }, // RideLaunch1 - { 0, 0 }, // RideLaunch2 - { 0, 0 }, // Cough1 - { 0, 0 }, // Cough2 - { 0, 0 }, // Cough3 - { 0, 0 }, // Cough4 - { 1, 0 }, // Rain - { 0, 0 }, // Thunder1 - { 0, 0 }, // Thunder2 - { 1, 0 }, // TrackFrictionTrain - { 1, 0 }, // TrackFrictionWater - { 0, 0 }, // BalloonPop - { 0, 0 }, // MechanicFix - { 0, 1 }, // Scream7 - { 0, 0 }, // ToiletFlush - { 0, 0 }, // Click3 - { 0, 0 }, // Quack - { 0, 0 }, // NewsItem - { 0, 0 }, // WindowOpen - { 0, 0 }, // Laugh1 - { 0, 0 }, // Laugh2 - { 0, 0 }, // Laugh3 - { 0, 0 }, // Applause - { 0, 0 }, // HauntedHouseScare - { 0, 0 }, // HauntedHouseScream1 - { 0, 0 }, // HauntedHouseScream2 - { 0, 0 }, // BlockBrakeClose - { 0, 0 }, // BlockBrakeRelease - { 0, 0 }, // Error - { 0, 0 }, // BrakeRelease - { 1, 0 }, // LiftArrow - { 1, 0 }, // LiftWood - { 1, 0 }, // TrackFrictionWood - { 1, 0 }, // LiftWildMouse - { 1, 0 }, // LiftBM - { 1, 2 }, // TrackFrictionBM - { 0, 1 }, // Scream8 - { 0, 1 }, // Tram - { 0, 0 }, // DoorOpen - { 0, 0 }, // DoorClose - { 0, 0 }, // Portcullis -}; - // clang-format off static constexpr const uint8_t SpaceRingsTimeToSpriteMap[] = { @@ -1047,6 +981,64 @@ static OpenRCT2::Audio::VehicleSound* vehicle_sounds_update_get_vehicle_sound(Op return nullptr; } +static bool IsLoopingSound(SoundId id) +{ + switch (id) + { + case SoundId::LiftClassic: + case SoundId::TrackFrictionClassicWood: + case SoundId::FrictionClassic: + case SoundId::LiftFrictionWheels: + case SoundId::GoKartEngine: + case SoundId::TrackFrictionTrain: + case SoundId::TrackFrictionWater: + case SoundId::LiftArrow: + case SoundId::LiftWood: + case SoundId::TrackFrictionWood: + case SoundId::LiftWildMouse: + case SoundId::LiftBM: + case SoundId::TrackFrictionBM: + case SoundId::LiftRMC: + case SoundId::TrackFrictionRMC: + return true; + default: + return false; + } +} + +static bool IsFixedFrequencySound(SoundId id) +{ + switch (id) + { + case SoundId::Scream1: + case SoundId::Scream2: + case SoundId::Scream3: + case SoundId::Scream4: + case SoundId::Scream5: + case SoundId::Scream6: + case SoundId::Scream7: + case SoundId::Scream8: + case SoundId::TrainWhistle: + case SoundId::TrainDeparting: + case SoundId::Tram: + return true; + default: + return false; + } +} + +static bool IsSpecialFrequencySound(SoundId id) +{ + switch (id) + { + case SoundId::TrackFrictionBM: + case SoundId::TrackFrictionRMC: + return true; + default: + return false; + } +} + enum class SoundType { TrackNoises, @@ -1057,7 +1049,7 @@ template static uint16_t SoundFrequency(const OpenRCT2::Audio::S { if constexpr (type == SoundType::TrackNoises) { - if (_soundParams[static_cast(id)][1] & 2) + if (IsSpecialFrequencySound(id)) { return (baseFrequency / 2) + 4000; } @@ -1065,7 +1057,7 @@ template static uint16_t SoundFrequency(const OpenRCT2::Audio::S } else { - if (_soundParams[static_cast(id)][1] & 1) + if (IsFixedFrequencySound(id)) { return 22050; } @@ -1075,7 +1067,7 @@ template static uint16_t SoundFrequency(const OpenRCT2::Audio::S template static bool ShouldUpdateChannelRate(const OpenRCT2::Audio::SoundId id) { - return type == SoundType::TrackNoises || !(_soundParams[static_cast(id)][1] & 1); + return type == SoundType::TrackNoises || !IsFixedFrequencySound(id); } template @@ -1105,7 +1097,7 @@ static void UpdateSound( if (sound.Id == OpenRCT2::Audio::SoundId::Null) { auto frequency = SoundFrequency(id, sound_params->frequency); - auto looping = _soundParams[static_cast(id)][0]; + auto looping = IsLoopingSound(id); auto pan = sound_params->pan_x; auto channel = CreateAudioChannel( id, looping, DStoMixerVolume(volume), DStoMixerPan(pan), DStoMixerRate(frequency), false); diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index 788b1cf25f..761cf057ac 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -507,6 +507,7 @@ enum FRICTION_SOUND_WATERSLIDE = 32, FRICTION_SOUND_WOOD_LARGE = 54, FRICTION_SOUND_STEEL_SMOOTH = 57, + FRICTION_SOUND_HYBRID = 65, FRICTION_SOUND_NONE = 255 }; diff --git a/src/openrct2/ride/coaster/meta/HybridCoaster.h b/src/openrct2/ride/coaster/meta/HybridCoaster.h index 8890d2cecc..122a2a4f32 100644 --- a/src/openrct2/ride/coaster/meta/HybridCoaster.h +++ b/src/openrct2/ride/coaster/meta/HybridCoaster.h @@ -34,7 +34,7 @@ constexpr const RideTypeDescriptor HybridCoasterRTD = SET_FIELD(AvailableBreakdowns, (1 << BREAKDOWN_SAFETY_CUT_OUT) | (1 << BREAKDOWN_RESTRAINTS_STUCK_CLOSED) | (1 << BREAKDOWN_RESTRAINTS_STUCK_OPEN) | (1 << BREAKDOWN_VEHICLE_MALFUNCTION) | (1 << BREAKDOWN_BRAKES_FAILURE)), SET_FIELD(Heights, { 43, 24, 13, 13}), SET_FIELD(MaxMass, 18), - SET_FIELD(LiftData, { OpenRCT2::Audio::SoundId::LiftClassic, 5, 8 }), + SET_FIELD(LiftData, { OpenRCT2::Audio::SoundId::LiftRMC, 5, 8 }), SET_FIELD(RatingsCalculationFunction, ride_ratings_calculate_hybrid_coaster), SET_FIELD(RatingsMultipliers, { 52, 36, 10 }), SET_FIELD(UpkeepCosts, { 40, 20, 80, 10, 3, 10 }), diff --git a/src/openrct2/ride/coaster/meta/SingleRailRollerCoaster.h b/src/openrct2/ride/coaster/meta/SingleRailRollerCoaster.h index a6c7a2f858..118647ab0f 100644 --- a/src/openrct2/ride/coaster/meta/SingleRailRollerCoaster.h +++ b/src/openrct2/ride/coaster/meta/SingleRailRollerCoaster.h @@ -34,7 +34,7 @@ constexpr const RideTypeDescriptor SingleRailRollerCoasterRTD = SET_FIELD(AvailableBreakdowns, (1 << BREAKDOWN_SAFETY_CUT_OUT) | (1 << BREAKDOWN_RESTRAINTS_STUCK_CLOSED) | (1 << BREAKDOWN_RESTRAINTS_STUCK_OPEN) | (1 << BREAKDOWN_VEHICLE_MALFUNCTION) | (1 << BREAKDOWN_BRAKES_FAILURE)), SET_FIELD(Heights, { 28, 24, 5, 7}), SET_FIELD(MaxMass, 18), - SET_FIELD(LiftData, { OpenRCT2::Audio::SoundId::LiftClassic, 5, 8 }), + SET_FIELD(LiftData, { OpenRCT2::Audio::SoundId::LiftRMC, 5, 8 }), SET_FIELD(RatingsCalculationFunction, ride_ratings_calculate_single_rail_roller_coaster), SET_FIELD(RatingsMultipliers, { 52, 36, 10 }), SET_FIELD(UpkeepCosts, { 40, 20, 80, 10, 3, 10 }),