mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-20 22:33:02 +01:00
Add MusicUpdateFunction field to RTD
This commit is contained in:
@@ -104,7 +104,7 @@ static void ride_entrance_exit_connected(Ride* ride);
|
|||||||
static int32_t ride_get_new_breakdown_problem(Ride* ride);
|
static int32_t ride_get_new_breakdown_problem(Ride* ride);
|
||||||
static void ride_inspection_update(Ride* ride);
|
static void ride_inspection_update(Ride* ride);
|
||||||
static void ride_mechanic_status_update(Ride* ride, int32_t mechanicStatus);
|
static void ride_mechanic_status_update(Ride* ride, int32_t mechanicStatus);
|
||||||
static void ride_music_update(Ride* ride);
|
static void RideMusicUpdate(Ride* ride);
|
||||||
static void ride_shop_connected(Ride* ride);
|
static void ride_shop_connected(Ride* ride);
|
||||||
|
|
||||||
RideManager GetRideManager()
|
RideManager GetRideManager()
|
||||||
@@ -1020,7 +1020,7 @@ void Ride::Update()
|
|||||||
if (vehicle_change_timeout != 0)
|
if (vehicle_change_timeout != 0)
|
||||||
vehicle_change_timeout--;
|
vehicle_change_timeout--;
|
||||||
|
|
||||||
ride_music_update(this);
|
RideMusicUpdate(this);
|
||||||
|
|
||||||
// Update stations
|
// Update stations
|
||||||
if (type != RIDE_TYPE_MAZE)
|
if (type != RIDE_TYPE_MAZE)
|
||||||
@@ -1854,7 +1854,7 @@ static bool RideMusicBreakdownEffect(Ride* ride)
|
|||||||
*
|
*
|
||||||
* Circus music is a sound effect, rather than music. Needs separate processing.
|
* Circus music is a sound effect, rather than music. Needs separate processing.
|
||||||
*/
|
*/
|
||||||
static void CircusMusicUpdate(Ride* ride)
|
void CircusMusicUpdate(Ride* ride)
|
||||||
{
|
{
|
||||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
|
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
|
||||||
if (vehicle == nullptr || vehicle->status != Vehicle::Status::DoingCircusShow)
|
if (vehicle == nullptr || vehicle->status != Vehicle::Status::DoingCircusShow)
|
||||||
@@ -1880,20 +1880,8 @@ static void CircusMusicUpdate(Ride* ride)
|
|||||||
*
|
*
|
||||||
* rct2: 0x006ABE85
|
* rct2: 0x006ABE85
|
||||||
*/
|
*/
|
||||||
static void ride_music_update(Ride* ride)
|
void DefaultMusicUpdate(Ride* ride)
|
||||||
{
|
{
|
||||||
if (ride->type == RIDE_TYPE_CIRCUS)
|
|
||||||
{
|
|
||||||
CircusMusicUpdate(ride);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& rtd = ride->GetRideTypeDescriptor();
|
|
||||||
if (!rtd.HasFlag(RIDE_TYPE_FLAG_MUSIC_ON_DEFAULT) && !rtd.HasFlag(RIDE_TYPE_FLAG_ALLOW_MUSIC))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ride->status != RideStatus::Open || !(ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC))
|
if (ride->status != RideStatus::Open || !(ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC))
|
||||||
{
|
{
|
||||||
ride->music_tune_id = 255;
|
ride->music_tune_id = 255;
|
||||||
@@ -1926,6 +1914,15 @@ static void ride_music_update(Ride* ride)
|
|||||||
OpenRCT2::RideAudio::UpdateMusicInstance(*ride, rideCoords, sampleRate);
|
OpenRCT2::RideAudio::UpdateMusicInstance(*ride, rideCoords, sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void RideMusicUpdate(Ride* ride)
|
||||||
|
{
|
||||||
|
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||||
|
|
||||||
|
if (!rtd.HasFlag(RIDE_TYPE_FLAG_MUSIC_ON_DEFAULT) && !rtd.HasFlag(RIDE_TYPE_FLAG_ALLOW_MUSIC))
|
||||||
|
return;
|
||||||
|
rtd.MusicUpdateFunction(ride);
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#pragma region Measurement functions
|
#pragma region Measurement functions
|
||||||
|
|||||||
@@ -1086,3 +1086,5 @@ void ride_clear_leftover_entrances(Ride* ride);
|
|||||||
std::vector<RideId> GetTracklessRides();
|
std::vector<RideId> GetTracklessRides();
|
||||||
|
|
||||||
void ride_remove_vehicles(Ride* ride);
|
void ride_remove_vehicles(Ride* ride);
|
||||||
|
void CircusMusicUpdate(Ride* ride);
|
||||||
|
void DefaultMusicUpdate(Ride* ride);
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ struct UpkeepCostsDescriptor
|
|||||||
};
|
};
|
||||||
|
|
||||||
using RideTrackGroup = OpenRCT2::BitSet<TRACK_GROUP_COUNT>;
|
using RideTrackGroup = OpenRCT2::BitSet<TRACK_GROUP_COUNT>;
|
||||||
|
using RideMusicUpdateFunction = void (*)(Ride*);
|
||||||
struct RideTypeDescriptor
|
struct RideTypeDescriptor
|
||||||
{
|
{
|
||||||
uint8_t AlternateType;
|
uint8_t AlternateType;
|
||||||
@@ -189,6 +189,8 @@ struct RideTypeDescriptor
|
|||||||
track_colour_preset_list ColourPresets;
|
track_colour_preset_list ColourPresets;
|
||||||
RideColourPreview ColourPreview;
|
RideColourPreview ColourPreview;
|
||||||
RideColourKey ColourKey;
|
RideColourKey ColourKey;
|
||||||
|
|
||||||
|
RideMusicUpdateFunction MusicUpdateFunction = DefaultMusicUpdate;
|
||||||
RideClassification Classification = RideClassification::Ride;
|
RideClassification Classification = RideClassification::Ride;
|
||||||
|
|
||||||
bool HasFlag(uint64_t flag) const;
|
bool HasFlag(uint64_t flag) const;
|
||||||
|
|||||||
@@ -49,5 +49,6 @@ constexpr const RideTypeDescriptor CircusRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::Ride),
|
SET_FIELD(ColourKey, RideColourKey::Ride),
|
||||||
|
SET_FIELD(MusicUpdateFunction, CircusMusicUpdate),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ constexpr const RideTypeDescriptor CashMachineRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::CashMachine),
|
SET_FIELD(ColourKey, RideColourKey::CashMachine),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ constexpr const RideTypeDescriptor DrinkStallRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::Drink),
|
SET_FIELD(ColourKey, RideColourKey::Drink),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::ShopOrStall),
|
SET_FIELD(Classification, RideClassification::ShopOrStall),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ constexpr const RideTypeDescriptor FirstAidRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::FirstAid),
|
SET_FIELD(ColourKey, RideColourKey::FirstAid),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ constexpr const RideTypeDescriptor FoodStallRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::Food),
|
SET_FIELD(ColourKey, RideColourKey::Food),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::ShopOrStall),
|
SET_FIELD(Classification, RideClassification::ShopOrStall),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ constexpr const RideTypeDescriptor InformationKioskRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::InfoKiosk),
|
SET_FIELD(ColourKey, RideColourKey::InfoKiosk),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ constexpr const RideTypeDescriptor ShopRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_STALL_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::Shop),
|
SET_FIELD(ColourKey, RideColourKey::Shop),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::ShopOrStall),
|
SET_FIELD(Classification, RideClassification::ShopOrStall),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ constexpr const RideTypeDescriptor ToiletsRTD =
|
|||||||
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
SET_FIELD(ColourPresets, DEFAULT_FLAT_RIDE_COLOUR_PRESET),
|
||||||
SET_FIELD(ColourPreview, { 0, 0 }),
|
SET_FIELD(ColourPreview, { 0, 0 }),
|
||||||
SET_FIELD(ColourKey, RideColourKey::Toilets),
|
SET_FIELD(ColourKey, RideColourKey::Toilets),
|
||||||
|
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||||
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
SET_FIELD(Classification, RideClassification::KioskOrFacility),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
Reference in New Issue
Block a user