mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #7051 from IntelOrca/refactor/remaining-ride-to-cpp
Refactor remaining ride sources to C++
This commit is contained in:
commit
51df68a7d9
|
@ -43,7 +43,6 @@
|
|||
4C6A66B71FE278C900694CB6 /* PaintHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6A66B21FE278C900694CB6 /* PaintHelpers.cpp */; };
|
||||
4C6A66B81FE278C900694CB6 /* Supports.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6A66B31FE278C900694CB6 /* Supports.cpp */; };
|
||||
4C6A66BC1FED04EE00694CB6 /* SSE41Drawing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6A66BB1FED04EE00694CB6 /* SSE41Drawing.cpp */; settings = {COMPILER_FLAGS = "-msse4.1"; }; };
|
||||
4C6A66C11FF9322A00694CB6 /* music_list.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C6A66BD1FF9322A00694CB6 /* music_list.c */; };
|
||||
4C6A66C21FF9322A00694CB6 /* Ride.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6A66BF1FF9322A00694CB6 /* Ride.cpp */; };
|
||||
4C6AC20F1F9E1693004324AA /* Station.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6AC20D1F9E1693004324AA /* Station.cpp */; };
|
||||
4C6AC2121F9E1CB3004324AA /* CableLift.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6AC2101F9E1CB3004324AA /* CableLift.cpp */; };
|
||||
|
@ -350,6 +349,9 @@
|
|||
D4EC48E81C2637710024B507 /* title in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E51C2637710024B507 /* title */; };
|
||||
F70839921FFC0AFF002DCEFA /* Scenario.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F70839911FFC0AFF002DCEFA /* Scenario.cpp */; };
|
||||
F70839931FFC0B61002DCEFA /* Scenario.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F70839911FFC0AFF002DCEFA /* Scenario.cpp */; };
|
||||
F73E32102011589F00C4D975 /* RideRatings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73E320B2011589E00C4D975 /* RideRatings.cpp */; };
|
||||
F73E32112011589F00C4D975 /* TrackDesignSave.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73E320E2011589F00C4D975 /* TrackDesignSave.cpp */; };
|
||||
F73E32122011589F00C4D975 /* MusicList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73E320F2011589F00C4D975 /* MusicList.cpp */; };
|
||||
F76C85B01EC4E88300FA49E2 /* Audio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83571EC4E7CC00FA49E2 /* Audio.cpp */; };
|
||||
F76C85B41EC4E88300FA49E2 /* AudioMixer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C835B1EC4E7CC00FA49E2 /* AudioMixer.cpp */; };
|
||||
F76C85B71EC4E88300FA49E2 /* NullAudioSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C835E1EC4E7CC00FA49E2 /* NullAudioSource.cpp */; };
|
||||
|
@ -426,8 +428,6 @@
|
|||
F76C86BA1EC4E88400FA49E2 /* SawyerEncoding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84731EC4E7CC00FA49E2 /* SawyerEncoding.cpp */; };
|
||||
F76C86C31EC4E88400FA49E2 /* S6Exporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C847D1EC4E7CC00FA49E2 /* S6Exporter.cpp */; };
|
||||
F76C86C51EC4E88400FA49E2 /* S6Importer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C847F1EC4E7CC00FA49E2 /* S6Importer.cpp */; };
|
||||
F76C87001EC4E88400FA49E2 /* ride_ratings.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C84BE1EC4E7CC00FA49E2 /* ride_ratings.c */; };
|
||||
F76C87191EC4E88400FA49E2 /* track_design_save.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C84D91EC4E7CD00FA49E2 /* track_design_save.c */; };
|
||||
F76C871C1EC4E88400FA49E2 /* TrackDesignRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84DC1EC4E7CD00FA49E2 /* TrackDesignRepository.cpp */; };
|
||||
F76C87331EC4E88400FA49E2 /* ScenarioRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84F61EC4E7CD00FA49E2 /* ScenarioRepository.cpp */; };
|
||||
F76C87351EC4E88400FA49E2 /* ScenarioSources.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C84F81EC4E7CD00FA49E2 /* ScenarioSources.cpp */; };
|
||||
|
@ -640,8 +640,6 @@
|
|||
4C6A66B31FE278C900694CB6 /* Supports.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Supports.cpp; sourceTree = "<group>"; };
|
||||
4C6A66B41FE278C900694CB6 /* Supports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Supports.h; sourceTree = "<group>"; };
|
||||
4C6A66BB1FED04EE00694CB6 /* SSE41Drawing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SSE41Drawing.cpp; sourceTree = "<group>"; };
|
||||
4C6A66BD1FF9322A00694CB6 /* music_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_list.c; sourceTree = "<group>"; };
|
||||
4C6A66BE1FF9322A00694CB6 /* music_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_list.h; sourceTree = "<group>"; };
|
||||
4C6A66BF1FF9322A00694CB6 /* Ride.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Ride.cpp; sourceTree = "<group>"; };
|
||||
4C6A66C01FF9322A00694CB6 /* Ride.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ride.h; sourceTree = "<group>"; };
|
||||
4C6AC20D1F9E1693004324AA /* Station.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Station.cpp; sourceTree = "<group>"; };
|
||||
|
@ -1186,6 +1184,11 @@
|
|||
D4EC48E41C2637710024B507 /* language */ = {isa = PBXFileReference; lastKnownFileType = folder; name = language; path = data/language; sourceTree = SOURCE_ROOT; };
|
||||
D4EC48E51C2637710024B507 /* title */ = {isa = PBXFileReference; lastKnownFileType = folder; name = title; path = data/title; sourceTree = SOURCE_ROOT; };
|
||||
F70839911FFC0AFF002DCEFA /* Scenario.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scenario.cpp; sourceTree = "<group>"; };
|
||||
F73E320B2011589E00C4D975 /* RideRatings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RideRatings.cpp; sourceTree = "<group>"; };
|
||||
F73E320C2011589F00C4D975 /* RideRatings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RideRatings.h; sourceTree = "<group>"; };
|
||||
F73E320D2011589F00C4D975 /* MusicList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicList.h; sourceTree = "<group>"; };
|
||||
F73E320E2011589F00C4D975 /* TrackDesignSave.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackDesignSave.cpp; sourceTree = "<group>"; };
|
||||
F73E320F2011589F00C4D975 /* MusicList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicList.cpp; sourceTree = "<group>"; };
|
||||
F74789541EEDEA0D009E50E7 /* Input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Input.h; sourceTree = "<group>"; };
|
||||
F76C809A1EC4D9FA00FA49E2 /* libopenrct2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libopenrct2.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F76C83571EC4E7CC00FA49E2 /* Audio.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Audio.cpp; sourceTree = "<group>"; };
|
||||
|
@ -1350,9 +1353,6 @@
|
|||
F76C847D1EC4E7CC00FA49E2 /* S6Exporter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = S6Exporter.cpp; sourceTree = "<group>"; };
|
||||
F76C847E1EC4E7CC00FA49E2 /* S6Exporter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = S6Exporter.h; sourceTree = "<group>"; };
|
||||
F76C847F1EC4E7CC00FA49E2 /* S6Importer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = S6Importer.cpp; sourceTree = "<group>"; };
|
||||
F76C84BE1EC4E7CC00FA49E2 /* ride_ratings.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ride_ratings.c; sourceTree = "<group>"; };
|
||||
F76C84BF1EC4E7CC00FA49E2 /* ride_ratings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ride_ratings.h; sourceTree = "<group>"; };
|
||||
F76C84D91EC4E7CD00FA49E2 /* track_design_save.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = track_design_save.c; sourceTree = "<group>"; };
|
||||
F76C84DC1EC4E7CD00FA49E2 /* TrackDesignRepository.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TrackDesignRepository.cpp; sourceTree = "<group>"; };
|
||||
F76C84DD1EC4E7CD00FA49E2 /* TrackDesignRepository.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TrackDesignRepository.h; sourceTree = "<group>"; };
|
||||
F76C84F51EC4E7CD00FA49E2 /* scenario.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scenario.h; sourceTree = "<group>"; };
|
||||
|
@ -2308,16 +2308,17 @@
|
|||
F76C84EA1EC4E7CD00FA49E2 /* water */,
|
||||
4C6AC2101F9E1CB3004324AA /* CableLift.cpp */,
|
||||
4C6AC2111F9E1CB3004324AA /* CableLift.h */,
|
||||
4C6A66BD1FF9322A00694CB6 /* music_list.c */,
|
||||
4C6A66BE1FF9322A00694CB6 /* music_list.h */,
|
||||
4C6A66BF1FF9322A00694CB6 /* Ride.cpp */,
|
||||
4C6A66C01FF9322A00694CB6 /* Ride.h */,
|
||||
F73E320F2011589F00C4D975 /* MusicList.cpp */,
|
||||
F73E320D2011589F00C4D975 /* MusicList.h */,
|
||||
F73E320B2011589E00C4D975 /* RideRatings.cpp */,
|
||||
F73E320C2011589F00C4D975 /* RideRatings.h */,
|
||||
F73E320E2011589F00C4D975 /* TrackDesignSave.cpp */,
|
||||
4C7B541420060D8E00A52E21 /* RideData.cpp */,
|
||||
4C7B541520060D8E00A52E21 /* RideData.h */,
|
||||
4C8667801EEFDCDF0024AAB8 /* RideGroupManager.cpp */,
|
||||
4C8667811EEFDCDF0024AAB8 /* RideGroupManager.h */,
|
||||
F76C84BE1EC4E7CC00FA49E2 /* ride_ratings.c */,
|
||||
F76C84BF1EC4E7CC00FA49E2 /* ride_ratings.h */,
|
||||
4C6AC20D1F9E1693004324AA /* Station.cpp */,
|
||||
4C6AC20E1F9E1693004324AA /* Station.h */,
|
||||
4CFE4E8E1F9625B0005243C2 /* Track.cpp */,
|
||||
|
@ -2325,7 +2326,6 @@
|
|||
4CFE4E861F950164005243C2 /* TrackData.cpp */,
|
||||
4CFE4E871F950164005243C2 /* TrackData.h */,
|
||||
4CFE4E881F950164005243C2 /* TrackDataOld.cpp */,
|
||||
F76C84D91EC4E7CD00FA49E2 /* track_design_save.c */,
|
||||
4C4C1E971F58226500560300 /* TrackDesign.cpp */,
|
||||
4C4C1E991F5832AA00560300 /* TrackDesign.h */,
|
||||
F76C84DC1EC4E7CD00FA49E2 /* TrackDesignRepository.cpp */,
|
||||
|
@ -3218,6 +3218,7 @@
|
|||
C64644F91F3FA4120026AC2D /* EditorInventionsList.cpp in Sources */,
|
||||
4C7B54062005735F00A52E21 /* VehicleData.cpp in Sources */,
|
||||
4C7B53FC200143C200A52E21 /* Widget.cpp in Sources */,
|
||||
F73E32112011589F00C4D975 /* TrackDesignSave.cpp in Sources */,
|
||||
4C7B54512007646A00A52E21 /* Particle.cpp in Sources */,
|
||||
4C7B546120079C4900A52E21 /* Hook.cpp in Sources */,
|
||||
4C6A66AD1FE2787700694CB6 /* TileElement.cpp in Sources */,
|
||||
|
@ -3294,6 +3295,7 @@
|
|||
4C93F18A1F8B747A00A9330D /* Enterprise.cpp in Sources */,
|
||||
4CE4624A1FD1613D0001CD98 /* Platform.Linux.cpp in Sources */,
|
||||
C654DF391F69C0430040F43D /* TitleCommandEditor.cpp in Sources */,
|
||||
F73E32102011589F00C4D975 /* RideRatings.cpp in Sources */,
|
||||
4C7B54452007646A00A52E21 /* Climate.cpp in Sources */,
|
||||
4C93F13B1F8B744400A9330D /* BobsleighCoaster.cpp in Sources */,
|
||||
4C7B54472007646A00A52E21 /* Entrance.cpp in Sources */,
|
||||
|
@ -3338,7 +3340,6 @@
|
|||
4C7B54492007646A00A52E21 /* Fountain.cpp in Sources */,
|
||||
4C6A668E1FE14C3A00694CB6 /* SawyerCoding.cpp in Sources */,
|
||||
4C6AC2121F9E1CB3004324AA /* CableLift.cpp in Sources */,
|
||||
4C6A66C11FF9322A00694CB6 /* music_list.c in Sources */,
|
||||
4C93F19D1F8B748200A9330D /* SuspendedMonorail.cpp in Sources */,
|
||||
C666EE751F37ACB10061AA04 /* NewsOptions.cpp in Sources */,
|
||||
C654DF311F69C0430040F43D /* GuestList.cpp in Sources */,
|
||||
|
@ -3402,6 +3403,7 @@
|
|||
F76C888B1EC5324E00FA49E2 /* Ui.cpp in Sources */,
|
||||
4C7B54552007646A00A52E21 /* TileInspector.cpp in Sources */,
|
||||
C685E51A1F8907850090598F /* Staff.cpp in Sources */,
|
||||
F73E32122011589F00C4D975 /* MusicList.cpp in Sources */,
|
||||
F76C888C1EC5324E00FA49E2 /* UiContext.cpp in Sources */,
|
||||
4C7B54482007646A00A52E21 /* Footpath.cpp in Sources */,
|
||||
4C7B54532007646A00A52E21 /* SmallScenery.cpp in Sources */,
|
||||
|
@ -3506,8 +3508,6 @@
|
|||
F76C86C31EC4E88400FA49E2 /* S6Exporter.cpp in Sources */,
|
||||
F76C86C51EC4E88400FA49E2 /* S6Importer.cpp in Sources */,
|
||||
C6352B921F477032006CCEE3 /* GameActionCompat.cpp in Sources */,
|
||||
F76C87001EC4E88400FA49E2 /* ride_ratings.c in Sources */,
|
||||
F76C87191EC4E88400FA49E2 /* track_design_save.c in Sources */,
|
||||
F76C871C1EC4E88400FA49E2 /* TrackDesignRepository.cpp in Sources */,
|
||||
F76C87331EC4E88400FA49E2 /* ScenarioRepository.cpp in Sources */,
|
||||
F76C87351EC4E88400FA49E2 /* ScenarioSources.cpp in Sources */,
|
||||
|
|
|
@ -4813,9 +4813,9 @@ static void window_ride_music_mousedown(rct_window *w, rct_widgetindex widgetInd
|
|||
for (size_t n = 0; n < Util::CountOf(MusicStyleOrder); n++)
|
||||
window_ride_current_music_style_order[numItems++] = MusicStyleOrder[n];
|
||||
|
||||
if (gRideMusicInfoList[36]->length != 0)
|
||||
if (gRideMusicInfoList[36].length != 0)
|
||||
window_ride_current_music_style_order[numItems++] = MUSIC_STYLE_CUSTOM_MUSIC_1;
|
||||
if (gRideMusicInfoList[37]->length != 0)
|
||||
if (gRideMusicInfoList[37].length != 0)
|
||||
window_ride_current_music_style_order[numItems++] = MUSIC_STYLE_CUSTOM_MUSIC_2;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "platform/platform.h"
|
||||
#include "rct1/RCT1.h"
|
||||
#include "ride/Ride.h"
|
||||
#include "ride/ride_ratings.h"
|
||||
#include "ride/RideRatings.h"
|
||||
#include "ride/Track.h"
|
||||
#include "ride/TrackDesign.h"
|
||||
#include "ride/Vehicle.h"
|
||||
|
|
|
@ -347,9 +347,9 @@ void audio_init_ride_sounds_and_info()
|
|||
sint32 deviceNum = 0;
|
||||
audio_init_ride_sounds(deviceNum);
|
||||
|
||||
for (auto * rideMusicInfo : gRideMusicInfoList)
|
||||
for (auto &rideMusicInfo : gRideMusicInfoList)
|
||||
{
|
||||
const utf8 * path = context_get_path_legacy(rideMusicInfo->path_id);
|
||||
const utf8 * path = context_get_path_legacy(rideMusicInfo.path_id);
|
||||
if (File::Exists(path))
|
||||
{
|
||||
try
|
||||
|
@ -358,12 +358,12 @@ void audio_init_ride_sounds_and_info()
|
|||
uint32 head = fs.ReadValue<uint32>();
|
||||
if (head == 0x78787878)
|
||||
{
|
||||
rideMusicInfo->length = 0;
|
||||
rideMusicInfo.length = 0;
|
||||
}
|
||||
// The length used to be hardcoded, but we stopped doing that to allow replacement.
|
||||
if (rideMusicInfo->length == 0)
|
||||
if (rideMusicInfo.length == 0)
|
||||
{
|
||||
rideMusicInfo->length = fs.GetLength();
|
||||
rideMusicInfo.length = fs.GetLength();
|
||||
}
|
||||
}
|
||||
catch (const std::exception &)
|
||||
|
|
|
@ -168,7 +168,7 @@ extern void * gTitleMusicChannel;
|
|||
extern void * gRainSoundChannel;
|
||||
|
||||
extern rct_ride_music gRideMusicList[AUDIO_MAX_RIDE_MUSIC];
|
||||
extern rct_ride_music_info * gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS];
|
||||
extern rct_ride_music_info gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS];
|
||||
extern rct_ride_music_params gRideMusicParamsList[6];
|
||||
extern rct_ride_music_params * gRideMusicParamsListEnd;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef _RCT2_H_
|
||||
#define _RCT2_H_
|
||||
|
||||
#include "../ride/ride_ratings.h"
|
||||
#include "../ride/RideRatings.h"
|
||||
#include "../ride/Vehicle.h"
|
||||
#include "../common.h"
|
||||
#include "../rct12/RCT12.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "../OpenRCT2.h"
|
||||
#include "../peep/Staff.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/ride_ratings.h"
|
||||
#include "../ride/RideRatings.h"
|
||||
#include "../ride/TrackData.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "../util/SawyerCoding.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "../OpenRCT2.h"
|
||||
#include "../peep/Staff.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/ride_ratings.h"
|
||||
#include "../ride/RideRatings.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "../util/SawyerCoding.h"
|
||||
#include "../world/Climate.h"
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
#include "../audio/audio.h"
|
||||
#include "../common.h"
|
||||
#include "../Context.h"
|
||||
#include "music_list.h"
|
||||
#include "../core/Util.hpp"
|
||||
#include "MusicList.h"
|
||||
|
||||
|
||||
#define MAKE_TUNEID_LIST(...) (uint8[]){(countof(((uint8[]){__VA_ARGS__}))), __VA_ARGS__}
|
||||
#define MAKE_TUNEID_LIST(...) std::vector<uint8>({__VA_ARGS__})
|
||||
|
||||
// 0x009AEF28
|
||||
uint8 * gRideMusicStyleTuneIds[] =
|
||||
std::vector<uint8> gRideMusicStyleTuneIds[] =
|
||||
{
|
||||
MAKE_TUNEID_LIST(TUNE_DODGEMS_BEAT), // MUSIC_STYLE_DODGEMS_BEAT
|
||||
MAKE_TUNEID_LIST( // MUSIC_STYLE_FAIRGROUND_ORGAN
|
||||
|
@ -73,10 +74,10 @@ uint8 * gRideMusicStyleTuneIds[] =
|
|||
MAKE_TUNEID_LIST(TUNE_SWEAT_DREAMS), // MUSIC_STYLE_CANDY_STYLE
|
||||
};
|
||||
|
||||
#define INIT_MUSIC_INFO(path_id, offset) (rct_ride_music_info[]){path_id, offset, 0}
|
||||
#define INIT_MUSIC_INFO(path_id, offset) { path_id, offset, 0 }
|
||||
|
||||
//0x009AF1C8
|
||||
rct_ride_music_info * gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS] = {
|
||||
rct_ride_music_info gRideMusicInfoList[NUM_DEFAULT_MUSIC_TRACKS] = {
|
||||
INIT_MUSIC_INFO(PATH_ID_CSS4, 1378),
|
||||
INIT_MUSIC_INFO(PATH_ID_CSS5, 1378),
|
||||
INIT_MUSIC_INFO(PATH_ID_CSS6, 1378),
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "../audio/audio.h"
|
||||
#include "../common.h"
|
||||
|
||||
|
@ -69,13 +70,4 @@ enum
|
|||
TUNE_SWEAT_DREAMS, // 45, (sic)
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern uint8 * gRideMusicStyleTuneIds[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern std::vector<uint8> gRideMusicStyleTuneIds[];
|
|
@ -50,7 +50,7 @@
|
|||
#include "../world/Scenery.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "CableLift.h"
|
||||
#include "music_list.h"
|
||||
#include "MusicList.h"
|
||||
#include "Ride.h"
|
||||
#include "RideData.h"
|
||||
#include "RideGroupManager.h"
|
||||
|
@ -2806,8 +2806,8 @@ static void ride_music_update(sint32 rideIndex)
|
|||
|
||||
// Select random tune from available tunes for a music style (of course only merry-go-rounds have more than one tune)
|
||||
if (ride->music_tune_id == 255) {
|
||||
uint8 *musicStyleTunes = gRideMusicStyleTuneIds[ride->music];
|
||||
uint8 numTunes = *musicStyleTunes++;
|
||||
const auto &musicStyleTunes = gRideMusicStyleTuneIds[ride->music];
|
||||
auto numTunes = musicStyleTunes.size();
|
||||
ride->music_tune_id = musicStyleTunes[util_rand() % numTunes];
|
||||
ride->music_position = 0;
|
||||
return;
|
||||
|
@ -3431,7 +3431,7 @@ void ride_set_map_tooltip(rct_tile_element *tileElement)
|
|||
|
||||
static sint32 ride_music_params_update_label_51(uint32 a1, uint8 * tuneId, uint8 rideIndex, sint32 v32, sint32 pan_x, uint16 sampleRate)
|
||||
{
|
||||
if (a1 < gRideMusicInfoList[*tuneId]->length)
|
||||
if (a1 < gRideMusicInfoList[*tuneId].length)
|
||||
{
|
||||
rct_ride_music_params * ride_music_params = gRideMusicParamsListEnd;
|
||||
if (ride_music_params < &gRideMusicParamsList[Util::CountOf(gRideMusicParamsList)])
|
||||
|
@ -3456,7 +3456,7 @@ static sint32 ride_music_params_update_label_51(uint32 a1, uint8 * tuneId, uint8
|
|||
|
||||
static sint32 ride_music_params_update_label_58(uint32 position, uint8 * tuneId)
|
||||
{
|
||||
rct_ride_music_info * ride_music_info = gRideMusicInfoList[*tuneId];
|
||||
rct_ride_music_info * ride_music_info = &gRideMusicInfoList[*tuneId];
|
||||
position += ride_music_info->offset;
|
||||
if (position < ride_music_info->length)
|
||||
{
|
||||
|
@ -3594,7 +3594,7 @@ sint32 ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, u
|
|||
channel++;
|
||||
if (channel >= AUDIO_MAX_RIDE_MUSIC)
|
||||
{
|
||||
rct_ride_music_info * ride_music_info = gRideMusicInfoList[*tuneId];
|
||||
rct_ride_music_info * ride_music_info = &gRideMusicInfoList[*tuneId];
|
||||
a1 = position + ride_music_info->offset;
|
||||
|
||||
return ride_music_params_update_label_51(a1, tuneId, rideIndex, v32, pan_x, sampleRate);
|
||||
|
@ -3702,7 +3702,7 @@ void ride_music_update_final()
|
|||
channel2++;
|
||||
if (channel2 >= AUDIO_MAX_RIDE_MUSIC)
|
||||
{
|
||||
rct_ride_music_info * ride_music_info = gRideMusicInfoList[ride_music_params->tune_id];
|
||||
rct_ride_music_info * ride_music_info = &gRideMusicInfoList[ride_music_params->tune_id];
|
||||
rct_ride_music * ride_music_3 = &gRideMusicList[ebx];
|
||||
ride_music_3->sound_channel = Mixer_Play_Music(ride_music_info->path_id, MIXER_LOOP_NONE, true);
|
||||
if (ride_music_3->sound_channel)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "../rct12/RCT12.h"
|
||||
#include "../rct2/RCT2.h"
|
||||
#include "../world/Map.h"
|
||||
#include "ride_ratings.h"
|
||||
#include "RideRatings.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
#define MAX_RIDE_TYPES_PER_RIDE_ENTRY 3
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include <algorithm>
|
||||
#include "../Cheats.h"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../interface/Window.h"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../OpenRCT2.h"
|
||||
|
@ -22,10 +25,13 @@
|
|||
#include "../world/Map.h"
|
||||
#include "Ride.h"
|
||||
#include "RideData.h"
|
||||
#include "ride_ratings.h"
|
||||
#include "RideRatings.h"
|
||||
#include "Station.h"
|
||||
#include "Track.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
enum {
|
||||
RIDE_RATINGS_STATE_FIND_NEXT_RIDE,
|
||||
RIDE_RATINGS_STATE_INITIALISE,
|
||||
|
@ -69,7 +75,7 @@ typedef void (*ride_ratings_calculation)(Ride *ride);
|
|||
|
||||
rct_ride_rating_calc_data gRideRatingsCalcData;
|
||||
|
||||
static const ride_ratings_calculation ride_ratings_calculate_func_table[RIDE_TYPE_COUNT];
|
||||
static ride_ratings_calculation ride_ratings_get_calculate_func(uint8 rideType);
|
||||
|
||||
static void ride_ratings_update_state();
|
||||
static void ride_ratings_update_state_0();
|
||||
|
@ -216,9 +222,9 @@ static void ride_ratings_update_state_2()
|
|||
ride_ratings_score_close_proximity(tileElement);
|
||||
|
||||
rct_xy_element trackElement = {
|
||||
.x = gRideRatingsCalcData.proximity_x,
|
||||
.y = gRideRatingsCalcData.proximity_y,
|
||||
.element = tileElement
|
||||
/* .x = */ gRideRatingsCalcData.proximity_x,
|
||||
/* .y = */ gRideRatingsCalcData.proximity_y,
|
||||
/* .element = */ tileElement
|
||||
};
|
||||
rct_xy_element nextTrackElement;
|
||||
if (!track_block_get_next(&trackElement, &nextTrackElement, NULL, NULL)) {
|
||||
|
@ -491,13 +497,14 @@ static void ride_ratings_score_close_proximity(rct_tile_element *inputTileElemen
|
|||
sint32 y = gRideRatingsCalcData.proximity_y;
|
||||
rct_tile_element *tileElement = map_get_first_element_at(x >> 5, y >> 5);
|
||||
do {
|
||||
sint32 waterHeight;
|
||||
switch (tile_element_get_type(tileElement)) {
|
||||
case TILE_ELEMENT_TYPE_SURFACE:
|
||||
gRideRatingsCalcData.proximity_base_height = tileElement->base_height;
|
||||
if (tileElement->base_height * 8 == gRideRatingsCalcData.proximity_z) {
|
||||
proximity_score_increment(PROXIMITY_SURFACE_TOUCH);
|
||||
}
|
||||
sint32 waterHeight = map_get_water_height(tileElement);
|
||||
waterHeight = map_get_water_height(tileElement);
|
||||
if (waterHeight != 0) {
|
||||
sint32 z = waterHeight * 16;
|
||||
if (z <= gRideRatingsCalcData.proximity_z) {
|
||||
|
@ -626,7 +633,7 @@ static void ride_ratings_score_close_proximity(rct_tile_element *inputTileElemen
|
|||
|
||||
static void ride_ratings_calculate(Ride *ride)
|
||||
{
|
||||
ride_ratings_calculation calcFunc = ride_ratings_calculate_func_table[ride->type];
|
||||
auto calcFunc = ride_ratings_get_calculate_func(ride->type);
|
||||
if (calcFunc != NULL) {
|
||||
calcFunc(ride);
|
||||
}
|
||||
|
@ -643,10 +650,7 @@ static void ride_ratings_calculate(Ride *ride)
|
|||
|
||||
static void ride_ratings_calculate_value(Ride *ride)
|
||||
{
|
||||
typedef struct row {
|
||||
sint32 months, multiplier, divisor, summand;
|
||||
} row;
|
||||
|
||||
struct row { sint32 months, multiplier, divisor, summand; };
|
||||
static const row age_table_new[] = {
|
||||
{5, 3, 2, 0}, // 1.5x
|
||||
{13, 6, 5, 0}, // 1.2x
|
||||
|
@ -692,11 +696,11 @@ static void ride_ratings_calculate_value(Ride *ride)
|
|||
}
|
||||
|
||||
const row *age_table = age_table_new;
|
||||
sint32 table_size = countof(age_table_new);
|
||||
size_t table_size = Util::CountOf(age_table_new);
|
||||
|
||||
#ifdef ORIGINAL_RATINGS
|
||||
age_table = age_table_old;
|
||||
table_size = countof(age_table_old);
|
||||
table_size = Util::CountOf(age_table_old);
|
||||
#endif
|
||||
|
||||
row last_row = age_table[table_size-1];
|
||||
|
@ -707,7 +711,7 @@ static void ride_ratings_calculate_value(Ride *ride)
|
|||
}
|
||||
else {
|
||||
// Find the first hit in the table that matches this ride's age
|
||||
for(sint32 it = 0; it < table_size; it++) {
|
||||
for(size_t it = 0; it < table_size; it++) {
|
||||
row curr = age_table[it];
|
||||
|
||||
if(monthsOld < curr.months) {
|
||||
|
@ -728,7 +732,7 @@ static void ride_ratings_calculate_value(Ride *ride)
|
|||
if (otherRidesOfSameType > 1)
|
||||
value -= value / 4;
|
||||
|
||||
ride->value = max(0, value);
|
||||
ride->value = std::max(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -856,7 +860,7 @@ static void ride_ratings_apply_adjustments(Ride *ride, rating_tuple *ratings)
|
|||
sint32 nauseaModifier;
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_LIMIT_AIRTIME_BONUS) {
|
||||
// Limit airtime bonus for heartline twister coaster (see issues #2031 and #2064)
|
||||
excitementModifier = min(ride->total_air_time, 96) / 8;
|
||||
excitementModifier = std::min<uint16>(ride->total_air_time, 96) / 8;
|
||||
} else {
|
||||
excitementModifier = ride->total_air_time / 8;
|
||||
}
|
||||
|
@ -874,12 +878,14 @@ static void ride_ratings_apply_adjustments(Ride *ride, rating_tuple *ratings)
|
|||
static void ride_ratings_apply_intensity_penalty(rating_tuple *ratings)
|
||||
{
|
||||
static const ride_rating intensityBounds[] = { 1000, 1100, 1200, 1320, 1450 };
|
||||
sint32 i;
|
||||
|
||||
ride_rating excitement = ratings->excitement;
|
||||
for (i = 0; i < countof(intensityBounds); i++)
|
||||
if (ratings->intensity >= intensityBounds[i])
|
||||
for (auto intensityBound : intensityBounds)
|
||||
{
|
||||
if (ratings->intensity >= intensityBound)
|
||||
{
|
||||
excitement -= excitement / 4;
|
||||
}
|
||||
}
|
||||
ratings->excitement = excitement;
|
||||
}
|
||||
|
||||
|
@ -896,14 +902,14 @@ static void set_unreliability_factor(Ride *ride)
|
|||
|
||||
static uint32 get_proximity_score_helper_1(uint16 x, uint16 max, uint32 multiplier)
|
||||
{
|
||||
return (min(x, max) * multiplier) >> 16;
|
||||
return (std::min(x, max) * multiplier) >> 16;
|
||||
}
|
||||
|
||||
static uint32 get_proximity_score_helper_2(uint16 x, uint16 additionIfNotZero, uint16 max, uint32 multiplier)
|
||||
{
|
||||
uint32 result = x;
|
||||
if (result != 0) result += additionIfNotZero;
|
||||
return (min(result, max) * multiplier) >> 16;
|
||||
return (std::min<sint32>(result, max) * multiplier) >> 16;
|
||||
}
|
||||
|
||||
static uint32 get_proximity_score_helper_3(uint16 x, uint16 resultIfNotZero)
|
||||
|
@ -1039,12 +1045,12 @@ static rating_tuple get_sloped_turns_rating(Ride* ride) {
|
|||
sint32 no_2_turns = get_turn_count_2_elements(ride, 2);
|
||||
sint32 no_1_turns = get_turn_count_1_element(ride, 2);
|
||||
|
||||
rating.excitement = (min(no_4_plus_turns, 4) * 0x78000) >> 16;
|
||||
rating.excitement += (min(no_3_turns, 6) * 273066) >> 16;
|
||||
rating.excitement += (min(no_2_turns, 6) * 0x3AAAA) >> 16;
|
||||
rating.excitement += (min(no_1_turns, 7) * 187245) >> 16;
|
||||
rating.excitement = (std::min(no_4_plus_turns, 4) * 0x78000) >> 16;
|
||||
rating.excitement += (std::min(no_3_turns, 6) * 273066) >> 16;
|
||||
rating.excitement += (std::min(no_2_turns, 6) * 0x3AAAA) >> 16;
|
||||
rating.excitement += (std::min(no_1_turns, 7) * 187245) >> 16;
|
||||
rating.intensity = 0;
|
||||
rating.nausea = (min(no_4_plus_turns, 8) * 0x78000) >> 16;
|
||||
rating.nausea = (std::min(no_4_plus_turns, 8) * 0x78000) >> 16;
|
||||
|
||||
return rating;
|
||||
}
|
||||
|
@ -1056,7 +1062,7 @@ static rating_tuple get_sloped_turns_rating(Ride* ride) {
|
|||
static rating_tuple get_inversions_ratings(uint8 inversions) {
|
||||
rating_tuple rating;
|
||||
|
||||
rating.excitement = (min(inversions, 6) * 0x1AAAAA) >> 16;
|
||||
rating.excitement = (std::min<sint32>(inversions, 6) * 0x1AAAAA) >> 16;
|
||||
rating.intensity = (inversions * 0x320000) >> 16;
|
||||
rating.nausea = (inversions * 0x15AAAA) >> 16;
|
||||
|
||||
|
@ -1095,17 +1101,17 @@ static rating_tuple get_special_track_elements_rating(uint8 type, Ride *ride) {
|
|||
}
|
||||
}
|
||||
uint8 helix_sections = ride_get_helix_sections(ride);
|
||||
sint32 al = min(helix_sections, 9);
|
||||
sint32 al = std::min<sint32>(helix_sections, 9);
|
||||
excitement += (al * 254862) >> 16;
|
||||
|
||||
al = min(helix_sections, 11);
|
||||
al = std::min<sint32>(helix_sections, 11);
|
||||
intensity += (al * 148945) >> 16;
|
||||
|
||||
al = max(helix_sections - 5, 0);
|
||||
al = min(al, 10);
|
||||
al = std::max<sint32>(helix_sections - 5, 0);
|
||||
al = std::min(al, 10);
|
||||
nausea += (al * 0x140000) >> 16;
|
||||
|
||||
rating_tuple rating = { excitement, intensity, nausea };
|
||||
rating_tuple rating = { (ride_rating)excitement, (ride_rating)intensity, (ride_rating)nausea };
|
||||
return rating;
|
||||
}
|
||||
|
||||
|
@ -1142,7 +1148,7 @@ static rating_tuple ride_ratings_get_turns_ratings(Ride *ride)
|
|||
intensity += inversions_rating.intensity;
|
||||
nausea += inversions_rating.nausea;
|
||||
|
||||
rating_tuple rating = { excitement, intensity, nausea };
|
||||
rating_tuple rating = { (ride_rating)excitement, (ride_rating)intensity, (ride_rating)nausea };
|
||||
return rating;
|
||||
}
|
||||
|
||||
|
@ -1153,13 +1159,13 @@ static rating_tuple ride_ratings_get_turns_ratings(Ride *ride)
|
|||
static rating_tuple ride_ratings_get_sheltered_ratings(Ride *ride)
|
||||
{
|
||||
sint32 sheltered_length_shifted = (ride->sheltered_length) >> 16;
|
||||
uint32 eax = min(sheltered_length_shifted, 1000);
|
||||
uint32 eax = std::min(sheltered_length_shifted, 1000);
|
||||
sint32 excitement = (eax * 9175) >> 16;
|
||||
|
||||
eax = min(sheltered_length_shifted, 2000);
|
||||
eax = std::min(sheltered_length_shifted, 2000);
|
||||
sint32 intensity = (eax * 0x2666) >> 16;
|
||||
|
||||
eax = min(sheltered_length_shifted, 1000);
|
||||
eax = std::min(sheltered_length_shifted, 1000);
|
||||
sint32 nausea = (eax * 0x4000) >> 16;
|
||||
|
||||
/*eax = (ride->var_11C * 30340) >> 16;*/
|
||||
|
@ -1176,10 +1182,10 @@ static rating_tuple ride_ratings_get_sheltered_ratings(Ride *ride)
|
|||
}
|
||||
|
||||
uint8 lowerval = ride->num_sheltered_sections & 0x1F;
|
||||
lowerval = min(lowerval, 11);
|
||||
lowerval = std::min<uint8>(lowerval, 11);
|
||||
excitement += (lowerval * 774516) >> 16;
|
||||
|
||||
rating_tuple rating = { excitement, intensity, nausea };
|
||||
rating_tuple rating = { (ride_rating)excitement, (ride_rating)intensity, (ride_rating)nausea };
|
||||
return rating;
|
||||
}
|
||||
|
||||
|
@ -1190,9 +1196,9 @@ static rating_tuple ride_ratings_get_sheltered_ratings(Ride *ride)
|
|||
static rating_tuple ride_ratings_get_gforce_ratings(Ride *ride)
|
||||
{
|
||||
rating_tuple result = {
|
||||
.excitement = 0,
|
||||
.intensity = 0,
|
||||
.nausea = 0
|
||||
/* .excitement = */ 0,
|
||||
/* .intensity = */ 0,
|
||||
/* .nausea = */ 0
|
||||
};
|
||||
|
||||
// Apply maximum positive G force factor
|
||||
|
@ -1202,12 +1208,12 @@ static rating_tuple ride_ratings_get_gforce_ratings(Ride *ride)
|
|||
|
||||
// Apply maximum negative G force factor
|
||||
fixed16_2dp gforce = ride->max_negative_vertical_g;
|
||||
result.excitement += (clamp(-FIXED_2DP(2,50), gforce, FIXED_2DP(0,00)) * -15728) >> 16;
|
||||
result.excitement += (Math::Clamp<fixed16_2dp>(-FIXED_2DP(2,50), gforce, FIXED_2DP(0,00)) * -15728) >> 16;
|
||||
result.intensity += ((gforce - FIXED_2DP(1,00)) * -52428) >> 16;
|
||||
result.nausea += ((gforce - FIXED_2DP(1,00)) * -14563) >> 16;
|
||||
|
||||
// Apply lateral G force factor
|
||||
result.excitement += (min(FIXED_2DP(1,50), ride->max_lateral_g) * 26214) >> 16;
|
||||
result.excitement += (std::min<fixed16_2dp>(FIXED_2DP(1,50), ride->max_lateral_g) * 26214) >> 16;
|
||||
result.intensity += ride->max_lateral_g;
|
||||
result.nausea += (ride->max_lateral_g * 21845) >> 16;
|
||||
|
||||
|
@ -1234,14 +1240,14 @@ static rating_tuple ride_ratings_get_gforce_ratings(Ride *ride)
|
|||
static rating_tuple ride_ratings_get_drop_ratings(Ride *ride)
|
||||
{
|
||||
rating_tuple result = {
|
||||
.excitement = 0,
|
||||
.intensity = 0,
|
||||
.nausea = 0
|
||||
/* .excitement = */ 0,
|
||||
/* .intensity = */ 0,
|
||||
/* .nausea = */ 0
|
||||
};
|
||||
|
||||
// Apply number of drops factor
|
||||
sint32 drops = ride->drops & 0x3F;
|
||||
result.excitement += (min(9, drops) * 728177) >> 16;
|
||||
result.excitement += (std::min(9, drops) * 728177) >> 16;
|
||||
result.intensity += (drops * 928426) >> 16;
|
||||
result.nausea += (drops * 655360) >> 16;
|
||||
|
||||
|
@ -1289,8 +1295,8 @@ static sint32 ride_ratings_get_scenery_score(Ride *ride)
|
|||
|
||||
// Count surrounding scenery items
|
||||
sint32 numSceneryItems = 0;
|
||||
for (sint32 yy = max(y - 5, 0); yy <= min(y + 5, 255); yy++) {
|
||||
for (sint32 xx = max(x - 5, 0); xx <= min(x + 5, 255); xx++) {
|
||||
for (sint32 yy = std::max(y - 5, 0); yy <= std::min(y + 5, 255); yy++) {
|
||||
for (sint32 xx = std::max(x - 5, 0); xx <= std::min(x + 5, 255); xx++) {
|
||||
// Count scenery items on this tile
|
||||
rct_tile_element *tileElement = map_get_first_element_at(xx, yy);
|
||||
do {
|
||||
|
@ -1304,14 +1310,16 @@ static sint32 ride_ratings_get_scenery_score(Ride *ride)
|
|||
}
|
||||
}
|
||||
|
||||
return min(numSceneryItems, 47) * 5;
|
||||
return std::min(numSceneryItems, 47) * 5;
|
||||
}
|
||||
|
||||
#pragma region Ride rating calculation helpers
|
||||
|
||||
static void ride_ratings_set(rating_tuple *ratings, sint32 excitement, sint32 intensity, sint32 nausea)
|
||||
{
|
||||
*ratings = (rating_tuple){ 0 };
|
||||
ratings->excitement = 0;
|
||||
ratings->intensity = 0;
|
||||
ratings->nausea = 0;
|
||||
ride_ratings_add(ratings, excitement, intensity, nausea);
|
||||
}
|
||||
|
||||
|
@ -1323,15 +1331,15 @@ static void ride_ratings_add(rating_tuple * rating, sint32 excitement, sint32 in
|
|||
sint32 newExcitement = rating->excitement + excitement;
|
||||
sint32 newIntensity = rating->intensity + intensity;
|
||||
sint32 newNausea = rating->nausea + nausea;
|
||||
rating->excitement = clamp(0, newExcitement, INT16_MAX);
|
||||
rating->intensity = clamp(0, newIntensity, INT16_MAX);
|
||||
rating->nausea = clamp(0, newNausea, INT16_MAX);
|
||||
rating->excitement = Math::Clamp<sint32>(0, newExcitement, INT16_MAX);
|
||||
rating->intensity = Math::Clamp<sint32>(0, newIntensity, INT16_MAX);
|
||||
rating->nausea = Math::Clamp<sint32>(0, newNausea, INT16_MAX);
|
||||
}
|
||||
|
||||
static void ride_ratings_apply_length(rating_tuple *ratings, Ride *ride, sint32 maxLength, sint32 excitementMultiplier)
|
||||
{
|
||||
ride_ratings_add(ratings,
|
||||
(min(ride_get_total_length(ride) >> 16, maxLength) * excitementMultiplier) >> 16,
|
||||
(std::min(ride_get_total_length(ride) >> 16, maxLength) * excitementMultiplier) >> 16,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
@ -1374,7 +1382,7 @@ static void ride_ratings_apply_average_speed(rating_tuple *ratings, Ride *ride,
|
|||
static void ride_ratings_apply_duration(rating_tuple *ratings, Ride *ride, sint32 maxDuration, sint32 excitementMultiplier)
|
||||
{
|
||||
ride_ratings_add(ratings,
|
||||
(min(ride_get_total_time(ride), maxDuration) * excitementMultiplier) >> 16,
|
||||
(std::min(ride_get_total_time(ride), maxDuration) * excitementMultiplier) >> 16,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
@ -2336,7 +2344,7 @@ static void ride_ratings_calculate_maze(Ride *ride)
|
|||
rating_tuple ratings;
|
||||
ride_ratings_set(&ratings, RIDE_RATING(1,30), RIDE_RATING(0,50), RIDE_RATING(0,00));
|
||||
|
||||
sint32 size = min(ride->maze_tiles, 100);
|
||||
sint32 size = std::min<uint16>(ride->maze_tiles, 100);
|
||||
ride_ratings_add(&ratings,
|
||||
size,
|
||||
size * 2,
|
||||
|
@ -2960,9 +2968,9 @@ static void ride_ratings_calculate_haunted_house(Ride *ride)
|
|||
set_unreliability_factor(ride);
|
||||
|
||||
rating_tuple ratings = {
|
||||
.excitement = RIDE_RATING(3,41),
|
||||
.intensity = RIDE_RATING(1,53),
|
||||
.nausea = RIDE_RATING(0,10)
|
||||
/* .excitement = */ RIDE_RATING(3,41),
|
||||
/* .intensity = */ RIDE_RATING(1,53),
|
||||
/* .nausea = */ RIDE_RATING(0,10)
|
||||
};
|
||||
|
||||
ride_ratings_apply_intensity_penalty(&ratings);
|
||||
|
@ -3230,7 +3238,7 @@ static void ride_ratings_calculate_reverser_roller_coaster(Ride *ride)
|
|||
ride_ratings_apply_max_speed(&ratings, ride, 44281, 88562, 35424);
|
||||
ride_ratings_apply_average_speed(&ratings, ride, 364088, 655360);
|
||||
|
||||
sint32 numReversers = min(gRideRatingsCalcData.num_reversers, 6);
|
||||
sint32 numReversers = std::min<uint16>(gRideRatingsCalcData.num_reversers, 6);
|
||||
ride_rating reverserRating = numReversers * RIDE_RATING(0,20);
|
||||
ride_ratings_add(&ratings,
|
||||
reverserRating,
|
||||
|
@ -3361,9 +3369,9 @@ static void ride_ratings_calculate_circus_show(Ride *ride)
|
|||
set_unreliability_factor(ride);
|
||||
|
||||
rating_tuple ratings = {
|
||||
.excitement = RIDE_RATING(2,10),
|
||||
.intensity = RIDE_RATING(0,30),
|
||||
.nausea = RIDE_RATING(0,0)
|
||||
/* .excitement = */ RIDE_RATING(2,10),
|
||||
/* .intensity = */ RIDE_RATING(0,30),
|
||||
/* .nausea = */ RIDE_RATING(0,0)
|
||||
};
|
||||
|
||||
ride_ratings_apply_intensity_penalty(&ratings);
|
||||
|
@ -3712,9 +3720,9 @@ static void ride_ratings_calculate_flying_saucers(Ride *ride)
|
|||
set_unreliability_factor(ride);
|
||||
|
||||
rating_tuple ratings = {
|
||||
.excitement = RIDE_RATING(2,40),
|
||||
.intensity = RIDE_RATING(0,55),
|
||||
.nausea = RIDE_RATING(0,39)
|
||||
/* .excitement = */ RIDE_RATING(2,40),
|
||||
/* .intensity = */ RIDE_RATING(0,55),
|
||||
/* .nausea = */ RIDE_RATING(0,39)
|
||||
};
|
||||
|
||||
if (ride->num_vehicles >= 4) {
|
||||
|
@ -3758,9 +3766,9 @@ static void ride_ratings_calculate_crooked_house(Ride *ride)
|
|||
set_unreliability_factor(ride);
|
||||
|
||||
rating_tuple ratings = {
|
||||
.excitement = RIDE_RATING(2,15),
|
||||
.intensity = RIDE_RATING(0,62),
|
||||
.nausea = RIDE_RATING(0,34)
|
||||
/* .excitement = */ RIDE_RATING(2,15),
|
||||
/* .intensity = */ RIDE_RATING(0,62),
|
||||
/* .nausea = */ RIDE_RATING(0,34)
|
||||
};
|
||||
|
||||
ride_ratings_apply_intensity_penalty(&ratings);
|
||||
|
@ -4064,9 +4072,9 @@ static void ride_ratings_calculate_enterprise(Ride *ride)
|
|||
|
||||
// Base ratings
|
||||
rating_tuple ratings = {
|
||||
.excitement = RIDE_RATING(3,60),
|
||||
.intensity = RIDE_RATING(4,55),
|
||||
.nausea = RIDE_RATING(5,72)
|
||||
/* .excitement = */ RIDE_RATING(3,60),
|
||||
/* .intensity = */ RIDE_RATING(4,55),
|
||||
/* .nausea = */ RIDE_RATING(5,72)
|
||||
};
|
||||
|
||||
ride_ratings_add(&ratings,
|
||||
|
@ -4348,4 +4356,11 @@ static const ride_ratings_calculation ride_ratings_calculate_func_table[RIDE_TYP
|
|||
ride_ratings_calculate_lim_launched_roller_coaster, // LIM_LAUNCHED_ROLLER_COASTER
|
||||
};
|
||||
|
||||
static ride_ratings_calculation ride_ratings_get_calculate_func(uint8 rideType)
|
||||
{
|
||||
return ride_ratings_calculate_func_table[rideType];
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
}
|
|
@ -14,8 +14,7 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef _RIDE_RATINGS_H_
|
||||
#define _RIDE_RATINGS_H_
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
|
@ -72,5 +71,3 @@ void ride_ratings_update_all();
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -33,7 +33,7 @@
|
|||
#include "../world/Scenery.h"
|
||||
#include "Ride.h"
|
||||
#include "RideData.h"
|
||||
#include "ride_ratings.h"
|
||||
#include "RideRatings.h"
|
||||
#include "RideGroupManager.h"
|
||||
#include "Station.h"
|
||||
#include "Track.h"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include <algorithm>
|
||||
#include "../audio/audio.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../Context.h"
|
||||
|
@ -39,6 +40,9 @@
|
|||
#define TRACK_NEARBY_SCENERY_DISTANCE 1
|
||||
#define TRACK_TD6_MAX_ELEMENTS 8192
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
bool gTrackDesignSaveMode = false;
|
||||
uint8 gTrackDesignSaveRideIndex = 255;
|
||||
|
||||
|
@ -632,7 +636,7 @@ static bool track_design_save_copy_scenery_to_td6(rct_track_td6 *td6)
|
|||
{
|
||||
// Copy TD6 scenery elements to new memory and add end marker
|
||||
size_t totalSceneryElementsSize = _trackSavedTileElementsDescCount * sizeof(rct_td6_scenery_element);
|
||||
td6->scenery_elements = malloc(totalSceneryElementsSize + 1);
|
||||
td6->scenery_elements = (rct_td6_scenery_element *)malloc(totalSceneryElementsSize + 1);
|
||||
memcpy(td6->scenery_elements, _trackSavedTileElementsDesc, totalSceneryElementsSize);
|
||||
*((uint8*)&td6->scenery_elements[_trackSavedTileElementsDescCount]) = 0xFF;
|
||||
|
||||
|
@ -715,7 +719,7 @@ static bool track_design_save_copy_scenery_to_td6(rct_track_td6 *td6)
|
|||
*/
|
||||
static rct_track_td6 *track_design_save_to_td6(uint8 rideIndex)
|
||||
{
|
||||
rct_track_td6 *td6 = calloc(1, sizeof(rct_track_td6));
|
||||
rct_track_td6 *td6 = (rct_track_td6 *)calloc(1, sizeof(rct_track_td6));
|
||||
Ride *ride = get_ride(rideIndex);
|
||||
td6->type = ride->type;
|
||||
rct_object_entry_extended *object = &object_entry_groups[OBJECT_TYPE_RIDE].entries[ride->subtype];
|
||||
|
@ -825,10 +829,10 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td
|
|||
return false;
|
||||
}
|
||||
|
||||
gTrackPreviewOrigin = (LocationXYZ16) { startX, startY, tileElement->base_height * 8 };
|
||||
gTrackPreviewOrigin = { startX, startY, (sint16)(tileElement->base_height * 8) };
|
||||
|
||||
size_t numMazeElements = 0;
|
||||
td6->maze_elements = calloc(8192, sizeof(rct_td6_maze_element));
|
||||
td6->maze_elements = (rct_td6_maze_element *)calloc(8192, sizeof(rct_td6_maze_element));
|
||||
rct_td6_maze_element *maze = td6->maze_elements;
|
||||
|
||||
// x is defined here as we can start the search
|
||||
|
@ -919,12 +923,12 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td
|
|||
numMazeElements++;
|
||||
|
||||
// Trim memory
|
||||
td6->maze_elements = realloc(td6->maze_elements, numMazeElements * sizeof(rct_td6_maze_element));
|
||||
td6->maze_elements = (rct_td6_maze_element *)realloc(td6->maze_elements, numMazeElements * sizeof(rct_td6_maze_element));
|
||||
|
||||
// Save global vars as they are still used by scenery
|
||||
sint16 startZ = gTrackPreviewOrigin.z;
|
||||
place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, true, 0, 4096, 4096, 0);
|
||||
gTrackPreviewOrigin = (LocationXYZ16) { startX, startY, startZ };
|
||||
gTrackPreviewOrigin = { startX, startY, startZ };
|
||||
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
|
@ -957,9 +961,9 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8 rideIndex, rct_track
|
|||
rct_tile_element* initial_map = trackElement.element;
|
||||
do {
|
||||
rct_xy_element lastGood = {
|
||||
.element = trackBeginEnd.begin_element,
|
||||
.x = trackBeginEnd.begin_x,
|
||||
.y = trackBeginEnd.begin_y
|
||||
/* .x = */ trackBeginEnd.begin_x,
|
||||
/* .y = */ trackBeginEnd.begin_y,
|
||||
/* .element = */ trackBeginEnd.begin_element
|
||||
};
|
||||
|
||||
if (!track_block_get_previous(trackBeginEnd.end_x, trackBeginEnd.end_y, trackBeginEnd.begin_element, &trackBeginEnd)) {
|
||||
|
@ -988,10 +992,10 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8 rideIndex, rct_track
|
|||
sint16 start_x = trackElement.x;
|
||||
sint16 start_y = trackElement.y;
|
||||
sint16 start_z = z + trackCoordinates->z_begin;
|
||||
gTrackPreviewOrigin = (LocationXYZ16) { start_x, start_y, start_z };
|
||||
gTrackPreviewOrigin = { start_x, start_y, start_z };
|
||||
|
||||
size_t numTrackElements = 0;
|
||||
td6->track_elements = calloc(TRACK_TD6_MAX_ELEMENTS, sizeof(rct_td6_track_element));
|
||||
td6->track_elements = (rct_td6_track_element *)calloc(TRACK_TD6_MAX_ELEMENTS, sizeof(rct_td6_track_element));
|
||||
rct_td6_track_element *track = td6->track_elements;
|
||||
do {
|
||||
track->type = track_element_get_type(trackElement.element);
|
||||
|
@ -1045,11 +1049,11 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8 rideIndex, rct_track
|
|||
}
|
||||
while (trackElement.element != initialMap);
|
||||
|
||||
td6->track_elements = realloc(td6->track_elements, numTrackElements * sizeof(rct_td6_track_element) + 1);
|
||||
td6->track_elements = (rct_td6_track_element *)realloc(td6->track_elements, numTrackElements * sizeof(rct_td6_track_element) + 1);
|
||||
*((uint8*)&td6->track_elements[numTrackElements]) = 0xFF;
|
||||
|
||||
size_t numEntranceElements = 0;
|
||||
td6->entrance_elements = calloc(32, sizeof(rct_td6_entrance_element));
|
||||
td6->entrance_elements = (rct_td6_entrance_element *)calloc(32, sizeof(rct_td6_entrance_element));
|
||||
rct_td6_entrance_element *entrance = td6->entrance_elements;
|
||||
|
||||
// First entrances, second exits
|
||||
|
@ -1114,13 +1118,13 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8 rideIndex, rct_track
|
|||
numEntranceElements++;
|
||||
}
|
||||
}
|
||||
td6->entrance_elements = realloc(td6->entrance_elements, numEntranceElements * sizeof(rct_td6_entrance_element) + 1);
|
||||
td6->entrance_elements = (rct_td6_entrance_element *)realloc(td6->entrance_elements, numEntranceElements * sizeof(rct_td6_entrance_element) + 1);
|
||||
*((uint8*)&td6->entrance_elements[numEntranceElements]) = 0xFF;
|
||||
|
||||
place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, true, 0, 4096, 4096, 0);
|
||||
|
||||
// Resave global vars for scenery reasons.
|
||||
gTrackPreviewOrigin = (LocationXYZ16) { start_x, start_y, start_z };
|
||||
gTrackPreviewOrigin = { start_x, start_y, start_z };
|
||||
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
|
@ -1188,7 +1192,7 @@ static void auto_buffer_write(auto_buffer *buffer, const void *src, size_t len)
|
|||
size_t remainingSpace = buffer->capacity - buffer->length;
|
||||
if (remainingSpace < len) {
|
||||
do {
|
||||
buffer->capacity = max(8, buffer->capacity * 2);
|
||||
buffer->capacity = std::max<size_t>(8, buffer->capacity * 2);
|
||||
remainingSpace = buffer->capacity - buffer->length;
|
||||
} while (remainingSpace < len);
|
||||
|
||||
|
@ -1227,7 +1231,7 @@ bool track_design_save_to_file(const utf8 *path)
|
|||
auto_buffer_write(&td6Buffer, &EndMarker, sizeof(EndMarker));
|
||||
|
||||
// Encode TD6 data
|
||||
uint8 *encodedData = malloc(0x8000);
|
||||
uint8 *encodedData = (uint8 *)malloc(0x8000);
|
||||
assert(td6Buffer.ptr != NULL);
|
||||
size_t encodedDataLength = sawyercoding_encode_td6((uint8*)td6Buffer.ptr, encodedData, td6Buffer.length);
|
||||
|
||||
|
@ -1243,3 +1247,5 @@ bool track_design_save_to_file(const utf8 *path)
|
|||
free(td6Buffer.ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,7 +24,7 @@
|
|||
#include "../rct12/RCT12.h"
|
||||
#include "../rct2/RCT2.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/ride_ratings.h"
|
||||
#include "../ride/RideRatings.h"
|
||||
#include "../world/Banner.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/MapAnimation.h"
|
||||
|
|
Loading…
Reference in New Issue