From bb55c6ce662556c2b3aae65d4b8042512734d5cc Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Tue, 17 Jan 2023 20:46:55 +0100 Subject: [PATCH] Remove loadsasnakes (#19192) * Rename snake_case methods in scenario folder * Rename snake_case methods in title folder * Rename snake_case methods in object folder * Rename snake_case methods in platform folder * Rename snake_case methods in windows folder * Rename tile_inspector.h to TileInspectorGlobals.h * Rename snake_case methods in ui/windows folder --- src/openrct2-ui/input/Shortcuts.cpp | 10 +- .../interface/ViewportInteraction.cpp | 6 +- src/openrct2-ui/scripting/ScTitleSequence.hpp | 14 +- .../windows/EditorBottomToolbar.cpp | 6 +- .../windows/EditorInventionsList.cpp | 4 +- .../windows/EditorObjectSelection.cpp | 26 ++-- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2-ui/windows/InstallTrack.cpp | 8 +- src/openrct2-ui/windows/LoadSave.cpp | 10 +- src/openrct2-ui/windows/MapGen.cpp | 4 +- src/openrct2-ui/windows/MazeConstruction.cpp | 2 +- src/openrct2-ui/windows/NewRide.cpp | 4 +- src/openrct2-ui/windows/ObjectLoadError.cpp | 6 +- src/openrct2-ui/windows/Options.cpp | 14 +- src/openrct2-ui/windows/Park.cpp | 2 +- src/openrct2-ui/windows/Ride.cpp | 24 +-- src/openrct2-ui/windows/RideConstruction.cpp | 13 +- src/openrct2-ui/windows/RideList.cpp | 2 +- src/openrct2-ui/windows/SavePrompt.cpp | 6 +- src/openrct2-ui/windows/ScenarioSelect.cpp | 10 +- src/openrct2-ui/windows/ServerStart.cpp | 4 +- src/openrct2-ui/windows/Staff.cpp | 2 +- src/openrct2-ui/windows/StaffList.cpp | 4 +- src/openrct2-ui/windows/TileInspector.cpp | 2 +- src/openrct2-ui/windows/TopToolbar.cpp | 4 +- src/openrct2-ui/windows/TrackDesignPlace.cpp | 6 +- src/openrct2-ui/windows/TrackList.cpp | 4 +- src/openrct2-ui/windows/Window.h | 2 +- src/openrct2/CmdlineSprite.cpp | 6 +- src/openrct2/Context.cpp | 36 ++--- src/openrct2/Editor.cpp | 12 +- src/openrct2/EditorObjectSelectionSession.cpp | 44 +++--- src/openrct2/Game.cpp | 20 +-- src/openrct2/GameState.cpp | 6 +- src/openrct2/ReplayManager.cpp | 4 +- .../actions/BannerSetColourAction.cpp | 2 +- src/openrct2/actions/BannerSetNameAction.cpp | 2 +- src/openrct2/actions/BannerSetStyleAction.cpp | 2 +- src/openrct2/actions/CheatSetAction.cpp | 8 +- src/openrct2/actions/RideSetVehicleAction.cpp | 2 +- src/openrct2/actions/SignSetStyleAction.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.cpp | 4 +- src/openrct2/cmdline/ConvertCommand.cpp | 2 +- src/openrct2/drawing/Drawing.cpp | 2 +- src/openrct2/entity/Balloon.cpp | 2 +- src/openrct2/entity/Duck.cpp | 16 +- src/openrct2/entity/Fountain.cpp | 10 +- src/openrct2/entity/Guest.cpp | 144 +++++++++--------- src/openrct2/entity/Particle.cpp | 12 +- src/openrct2/entity/Peep.cpp | 18 +-- src/openrct2/entity/Staff.cpp | 42 ++--- src/openrct2/interface/InteractiveConsole.cpp | 10 +- src/openrct2/libopenrct2.vcxproj | 4 +- src/openrct2/management/Award.cpp | 2 +- src/openrct2/management/NewsItem.cpp | 14 +- src/openrct2/management/Research.cpp | 4 +- src/openrct2/network/NetworkBase.cpp | 30 ++-- src/openrct2/object/Object.h | 10 +- src/openrct2/object/ObjectFactory.cpp | 4 +- src/openrct2/object/ObjectList.cpp | 10 +- src/openrct2/object/ObjectList.h | 2 +- src/openrct2/object/ObjectManager.cpp | 18 +-- src/openrct2/object/ObjectManager.h | 14 +- src/openrct2/object/ObjectRepository.cpp | 22 +-- src/openrct2/object/ObjectRepository.h | 10 +- src/openrct2/paint/Painter.cpp | 2 +- src/openrct2/park/ParkFile.cpp | 2 +- src/openrct2/peep/GuestPathfinding.cpp | 16 +- src/openrct2/platform/Crash.cpp | 6 +- src/openrct2/platform/Crash.h | 6 +- src/openrct2/platform/Platform.Win32.cpp | 6 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 4 +- src/openrct2/rct2/T6Importer.cpp | 2 +- src/openrct2/ride/Ride.cpp | 28 ++-- src/openrct2/ride/RideConstruction.cpp | 2 +- src/openrct2/ride/Station.cpp | 2 +- src/openrct2/ride/TrackDesign.cpp | 2 +- src/openrct2/ride/TrackDesignSave.cpp | 8 +- src/openrct2/ride/Vehicle.cpp | 40 ++--- src/openrct2/scenario/Scenario.cpp | 98 ++++++------ src/openrct2/scenario/Scenario.h | 28 ++-- src/openrct2/scenario/ScenarioRepository.cpp | 26 ++-- src/openrct2/scenario/ScenarioRepository.h | 11 +- .../scripting/bindings/game/ScContext.hpp | 2 +- src/openrct2/title/TitleScreen.cpp | 46 +++--- src/openrct2/title/TitleScreen.h | 22 +-- src/openrct2/title/TitleSequenceManager.cpp | 28 ++-- src/openrct2/title/TitleSequenceManager.h | 24 +-- src/openrct2/windows/Intent.cpp | 10 +- src/openrct2/windows/Intent.h | 14 +- ...ile_inspector.h => TileInspectorGlobals.h} | 0 src/openrct2/world/Climate.cpp | 4 +- src/openrct2/world/LargeScenery.cpp | 2 +- src/openrct2/world/MapGen.cpp | 2 +- src/openrct2/world/Park.cpp | 6 +- src/openrct2/world/Surface.cpp | 2 +- src/openrct2/world/TileInspector.cpp | 2 +- test/tests/Pathfinding.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 100 files changed, 605 insertions(+), 607 deletions(-) rename src/openrct2/windows/{tile_inspector.h => TileInspectorGlobals.h} (100%) diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index b79707854d..6cf37487e2 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include @@ -152,11 +152,11 @@ static void ShortcutRemoveTopBottomToolbarToggle() WindowClose(*WindowFindByClass(WindowClass::TitleOptions)); WindowClose(*WindowFindByClass(WindowClass::TitleMenu)); WindowClose(*WindowFindByClass(WindowClass::TitleExit)); - title_set_hide_version_info(true); + TitleSetHideVersionInfo(true); } else { - title_create_windows(); + TitleCreateWindows(); } } else @@ -429,8 +429,8 @@ static void ShortcutQuickSaveGame() else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent.PutExtra(INTENT_EXTRA_PATH, gScenarioName); ContextOpenIntent(&intent); } } diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index da32ae2d5b..ecdc92e8bb 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -185,7 +185,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) case EntityType::Vehicle: { auto intent = Intent(WD_VEHICLE); - intent.putExtra(INTENT_EXTRA_VEHICLE, entity); + intent.PutExtra(INTENT_EXTRA_VEHICLE, entity); ContextOpenIntent(&intent); break; } @@ -193,7 +193,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) case EntityType::Staff: { auto intent = Intent(WindowClass::Peep); - intent.putExtra(INTENT_EXTRA_PEEP, entity); + intent.PutExtra(INTENT_EXTRA_PEEP, entity); ContextOpenIntent(&intent); break; } @@ -226,7 +226,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) case ViewportInteractionItem::Ride: { auto intent = Intent(WD_TRACK); - intent.putExtra(INTENT_EXTRA_TILE_ELEMENT, info.Element); + intent.PutExtra(INTENT_EXTRA_TILE_ELEMENT, info.Element); ContextOpenIntent(&intent); return true; } diff --git a/src/openrct2-ui/scripting/ScTitleSequence.hpp b/src/openrct2-ui/scripting/ScTitleSequence.hpp index 37d485338f..d6dfd60c22 100644 --- a/src/openrct2-ui/scripting/ScTitleSequence.hpp +++ b/src/openrct2-ui/scripting/ScTitleSequence.hpp @@ -265,7 +265,7 @@ namespace OpenRCT2::Scripting } if (isScenario) - scenario_begin(); + ScenarioBegin(); else GameLoadInit(); gLoadKeepWindowsOpen = old; @@ -446,7 +446,7 @@ namespace OpenRCT2::Scripting bool isPlaying_get() const { auto index = GetManagerIndex(); - return index && title_is_previewing_sequence() && *index == title_get_current_sequence(); + return index && TitleIsPreviewingSequence() && *index == TitleGetCurrentSequence(); } DukValue position_get() const @@ -454,7 +454,7 @@ namespace OpenRCT2::Scripting auto ctx = GetContext()->GetScriptEngine().GetContext(); if (isPlaying_get()) { - auto* player = static_cast(title_get_sequence_player()); + auto* player = static_cast(TitleGetSequencePlayer()); if (player != nullptr) { return ToDuk(ctx, player->GetCurrentPosition()); @@ -467,9 +467,9 @@ namespace OpenRCT2::Scripting { auto ctx = GetContext()->GetScriptEngine().GetContext(); auto index = GetManagerIndex(); - if (index && (!title_is_previewing_sequence() || *index != title_get_current_sequence())) + if (index && (!TitleIsPreviewingSequence() || *index != TitleGetCurrentSequence())) { - if (!title_preview_sequence(*index)) + if (!TitlePreviewSequence(*index)) { duk_error(ctx, DUK_ERR_ERROR, "Failed to load title sequence"); } @@ -485,7 +485,7 @@ namespace OpenRCT2::Scripting auto ctx = GetContext()->GetScriptEngine().GetContext(); if (isPlaying_get()) { - auto* player = static_cast(title_get_sequence_player()); + auto* player = static_cast(TitleGetSequencePlayer()); try { player->Seek(position); @@ -502,7 +502,7 @@ namespace OpenRCT2::Scripting { if (isPlaying_get()) { - title_stop_previewing_sequence(); + TitleStopPreviewingSequence(); } } diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index f649444a97..e71fe1ec0c 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -251,7 +251,7 @@ private: void JumpForwardToSaveScenario() const { - const auto savePrepareResult = scenario_prepare_for_save(); + const auto savePrepareResult = ScenarioPrepareForSave(); if (!savePrepareResult.Successful) { ContextShowError(STR_UNABLE_TO_SAVE_SCENARIO_FILE, savePrepareResult.Message, {}); @@ -261,8 +261,8 @@ private: WindowCloseAll(); auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); - intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); + intent.PutExtra(INTENT_EXTRA_PATH, gScenarioName); ContextOpenIntent(&intent); } diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 538a39e5ff..5467eb6d24 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -384,12 +384,12 @@ public: if (researchItem->type == Research::EntryType::Ride) objectEntryType = ObjectType::Ride; - auto chunk = object_entry_get_chunk(objectEntryType, researchItem->entryIndex); + auto chunk = ObjectEntryGetChunk(objectEntryType, researchItem->entryIndex); if (chunk == nullptr) return; // Draw preview - const auto* object = object_entry_get_object(objectEntryType, researchItem->entryIndex); + const auto* object = ObjectEntryGetObject(objectEntryType, researchItem->entryIndex); if (object != nullptr) { rct_drawpixelinfo clipDPI; diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 4587c2fc9e..1206334800 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -362,7 +362,7 @@ public: { GameNotifyMapChange(); GameUnloadScripts(); - title_load(); + TitleLoad(); } break; case WIDX_FILTER_RIDE_TAB_ALL: @@ -411,7 +411,7 @@ public: Invalidate(); auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); ContextOpenIntent(&intent); break; } @@ -1119,12 +1119,12 @@ private: void VisibleListRefresh() { - int32_t numObjects = static_cast(object_repository_get_items_count()); + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); VisibleListDispose(); selected_list_item = -1; - const ObjectRepositoryItem* items = object_repository_get_items(); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); for (int32_t i = 0; i < numObjects; i++) { uint8_t selectionFlags = _objectSelectionFlags[i]; @@ -1268,7 +1268,7 @@ private: screenPos.y += LIST_ROW_HEIGHT; // Draw object source - auto stringId = object_manager_get_source_game_string(listItem->repositoryItem->GetFirstSourceGame()); + auto stringId = ObjectManagerGetSourceGameString(listItem->repositoryItem->GetFirstSourceGame()); DrawTextBasic(dpi, screenPos, stringId, {}, { COLOUR_WHITE, TextAlignment::RIGHT }); screenPos.y += LIST_ROW_HEIGHT; @@ -1431,8 +1431,8 @@ private: const auto& selectionFlags = _objectSelectionFlags; std::fill(std::begin(_filter_object_counts), std::end(_filter_object_counts), 0); - size_t numObjects = object_repository_get_items_count(); - const ObjectRepositoryItem* items = object_repository_get_items(); + size_t numObjects = ObjectRepositoryGetItemsCount(); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); for (size_t i = 0; i < numObjects; i++) { const ObjectRepositoryItem* item = &items[i]; @@ -1502,15 +1502,15 @@ private: gEditorStep = EditorStep::DesignsManager; int32_t entry_index = 0; - for (; object_entry_get_chunk(ObjectType::Ride, entry_index) == nullptr; entry_index++) + for (; ObjectEntryGetChunk(ObjectType::Ride, entry_index) == nullptr; entry_index++) ; rct_ride_entry* ride_entry = GetRideEntryByIndex(entry_index); auto rideType = ride_entry->GetFirstNonNullRideType(); auto intent = Intent(WindowClass::TrackDesignList); - intent.putExtra(INTENT_EXTRA_RIDE_TYPE, rideType); - intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, entry_index); + intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, rideType); + intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, entry_index); ContextOpenIntent(&intent); } }; @@ -1562,8 +1562,8 @@ static StringId GetRideTypeStringId(const ObjectRepositoryItem* item) void EditorLoadSelectedObjects() { auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); - int32_t numItems = static_cast(object_repository_get_items_count()); - const ObjectRepositoryItem* items = object_repository_get_items(); + int32_t numItems = static_cast(ObjectRepositoryGetItemsCount()); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); bool showFallbackWarning = false; for (int32_t i = 0; i < numItems; i++) { @@ -1583,7 +1583,7 @@ void EditorLoadSelectedObjects() { // Defaults selected items to researched (if in-game) auto objectType = loadedObject->GetObjectType(); - auto entryIndex = object_manager_get_loaded_object_entry_index(loadedObject); + auto entryIndex = ObjectManagerGetLoadedObjectEntryIndex(loadedObject); if (objectType == ObjectType::Ride) { rct_ride_entry* rideEntry = GetRideEntryByIndex(entryIndex); diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 4a62cdb8fd..d9ea1a785e 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1288,7 +1288,7 @@ private: return; auto intent = Intent(WindowClass::Ride); - intent.putExtra(INTENT_EXTRA_RIDE_ID, list_item_positions[index]); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, list_item_positions[index]); ContextOpenIntent(&intent); } diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index e5d9319ae7..7cf53c478f 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -197,10 +197,10 @@ public: { auto ft = Formatter(); - const auto* objectEntry = object_manager_load_object(&td6->vehicle_object.Entry); + const auto* objectEntry = ObjectManagerLoadObject(&td6->vehicle_object.Entry); if (objectEntry != nullptr) { - auto groupIndex = object_manager_get_loaded_object_entry_index(objectEntry); + auto groupIndex = ObjectManagerGetLoadedObjectEntryIndex(objectEntry); auto rideName = GetRideNaming(td6->type, *GetRideEntryByIndex(groupIndex)); ft.Add(rideName.Name); } @@ -410,13 +410,13 @@ rct_window* WindowInstallTrackOpen(const utf8* path) return nullptr; } - object_manager_unload_all_objects(); + ObjectManagerUnloadAllObjects(); if (trackDesign->type == RIDE_TYPE_NULL) { LOG_ERROR("Failed to load track (ride type null): %s", path); return nullptr; } - if (object_manager_load_object(&trackDesign->vehicle_object.Entry) == nullptr) + if (ObjectManagerLoadObject(&trackDesign->vehicle_object.Entry) == nullptr) { LOG_ERROR("Failed to load track (vehicle load fail): %s", path); return nullptr; diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 8d1f340060..a313b3a50b 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -285,7 +285,7 @@ static void Select(const char* path) case (LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME): SetAndSaveConfigPath(gConfigGeneral.LastSaveGameDirectory, pathBuffer); - if (scenario_save(pathBuffer, gConfigGeneral.SavePluginData ? 1 : 0)) + if (ScenarioSave(pathBuffer, gConfigGeneral.SavePluginData ? 1 : 0)) { gScenarioSavePath = pathBuffer; gCurrentLoadedPath = pathBuffer; @@ -323,7 +323,7 @@ static void Select(const char* path) case (LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE): SetAndSaveConfigPath(gConfigGeneral.LastSaveLandscapeDirectory, pathBuffer); gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer))); - if (scenario_save(pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2)) + if (ScenarioSave(pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2)) { gCurrentLoadedPath = pathBuffer; WindowCloseByClass(WindowClass::Loadsave); @@ -344,14 +344,14 @@ static void Select(const char* path) gParkFlags &= ~PARK_FLAGS_SPRITES_INITIALISED; gEditorStep = EditorStep::Invalid; gScenarioFileName = std::string(String::ToStringView(pathBuffer, std::size(pathBuffer))); - int32_t success = scenario_save(pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2); + int32_t success = ScenarioSave(pathBuffer, gConfigGeneral.SavePluginData ? 3 : 2); gParkFlags = parkFlagsBackup; if (success) { WindowCloseByClass(WindowClass::Loadsave); InvokeCallback(MODAL_RESULT_OK, pathBuffer); - title_load(); + TitleLoad(); } else { @@ -366,7 +366,7 @@ static void Select(const char* path) { SetAndSaveConfigPath(gConfigGeneral.LastSaveTrackDirectory, pathBuffer); auto intent = Intent(WindowClass::InstallTrack); - intent.putExtra(INTENT_EXTRA_PATH, std::string{ pathBuffer }); + intent.PutExtra(INTENT_EXTRA_PATH, std::string{ pathBuffer }); ContextOpenIntent(&intent); WindowCloseByClass(WindowClass::Loadsave); InvokeCallback(MODAL_RESULT_OK, pathBuffer); diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index a8d75b9ccd..f1e2797b70 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -1205,8 +1205,8 @@ static void WindowMapgenHeightmapMouseup(rct_window* w, WidgetIndex widgetIndex) case WIDX_HEIGHTMAP_SELECT: { auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowMapgenHeightmapLoadsaveCallback)); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowMapgenHeightmapLoadsaveCallback)); ContextOpenIntent(&intent); return; } diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index d11e5136d2..eac61d5b47 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -134,7 +134,7 @@ public: else { auto intent = Intent(WindowClass::Ride); - intent.putExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); ContextOpenIntent(&intent); } } diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 8b044e9cee..c5f331a7a9 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -528,8 +528,8 @@ private: if (count > 0) { auto intent = Intent(WindowClass::TrackDesignList); - intent.putExtra(INTENT_EXTRA_RIDE_TYPE, item.Type); - intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.EntryIndex); + intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, item.Type); + intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.EntryIndex); ContextOpenIntent(&intent); return; } diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index 53cd4c803c..d9145c7cd3 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -134,8 +134,8 @@ private: } auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string(str_downloading_objects)); - intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { _downloadingObjects = false; }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string(str_downloading_objects)); + intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { _downloadingObjects = false; }); ContextOpenIntent(&intent); } } @@ -539,7 +539,7 @@ public: if (entry.Generation == ObjectGeneration::DAT) { // ... source game ... - const auto sourceStringId = object_manager_get_source_game_string(entry.Entry.GetSourceGame()); + const auto sourceStringId = ObjectManagerGetSourceGameString(entry.Entry.GetSourceGame()); DrawTextBasic(&dpi, { SOURCE_COL_LEFT - 3, screenCoords.y }, sourceStringId, {}, { COLOUR_DARK_GREEN }); } diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 8ed23761a3..7f5b01c755 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -1713,11 +1713,11 @@ private: { case WIDX_TITLE_SEQUENCE_DROPDOWN: { - uint32_t numItems = static_cast(title_sequence_manager_get_count()); + uint32_t numItems = static_cast(TitleSequenceManagerGetCount()); for (size_t i = 0; i < numItems; i++) { gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; - gDropdownItems[i].Args = reinterpret_cast(title_sequence_manager_get_name(i)); + gDropdownItems[i].Args = reinterpret_cast(TitleSequenceManagerGetName(i)); } gDropdownItems[numItems].Format = 0; @@ -1731,7 +1731,7 @@ private: Dropdown::Flag::StayOpen, numItems); auto selectedIndex = gConfigInterface.RandomTitleSequence ? numItems - 1 - : static_cast(title_get_current_sequence()); + : static_cast(TitleGetCurrentSequence()); Dropdown::SetChecked(selectedIndex, true); break; } @@ -1770,11 +1770,11 @@ private: { case WIDX_TITLE_SEQUENCE_DROPDOWN: { - auto numItems = static_cast(title_sequence_manager_get_count()); - if (dropdownIndex < numItems && dropdownIndex != static_cast(title_get_current_sequence())) + auto numItems = static_cast(TitleSequenceManagerGetCount()); + if (dropdownIndex < numItems && dropdownIndex != static_cast(TitleGetCurrentSequence())) { gConfigInterface.RandomTitleSequence = false; - title_sequence_change_preset(static_cast(dropdownIndex)); + TitleSequenceChangePreset(static_cast(dropdownIndex)); ConfigSaveDefault(); Invalidate(); } @@ -1816,7 +1816,7 @@ private: } else { - auto name = title_sequence_manager_get_name(title_get_config_sequence()); + auto name = TitleSequenceManagerGetName(TitleGetConfigSequence()); ft.Add(STR_STRING); ft.Add(name); } diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index a278a8663f..6c2a3ded04 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -1037,7 +1037,7 @@ private: if (widgetIndex == WIDX_ENTER_NAME && !text.empty()) { std::string strText(text); - scenario_success_submit_name(strText.c_str()); + ScenarioSuccessSubmitName(strText.c_str()); Invalidate(); } } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index ddfd3d28cf..a6fd012b75 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1364,7 +1364,7 @@ rct_window* WindowRideOpenVehicle(Vehicle* vehicle) if (w2 == nullptr) { auto intent = Intent(WindowClass::Peep); - intent.putExtra(INTENT_EXTRA_PEEP, peep); + intent.PutExtra(INTENT_EXTRA_PEEP, peep); ContextOpenIntent(&intent); openedPeepWindow = 1; @@ -3754,7 +3754,7 @@ static void WindowRideLocateMechanic(rct_window* w) else { auto intent = Intent(WindowClass::Peep); - intent.putExtra(INTENT_EXTRA_PEEP, mechanic); + intent.PutExtra(INTENT_EXTRA_PEEP, mechanic); ContextOpenIntent(&intent); } } @@ -5377,10 +5377,10 @@ static void WindowRideMeasurementsDesignSave(rct_window* w) auto trackName = ride->GetName(); auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK); - intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, _trackDesign.get()); - intent.putExtra(INTENT_EXTRA_PATH, trackName); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(&TrackDesignCallback)); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK); + intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, _trackDesign.get()); + intent.PutExtra(INTENT_EXTRA_PATH, trackName); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(&TrackDesignCallback)); ContextOpenIntent(&intent); } @@ -6854,24 +6854,24 @@ static void WindowRideCustomerMouseup(rct_window* w, WidgetIndex widgetIndex) case WIDX_SHOW_GUESTS_THOUGHTS: { auto intent = Intent(WindowClass::GuestList); - intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingAboutRide)); - intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); + intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingAboutRide)); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, w->number); ContextOpenIntent(&intent); break; } case WIDX_SHOW_GUESTS_ON_RIDE: { auto intent = Intent(WindowClass::GuestList); - intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsOnRide)); - intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); + intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsOnRide)); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, w->number); ContextOpenIntent(&intent); break; } case WIDX_SHOW_GUESTS_QUEUING: { auto intent = Intent(WindowClass::GuestList); - intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsInQueue)); - intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); + intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsInQueue)); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, w->number); ContextOpenIntent(&intent); break; } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index e7b27f6612..83f7b2316a 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -168,7 +168,7 @@ static constexpr const StringId RideConstructionSeatAngleRotationStrings[] = { STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_450, STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_495, }; -static void window_ride_construction_mouseup_demolish_next_piece(const CoordsXYZD& piecePos, int32_t type); +static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type); static int32_t RideGetAlternativeType(const Ride& ride) { @@ -283,7 +283,7 @@ public: currentRide->SetToDefaultInspectionInterval(); auto intent = Intent(WindowClass::Ride); - intent.putExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); ContextOpenIntent(&intent); } else @@ -2389,8 +2389,7 @@ private: auto currentRide = GetRide(_currentRideIndex); if (currentRide != nullptr) { - window_ride_construction_mouseup_demolish_next_piece( - { *newCoords, static_cast(direction) }, type); + WindowRideConstructionMouseUpDemolishNextPiece({ *newCoords, static_cast(direction) }, type); } } }); @@ -2806,7 +2805,7 @@ static void CloseConstructWindowOnCompletion(const Ride& ride) } } -static void window_ride_construction_do_entrance_exit_check() +static void WindowRideConstructionDoEntranceExitCheck() { auto w = WindowFindByClass(WindowClass::RideConstruction); auto ride = GetRide(_currentRideIndex); @@ -2864,7 +2863,7 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c _rideConstructionState = RideConstructionState::State0; } - window_ride_construction_do_entrance_exit_check(); + WindowRideConstructionDoEntranceExitCheck(); WindowRideConstructionUpdateActiveElements(); } @@ -4545,7 +4544,7 @@ void WindowRideConstructionKeyboardShortcutDemolishCurrent() WindowEventMouseUpCall(w, WIDX_DEMOLISH); } -static void window_ride_construction_mouseup_demolish_next_piece(const CoordsXYZD& piecePos, int32_t type) +static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type) { if (_gotoStartPlacementMode) { diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index e5d297d1ce..891876d7fd 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -411,7 +411,7 @@ public: else { auto intent = Intent(WindowClass::Ride); - intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex.ToUnderlying()); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, rideIndex.ToUnderlying()); ContextOpenIntent(&intent); } } diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index b918b764a9..652cd7d698 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -159,15 +159,15 @@ public: if (gScreenFlags & (SCREEN_FLAGS_EDITOR)) { intent = std::make_unique(WindowClass::Loadsave); - intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent->putExtra(INTENT_EXTRA_PATH, gScenarioName); + intent->PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent->PutExtra(INTENT_EXTRA_PATH, gScenarioName); } else { intent = CreateSaveGameAsIntent(); } Close(); - intent->putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowSavePromptCallback)); + intent->PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowSavePromptCallback)); ContextOpenIntent(intent.get()); break; } diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 14ed303abf..563a16b547 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -181,7 +181,7 @@ rct_window* WindowScenarioselectOpen(std::function callb _disableLocking = disableLocking; // Load scenario list - scenario_repository_scan(); + ScenarioRepositoryScan(); window = WindowCreateCentred( WW, WH, &window_scenarioselect_events, WindowClass::ScenarioSelect, WF_10 | (titleEditor ? WF_STICK_TO_FRONT : 0)); @@ -203,10 +203,10 @@ rct_window* WindowScenarioselectOpen(std::function callb static void WindowScenarioselectInitTabs(rct_window* w) { int32_t showPages = 0; - size_t numScenarios = scenario_repository_get_count(); + size_t numScenarios = ScenarioRepositoryGetCount(); for (size_t i = 0; i < numScenarios; i++) { - const scenario_index_entry* scenario = scenario_repository_get_by_index(i); + const scenario_index_entry* scenario = ScenarioRepositoryGetByIndex(i); if (gConfigGeneral.ScenarioSelectMode == SCENARIO_SELECT_MODE_ORIGIN || _titleEditor) { if (_titleEditor && scenario->source_game == ScenarioSource::Other) @@ -687,7 +687,7 @@ static void DrawCategoryHeading( static void InitialiseListItems(rct_window* w) { - size_t numScenarios = scenario_repository_get_count(); + size_t numScenarios = ScenarioRepositoryGetCount(); _listItems.clear(); // Mega park unlock @@ -699,7 +699,7 @@ static void InitialiseListItems(rct_window* w) uint8_t currentHeading = UINT8_MAX; for (size_t i = 0; i < numScenarios; i++) { - const scenario_index_entry* scenario = scenario_repository_get_by_index(i); + const scenario_index_entry* scenario = ScenarioRepositoryGetByIndex(i); if (!IsScenarioVisible(w, scenario)) continue; diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 56016694bc..25b3c07622 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -139,8 +139,8 @@ public: case WIDX_LOAD_SERVER: network_set_password(_password); auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(LoadSaveCallback)); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(LoadSaveCallback)); ContextOpenIntent(&intent); break; } diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 5a41d02848..aee03087d8 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -381,7 +381,7 @@ private: case WIDX_FIRE: { auto intent = Intent(WindowClass::FirePrompt); - intent.putExtra(INTENT_EXTRA_PEEP, staff); + intent.PutExtra(INTENT_EXTRA_PEEP, staff); ContextOpenIntent(&intent); break; } diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index f3115dacd4..3deb856468 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -356,7 +356,7 @@ public: if (peep != nullptr) { auto intent = Intent(WindowClass::Peep); - intent.putExtra(INTENT_EXTRA_PEEP, peep); + intent.PutExtra(INTENT_EXTRA_PEEP, peep); ContextOpenIntent(&intent); } } @@ -530,7 +530,7 @@ private: // Open window for new staff. auto* staff = GetEntity(actionResult.StaffEntityId); auto intent = Intent(WindowClass::Peep); - intent.putExtra(INTENT_EXTRA_PEEP, staff); + intent.PutExtra(INTENT_EXTRA_PEEP, staff); ContextOpenIntent(&intent); }); diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index dad2766f2f..20fafb8e91 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 7a77d1a809..f8dea9aa05 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -582,8 +582,8 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) { auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); - intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); + intent.PutExtra(INTENT_EXTRA_PATH, gScenarioName); ContextOpenIntent(&intent); } else diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 9aa294a10c..c1efe0697a 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -127,8 +127,8 @@ public: Close(); auto intent = Intent(WindowClass::TrackDesignList); - intent.putExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.Type); - intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, _window_track_list_item.EntryIndex); + intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.Type); + intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, _window_track_list_item.EntryIndex); ContextOpenIntent(&intent); break; } @@ -240,7 +240,7 @@ public: if (TrackDesignAreEntranceAndExitPlaced()) { auto intent = Intent(WindowClass::Ride); - intent.putExtra(INTENT_EXTRA_RIDE_ID, rideId.ToUnderlying()); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, rideId.ToUnderlying()); ContextOpenIntent(&intent); auto wnd = WindowFindByClass(WindowClass::TrackDesignPlace); WindowClose(*wnd); diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 91154d5aa1..79c2655803 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -137,7 +137,7 @@ private: if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { auto intent = Intent(WindowClass::ManageTrackDesign); - intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); + intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); ContextOpenIntent(&intent); } else @@ -149,7 +149,7 @@ private: } auto intent = Intent(WindowClass::TrackDesignPlace); - intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); + intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); ContextOpenIntent(&intent); } } diff --git a/src/openrct2-ui/windows/Window.h b/src/openrct2-ui/windows/Window.h index 366181fb4b..175d9d2944 100644 --- a/src/openrct2-ui/windows/Window.h +++ b/src/openrct2-ui/windows/Window.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include using loadsave_callback = void (*)(int32_t result, const utf8* path); diff --git a/src/openrct2/CmdlineSprite.cpp b/src/openrct2/CmdlineSprite.cpp index 51d0813f24..76fc3a04da 100644 --- a/src/openrct2/CmdlineSprite.cpp +++ b/src/openrct2/CmdlineSprite.cpp @@ -408,7 +408,7 @@ int32_t CmdLineForSprite(const char** argv, int32_t argc) auto context = OpenRCT2::CreateContext(); context->Initialise(); - const ObjectRepositoryItem* ori = object_repository_find_object_by_name(datName); + const ObjectRepositoryItem* ori = ObjectRepositoryFindObjectByName(datName); if (ori == nullptr) { fprintf(stderr, "Could not find the object.\n"); @@ -416,13 +416,13 @@ int32_t CmdLineForSprite(const char** argv, int32_t argc) } const rct_object_entry* entry = &ori->ObjectEntry; - const auto* loadedObject = object_manager_load_object(entry); + const auto* loadedObject = ObjectManagerLoadObject(entry); if (loadedObject == nullptr) { fprintf(stderr, "Unable to load object.\n"); return -1; } - auto entryIndex = object_manager_get_loaded_object_entry_index(loadedObject); + auto entryIndex = ObjectManagerGetLoadedObjectEntryIndex(loadedObject); ObjectType objectType = entry->GetType(); auto& objManager = context->GetObjectManager(); diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 6082798ac2..78aaa4de25 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -334,7 +334,7 @@ namespace OpenRCT2 } _initialised = true; - crash_init(); + CrashInit(); if (String::Equals(gConfigGeneral.LastRunVersion, OPENRCT2_VERSION)) { @@ -564,12 +564,12 @@ namespace OpenRCT2 CrashAdditionalFileRegistration(const std::string& path) { // Register the file for crash upload if it asserts while loading. - crash_register_additional_file("load_park", path); + CrashRegisterAdditionalFile("load_park", path); } ~CrashAdditionalFileRegistration() { // Deregister park file in case it was processed without hitting an assert. - crash_unregister_additional_file("load_park"); + CrashUnregisterAdditionalFile("load_park"); } } crash_additional_file_registration(path); @@ -598,7 +598,7 @@ namespace OpenRCT2 Console::Error::WriteLine(e.what()); if (loadTitleScreenOnFail) { - title_load(); + TitleLoad(); } auto windowManager = _uiContext->GetWindowManager(); windowManager->ShowError(STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, STR_NONE, {}); @@ -678,7 +678,7 @@ namespace OpenRCT2 } else { - scenario_begin(); + ScenarioBegin(); #ifndef DISABLE_NETWORK if (_network.GetMode() == NETWORK_MODE_SERVER) { @@ -730,14 +730,14 @@ namespace OpenRCT2 // If loading the SV6 or SV4 failed return to the title screen if requested. if (loadTitleScreenFirstOnFail) { - title_load(); + TitleLoad(); } // The path needs to be duplicated as it's a const here // which the window function doesn't like auto intent = Intent(WindowClass::ObjectLoadError); - intent.putExtra(INTENT_EXTRA_PATH, path); - intent.putExtra(INTENT_EXTRA_LIST, const_cast(e.MissingObjects.data())); - intent.putExtra(INTENT_EXTRA_LIST_COUNT, static_cast(e.MissingObjects.size())); + intent.PutExtra(INTENT_EXTRA_PATH, path); + intent.PutExtra(INTENT_EXTRA_LIST, const_cast(e.MissingObjects.data())); + intent.PutExtra(INTENT_EXTRA_LIST_COUNT, static_cast(e.MissingObjects.size())); auto windowManager = _uiContext->GetWindowManager(); windowManager->OpenIntent(&intent); @@ -749,7 +749,7 @@ namespace OpenRCT2 // If loading the SV6 or SV4 failed return to the title screen if requested. if (loadTitleScreenFirstOnFail) { - title_load(); + TitleLoad(); } auto windowManager = _uiContext->GetWindowManager(); windowManager->ShowError(STR_FILE_CONTAINS_UNSUPPORTED_RIDE_TYPES, STR_NONE, {}); @@ -760,7 +760,7 @@ namespace OpenRCT2 if (loadTitleScreenFirstOnFail) { - title_load(); + TitleLoad(); } auto windowManager = _uiContext->GetWindowManager(); Formatter ft; @@ -791,7 +791,7 @@ namespace OpenRCT2 // If loading the SV6 or SV4 failed return to the title screen if requested. if (loadTitleScreenFirstOnFail) { - title_load(); + TitleLoad(); } Console::Error::WriteLine(e.what()); } @@ -894,10 +894,10 @@ namespace OpenRCT2 { case StartupAction::Intro: gIntroState = IntroState::PublisherBegin; - title_load(); + TitleLoad(); break; case StartupAction::Title: - title_load(); + TitleLoad(); break; case StartupAction::Open: { @@ -910,7 +910,7 @@ namespace OpenRCT2 auto data = DownloadPark(gOpenRCT2StartupActionPath); if (data.empty()) { - title_load(); + TitleLoad(); break; } @@ -918,7 +918,7 @@ namespace OpenRCT2 if (!LoadParkFromStream(&ms, gOpenRCT2StartupActionPath, true)) { Console::Error::WriteLine("Failed to load '%s'", gOpenRCT2StartupActionPath); - title_load(); + TitleLoad(); break; } #endif @@ -936,7 +936,7 @@ namespace OpenRCT2 { Console::Error::WriteLine("Failed to load '%s'", gOpenRCT2StartupActionPath); Console::Error::WriteLine("%s", ex.what()); - title_load(); + TitleLoad(); break; } } @@ -981,7 +981,7 @@ namespace OpenRCT2 } else if (!Editor::LoadLandscape(gOpenRCT2StartupActionPath)) { - title_load(); + TitleLoad(); } break; default: diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 4450badf72..26ade90ef8 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -126,8 +126,8 @@ namespace Editor { ToolCancel(); auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(ConvertSaveToScenarioCallback)); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(ConvertSaveToScenarioCallback)); ContextOpenIntent(&intent); } @@ -143,7 +143,7 @@ namespace Editor return; } - scenario_reset(); + ScenarioReset(); gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; gEditorStep = EditorStep::ObjectiveSelection; @@ -164,7 +164,7 @@ namespace Editor gScreenFlags = SCREEN_FLAGS_TRACK_DESIGNER; gScreenAge = 0; - object_manager_unload_all_objects(); + ObjectManagerUnloadAllObjects(); ObjectListLoad(); OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); SetAllLandOwned(); @@ -185,7 +185,7 @@ namespace Editor gScreenFlags = SCREEN_FLAGS_TRACK_MANAGER; gScreenAge = 0; - object_manager_unload_all_objects(); + ObjectManagerUnloadAllObjects(); ObjectListLoad(); OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); SetAllLandOwned(); @@ -374,7 +374,7 @@ namespace Editor if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - object_manager_unload_all_objects(); + ObjectManagerUnloadAllObjects(); } ContextOpenWindow(WindowClass::EditorObjectSelection); diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 58d58d5e26..1a12aef9fd 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -64,8 +64,8 @@ static constexpr ResultWithMessage ObjectSelectionError(bool isMasterObject, Str */ static void SetupTrackManagerObjects() { - int32_t numObjects = static_cast(object_repository_get_items_count()); - const ObjectRepositoryItem* items = object_repository_get_items(); + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); for (int32_t i = 0; i < numObjects; i++) { uint8_t* selectionFlags = &_objectSelectionFlags[i]; @@ -92,8 +92,8 @@ static void SetupTrackManagerObjects() */ static void SetupTrackDesignerObjects() { - int32_t numObjects = static_cast(object_repository_get_items_count()); - const ObjectRepositoryItem* items = object_repository_get_items(); + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); SelectDesignerObjects(); for (int32_t i = 0; i < numObjects; i++) { @@ -257,8 +257,8 @@ void SetupInUseSelectionFlags() } } - auto numObjects = object_repository_get_items_count(); - const auto* items = object_repository_get_items(); + auto numObjects = ObjectRepositoryGetItemsCount(); + const auto* items = ObjectRepositoryGetItems(); for (size_t i = 0; i < numObjects; i++) { auto* selectionFlags = &_objectSelectionFlags[i]; @@ -280,7 +280,7 @@ void SetupInUseSelectionFlags() */ void sub_6AB211() { - int32_t numObjects = static_cast(object_repository_get_items_count()); + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); _objectSelectionFlags = std::vector(numObjects); for (uint8_t objectType = 0; objectType < EnumValue(ObjectType::Count); objectType++) @@ -289,7 +289,7 @@ void sub_6AB211() _numAvailableObjectsForType[objectType] = 0; } - const ObjectRepositoryItem* items = object_repository_get_items(); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); for (int32_t i = 0; i < numObjects; i++) { ObjectType objectType = items[i].Type; @@ -378,8 +378,8 @@ static void RemoveSelectedObjectsFromResearch(const ObjectEntryDescriptor& descr */ void UnloadUnselectedObjects() { - auto numItems = static_cast(object_repository_get_items_count()); - const auto* items = object_repository_get_items(); + auto numItems = static_cast(ObjectRepositoryGetItemsCount()); + const auto* items = ObjectRepositoryGetItems(); std::vector objectsToUnload; for (int32_t i = 0; i < numItems; i++) @@ -394,7 +394,7 @@ void UnloadUnselectedObjects() } } } - object_manager_unload_objects(objectsToUnload); + ObjectManagerUnloadObjects(objectsToUnload); } /** @@ -467,8 +467,8 @@ void ResetSelectedObjectCountAndSize() objectType = 0; } - int32_t numObjects = static_cast(object_repository_get_items_count()); - const ObjectRepositoryItem* items = object_repository_get_items(); + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); for (int32_t i = 0; i < numObjects; i++) { ObjectType objectType = items[i].Type; @@ -509,10 +509,10 @@ ResultWithMessage WindowEditorObjectSelectionSelectObject( return ObjectSelectionError(isMasterObject, STR_OBJECT_SELECTION_ERR_OBJECT_DATA_NOT_FOUND); } - int32_t numObjects = static_cast(object_repository_get_items_count()); + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); // Get repository item index int32_t index = -1; - const ObjectRepositoryItem* items = object_repository_get_items(); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); for (int32_t i = 0; i < numObjects; i++) { if (&items[i] == item) @@ -594,7 +594,7 @@ ResultWithMessage WindowEditorObjectSelectionSelectObject( if (isMasterObject != 0 && !(flags & INPUT_FLAG_EDITOR_OBJECT_1)) { char objectName[64]; - object_create_identifier_name(objectName, 64, &item->ObjectEntry); + ObjectCreateIdentifierName(objectName, 64, &item->ObjectEntry); auto ft = Formatter::Common(); ft.Add(objectName); return ObjectSelectionError(isMasterObject, STR_OBJECT_SELECTION_ERR_SHOULD_SELECT_X_FIRST); @@ -621,8 +621,8 @@ ResultWithMessage WindowEditorObjectSelectionSelectObject( bool EditorCheckObjectGroupAtLeastOneSelected(ObjectType checkObjectType) { - auto numObjects = std::min(object_repository_get_items_count(), _objectSelectionFlags.size()); - const ObjectRepositoryItem* items = object_repository_get_items(); + auto numObjects = std::min(ObjectRepositoryGetItemsCount(), _objectSelectionFlags.size()); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); for (size_t i = 0; i < numObjects; i++) { @@ -637,8 +637,8 @@ bool EditorCheckObjectGroupAtLeastOneSelected(ObjectType checkObjectType) bool EditorCheckObjectGroupAtLeastOneSurfaceSelected(bool queue) { - auto numObjects = std::min(object_repository_get_items_count(), _objectSelectionFlags.size()); - const auto* items = object_repository_get_items(); + auto numObjects = std::min(ObjectRepositoryGetItemsCount(), _objectSelectionFlags.size()); + const auto* items = ObjectRepositoryGetItems(); for (size_t i = 0; i < numObjects; i++) { const auto& ori = items[i]; @@ -657,8 +657,8 @@ int32_t EditorRemoveUnusedObjects() sub_6AB211(); SetupInUseSelectionFlags(); - int32_t numObjects = static_cast(object_repository_get_items_count()); - const ObjectRepositoryItem* items = object_repository_get_items(); + int32_t numObjects = static_cast(ObjectRepositoryGetItemsCount()); + const ObjectRepositoryItem* items = ObjectRepositoryGetItems(); int32_t numUnselectedObjects = 0; for (int32_t i = 0; i < numObjects; i++) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 708d097619..95e411a21d 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -148,7 +148,7 @@ enum */ void UpdatePaletteEffects() { - auto water_type = static_cast(object_entry_get_chunk(ObjectType::Water, 0)); + auto water_type = static_cast(ObjectEntryGetChunk(ObjectType::Water, 0)); if (gClimateLightningFlash == 1) { @@ -326,7 +326,7 @@ bool GameIsNotPaused() static void LoadLandscape() { auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE); ContextOpenIntent(&intent); } @@ -595,7 +595,7 @@ void SaveGameCmd(u8string_view name /* = {} */) void SaveGameWithName(u8string_view name) { LOG_VERBOSE("Saving to %s", u8string(name).c_str()); - if (scenario_save(name, gConfigGeneral.SavePluginData ? 1 : 0)) + if (ScenarioSave(name, gConfigGeneral.SavePluginData ? 1 : 0)) { LOG_VERBOSE("Saved to %s", u8string(name).c_str()); gCurrentLoadedPath = name; @@ -609,8 +609,8 @@ std::unique_ptr CreateSaveGameAsIntent() auto name = Path::GetFileNameWithoutExtension(gScenarioSavePath); auto intent = std::make_unique(WindowClass::Loadsave); - intent->putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME); - intent->putExtra(INTENT_EXTRA_PATH, name); + intent->PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME); + intent->PutExtra(INTENT_EXTRA_PATH, name); return intent; } @@ -717,7 +717,7 @@ void GameAutosave() File::Copy(path, backupPath, true); } - if (!scenario_save(path, saveFlags)) + if (!ScenarioSave(path, saveFlags)) Console::Error::WriteLine("Could not autosave the scenario. Is the save folder writeable?"); } @@ -765,8 +765,8 @@ void GameLoadOrQuitNoSavePrompt() else { auto intent = Intent(WindowClass::Loadsave); - intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(GameLoadOrQuitNoSavePromptCallback)); + intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(GameLoadOrQuitNoSavePromptCallback)); ContextOpenIntent(&intent); } break; @@ -784,7 +784,7 @@ void GameLoadOrQuitNoSavePrompt() gFirstTimeSaving = true; GameNotifyMapChange(); GameUnloadScripts(); - title_load(); + TitleLoad(); break; } case PromptMode::SaveBeforeNewGame: @@ -793,7 +793,7 @@ void GameLoadOrQuitNoSavePrompt() GameActions::Execute(&loadOrQuitAction); ToolCancel(); auto intent = Intent(WindowClass::ScenarioSelect); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(NewGameWindowCallback)); + intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(NewGameWindowCallback)); ContextOpenIntent(&intent); break; } diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index a332d36ab9..ec3fd300ea 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -237,7 +237,7 @@ void GameState::Tick() if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && !(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { - scenario_autosave_check(); + ScenarioAutosaveCheck(); } WindowDispatchUpdateAll(); @@ -317,7 +317,7 @@ void GameState::UpdateLogic(LogicTimings* timings) _date = Date(static_cast(gDateMonthsElapsed), gDateMonthTicks); report_time(LogicTimePart::Date); - scenario_update(); + ScenarioUpdate(); report_time(LogicTimePart::Scenario); ClimateUpdate(); report_time(LogicTimePart::Climate); @@ -406,5 +406,5 @@ void GameState::CreateStateSnapshot() auto& snapshot = snapshots->CreateSnapshot(); snapshots->Capture(snapshot); - snapshots->LinkSnapshot(snapshot, gCurrentTicks, scenario_rand_state().s0); + snapshots->LinkSnapshot(snapshot, gCurrentTicks, ScenarioRandState().s0); } diff --git a/src/openrct2/ReplayManager.cpp b/src/openrct2/ReplayManager.cpp index 3c86059afc..2be3222e00 100644 --- a/src/openrct2/ReplayManager.cpp +++ b/src/openrct2/ReplayManager.cpp @@ -214,7 +214,7 @@ namespace OpenRCT2 auto& snapshot = snapshots->CreateSnapshot(); snapshots->Capture(snapshot); - snapshots->LinkSnapshot(snapshot, gCurrentTicks, scenario_rand_state().s0); + snapshots->LinkSnapshot(snapshot, gCurrentTicks, ScenarioRandState().s0); DataSerialiser snapShotDs(true, snapshotStream); snapshots->SerialiseSnapshot(snapshot, snapShotDs); } @@ -386,7 +386,7 @@ namespace OpenRCT2 auto& localSnapshot = snapshots->CreateSnapshot(); snapshots->Capture(localSnapshot); - snapshots->LinkSnapshot(localSnapshot, gCurrentTicks, scenario_rand_state().s0); + snapshots->LinkSnapshot(localSnapshot, gCurrentTicks, ScenarioRandState().s0); try { GameStateCompareData_t cmpData = snapshots->Compare(replaySnapshot, localSnapshot); diff --git a/src/openrct2/actions/BannerSetColourAction.cpp b/src/openrct2/actions/BannerSetColourAction.cpp index 776eb9d7ed..cb97045409 100644 --- a/src/openrct2/actions/BannerSetColourAction.cpp +++ b/src/openrct2/actions/BannerSetColourAction.cpp @@ -94,7 +94,7 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const if (isExecuting) { auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); - intent.putExtra(INTENT_EXTRA_BANNER_INDEX, index); + intent.PutExtra(INTENT_EXTRA_BANNER_INDEX, index); ContextBroadcastIntent(&intent); banner->colour = _primaryColour; diff --git a/src/openrct2/actions/BannerSetNameAction.cpp b/src/openrct2/actions/BannerSetNameAction.cpp index 7eabbc9b27..1a00728eee 100644 --- a/src/openrct2/actions/BannerSetNameAction.cpp +++ b/src/openrct2/actions/BannerSetNameAction.cpp @@ -65,7 +65,7 @@ GameActions::Result BannerSetNameAction::Execute() const banner->text = _name; auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); - intent.putExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); + intent.PutExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); ContextBroadcastIntent(&intent); ScrollingTextInvalidate(); diff --git a/src/openrct2/actions/BannerSetStyleAction.cpp b/src/openrct2/actions/BannerSetStyleAction.cpp index db24db91d4..203a68fbd6 100644 --- a/src/openrct2/actions/BannerSetStyleAction.cpp +++ b/src/openrct2/actions/BannerSetStyleAction.cpp @@ -152,7 +152,7 @@ GameActions::Result BannerSetStyleAction::Execute() const } auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); - intent.putExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); + intent.PutExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); ContextBroadcastIntent(&intent); return res; diff --git a/src/openrct2/actions/CheatSetAction.cpp b/src/openrct2/actions/CheatSetAction.cpp index 4616442dcf..4024a7940c 100644 --- a/src/openrct2/actions/CheatSetAction.cpp +++ b/src/openrct2/actions/CheatSetAction.cpp @@ -194,7 +194,7 @@ GameActions::Result CheatSetAction::Execute() const Set10MinuteInspection(); break; case CheatType::WinScenario: - scenario_success(); + ScenarioSuccess(); break; case CheatType::ForceWeather: // Todo - make sure this is safe @@ -616,12 +616,12 @@ void CheatSetAction::GiveObjectToGuests(int32_t object) const break; case OBJECT_BALLOON: peep->GiveItem(ShopItem::Balloon); - peep->BalloonColour = scenario_rand_max(COLOUR_COUNT - 1); + peep->BalloonColour = ScenarioRandMax(COLOUR_COUNT - 1); peep->UpdateSpriteType(); break; case OBJECT_UMBRELLA: peep->GiveItem(ShopItem::Umbrella); - peep->UmbrellaColour = scenario_rand_max(COLOUR_COUNT - 1); + peep->UmbrellaColour = ScenarioRandMax(COLOUR_COUNT - 1); peep->UpdateSpriteType(); break; } @@ -745,7 +745,7 @@ void CheatSetAction::CreateDucks(int count) const // 100 attempts at finding some water to create a few ducks at for (int32_t attempts = 0; attempts < 100; attempts++) { - if (scenario_create_ducks()) + if (ScenarioCreateDucks()) break; } } diff --git a/src/openrct2/actions/RideSetVehicleAction.cpp b/src/openrct2/actions/RideSetVehicleAction.cpp index 9fd77a5d76..99ca88f5c4 100644 --- a/src/openrct2/actions/RideSetVehicleAction.cpp +++ b/src/openrct2/actions/RideSetVehicleAction.cpp @@ -201,7 +201,7 @@ GameActions::Result RideSetVehicleAction::Execute() const } auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE); - intent.putExtra(INTENT_EXTRA_RIDE_ID, _rideIndex.ToUnderlying()); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, _rideIndex.ToUnderlying()); ContextBroadcastIntent(&intent); GfxInvalidateScreen(); diff --git a/src/openrct2/actions/SignSetStyleAction.cpp b/src/openrct2/actions/SignSetStyleAction.cpp index d5371b657c..e7bf058b40 100644 --- a/src/openrct2/actions/SignSetStyleAction.cpp +++ b/src/openrct2/actions/SignSetStyleAction.cpp @@ -113,7 +113,7 @@ GameActions::Result SignSetStyleAction::Execute() const } auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); - intent.putExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); + intent.PutExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); ContextBroadcastIntent(&intent); return GameActions::Result(); diff --git a/src/openrct2/actions/StaffHireNewAction.cpp b/src/openrct2/actions/StaffHireNewAction.cpp index 908616f725..52c889f7c6 100644 --- a/src/openrct2/actions/StaffHireNewAction.cpp +++ b/src/openrct2/actions/StaffHireNewAction.cpp @@ -242,7 +242,7 @@ void StaffHireNewAction::AutoPositionNewStaff(Peep* newPeep) const if (count > 0) { // Place staff at a random guest - uint32_t rand = scenario_rand_max(count); + uint32_t rand = ScenarioRandMax(count); Guest* chosenGuest = nullptr; for (auto guest : EntityList()) @@ -278,7 +278,7 @@ void StaffHireNewAction::AutoPositionNewStaff(Peep* newPeep) const // No walking guests; pick random park entrance if (!gParkEntrances.empty()) { - auto rand = scenario_rand_max(static_cast(gParkEntrances.size())); + auto rand = ScenarioRandMax(static_cast(gParkEntrances.size())); const auto& entrance = gParkEntrances[rand]; auto dir = entrance.direction; newLocation = entrance; diff --git a/src/openrct2/cmdline/ConvertCommand.cpp b/src/openrct2/cmdline/ConvertCommand.cpp index 77393e6303..ccac025d1f 100644 --- a/src/openrct2/cmdline/ConvertCommand.cpp +++ b/src/openrct2/cmdline/ConvertCommand.cpp @@ -109,7 +109,7 @@ exitcode_t CommandLine::HandleCommandConvert(CommandLineArgEnumerator* enumerato if (sourceFileType == FileExtension::SC4 || sourceFileType == FileExtension::SC6) { // We are converting a scenario, so reset the park - scenario_begin(); + ScenarioBegin(); } try diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index f8f769d253..0774772479 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -622,7 +622,7 @@ void LoadPalette() return; } - auto water_type = static_cast(object_entry_get_chunk(ObjectType::Water, 0)); + auto water_type = static_cast(ObjectEntryGetChunk(ObjectType::Water, 0)); uint32_t palette = 0x5FC; diff --git a/src/openrct2/entity/Balloon.cpp b/src/openrct2/entity/Balloon.cpp index f1490a3e85..671a1c8a26 100644 --- a/src/openrct2/entity/Balloon.cpp +++ b/src/openrct2/entity/Balloon.cpp @@ -64,7 +64,7 @@ void Balloon::Press() { // There is a random chance that pressing the balloon will not pop it // and instead shift it slightly - uint32_t random = scenario_rand(); + uint32_t random = ScenarioRand(); if ((sprite_index.ToUnderlying() & 7) || (random & 0xFFFF) < 0x2000) { Pop(); diff --git a/src/openrct2/entity/Duck.cpp b/src/openrct2/entity/Duck.cpp index 25ab407b59..5cdc10e1cd 100644 --- a/src/openrct2/entity/Duck.cpp +++ b/src/openrct2/entity/Duck.cpp @@ -153,7 +153,7 @@ void Duck::UpdateSwim() if (((gCurrentTicks + sprite_index.ToUnderlying()) & 3) != 0) return; - uint32_t randomNumber = scenario_rand(); + uint32_t randomNumber = ScenarioRand(); if ((randomNumber & 0xFFFF) < 0x666) { if (randomNumber & 0x80000000) @@ -191,7 +191,7 @@ void Duck::UpdateSwim() else { z = waterZ; - randomNumber = scenario_rand(); + randomNumber = ScenarioRand(); if ((randomNumber & 0xFFFF) <= 0xAAA) { randomNumber >>= 16; @@ -290,7 +290,7 @@ void Duck::Create(const CoordsXY& pos) CoordsXY targetPos = pos; - int32_t offsetXY = scenario_rand() & 0x1E; + int32_t offsetXY = ScenarioRand() & 0x1E; targetPos.x += offsetXY; targetPos.y += offsetXY; @@ -299,20 +299,20 @@ void Duck::Create(const CoordsXY& pos) duck->sprite_height_positive = 9; duck->target_x = targetPos.x; duck->target_y = targetPos.y; - uint8_t direction = scenario_rand() & 3; + uint8_t direction = ScenarioRand() & 3; switch (direction) { case 0: - targetPos.x = GetMapSizeMaxXY().x - (scenario_rand() & 0x3F); + targetPos.x = GetMapSizeMaxXY().x - (ScenarioRand() & 0x3F); break; case 1: - targetPos.y = scenario_rand() & 0x3F; + targetPos.y = ScenarioRand() & 0x3F; break; case 2: - targetPos.x = scenario_rand() & 0x3F; + targetPos.x = ScenarioRand() & 0x3F; break; case 3: - targetPos.y = GetMapSizeMaxXY().y - (scenario_rand() & 0x3F); + targetPos.y = GetMapSizeMaxXY().y - (ScenarioRand() & 0x3F); break; } duck->sprite_direction = direction << 3; diff --git a/src/openrct2/entity/Fountain.cpp b/src/openrct2/entity/Fountain.cpp index b028c8f82f..0b3ed1bcce 100644 --- a/src/openrct2/entity/Fountain.cpp +++ b/src/openrct2/entity/Fountain.cpp @@ -103,7 +103,7 @@ void JumpingFountain::StartAnimation(const JumpingFountainType newType, const Co break; case PATTERN::BOUNCING_PAIRS: // random [0, 2 or 1, 3] - randomIndex = scenario_rand() & 1; + randomIndex = ScenarioRand() & 1; for (int32_t i = randomIndex; i < NumOrthogonalDirections; i += 2) { JumpingFountain::Create( @@ -113,7 +113,7 @@ void JumpingFountain::StartAnimation(const JumpingFountainType newType, const Co break; case PATTERN::RACING_PAIRS: // random [0 - 3 and 4 - 7] - randomIndex = scenario_rand() & 3; + randomIndex = ScenarioRand() & 3; JumpingFountain::Create( newType, { newLoc + _fountainDirectionsPositive[randomIndex], newZ }, _fountainDirections[randomIndex], _fountainDirectionFlags[randomIndex] | _fountainPatternFlags[pattern], 0); @@ -124,7 +124,7 @@ void JumpingFountain::StartAnimation(const JumpingFountainType newType, const Co break; default: // random [0 - 7] - randomIndex = scenario_rand() & 7; + randomIndex = ScenarioRand() & 7; JumpingFountain::Create( newType, { newLoc + _fountainDirectionsPositive[randomIndex], newZ }, _fountainDirections[randomIndex], _fountainDirectionFlags[randomIndex] | _fountainPatternFlags[pattern], 0); @@ -291,7 +291,7 @@ void JumpingFountain::GoToEdge(const CoordsXYZ& newLoc, const int32_t availableD return; } - const uint32_t randomIndex = scenario_rand(); + const uint32_t randomIndex = ScenarioRand(); if ((randomIndex & 0xFFFF) < _FountainChanceOfStoppingEdgeMode) { return; @@ -361,7 +361,7 @@ void JumpingFountain::Split(const CoordsXYZ& newLoc, int32_t availableDirections void JumpingFountain::Random(const CoordsXYZ& newLoc, int32_t availableDirections) const { - const uint32_t randomIndex = scenario_rand(); + const uint32_t randomIndex = ScenarioRand(); if ((randomIndex & 0xFFFF) >= _FountainChanceOfStoppingRandomMode) { int32_t direction = randomIndex & 7; diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index d6a21d5b76..fc4b2d86a7 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -562,7 +562,7 @@ void Guest::UpdateEasterEggInteractions() if (PeepFlags & PEEP_FLAGS_JOY) { - if ((scenario_rand() & 0xFFFF) <= 1456) + if ((ScenarioRand() & 0xFFFF) <= 1456) { if (IsActionInterruptable()) { @@ -765,7 +765,7 @@ void Guest::loc_68F9F3() if (State == PeepState::Walking && NauseaTarget >= 128) { - if ((scenario_rand() & 0xFF) <= static_cast((Nausea - 128) / 2)) + if ((ScenarioRand() & 0xFF) <= static_cast((Nausea - 128) / 2)) { if (IsActionInterruptable()) { @@ -901,7 +901,7 @@ void Guest::Tick128UpdateGuest(int32_t index) * is executed to once every four calls. */ if (PeepFlags & PEEP_FLAGS_CROWDED) { - PeepThoughtType thought_type = crowded_thoughts[scenario_rand() & 0xF]; + PeepThoughtType thought_type = crowded_thoughts[ScenarioRand() & 0xF]; if (thought_type != PeepThoughtType::None) { InsertNewThought(thought_type); @@ -1022,7 +1022,7 @@ void Guest::Tick128UpdateGuest(int32_t index) } } - if ((scenario_rand() & 0xFFFF) <= ((HasItem(ShopItem::Map)) ? 8192u : 2184u)) + if ((ScenarioRand() & 0xFFFF) <= ((HasItem(ShopItem::Map)) ? 8192u : 2184u)) { PickRideToGoOn(); } @@ -1081,7 +1081,7 @@ void Guest::Tick128UpdateGuest(int32_t index) if (num_thoughts != 0) { - PeepThoughtType chosen_thought = possible_thoughts[scenario_rand() % num_thoughts]; + PeepThoughtType chosen_thought = possible_thoughts[ScenarioRand() % num_thoughts]; InsertNewThought(chosen_thought); @@ -1297,7 +1297,7 @@ void Guest::UpdateSitting() if (HasFoodOrDrink()) { - if ((scenario_rand() & 0xFFFF) > 1310) + if ((ScenarioRand() & 0xFFFF) > 1310) { TryGetUpFromSitting(); return; @@ -1309,7 +1309,7 @@ void Guest::UpdateSitting() return; } - int32_t rand = scenario_rand(); + int32_t rand = ScenarioRand(); if ((rand & 0xFFFF) > 131) { TryGetUpFromSitting(); @@ -1521,7 +1521,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) if (!isRainingAndUmbrella && (shopItem != ShopItem::Map) && GetShopItemDescriptor(shopItem).IsSouvenir() && !hasVoucher) { - if (((scenario_rand() & 0x7F) + 0x73) > Happiness || GuestNumRides < 3) + if (((ScenarioRand() & 0x7F) + 0x73) > Happiness || GuestNumRides < 3) return false; } @@ -1561,7 +1561,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) if (Happiness >= 180) itemValue /= 2; } - if (itemValue > (static_cast(scenario_rand() & 0x07))) + if (itemValue > (static_cast(ScenarioRand() & 0x07))) { // "I'm not paying that much for x" InsertNewThought(GetShopItemDescriptor(shopItem).TooMuchThought, ride.id); @@ -1576,7 +1576,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - if (itemValue >= static_cast(scenario_rand() & 0x07)) + if (itemValue >= static_cast(ScenarioRand() & 0x07)) { // "This x is a really good value" InsertNewThought(GetShopItemDescriptor(shopItem).GoodValueThought, ride.id); @@ -1616,16 +1616,16 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price) const auto hasRandomShopColour = ride.HasLifecycleFlag(RIDE_LIFECYCLE_RANDOM_SHOP_COLOURS); if (shopItem == ShopItem::TShirt) - TshirtColour = hasRandomShopColour ? scenario_rand_max(COLOUR_COUNT - 1) : ride.track_colour[0].main; + TshirtColour = hasRandomShopColour ? ScenarioRandMax(COLOUR_COUNT - 1) : ride.track_colour[0].main; if (shopItem == ShopItem::Hat) - HatColour = hasRandomShopColour ? scenario_rand_max(COLOUR_COUNT - 1) : ride.track_colour[0].main; + HatColour = hasRandomShopColour ? ScenarioRandMax(COLOUR_COUNT - 1) : ride.track_colour[0].main; if (shopItem == ShopItem::Balloon) - BalloonColour = hasRandomShopColour ? scenario_rand_max(COLOUR_COUNT - 1) : ride.track_colour[0].main; + BalloonColour = hasRandomShopColour ? ScenarioRandMax(COLOUR_COUNT - 1) : ride.track_colour[0].main; if (shopItem == ShopItem::Umbrella) - UmbrellaColour = hasRandomShopColour ? scenario_rand_max(COLOUR_COUNT - 1) : ride.track_colour[0].main; + UmbrellaColour = hasRandomShopColour ? ScenarioRandMax(COLOUR_COUNT - 1) : ride.track_colour[0].main; if (shopItem == ShopItem::Map) ResetPathfindGoal(); @@ -1781,7 +1781,7 @@ void Guest::OnExitRide(Ride& ride) OpenRCT2::Audio::SoundId::Laugh2, OpenRCT2::Audio::SoundId::Laugh3, }; - int32_t laughType = scenario_rand() & 7; + int32_t laughType = ScenarioRand() & 7; if (laughType < 3) { OpenRCT2::Audio::Play3D(laughs[laughType], GetLocation()); @@ -2121,7 +2121,7 @@ bool Guest::ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, b // there's a 90% chance that the peep will ignore it. if (!RideHasRatings(ride) && ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES)) { - if ((scenario_rand() & 0xFFFF) > 0x1999U) + if ((ScenarioRand() & 0xFFFF) > 0x1999U) { ChoseNotToGoOnRide(ride, peepAtRide, false); return false; @@ -2353,7 +2353,7 @@ bool Guest::ShouldRideWhileRaining(const Ride& ride) // Peeps with umbrellas will go on rides where they can use their umbrella on it (like the Maze) 50% of the time if (HasItem(ShopItem::Umbrella) && ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_PEEP_CAN_USE_UMBRELLA) - && (scenario_rand() & 2) == 0) + && (ScenarioRand() & 2) == 0) { return true; } @@ -2434,10 +2434,10 @@ static void peep_ride_is_too_intense(Guest* peep, Ride& ride, bool peepAtRide) */ static Vehicle* peep_choose_car_from_ride(Peep* peep, const Ride& ride, std::vector& car_array) { - uint8_t chosen_car = scenario_rand(); + uint8_t chosen_car = ScenarioRand(); if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES) && ((chosen_car & 0xC) != 0xC)) { - chosen_car = (scenario_rand() & 1) ? 0 : static_cast(car_array.size()) - 1; + chosen_car = (ScenarioRand() & 1) ? 0 : static_cast(car_array.size()) - 1; } else { @@ -2863,7 +2863,7 @@ static bool peep_should_go_on_ride_again(Guest* peep, const Ride& ride) if (peep->Toilet > 170) return false; - uint8_t r = (scenario_rand() & 0xFF); + uint8_t r = (ScenarioRand() & 0xFF); if (r <= 128) { if (peep->GuestNumRides > 7) @@ -2882,7 +2882,7 @@ static bool peep_should_preferred_intensity_increase(Guest* peep) if (peep->Happiness < 200) return false; - return (scenario_rand() & 0xFF) >= static_cast(peep->Intensity); + return (ScenarioRand() & 0xFF) >= static_cast(peep->Intensity); } static bool peep_really_liked_ride(Guest* peep, const Ride& ride) @@ -3077,7 +3077,7 @@ static void peep_decide_whether_to_leave_park(Guest* peep) } // Approx 95% chance of staying in the park - if ((scenario_rand() & 0xFFFF) > 3276) + if ((ScenarioRand() & 0xFFFF) > 3276) { return; } @@ -3296,7 +3296,7 @@ static bool peep_should_use_cash_machine(Guest* peep, RideId rideIndex) return false; if (peep->CashInPocket > 20.00_GBP) return false; - if (115 + (scenario_rand() % 128) > peep->Happiness) + if (115 + (ScenarioRand() % 128) > peep->Happiness) return false; if (peep->Energy < 80) return false; @@ -3515,7 +3515,7 @@ void PeepUpdateRideLeaveEntranceMaze(Guest* peep, Ride& ride, CoordsXYZD& entran entrance_loc.y += CoordsDirectionDelta[entrance_loc.direction].y; uint8_t direction = entrance_loc.direction * 4 + 11; - if (scenario_rand() & 0x40) + if (ScenarioRand() & 0x40) { direction += 4; peep->MazeLastEdge += 2; @@ -4593,7 +4593,7 @@ void Guest::UpdateRideApproachSpiralSlide() { if (ride->mode == RideMode::SingleRidePerAdmission) lastRide = true; - if (static_cast(CurrentCar - 1) > (scenario_rand() & 0xF)) + if (static_cast(CurrentCar - 1) > (ScenarioRand() & 0xF)) lastRide = true; } @@ -4823,7 +4823,7 @@ void Guest::UpdateRideMazePathfinding() if (IsActionInterruptable()) { - if (Energy > 80 && !(PeepFlags & PEEP_FLAGS_SLOW_WALK) && !ClimateIsRaining() && (scenario_rand() & 0xFFFF) <= 2427) + if (Energy > 80 && !(PeepFlags & PEEP_FLAGS_SLOW_WALK) && !ClimateIsRaining() && (ScenarioRand() & 0xFFFF) <= 2427) { Action = PeepActionType::Jump; ActionFrame = 0; @@ -4865,7 +4865,7 @@ void Guest::UpdateRideMazePathfinding() hedges[openCount++] = mazeReverseLastEdge; } - uint8_t chosenEdge = hedges[scenario_rand() % openCount]; + uint8_t chosenEdge = hedges[ScenarioRand() % openCount]; assert(chosenEdge != 0xFF); targetLoc = GetDestination() + CoordsDirectionDelta[chosenEdge] / 2; @@ -5218,7 +5218,7 @@ void Guest::UpdateWalking() if (!IsOnLevelCrossing()) { - if (PeepFlags & PEEP_FLAGS_WAVING && IsActionInterruptable() && (0xFFFF & scenario_rand()) < 936) + if (PeepFlags & PEEP_FLAGS_WAVING && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936) { Action = PeepActionType::Wave2; ActionFrame = 0; @@ -5227,7 +5227,7 @@ void Guest::UpdateWalking() UpdateCurrentActionSpriteType(); } - if (PeepFlags & PEEP_FLAGS_PHOTO && IsActionInterruptable() && (0xFFFF & scenario_rand()) < 936) + if (PeepFlags & PEEP_FLAGS_PHOTO && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936) { Action = PeepActionType::TakePhoto; ActionFrame = 0; @@ -5236,7 +5236,7 @@ void Guest::UpdateWalking() UpdateCurrentActionSpriteType(); } - if (PeepFlags & PEEP_FLAGS_PAINTING && IsActionInterruptable() && (0xFFFF & scenario_rand()) < 936) + if (PeepFlags & PEEP_FLAGS_PAINTING && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936) { Action = PeepActionType::DrawPicture; ActionFrame = 0; @@ -5250,7 +5250,7 @@ void Guest::UpdateWalking() { if (!GetNextIsSurface()) { - if ((0xFFFF & scenario_rand()) <= 4096) + if ((0xFFFF & ScenarioRand()) <= 4096) { static constexpr const Litter::Type litter_types[] = { Litter::Type::EmptyCan, @@ -5258,11 +5258,11 @@ void Guest::UpdateWalking() Litter::Type::BurgerBox, Litter::Type::EmptyCup, }; - auto litterType = litter_types[scenario_rand() & 0x3]; + auto litterType = litter_types[ScenarioRand() & 0x3]; const auto loc = GetLocation(); - int32_t litterX = loc.x + (scenario_rand() & 0x7) - 3; - int32_t litterY = loc.y + (scenario_rand() & 0x7) - 3; - Direction litterDirection = (scenario_rand() & 0x3); + int32_t litterX = loc.x + (ScenarioRand() & 0x7) - 3; + int32_t litterY = loc.y + (ScenarioRand() & 0x7) - 3; + Direction litterDirection = (ScenarioRand() & 0x3); Litter::Create({ litterX, litterY, loc.z, litterDirection }, litterType); } @@ -5271,7 +5271,7 @@ void Guest::UpdateWalking() else if (HasEmptyContainer()) { if ((!GetNextIsSurface()) && (static_cast(sprite_index.ToUnderlying() & 0x1FF) == (gCurrentTicks & 0x1FF)) - && ((0xFFFF & scenario_rand()) <= 4096)) + && ((0xFFFF & ScenarioRand()) <= 4096)) { int32_t container = bitscanforward(GetEmptyContainerFlags()); auto litterType = Litter::Type::Vomit; @@ -5287,9 +5287,9 @@ void Guest::UpdateWalking() UpdateSpriteType(); const auto loc = GetLocation(); - int32_t litterX = loc.x + (scenario_rand() & 0x7) - 3; - int32_t litterY = loc.y + (scenario_rand() & 0x7) - 3; - Direction litterDirection = (scenario_rand() & 0x3); + int32_t litterX = loc.x + (ScenarioRand() & 0x7) - 3; + int32_t litterY = loc.y + (ScenarioRand() & 0x7) - 3; + Direction litterDirection = (ScenarioRand() & 0x3); Litter::Create({ litterX, litterY, loc.z, litterDirection }, litterType); } @@ -5353,7 +5353,7 @@ void Guest::UpdateWalking() uint16_t chance = HasFoodOrDrink() ? 13107 : 2849; - if ((scenario_rand() & 0xFFFF) > chance) + if ((ScenarioRand() & 0xFFFF) > chance) return; if (GetNextIsSurface() || GetNextIsSloped()) @@ -5397,7 +5397,7 @@ void Guest::UpdateWalking() if (edges == 0) return; - uint8_t chosen_edge = scenario_rand() & 0x3; + uint8_t chosen_edge = ScenarioRand() & 0x3; for (; !(edges & (1 << chosen_edge));) chosen_edge = (chosen_edge + 1) & 3; @@ -5425,7 +5425,7 @@ void Guest::UpdateWalking() if (!positions_free) return; - uint8_t chosen_position = scenario_rand() & 0x3; + uint8_t chosen_position = ScenarioRand() & 0x3; for (; !(positions_free & (1 << chosen_position));) chosen_position = (chosen_position + 1) & 3; @@ -5468,7 +5468,7 @@ void Guest::UpdateWaitingAtCrossing() if (HasFoodOrDrink()) { - if ((scenario_rand() & 0xFFFF) <= 1310) + if ((ScenarioRand() & 0xFFFF) <= 1310) { Action = PeepActionType::EatFood; ActionFrame = 0; @@ -5480,7 +5480,7 @@ void Guest::UpdateWaitingAtCrossing() return; } - if ((scenario_rand() & 0xFFFF) <= 64) + if ((ScenarioRand() & 0xFFFF) <= 64) { Action = PeepActionType::Wave2; ActionFrame = 0; @@ -5544,7 +5544,7 @@ void Guest::UpdateQueuing() return; if (SpriteType == PeepSpriteType::Normal) { - if (TimeInQueue >= 2000 && (0xFFFF & scenario_rand()) <= 119) + if (TimeInQueue >= 2000 && (0xFFFF & ScenarioRand()) <= 119) { // Eat Food/Look at watch Action = PeepActionType::EatFood; @@ -5552,7 +5552,7 @@ void Guest::UpdateQueuing() ActionSpriteImageOffset = 0; UpdateCurrentActionSpriteType(); } - if (TimeInQueue >= 3500 && (0xFFFF & scenario_rand()) <= 93) + if (TimeInQueue >= 3500 && (0xFFFF & ScenarioRand()) <= 93) { // Create the I have been waiting in line ages thought InsertNewThought(PeepThoughtType::QueuingAges, CurrentRide); @@ -5600,7 +5600,7 @@ void Guest::UpdateQueuing() if (TimeInQueue < 4300) return; - if (Happiness <= 65 && (0xFFFF & scenario_rand()) < 2184) + if (Happiness <= 65 && (0xFFFF & ScenarioRand()) < 2184) { // Give up queueing for the ride sprite_direction ^= (1 << 4); @@ -5722,7 +5722,7 @@ void Guest::UpdateWatching() { if (HasFoodOrDrink()) { - if ((scenario_rand() & 0xFFFF) <= 1310) + if ((ScenarioRand() & 0xFFFF) <= 1310) { Action = PeepActionType::EatFood; ActionFrame = 0; @@ -5732,7 +5732,7 @@ void Guest::UpdateWatching() } } - if ((scenario_rand() & 0xFFFF) <= 655) + if ((ScenarioRand() & 0xFFFF) <= 655) { Action = PeepActionType::TakePhoto; ActionFrame = 0; @@ -5743,7 +5743,7 @@ void Guest::UpdateWatching() if ((StandingFlags & 1)) { - if ((scenario_rand() & 0xFFFF) <= 655) + if ((ScenarioRand() & 0xFFFF) <= 655) { Action = PeepActionType::Wave; ActionFrame = 0; @@ -5849,7 +5849,7 @@ void Guest::UpdateUsingBin() // OpenRCT2 modification: This previously used // the tick count as a simple random function // switched to scenario_rand as it is more reliable - if ((scenario_rand() & 7) == 0) + if ((ScenarioRand() & 7) == 0) spaceLeftInBin--; RemoveItem(item); WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY; @@ -5859,10 +5859,10 @@ void Guest::UpdateUsingBin() auto litterType = Litter::Type(GetShopItemDescriptor(item).Type); - int32_t litterX = x + (scenario_rand() & 7) - 3; - int32_t litterY = y + (scenario_rand() & 7) - 3; + int32_t litterX = x + (ScenarioRand() & 7) - 3; + int32_t litterY = y + (ScenarioRand() & 7) - 3; - Litter::Create({ litterX, litterY, z, static_cast(scenario_rand() & 3) }, litterType); + Litter::Create({ litterX, litterY, z, static_cast(ScenarioRand() & 3) }, litterType); RemoveItem(item); WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY; @@ -5956,7 +5956,7 @@ bool Guest::UpdateWalkingFindBench() int32_t edges = pathElement->GetEdges() ^ 0xF; if (edges == 0) return false; - uint8_t chosen_edge = scenario_rand() & 0x3; + uint8_t chosen_edge = ScenarioRand() & 0x3; for (; !(edges & (1 << chosen_edge));) chosen_edge = (chosen_edge + 1) & 0x3; @@ -5984,7 +5984,7 @@ bool Guest::UpdateWalkingFindBench() free_edge ^= 0x3; if (!free_edge) { - if (scenario_rand() & 0x8000000) + if (ScenarioRand() & 0x8000000) free_edge = 1; } @@ -6045,7 +6045,7 @@ bool Guest::UpdateWalkingFindBin() if (edges == 0) return false; - uint8_t chosen_edge = scenario_rand() & 0x3; + uint8_t chosen_edge = ScenarioRand() & 0x3; // Note: Bin quantity is inverted 0 = full, 3 = empty uint8_t bin_quantities = pathElement->GetAdditionStatus(); @@ -6127,7 +6127,7 @@ static void peep_update_walking_break_scenery(Guest* peep) if ((peep->LitterCount & 0xC0) != 0xC0 && (peep->DisgustingCount & 0xC0) != 0xC0) return; - if ((scenario_rand() & 0xFFFF) > 3276) + if ((ScenarioRand() & 0xFFFF) > 3276) return; } @@ -6217,14 +6217,14 @@ static bool peep_should_watch_ride(TileElement* tileElement) if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_INTERESTING_TO_LOOK_AT)) { - if ((scenario_rand() & 0xFFFF) > 0x3333) + if ((ScenarioRand() & 0xFFFF) > 0x3333) { return false; } } else if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SLIGHTLY_INTERESTING_TO_LOOK_AT)) { - if ((scenario_rand() & 0xFFFF) > 0x1000) + if ((ScenarioRand() & 0xFFFF) > 0x1000) { return false; } @@ -6726,12 +6726,12 @@ static item_pref_t item_order_preference[] = { */ void Guest::UpdateSpriteType() { - if (SpriteType == PeepSpriteType::Balloon && (scenario_rand() & 0xFFFF) <= 327) + if (SpriteType == PeepSpriteType::Balloon && (ScenarioRand() & 0xFFFF) <= 327) { bool isBalloonPopped = false; if (x != LOCATION_NULL) { - if ((scenario_rand() & 0xFFFF) <= 13107) + if ((ScenarioRand() & 0xFFFF) <= 13107) { isBalloonPopped = true; OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::BalloonPop, { x, y, z }); @@ -7020,14 +7020,14 @@ Guest* Guest::Generate(const CoordsXYZ& coords) peep->MoveTo(coords); peep->sprite_direction = 0; - peep->Mass = (scenario_rand() & 0x1F) + 45; + peep->Mass = (ScenarioRand() & 0x1F) + 45; peep->PathCheckOptimisation = 0; peep->InteractionRideIndex = RideId::GetNull(); peep->PreviousRide = RideId::GetNull(); std::get<0>(peep->Thoughts).type = PeepThoughtType::None; peep->WindowInvalidateFlags = 0; - uint8_t intensityHighest = (scenario_rand() & 0x7) + 3; + uint8_t intensityHighest = (ScenarioRand() & 0x7) + 3; uint8_t intensityLowest = std::min(intensityHighest, static_cast(7)) - 3; if (intensityHighest >= 7) @@ -7056,7 +7056,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) peep->Intensity = IntensityRange(intensityLowest, intensityHighest); - uint8_t nauseaTolerance = scenario_rand() & 0x7; + uint8_t nauseaTolerance = ScenarioRand() & 0x7; if (gParkFlags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES) { nauseaTolerance += 4; @@ -7073,7 +7073,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) if (gGuestInitialHappiness == 0) peep->Happiness = 128; /* Initial value will vary by -15..16 */ - int8_t happinessDelta = (scenario_rand() & 0x1F) - 15; + int8_t happinessDelta = (ScenarioRand() & 0x1F) - 15; /* Adjust by the delta, clamping at min=0 and max=255. */ peep->Happiness = std::clamp(peep->Happiness + happinessDelta, 0, PEEP_MAX_HAPPINESS); peep->HappinessTarget = peep->Happiness; @@ -7085,7 +7085,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) * to any value 0..255. */ peep->Hunger = gGuestInitialHunger; /* Initial value will vary by -15..16 */ - int8_t hungerDelta = (scenario_rand() & 0x1F) - 15; + int8_t hungerDelta = (ScenarioRand() & 0x1F) - 15; /* Adjust by the delta, clamping at min=0 and max=255. */ peep->Hunger = std::clamp(peep->Hunger + hungerDelta, 0, PEEP_MAX_HUNGER); @@ -7094,7 +7094,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) * to any value 0..255. */ peep->Thirst = gGuestInitialThirst; /* Initial value will vary by -15..16 */ - int8_t thirstDelta = (scenario_rand() & 0x1F) - 15; + int8_t thirstDelta = (ScenarioRand() & 0x1F) - 15; /* Adjust by the delta, clamping at min=0 and max=255. */ peep->Thirst = std::clamp(peep->Thirst + thirstDelta, 0, PEEP_MAX_THIRST); @@ -7105,7 +7105,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords) peep->Id = gNextGuestNumber++; peep->Name = nullptr; - money32 cash = (scenario_rand() & 0x3) * 100 - 100 + gGuestInitialCash; + money32 cash = (ScenarioRand() & 0x3) * 100 - 100 + gGuestInitialCash; if (cash < 0) cash = 0; @@ -7145,15 +7145,15 @@ Guest* Guest::Generate(const CoordsXYZ& coords) peep->Angriness = 0; peep->TimeLost = 0; - uint8_t tshirtColour = static_cast(scenario_rand() % std::size(tshirt_colours)); + uint8_t tshirtColour = static_cast(ScenarioRand() % std::size(tshirt_colours)); peep->TshirtColour = tshirt_colours[tshirtColour]; - uint8_t trousersColour = static_cast(scenario_rand() % std::size(trouser_colours)); + uint8_t trousersColour = static_cast(ScenarioRand() % std::size(trouser_colours)); peep->TrousersColour = trouser_colours[trousersColour]; /* Minimum energy is capped at 32 and maximum at 128, so this initialises * a peep with approx 34%-100% energy. (65 - 32) / (128 - 32) ≈ 34% */ - uint8_t energy = (scenario_rand() % 64) + 65; + uint8_t energy = (ScenarioRand() % 64) + 65; peep->Energy = energy; peep->EnergyTarget = energy; diff --git a/src/openrct2/entity/Particle.cpp b/src/openrct2/entity/Particle.cpp index b0fbf395ee..991c831bd4 100644 --- a/src/openrct2/entity/Particle.cpp +++ b/src/openrct2/entity/Particle.cpp @@ -63,12 +63,12 @@ void VehicleCrashParticle::Create(VehicleColour& colours, const CoordsXYZ& vehic sprite->sprite_height_positive = 8; sprite->MoveTo(vehiclePos); - sprite->frame = (scenario_rand() & 0xFF) * 12; - sprite->time_to_live = (scenario_rand() & 0x7F) + 140; - sprite->crashed_sprite_base = scenario_rand_max(static_cast(std::size(_VehicleCrashParticleSprites))); - sprite->acceleration_x = (static_cast(scenario_rand() & 0xFFFF)) * 4; - sprite->acceleration_y = (static_cast(scenario_rand() & 0xFFFF)) * 4; - sprite->acceleration_z = (scenario_rand() & 0xFFFF) * 4 + 0x10000; + sprite->frame = (ScenarioRand() & 0xFF) * 12; + sprite->time_to_live = (ScenarioRand() & 0x7F) + 140; + sprite->crashed_sprite_base = ScenarioRandMax(static_cast(std::size(_VehicleCrashParticleSprites))); + sprite->acceleration_x = (static_cast(ScenarioRand() & 0xFFFF)) * 4; + sprite->acceleration_y = (static_cast(ScenarioRand() & 0xFFFF)) * 4; + sprite->acceleration_z = (ScenarioRand() & 0xFFFF) * 4 + 0x10000; sprite->velocity_x = 0; sprite->velocity_y = 0; sprite->velocity_z = 0; diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 1d51689695..3e572aefdd 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -534,7 +534,7 @@ std::optional Peep::UpdateAction(int16_t& xy_distance) OpenRCT2::Audio::SoundId::Cough3, OpenRCT2::Audio::SoundId::Cough4, }; - auto soundId = coughs[scenario_rand() & 3]; + auto soundId = coughs[ScenarioRand() & 3]; OpenRCT2::Audio::Play3D(soundId, curLoc); return { { x, y } }; @@ -1654,7 +1654,7 @@ void peep_set_map_tooltip(Peep* peep) } auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); - intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); + intent.PutExtra(INTENT_EXTRA_FORMATTER, &ft); ContextBroadcastIntent(&intent); } @@ -2023,7 +2023,7 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool // If there has been 2 vandalised tiles in the last 6 if (vandalisedTiles & 0x3E && (vandalThoughtTimeout == 0)) { - if ((scenario_rand() & 0xFFFF) <= 10922) + if ((ScenarioRand() & 0xFFFF) <= 10922) { guest->InsertNewThought(PeepThoughtType::Vandalism); guest->HappinessTarget = std::max(0, guest->HappinessTarget - 17); @@ -2032,7 +2032,7 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool } } - if (vandalThoughtTimeout && (scenario_rand() & 0xFFFF) <= 4369) + if (vandalThoughtTimeout && (ScenarioRand() & 0xFFFF) <= 4369) { vandalThoughtTimeout--; } @@ -2069,7 +2069,7 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool } } - if (crowded >= 10 && guest->State == PeepState::Walking && (scenario_rand() & 0xFFFF) <= 21845) + if (crowded >= 10 && guest->State == PeepState::Walking && (ScenarioRand() & 0xFFFF) <= 21845) { guest->InsertNewThought(PeepThoughtType::Crowded); guest->HappinessTarget = std::max(0, guest->HappinessTarget - 14); @@ -2082,7 +2082,7 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool uint8_t disgusting_count = ((guest->DisgustingCount & 0xF) << 2) | sick_count; guest->DisgustingCount = disgusting_count | disgusting_time; - if (disgusting_time & 0xC0 && (scenario_rand() & 0xFFFF) <= 4369) + if (disgusting_time & 0xC0 && (ScenarioRand() & 0xFFFF) <= 4369) { // Reduce the disgusting time guest->DisgustingCount -= 0x40; @@ -2095,7 +2095,7 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool total_sick += (disgusting_count >> (2 * time)) & 0x3; } - if (total_sick >= 3 && (scenario_rand() & 0xFFFF) <= 10922) + if (total_sick >= 3 && (ScenarioRand() & 0xFFFF) <= 10922) { guest->InsertNewThought(PeepThoughtType::PathDisgusting); guest->HappinessTarget = std::max(0, guest->HappinessTarget - 17); @@ -2108,7 +2108,7 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool litter_count = ((guest->LitterCount & 0xF) << 2) | litter_count; guest->LitterCount = litter_count | litter_time; - if (litter_time & 0xC0 && (scenario_rand() & 0xFFFF) <= 4369) + if (litter_time & 0xC0 && (ScenarioRand() & 0xFFFF) <= 4369) { // Reduce the litter time guest->LitterCount -= 0x40; @@ -2121,7 +2121,7 @@ static void peep_footpath_move_forward(Peep* peep, const CoordsXYE& coords, bool total_litter += (litter_count >> (2 * time)) & 0x3; } - if (total_litter >= 3 && (scenario_rand() & 0xFFFF) <= 10922) + if (total_litter >= 3 && (ScenarioRand() & 0xFFFF) <= 10922) { guest->InsertNewThought(PeepThoughtType::BadLitter); guest->HappinessTarget = std::max(0, guest->HappinessTarget - 17); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 838884823e..b16565b423 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -416,7 +416,7 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const return INVALID_DIRECTION; } - uint8_t chosenDirection = scenario_rand() & 0x3; + uint8_t chosenDirection = ScenarioRand() & 0x3; for (uint8_t i = 0; i < 4; ++i, ++chosenDirection) { chosenDirection &= 0x3; @@ -452,7 +452,7 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const */ Direction Staff::HandymanDirectionRandSurface(uint8_t validDirections) const { - Direction newDirection = scenario_rand() % NumOrthogonalDirections; + Direction newDirection = ScenarioRand() % NumOrthogonalDirections; for (int32_t i = 0; i < NumOrthogonalDirections; ++i, ++newDirection) { newDirection %= NumOrthogonalDirections; @@ -523,7 +523,7 @@ bool Staff::DoHandymanPathFinding() /// When in a queue path make the probability of following litter much lower (10% instead of 90%) /// as handymen often get stuck when there is litter on a normal path next to a queue they are in uint32_t chooseRandomProbability = connectedQueue ? 0xE666 : 0x1999; - if ((scenario_rand() & 0xFFFF) >= chooseRandomProbability) + if ((ScenarioRand() & 0xFFFF) >= chooseRandomProbability) { chooseRandom = false; newDirection = litterDirection; @@ -542,7 +542,7 @@ bool Staff::DoHandymanPathFinding() { do { - newDirection = scenario_rand() & 3; + newDirection = ScenarioRand() & 3; } while ((pathDirections & (1 << newDirection)) == 0); } } @@ -564,7 +564,7 @@ bool Staff::DoHandymanPathFinding() SetDestination(chosenTile + CoordsXY{ 16, 16 }, 3); if (State == PeepState::Queuing) { - DestinationTolerance = (scenario_rand() & 7) + 2; + DestinationTolerance = (ScenarioRand() & 7) + 2; } return false; } @@ -579,7 +579,7 @@ Direction Staff::DirectionSurface(Direction initialDirection) const { case 1: direction++; - if (scenario_rand() & 1) + if (ScenarioRand() & 1) { direction -= 2; } @@ -613,10 +613,10 @@ Direction Staff::DirectionSurface(Direction initialDirection) const */ Direction Staff::MechanicDirectionSurface() const { - Direction direction = scenario_rand() & 3; + Direction direction = ScenarioRand() & 3; auto ride = GetRide(CurrentRide); - if (ride != nullptr && (State == PeepState::Answering || State == PeepState::HeadingToInspection) && (scenario_rand() & 1)) + if (ride != nullptr && (State == PeepState::Answering || State == PeepState::HeadingToInspection) && (ScenarioRand() & 1)) { auto location = ride->GetStation(CurrentRideStation).Exit; if (location.IsNull()) @@ -636,14 +636,14 @@ Direction Staff::MechanicDirectionSurface() const */ Direction Staff::MechanicDirectionPathRand(uint8_t pathDirections) const { - if (scenario_rand() & 1) + if (ScenarioRand() & 1) { if (pathDirections & (1 << PeepDirection)) return PeepDirection; } // Modified from original to spam scenario_rand less - uint8_t direction = scenario_rand() & 3; + uint8_t direction = ScenarioRand() & 3; for (int32_t i = 0; i < 4; ++i, ++direction) { direction &= 3; @@ -778,7 +778,7 @@ bool Staff::DoMechanicPathFinding() } PeepDirection = newDirection; - auto tolerance = (scenario_rand() & 7) + 2; + auto tolerance = (ScenarioRand() & 7) + 2; SetDestination(chosenTile + CoordsXY{ 16, 16 }, tolerance); return false; @@ -798,7 +798,7 @@ Direction Staff::DirectionPath(uint8_t validDirections, PathElement* pathElement if (pathDirections == 0) { - return DirectionSurface(scenario_rand() & 3); + return DirectionSurface(ScenarioRand() & 3); } pathDirections &= ~(1 << DirectionReverse(PeepDirection)); @@ -814,7 +814,7 @@ Direction Staff::DirectionPath(uint8_t validDirections, PathElement* pathElement return direction; } - direction = scenario_rand() & 3; + direction = ScenarioRand() & 3; for (uint8_t i = 0; i < NumOrthogonalDirections; ++i, direction = DirectionNext(direction)) { if (pathDirections & (1 << direction)) @@ -836,7 +836,7 @@ bool Staff::DoMiscPathFinding() Direction newDirection = INVALID_DIRECTION; if (GetNextIsSurface()) { - newDirection = DirectionSurface(scenario_rand() & 3); + newDirection = DirectionSurface(ScenarioRand() & 3); } else { @@ -851,12 +851,12 @@ bool Staff::DoMiscPathFinding() while (!MapIsLocationValid(chosenTile)) { - newDirection = DirectionSurface(scenario_rand() & 3); + newDirection = DirectionSurface(ScenarioRand() & 3); chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; } PeepDirection = newDirection; - auto tolerance = (scenario_rand() & 7) + 2; + auto tolerance = (ScenarioRand() & 7) + 2; SetDestination(chosenTile + CoordsXY{ 16, 16 }, tolerance); return false; @@ -922,9 +922,9 @@ void Staff::EntertainerUpdateNearbyPeeps() const */ bool Staff::DoEntertainerPathFinding() { - if (((scenario_rand() & 0xFFFF) <= 0x4000) && IsActionInterruptable()) + if (((ScenarioRand() & 0xFFFF) <= 0x4000) && IsActionInterruptable()) { - Action = (scenario_rand() & 1) ? PeepActionType::Wave2 : PeepActionType::Joy; + Action = (ScenarioRand() & 1) ? PeepActionType::Wave2 : PeepActionType::Joy; ActionFrame = 0; ActionSpriteImageOffset = 0; @@ -1520,7 +1520,7 @@ bool Staff::UpdatePatrollingFindWatering() if (!(StaffOrders & STAFF_ORDERS_WATER_FLOWERS)) return false; - uint8_t chosen_position = scenario_rand() & 7; + uint8_t chosen_position = ScenarioRand() & 7; for (int32_t i = 0; i < 8; ++i, ++chosen_position) { chosen_position &= 7; @@ -2109,7 +2109,7 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride& ride) { sprite_direction = PeepDirection << 3; - Action = (scenario_rand() & 1) ? PeepActionType::StaffFix2 : PeepActionType::StaffFix; + Action = (ScenarioRand() & 1) ? PeepActionType::StaffFix2 : PeepActionType::StaffFix; ActionSpriteImageOffset = 0; ActionFrame = 0; UpdateCurrentActionSpriteType(); @@ -2560,7 +2560,7 @@ void Staff::UpdateRideInspected(RideId rideIndex) if (ride != nullptr) { ride->lifecycle_flags &= ~RIDE_LIFECYCLE_DUE_INSPECTION; - ride->reliability += ((100 - ride->reliability_percentage) / 4) * (scenario_rand() & 0xFF); + ride->reliability += ((100 - ride->reliability_percentage) / 4) * (ScenarioRand() & 0xFF); ride->last_inspection = 0; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE | RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST; diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 05f77fb6d5..df82f8fd9e 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1205,7 +1205,7 @@ static int32_t ConsoleCommandLoadObject(InteractiveConsole& console, const argum name[i++] = *ch; } - const ObjectRepositoryItem* ori = object_repository_find_object_by_name(name); + const ObjectRepositoryItem* ori = ObjectRepositoryFindObjectByName(name); if (ori == nullptr) { console.WriteLineError("Could not find the object."); @@ -1213,20 +1213,20 @@ static int32_t ConsoleCommandLoadObject(InteractiveConsole& console, const argum } const rct_object_entry* entry = &ori->ObjectEntry; - const auto* loadedObject = object_manager_get_loaded_object(ObjectEntryDescriptor(*ori)); + const auto* loadedObject = ObjectManagerGetLoadedObject(ObjectEntryDescriptor(*ori)); if (loadedObject != nullptr) { console.WriteLineError("Object is already in scenario."); return 1; } - loadedObject = object_manager_load_object(entry); + loadedObject = ObjectManagerLoadObject(entry); if (loadedObject == nullptr) { console.WriteLineError("Unable to load object."); return 1; } - auto groupIndex = object_manager_get_loaded_object_entry_index(loadedObject); + auto groupIndex = ObjectManagerGetLoadedObjectEntryIndex(loadedObject); ObjectType objectType = entry->GetType(); if (objectType == ObjectType::Ride) @@ -1300,7 +1300,7 @@ static int32_t ConsoleCommandCountObjects(InteractiveConsole& console, [[maybe_u int32_t entryGroupIndex = 0; for (; entryGroupIndex < object_entry_group_counts[EnumValue(objectType)]; entryGroupIndex++) { - if (object_entry_get_object(objectType, entryGroupIndex) == nullptr) + if (ObjectEntryGetObject(objectType, entryGroupIndex) == nullptr) { break; } diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index bb414e7902..741ce0fc03 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -531,7 +531,7 @@ - + @@ -1013,4 +1013,4 @@ - \ No newline at end of file + diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index c3b94cf7f7..29da4635b6 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -637,7 +637,7 @@ void award_update_all() AwardType awardType; do { - awardType = static_cast((((scenario_rand() & 0xFF) * EnumValue(AwardType::Count)) >> 8) & 0xFF); + awardType = static_cast((((ScenarioRand() & 0xFF) * EnumValue(AwardType::Count)) >> 8) & 0xFF); } while (activeAwardTypes & (1 << EnumValue(awardType))); // Check if award is deserved diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index 8db9450338..7bd2d77b0c 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -366,7 +366,7 @@ void News::OpenSubject(News::ItemType type, int32_t subject) case News::ItemType::Ride: { auto intent = Intent(WindowClass::Ride); - intent.putExtra(INTENT_EXTRA_RIDE_ID, subject); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, subject); ContextOpenIntent(&intent); break; } @@ -377,7 +377,7 @@ void News::OpenSubject(News::ItemType type, int32_t subject) if (peep != nullptr) { auto intent = Intent(WindowClass::Peep); - intent.putExtra(INTENT_EXTRA_PEEP, peep); + intent.PutExtra(INTENT_EXTRA_PEEP, peep); ContextOpenIntent(&intent); } break; @@ -394,22 +394,22 @@ void News::OpenSubject(News::ItemType type, int32_t subject) if (item.type == Research::EntryType::Ride) { auto intent = Intent(INTENT_ACTION_NEW_RIDE_OF_TYPE); - intent.putExtra(INTENT_EXTRA_RIDE_TYPE, item.baseRideType); - intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.entryIndex); + intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, item.baseRideType); + intent.PutExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.entryIndex); ContextOpenIntent(&intent); break; } auto intent = Intent(INTENT_ACTION_NEW_SCENERY); - intent.putExtra(INTENT_EXTRA_SCENERY_GROUP_ENTRY_INDEX, item.entryIndex); + intent.PutExtra(INTENT_EXTRA_SCENERY_GROUP_ENTRY_INDEX, item.entryIndex); ContextOpenIntent(&intent); break; } case News::ItemType::Peeps: { auto intent = Intent(WindowClass::GuestList); - intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingX)); - intent.putExtra(INTENT_EXTRA_RIDE_ID, subject); + intent.PutExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingX)); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, subject); ContextOpenIntent(&intent); break; } diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index 12ac940905..da7ff35cd6 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -480,7 +480,7 @@ void research_populate_list_random() continue; } - int32_t researched = (scenario_rand() & 0xFF) > 128; + int32_t researched = (ScenarioRand() & 0xFF) > 128; for (auto rideType : rideEntry->ride_type) { if (rideType != RIDE_TYPE_NULL) @@ -500,7 +500,7 @@ void research_populate_list_random() continue; } - int32_t researched = (scenario_rand() & 0xFF) > 85; + int32_t researched = (ScenarioRand() & 0xFF) > 85; research_insert_scenery_group_entry(i, researched); } } diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 923856067f..7ee35be0c2 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -564,8 +564,8 @@ void NetworkBase::UpdateClient() format_string(str_resolving, 256, STR_MULTIPLAYER_RESOLVING, nullptr); auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_resolving }); - intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_resolving }); + intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); ContextOpenIntent(&intent); } break; @@ -579,8 +579,8 @@ void NetworkBase::UpdateClient() format_string(str_connecting, 256, STR_MULTIPLAYER_CONNECTING, nullptr); auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_connecting }); - intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_connecting }); + intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); ContextOpenIntent(&intent); server_connect_time = Platform::GetTicks(); @@ -596,8 +596,8 @@ void NetworkBase::UpdateClient() format_string(str_authenticating, 256, STR_MULTIPLAYER_AUTHENTICATING, nullptr); auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_authenticating }); - intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_authenticating }); + intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); ContextOpenIntent(&intent); break; } @@ -641,7 +641,7 @@ void NetworkBase::UpdateClient() } auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_disconnected }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_disconnected }); ContextOpenIntent(&intent); } WindowCloseByClass(WindowClass::Multiplayer); @@ -784,7 +784,7 @@ bool NetworkBase::CheckDesynchronizaton() { // Check synchronisation if (GetMode() == NETWORK_MODE_CLIENT && _serverState.state != NetworkServerState::Desynced - && !CheckSRAND(gCurrentTicks, scenario_rand_state().s0)) + && !CheckSRAND(gCurrentTicks, ScenarioRandState().s0)) { _serverState.state = NetworkServerState::Desynced; _serverState.desyncTick = gCurrentTicks; @@ -793,7 +793,7 @@ bool NetworkBase::CheckDesynchronizaton() format_string(str_desync, 256, STR_MULTIPLAYER_DESYNC, nullptr); auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); ContextOpenIntent(&intent); if (!gConfigNetwork.StayConnected) @@ -1497,7 +1497,7 @@ void NetworkBase::Server_Send_GAME_ACTION(const GameAction* action) void NetworkBase::Server_Send_TICK() { NetworkPacket packet(NetworkCommand::Tick); - packet << gCurrentTicks << scenario_rand_state().s0; + packet << gCurrentTicks << ScenarioRandState().s0; uint32_t flags = 0; // Simple counter which limits how often a sprite checksum gets sent. // This can get somewhat expensive, so we don't want to push it every tick in release, @@ -2323,8 +2323,8 @@ void NetworkBase::Client_Handle_OBJECTS_LIST(NetworkConnection& connection, Netw format_string(objectListMsg, 256, STR_MULTIPLAYER_RECEIVING_OBJECTS_LIST, &args); auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ objectListMsg }); - intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ objectListMsg }); + intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); ContextOpenIntent(&intent); uint8_t objectType{}; @@ -2461,7 +2461,7 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network format_string(str_desync, sizeof(str_desync), STR_DESYNC_REPORT, ft.Data()); auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); ContextOpenIntent(&intent); } } @@ -2669,8 +2669,8 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti format_string(str_downloading_map, 256, STR_MULTIPLAYER_DOWNLOADING_MAP, downloading_map_args); auto intent = Intent(WindowClass::NetworkStatus); - intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_downloading_map }); - intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); + intent.PutExtra(INTENT_EXTRA_MESSAGE, std::string{ str_downloading_map }); + intent.PutExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); ContextOpenIntent(&intent); std::memcpy(&chunk_buffer[offset], const_cast(static_cast(packet.Read(chunksize))), chunksize); diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 9838bd34b4..4fe58dd8a0 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -398,13 +398,13 @@ public: extern int32_t object_entry_group_counts[]; extern int32_t object_entry_group_encoding[]; -int32_t object_calculate_checksum(const rct_object_entry* entry, const void* data, size_t dataLength); -void object_create_identifier_name(char* string_buffer, size_t size, const rct_object_entry* object); +int32_t ObjectCalculateChecksum(const rct_object_entry* entry, const void* data, size_t dataLength); +void ObjectCreateIdentifierName(char* string_buffer, size_t size, const rct_object_entry* object); -void object_entry_get_name_fixed(utf8* buffer, size_t bufferSize, const rct_object_entry* entry); +void ObjectEntryGetNameFixed(utf8* buffer, size_t bufferSize, const rct_object_entry* entry); -void* object_entry_get_chunk(ObjectType objectType, ObjectEntryIndex index); -const Object* object_entry_get_object(ObjectType objectType, ObjectEntryIndex index); +void* ObjectEntryGetChunk(ObjectType objectType, ObjectEntryIndex index); +const Object* ObjectEntryGetObject(ObjectType objectType, ObjectEntryIndex index); constexpr bool IsIntransientObjectType(ObjectType type) { diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index 0968feddbc..9438046944 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -269,7 +269,7 @@ namespace ObjectFactory result->SetDescriptor(ObjectEntryDescriptor(entry)); utf8 objectName[DAT_NAME_LENGTH + 1] = { 0 }; - object_entry_get_name_fixed(objectName, sizeof(objectName), &entry); + ObjectEntryGetNameFixed(objectName, sizeof(objectName), &entry); LOG_VERBOSE(" entry: { 0x%08X, \"%s\", 0x%08X }", entry.flags, objectName, entry.checksum); auto chunk = chunkReader.ReadChunk(); @@ -304,7 +304,7 @@ namespace ObjectFactory result->SetDescriptor(ObjectEntryDescriptor(*entry)); utf8 objectName[DAT_NAME_LENGTH + 1]; - object_entry_get_name_fixed(objectName, sizeof(objectName), entry); + ObjectEntryGetNameFixed(objectName, sizeof(objectName), entry); auto readContext = ReadObjectContext(objectRepository, objectName, !gOpenRCT2NoGraphics, nullptr); auto chunkStream = OpenRCT2::MemoryStream(data, dataSize); diff --git a/src/openrct2/object/ObjectList.cpp b/src/openrct2/object/ObjectList.cpp index 851fcd457b..d76ae13b95 100644 --- a/src/openrct2/object/ObjectList.cpp +++ b/src/openrct2/object/ObjectList.cpp @@ -195,12 +195,12 @@ ObjectEntryIndex ObjectList::Find(ObjectType type, std::string_view identifier) * * rct2: 0x006AB344 */ -void object_create_identifier_name(char* string_buffer, size_t size, const rct_object_entry* object) +void ObjectCreateIdentifierName(char* string_buffer, size_t size, const rct_object_entry* object) { snprintf(string_buffer, size, "%.8s/%4X%4X", object->name, object->flags, object->checksum); } -void get_type_entry_index(size_t index, ObjectType* outObjectType, ObjectEntryIndex* outEntryIndex) +void ObjectGetTypeEntryIndex(size_t index, ObjectType* outObjectType, ObjectEntryIndex* outEntryIndex) { uint8_t objectType = EnumValue(ObjectType::Ride); for (size_t groupCount : object_entry_group_counts) @@ -222,14 +222,14 @@ void get_type_entry_index(size_t index, ObjectType* outObjectType, ObjectEntryIn *outEntryIndex = static_cast(index); } -void object_entry_get_name_fixed(utf8* buffer, size_t bufferSize, const rct_object_entry* entry) +void ObjectEntryGetNameFixed(utf8* buffer, size_t bufferSize, const rct_object_entry* entry) { bufferSize = std::min(static_cast(DAT_NAME_LENGTH) + 1, bufferSize); std::memcpy(buffer, entry->name, bufferSize - 1); buffer[bufferSize - 1] = 0; } -void* object_entry_get_chunk(ObjectType objectType, ObjectEntryIndex index) +void* ObjectEntryGetChunk(ObjectType objectType, ObjectEntryIndex index) { auto& objectMgr = OpenRCT2::GetContext()->GetObjectManager(); auto* object = objectMgr.GetLoadedObject(objectType, index); @@ -240,7 +240,7 @@ void* object_entry_get_chunk(ObjectType objectType, ObjectEntryIndex index) return nullptr; } -const Object* object_entry_get_object(ObjectType objectType, ObjectEntryIndex index) +const Object* ObjectEntryGetObject(ObjectType objectType, ObjectEntryIndex index) { auto& objectMgr = OpenRCT2::GetContext()->GetObjectManager(); return objectMgr.GetLoadedObject(objectType, index); diff --git a/src/openrct2/object/ObjectList.h b/src/openrct2/object/ObjectList.h index 83982ccaab..f0b5e0bcea 100644 --- a/src/openrct2/object/ObjectList.h +++ b/src/openrct2/object/ObjectList.h @@ -50,4 +50,4 @@ public: const_iterator end() const; }; -void get_type_entry_index(size_t index, ObjectType* outObjectType, ObjectEntryIndex* outEntryIndex); +void ObjectGetTypeEntryIndex(size_t index, ObjectType* outObjectType, ObjectEntryIndex* outEntryIndex); diff --git a/src/openrct2/object/ObjectManager.cpp b/src/openrct2/object/ObjectManager.cpp index e6160936ef..e00bcf16f8 100644 --- a/src/openrct2/object/ObjectManager.cpp +++ b/src/openrct2/object/ObjectManager.cpp @@ -133,7 +133,7 @@ public: size_t index = GetLoadedObjectIndex(object); if (index != SIZE_MAX) { - get_type_entry_index(index, nullptr, &result); + ObjectGetTypeEntryIndex(index, nullptr, &result); } return result; } @@ -735,45 +735,45 @@ std::unique_ptr CreateObjectManager(IObjectRepository& objectRep return std::make_unique(objectRepository); } -Object* object_manager_get_loaded_object(const ObjectEntryDescriptor& entry) +Object* ObjectManagerGetLoadedObject(const ObjectEntryDescriptor& entry) { auto& objectManager = OpenRCT2::GetContext()->GetObjectManager(); Object* loadedObject = objectManager.GetLoadedObject(entry); return loadedObject; } -ObjectEntryIndex object_manager_get_loaded_object_entry_index(const Object* loadedObject) +ObjectEntryIndex ObjectManagerGetLoadedObjectEntryIndex(const Object* loadedObject) { auto& objectManager = OpenRCT2::GetContext()->GetObjectManager(); auto entryIndex = objectManager.GetLoadedObjectEntryIndex(loadedObject); return entryIndex; } -ObjectEntryIndex object_manager_get_loaded_object_entry_index(const ObjectEntryDescriptor& entry) +ObjectEntryIndex ObjectManagerGetLoadedObjectEntryIndex(const ObjectEntryDescriptor& entry) { - return object_manager_get_loaded_object_entry_index(object_manager_get_loaded_object(entry)); + return ObjectManagerGetLoadedObjectEntryIndex(ObjectManagerGetLoadedObject(entry)); } -Object* object_manager_load_object(const rct_object_entry* entry) +Object* ObjectManagerLoadObject(const rct_object_entry* entry) { auto& objectManager = OpenRCT2::GetContext()->GetObjectManager(); Object* loadedObject = objectManager.LoadObject(entry); return loadedObject; } -void object_manager_unload_objects(const std::vector& entries) +void ObjectManagerUnloadObjects(const std::vector& entries) { auto& objectManager = OpenRCT2::GetContext()->GetObjectManager(); objectManager.UnloadObjects(entries); } -void object_manager_unload_all_objects() +void ObjectManagerUnloadAllObjects() { auto& objectManager = OpenRCT2::GetContext()->GetObjectManager(); objectManager.UnloadAllTransient(); } -StringId object_manager_get_source_game_string(const ObjectSourceGame sourceGame) +StringId ObjectManagerGetSourceGameString(const ObjectSourceGame sourceGame) { return ObjectManager::GetObjectSourceGameString(sourceGame); } diff --git a/src/openrct2/object/ObjectManager.h b/src/openrct2/object/ObjectManager.h index 2f330c21cc..57790d2114 100644 --- a/src/openrct2/object/ObjectManager.h +++ b/src/openrct2/object/ObjectManager.h @@ -49,10 +49,10 @@ struct IObjectManager [[nodiscard]] std::unique_ptr CreateObjectManager(IObjectRepository& objectRepository); -[[nodiscard]] Object* object_manager_get_loaded_object(const ObjectEntryDescriptor& entry); -[[nodiscard]] ObjectEntryIndex object_manager_get_loaded_object_entry_index(const Object* loadedObject); -[[nodiscard]] ObjectEntryIndex object_manager_get_loaded_object_entry_index(const ObjectEntryDescriptor& entry); -Object* object_manager_load_object(const rct_object_entry* entry); -void object_manager_unload_objects(const std::vector& entries); -void object_manager_unload_all_objects(); -[[nodiscard]] StringId object_manager_get_source_game_string(const ObjectSourceGame sourceGame); +[[nodiscard]] Object* ObjectManagerGetLoadedObject(const ObjectEntryDescriptor& entry); +[[nodiscard]] ObjectEntryIndex ObjectManagerGetLoadedObjectEntryIndex(const Object* loadedObject); +[[nodiscard]] ObjectEntryIndex ObjectManagerGetLoadedObjectEntryIndex(const ObjectEntryDescriptor& entry); +Object* ObjectManagerLoadObject(const rct_object_entry* entry); +void ObjectManagerUnloadObjects(const std::vector& entries); +void ObjectManagerUnloadAllObjects(); +[[nodiscard]] StringId ObjectManagerGetSourceGameString(const ObjectSourceGame sourceGame); diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index c23c1ff08e..d80807afc7 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -296,7 +296,7 @@ public: void AddObject(const rct_object_entry* objectEntry, const void* data, size_t dataSize) override { utf8 objectName[9]; - object_entry_get_name_fixed(objectName, sizeof(objectName), objectEntry); + ObjectEntryGetNameFixed(objectName, sizeof(objectName), objectEntry); // Check that the object is loadable before writing it auto object = ObjectFactory::CreateObjectFromLegacyData(*this, objectEntry, data, dataSize); @@ -472,11 +472,11 @@ private: { if (fixChecksum) { - uint32_t realChecksum = object_calculate_checksum(entry, data, dataSize); + uint32_t realChecksum = ObjectCalculateChecksum(entry, data, dataSize); if (realChecksum != entry->checksum) { char objectName[9]; - object_entry_get_name_fixed(objectName, sizeof(objectName), entry); + ObjectEntryGetNameFixed(objectName, sizeof(objectName), entry); LOG_VERBOSE("[%s] Incorrect checksum, adding salt bytes...", objectName); // Calculate the value of extra bytes that can be appended to the data so that the @@ -493,7 +493,7 @@ private: try { - uint32_t newRealChecksum = object_calculate_checksum(entry, newData, newDataSize); + uint32_t newRealChecksum = ObjectCalculateChecksum(entry, newData, newDataSize); if (newRealChecksum != entry->checksum) { Console::Error::WriteLine("CalculateExtraBytesToFixChecksum failed to fix checksum."); @@ -671,7 +671,7 @@ bool IsObjectCustom(const ObjectRepositoryItem* object) } } -std::unique_ptr object_repository_load_object(const rct_object_entry* objectEntry) +std::unique_ptr ObjectRepositoryLoadObject(const rct_object_entry* objectEntry) { std::unique_ptr object; auto& objRepository = GetContext()->GetObjectRepository(); @@ -687,7 +687,7 @@ std::unique_ptr object_repository_load_object(const rct_object_entry* ob return object; } -void scenario_translate(scenario_index_entry* scenarioEntry) +void ScenarioTranslate(scenario_index_entry* scenarioEntry) { StringId localisedStringIds[3]; if (LanguageGetLocalisedScenarioStrings(scenarioEntry->name, localisedStringIds)) @@ -703,31 +703,31 @@ void scenario_translate(scenario_index_entry* scenarioEntry) } } -size_t object_repository_get_items_count() +size_t ObjectRepositoryGetItemsCount() { auto& objectRepository = GetContext()->GetObjectRepository(); return objectRepository.GetNumObjects(); } -const ObjectRepositoryItem* object_repository_get_items() +const ObjectRepositoryItem* ObjectRepositoryGetItems() { auto& objectRepository = GetContext()->GetObjectRepository(); return objectRepository.GetObjects(); } -const ObjectRepositoryItem* object_repository_find_object_by_entry(const rct_object_entry* entry) +const ObjectRepositoryItem* ObjectRepositoryFindObjectByEntry(const rct_object_entry* entry) { auto& objectRepository = GetContext()->GetObjectRepository(); return objectRepository.FindObject(entry); } -const ObjectRepositoryItem* object_repository_find_object_by_name(const char* name) +const ObjectRepositoryItem* ObjectRepositoryFindObjectByName(const char* name) { auto& objectRepository = GetContext()->GetObjectRepository(); return objectRepository.FindObjectLegacy(name); } -int32_t object_calculate_checksum(const rct_object_entry* entry, const void* data, size_t dataLength) +int32_t ObjectCalculateChecksum(const rct_object_entry* entry, const void* data, size_t dataLength) { const uint8_t* entryBytePtr = reinterpret_cast(entry); diff --git a/src/openrct2/object/ObjectRepository.h b/src/openrct2/object/ObjectRepository.h index 6d36314e19..94dfa40d39 100644 --- a/src/openrct2/object/ObjectRepository.h +++ b/src/openrct2/object/ObjectRepository.h @@ -100,8 +100,8 @@ struct IObjectRepository [[nodiscard]] bool IsObjectCustom(const ObjectRepositoryItem* object); -[[nodiscard]] size_t object_repository_get_items_count(); -[[nodiscard]] const ObjectRepositoryItem* object_repository_get_items(); -[[nodiscard]] const ObjectRepositoryItem* object_repository_find_object_by_entry(const rct_object_entry* entry); -[[nodiscard]] const ObjectRepositoryItem* object_repository_find_object_by_name(const char* name); -[[nodiscard]] std::unique_ptr object_repository_load_object(const rct_object_entry* objectEntry); +[[nodiscard]] size_t ObjectRepositoryGetItemsCount(); +[[nodiscard]] const ObjectRepositoryItem* ObjectRepositoryGetItems(); +[[nodiscard]] const ObjectRepositoryItem* ObjectRepositoryFindObjectByEntry(const rct_object_entry* entry); +[[nodiscard]] const ObjectRepositoryItem* ObjectRepositoryFindObjectByName(const char* name); +[[nodiscard]] std::unique_ptr ObjectRepositoryLoadObject(const rct_object_entry* objectEntry); diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 6efebb46fe..04e43a1105 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -52,7 +52,7 @@ void Painter::Paint(IDrawingEngine& de) UpdatePaletteEffects(); _uiContext->Draw(dpi); - if ((gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && !title_should_hide_version_info()) + if ((gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && !TitleShouldHideVersionInfo()) { DrawOpenRCT2(dpi, { 0, _uiContext->GetHeight() - 20 }); } diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 698ec85cb5..984d8ea742 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -2297,7 +2297,7 @@ enum : uint32_t S6_SAVE_FLAG_AUTOMATIC = 1u << 31, }; -int32_t scenario_save(u8string_view path, int32_t flags) +int32_t ScenarioSave(u8string_view path, int32_t flags) { if (flags & S6_SAVE_FLAG_SCENARIO) { diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index b73b2b46f4..2be97ba792 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -155,7 +155,7 @@ static int32_t peep_move_one_tile(Direction direction, Peep& peep) // coordinate constant, but instead clamp it to an acceptable range. This brings in 'outlier' guests from // the edges of the path, while allowing guests who are already in an acceptable position to stay there. - const int8_t offset = (scenario_rand() & 7) - 3; + const int8_t offset = (ScenarioRand() & 7) - 3; if (direction == 0 || direction == 2) { // Peep is moving along X, so apply the offset to the X position of the destination and clamp their current Y @@ -183,7 +183,7 @@ static int32_t peep_move_one_tile(Direction direction, Peep& peep) static int32_t guest_surface_path_finding(Peep& peep) { auto pathPos = CoordsXYRangedZ{ peep.NextLoc, peep.NextLoc.z, peep.NextLoc.z + PATH_CLEARANCE }; - Direction randDirection = scenario_rand() & 3; + Direction randDirection = ScenarioRand() & 3; if (!WallInTheWay(pathPos, randDirection)) { @@ -201,7 +201,7 @@ static int32_t guest_surface_path_finding(Peep& peep) } randDirection++; - uint8_t rand_backwards = scenario_rand() & 1; + uint8_t rand_backwards = ScenarioRand() & 1; if (rand_backwards) { randDirection -= 2; @@ -462,7 +462,7 @@ static uint8_t footpath_element_destination_in_direction( */ static int32_t guest_path_find_aimless(Peep& peep, uint8_t edges) { - if (scenario_rand() & 1) + if (ScenarioRand() & 1) { // If possible go straight if (edges & (1 << peep.PeepDirection)) @@ -473,7 +473,7 @@ static int32_t guest_path_find_aimless(Peep& peep, uint8_t edges) while (true) { - Direction direction = scenario_rand() & 3; + Direction direction = ScenarioRand() & 3; // Otherwise go in a random direction allowed from the tile. if (edges & (1 << direction)) { @@ -494,7 +494,7 @@ static uint8_t peep_pathfind_get_max_number_junctions(Peep& peep) // PEEP_FLAGS_2? It's cleared here but not set anywhere! if ((peep.PeepFlags & PEEP_FLAGS_2)) { - if ((scenario_rand() & 0xFFFF) <= 7281) + if ((ScenarioRand() & 0xFFFF) <= 7281) peep.PeepFlags &= ~PEEP_FLAGS_2; return 8; @@ -2086,7 +2086,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) * In principle, peeps with food are not paying as much attention to * where they are going and are consequently more like to walk up * dead end paths, paths to ride exits, etc. */ - if (!peep.HasFoodOrDrink() && (scenario_rand() & 0xFFFF) >= 2184) + if (!peep.HasFoodOrDrink() && (ScenarioRand() & 0xFFFF) >= 2184) { uint8_t adjustedEdges = edges; for (Direction chosenDirection : ALL_DIRECTIONS) @@ -2123,7 +2123,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) { probability = 9362; } - if ((scenario_rand() & 0xFFFF) < probability) + if ((ScenarioRand() & 0xFFFF) < probability) { peep.ReadMap(); } diff --git a/src/openrct2/platform/Crash.cpp b/src/openrct2/platform/Crash.cpp index 8cf995fe8a..7ad1ef3c60 100644 --- a/src/openrct2/platform/Crash.cpp +++ b/src/openrct2/platform/Crash.cpp @@ -328,7 +328,7 @@ constexpr const wchar_t* PipeName = L"openrct2-bpad"; #endif // USE_BREAKPAD -CExceptionHandler crash_init() +CExceptionHandler CrashInit() { #ifdef USE_BREAKPAD // Path must exist and be RW! @@ -340,14 +340,14 @@ CExceptionHandler crash_init() #endif // USE_BREAKPAD } -void crash_register_additional_file(const std::string& key, const std::string& path) +void CrashRegisterAdditionalFile(const std::string& key, const std::string& path) { #ifdef USE_BREAKPAD _uploadFiles[String::ToWideChar(key.c_str())] = String::ToWideChar(path.c_str()); #endif // USE_BREAKPAD } -void crash_unregister_additional_file(const std::string& key) +void CrashUnregisterAdditionalFile(const std::string& key) { #ifdef USE_BREAKPAD auto it = _uploadFiles.find(String::ToWideChar(key.c_str())); diff --git a/src/openrct2/platform/Crash.h b/src/openrct2/platform/Crash.h index c7c4a3a0e1..93b82c8115 100644 --- a/src/openrct2/platform/Crash.h +++ b/src/openrct2/platform/Crash.h @@ -14,6 +14,6 @@ using CExceptionHandler = void*; extern bool gOpenRCT2SilentBreakpad; -CExceptionHandler crash_init(); -void crash_register_additional_file(const std::string& key, const std::string& path); -void crash_unregister_additional_file(const std::string& key); +CExceptionHandler CrashInit(); +void CrashRegisterAdditionalFile(const std::string& key, const std::string& path); +void CrashUnregisterAdditionalFile(const std::string& key); diff --git a/src/openrct2/platform/Platform.Win32.cpp b/src/openrct2/platform/Platform.Win32.cpp index bbe1b45e24..2000727629 100644 --- a/src/openrct2/platform/Platform.Win32.cpp +++ b/src/openrct2/platform/Platform.Win32.cpp @@ -367,7 +367,7 @@ namespace Platform return _dllModule; } - static std::wstring get_progIdName(std::string_view extension) + static std::wstring GetProdIDName(std::string_view extension) { auto progIdName = std::string(OPENRCT2_NAME) + std::string(extension); auto progIdNameW = String::ToWideChar(progIdName); @@ -390,7 +390,7 @@ namespace Platform auto fileTypeTextW = String::ToWideChar(fileTypeText); auto commandTextW = String::ToWideChar(commandText); auto commandArgsW = String::ToWideChar(commandArgs); - auto progIdNameW = get_progIdName(extension); + auto progIdNameW = GetProdIDName(extension); HKEY hKey = nullptr; HKEY hRootKey = nullptr; @@ -473,7 +473,7 @@ namespace Platform RegDeleteTreeW(hRootKey, String::ToWideChar(extension).c_str()); // [hRootKey\OpenRCT2.ext] - auto progIdName = get_progIdName(extension); + auto progIdName = GetProdIDName(extension); RegDeleteTreeW(hRootKey, progIdName.c_str()); RegCloseKey(hRootKey); diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index bcb6ae2829..249dd141d1 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2123,7 +2123,7 @@ namespace RCT1 { // Date and srand gCurrentTicks = _s4.ticks; - scenario_rand_seed(_s4.random_a, _s4.random_b); + ScenarioRandSeed(_s4.random_a, _s4.random_b); gDateMonthsElapsed = static_cast(_s4.month); gDateMonthTicks = _s4.day; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 54b837de71..cbeef377ab 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -251,7 +251,7 @@ namespace RCT2 gDateMonthTicks = _s6.current_day; gCurrentTicks = _s6.game_ticks_1; - scenario_rand_seed(_s6.scenario_srand_0, _s6.scenario_srand_1); + ScenarioRandSeed(_s6.scenario_srand_0, _s6.scenario_srand_1); DetermineFlatRideStatus(); ImportTileElements(); @@ -1027,7 +1027,7 @@ namespace RCT2 // This stall was not colourable in RCT2. if (dst->type == RIDE_TYPE_FOOD_STALL) { - auto object = object_entry_get_object(ObjectType::Ride, dst->subtype); + auto object = ObjectEntryGetObject(ObjectType::Ride, dst->subtype); if (object != nullptr && object->GetIdentifier() == "rct2.ride.icecr1") { dst->track_colour[0].main = COLOUR_LIGHT_BLUE; diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index 09fa703919..9193fbfae1 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -219,7 +219,7 @@ namespace RCT2 if (RCT2RideTypeNeedsConversion(td->type)) { std::scoped_lock lock(_objectLookupMutex); - auto rawObject = object_repository_load_object(&td->vehicle_object.Entry); + auto rawObject = ObjectRepositoryLoadObject(&td->vehicle_object.Entry); if (rawObject != nullptr) { const auto* rideEntry = static_cast( diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index b5682c30a8..6008dafad2 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -218,7 +218,7 @@ std::string_view GetRideEntryName(ObjectEntryIndex index) return {}; } - auto objectEntry = object_entry_get_object(ObjectType::Ride, index); + auto objectEntry = ObjectEntryGetObject(ObjectType::Ride, index); if (objectEntry != nullptr) { return objectEntry->GetLegacyIdentifier(); @@ -1378,7 +1378,7 @@ static void ride_breakdown_update(Ride& ride) // a 0.8% chance, less the breakdown factor which accumulates as the game // continues. if ((ride.reliability == 0 - || static_cast(scenario_rand() & 0x2FFFFF) <= 1 + RIDE_INITIAL_RELIABILITY - ride.reliability) + || static_cast(ScenarioRand() & 0x2FFFFF) <= 1 + RIDE_INITIAL_RELIABILITY - ride.reliability) && !gCheatsDisableAllBreakdowns) { int32_t breakdownReason = ride_get_new_breakdown_problem(ride); @@ -1416,7 +1416,7 @@ static int32_t ride_get_new_breakdown_problem(const Ride& ride) return -1; // Choose a random number within this range - randomProbability = scenario_rand() % totalProbability; + randomProbability = ScenarioRand() % totalProbability; // Find which problem range the random number lies problemBits = availableBreakdownProblems; @@ -1465,7 +1465,7 @@ static void choose_random_train_to_breakdown_safe(Ride& ride) if (ride.NumTrains == 0) return; - ride.broken_vehicle = scenario_rand() % ride.NumTrains; + ride.broken_vehicle = ScenarioRand() % ride.NumTrains; // Prevent crash caused by accessing SPRITE_INDEX_NULL on hacked rides. // This should probably be cleaned up on import instead. @@ -1514,7 +1514,7 @@ void RidePrepareBreakdown(Ride& ride, int32_t breakdownReason) choose_random_train_to_breakdown_safe(ride); if (ride.num_cars_per_train != 0) { - ride.broken_car = scenario_rand() % ride.num_cars_per_train; + ride.broken_car = ScenarioRand() % ride.num_cars_per_train; // Set flag on broken car vehicle = GetEntity(ride.vehicles[ride.broken_vehicle]); @@ -2368,7 +2368,7 @@ static void ride_track_set_map_tooltip(TileElement* tileElement) ride->FormatNameTo(ft); ride->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); - intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); + intent.PutExtra(INTENT_EXTRA_FORMATTER, &ft); ContextBroadcastIntent(&intent); } } @@ -2384,7 +2384,7 @@ static void ride_queue_banner_set_map_tooltip(TileElement* tileElement) ride->FormatNameTo(ft); ride->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); - intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); + intent.PutExtra(INTENT_EXTRA_FORMATTER, &ft); ContextBroadcastIntent(&intent); } } @@ -2408,7 +2408,7 @@ static void ride_station_set_map_tooltip(TileElement* tileElement) ft.Add(stationIndex.ToUnderlying() + 1); ride->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); - intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); + intent.PutExtra(INTENT_EXTRA_FORMATTER, &ft); ContextBroadcastIntent(&intent); } } @@ -2455,7 +2455,7 @@ static void ride_entrance_set_map_tooltip(TileElement* tileElement) } ft.Add(queueLength); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); - intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); + intent.PutExtra(INTENT_EXTRA_FORMATTER, &ft); ContextBroadcastIntent(&intent); } else @@ -2475,7 +2475,7 @@ static void ride_entrance_set_map_tooltip(TileElement* tileElement) ft.Add(stationIndex.ToUnderlying() + 1); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); - intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); + intent.PutExtra(INTENT_EXTRA_FORMATTER, &ft); ContextBroadcastIntent(&intent); } } @@ -3182,9 +3182,9 @@ static Vehicle* vehicle_create_car( if (numAttempts > 10000) return nullptr; - vehicle->sprite_direction = scenario_rand() & 0x1E; - chosenLoc.y = dodgemPos.y + (scenario_rand() & 0xFF); - chosenLoc.x = dodgemPos.x + (scenario_rand() & 0xFF); + vehicle->sprite_direction = ScenarioRand() & 0x1E; + chosenLoc.y = dodgemPos.y + (ScenarioRand() & 0xFF); + chosenLoc.x = dodgemPos.x + (ScenarioRand() & 0xFF); } while (vehicle->DodgemsCarWouldCollideAt(chosenLoc).has_value()); vehicle->MoveTo({ chosenLoc, dodgemPos.z }); @@ -5075,7 +5075,7 @@ void Ride::Crash(uint8_t vehicleIndex) { // Open ride window for crashed vehicle auto intent = Intent(WD_VEHICLE); - intent.putExtra(INTENT_EXTRA_VEHICLE, vehicle); + intent.PutExtra(INTENT_EXTRA_VEHICLE, vehicle); rct_window* w = ContextOpenIntent(&intent); rct_viewport* viewport = WindowGetViewport(w); diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 84edf46b69..25fe0db143 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -121,7 +121,7 @@ static rct_window* ride_create_or_find_construction_window(RideId rideIndex) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS); - intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex.ToUnderlying()); + intent.PutExtra(INTENT_EXTRA_RIDE_ID, rideIndex.ToUnderlying()); windowManager->BroadcastIntent(intent); return WindowFindByClass(WindowClass::RideConstruction); } diff --git a/src/openrct2/ride/Station.cpp b/src/openrct2/ride/Station.cpp index 057d17403e..f432596ae1 100644 --- a/src/openrct2/ride/Station.cpp +++ b/src/openrct2/ride/Station.cpp @@ -282,7 +282,7 @@ static void ride_race_init_vehicle_speeds(const Ride& ride) rct_ride_entry* rideEntry = vehicle->GetRideEntry(); - vehicle->speed = (scenario_rand() & 15) - 8 + rideEntry->Cars[vehicle->vehicle_type].powered_max_speed; + vehicle->speed = (ScenarioRand() & 15) - 8 + rideEntry->Cars[vehicle->vehicle_type].powered_max_speed; if (vehicle->num_peeps != 0) { diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index cdc3404b20..8e61cdd9ce 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -96,7 +96,7 @@ ResultWithMessage TrackDesign::CreateTrackDesign(TrackDesignState& tds, const Ri { type = ride.type; - auto object = object_entry_get_object(ObjectType::Ride, ride.subtype); + auto object = ObjectEntryGetObject(ObjectType::Ride, ride.subtype); if (object != nullptr) { auto entry = object->GetObjectEntry(); diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 28ac0acb33..149e17c12a 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -243,7 +243,7 @@ static void track_design_save_push_tile_element_desc( static TrackDesignAddStatus track_design_save_add_scenery(const CoordsXY& loc, SmallSceneryElement* sceneryElement) { auto entryIndex = sceneryElement->GetEntryIndex(); - auto obj = object_entry_get_object(ObjectType::SmallScenery, entryIndex); + auto obj = ObjectEntryGetObject(ObjectType::SmallScenery, entryIndex); if (obj != nullptr && track_design_is_supported_object(obj)) { uint8_t flags = 0; @@ -315,7 +315,7 @@ static TrackDesignAddStatus track_design_save_add_large_scenery(const CoordsXY& static TrackDesignAddStatus track_design_save_add_wall(const CoordsXY& loc, WallElement* wallElement) { auto entryIndex = wallElement->GetEntryIndex(); - auto obj = object_entry_get_object(ObjectType::Walls, entryIndex); + auto obj = ObjectEntryGetObject(ObjectType::Walls, entryIndex); if (obj != nullptr && track_design_is_supported_object(obj)) { uint8_t flags = 0; @@ -461,7 +461,7 @@ static void track_design_save_pop_tile_element_desc(const ObjectEntryDescriptor& static void track_design_save_remove_scenery(const CoordsXY& loc, SmallSceneryElement* sceneryElement) { auto entryIndex = sceneryElement->GetEntryIndex(); - auto obj = object_entry_get_object(ObjectType::SmallScenery, entryIndex); + auto obj = ObjectEntryGetObject(ObjectType::SmallScenery, entryIndex); if (obj != nullptr) { uint8_t flags = 0; @@ -526,7 +526,7 @@ static void track_design_save_remove_large_scenery(const CoordsXY& loc, LargeSce static void track_design_save_remove_wall(const CoordsXY& loc, WallElement* wallElement) { auto entryIndex = wallElement->GetEntryIndex(); - auto obj = object_entry_get_object(ObjectType::Walls, entryIndex); + auto obj = ObjectEntryGetObject(ObjectType::Walls, entryIndex); if (obj != nullptr) { uint8_t flags = 0; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 0777d19e7e..be273c3927 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -3495,9 +3495,9 @@ void Vehicle::UpdateCollisionSetup() } train->IsCrashedVehicle = true; - train->animationState = scenario_rand() & 0xFFFF; + train->animationState = ScenarioRand() & 0xFFFF; - train->animation_frame = scenario_rand() & 0x7; + train->animation_frame = ScenarioRand() & 0x7; train->sprite_width = 13; train->sprite_height_negative = 45; train->sprite_height_positive = 5; @@ -3581,9 +3581,9 @@ void Vehicle::UpdateCrashSetup() trainVehicle->crash_x = trainX; trainVehicle->crash_y = trainY; trainVehicle->crash_z = trainZ; - trainVehicle->crash_x += (scenario_rand() & 0xF) - 8; - trainVehicle->crash_y += (scenario_rand() & 0xF) - 8; - trainVehicle->crash_z += (scenario_rand() & 0xF) - 8; + trainVehicle->crash_x += (ScenarioRand() & 0xF) - 8; + trainVehicle->crash_y += (ScenarioRand() & 0xF) - 8; + trainVehicle->crash_z += (ScenarioRand() & 0xF) - 8; trainVehicle->TrackLocation = { 0, 0, 0 }; } @@ -4554,11 +4554,11 @@ void Vehicle::UpdateBoatLocation() sub_state = 0; uint8_t curDirection = ((sprite_direction + 19) >> 3) & 3; - uint8_t randDirection = scenario_rand() & 3; + uint8_t randDirection = ScenarioRand() & 3; if (lost_time_out > 1920) { - if (scenario_rand() & 1) + if (ScenarioRand() & 1) { CoordsXY destLocation = (returnPosition.ToCoordsXY() - CoordsDirectionDelta[returnDirection]).ToTileCentre(); @@ -5373,10 +5373,10 @@ void Vehicle::UpdateCrash() if (curVehicle->crash_z <= 96) { curVehicle->crash_z++; - if ((scenario_rand() & 0xFFFF) <= 0x1555) + if ((ScenarioRand() & 0xFFFF) <= 0x1555) { - int32_t xOffset = (scenario_rand() & 2) - 1; - int32_t yOffset = (scenario_rand() & 2) - 1; + int32_t xOffset = (ScenarioRand() & 2) - 1; + int32_t yOffset = (ScenarioRand() & 2) - 1; ExplosionCloud::Create(curPos + CoordsXYZ{ xOffset, yOffset, 0 }); } @@ -5489,7 +5489,7 @@ void Vehicle::UpdateSound() break; } - if ((scenario_rand() & 0xFFFF) <= 0x5555) + if ((ScenarioRand() & 0xFFFF) <= 0x5555) { scream_sound_id = OpenRCT2::Audio::SoundId::TrainWhistle; screamSound.volume = 255; @@ -5511,7 +5511,7 @@ void Vehicle::UpdateSound() break; } - if ((scenario_rand() & 0xFFFF) <= 0x5555) + if ((ScenarioRand() & 0xFFFF) <= 0x5555) { scream_sound_id = OpenRCT2::Audio::SoundId::Tram; screamSound.volume = 255; @@ -5614,7 +5614,7 @@ OpenRCT2::Audio::SoundId Vehicle::ProduceScreamSound(const int32_t totalNumPeeps if (scream_sound_id == OpenRCT2::Audio::SoundId::Null) { - auto r = scenario_rand(); + auto r = ScenarioRand(); if (totalNumPeeps >= static_cast(r % 16)) { switch (carEntry->sound_range) @@ -5696,7 +5696,7 @@ void Vehicle::SetMapToolbar() const ft.Add(vehicleIndex + 1); curRide->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); - intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); + intent.PutExtra(INTENT_EXTRA_FORMATTER, &ft); ContextBroadcastIntent(&intent); } } @@ -5786,7 +5786,7 @@ int32_t Vehicle::UpdateMotionDodgems() sprite_direction &= 0x1E; Invalidate(); } - else if ((scenario_rand() & 0xFFFF) <= 2849) + else if ((ScenarioRand() & 0xFFFF) <= 2849) { if (var_35 & (1 << 6)) sprite_direction -= 2; @@ -5860,7 +5860,7 @@ int32_t Vehicle::UpdateMotionDodgems() Vehicle* collideVehicle = GetEntity(collideSprite.value()); if (collideVehicle != nullptr) { - var_34 = (scenario_rand() & 1) ? 1 : -1; + var_34 = (ScenarioRand() & 1) ? 1 : -1; if (oldVelocity >= 131072) { @@ -5870,7 +5870,7 @@ int32_t Vehicle::UpdateMotionDodgems() } else { - var_34 = (scenario_rand() & 1) ? 6 : -6; + var_34 = (ScenarioRand() & 1) ? 6 : -6; if (oldVelocity >= 131072) { @@ -6939,7 +6939,7 @@ void Vehicle::UpdateGoKartAttemptSwitchLanes() { probability = 0x0A3D; } - if ((scenario_rand() & 0xFFFF) <= probability) + if ((ScenarioRand() & 0xFFFF) <= probability) { // This changes "riding left" to "moving to right lane" and "riding right" to "moving to left lane". TrackSubposition = VehicleTrackSubposition{ static_cast(static_cast(TrackSubposition) + 2u) }; @@ -8319,7 +8319,7 @@ loc_6DC743: } else { - uint16_t rand16 = scenario_rand() & 0xFFFF; + uint16_t rand16 = ScenarioRand() & 0xFFFF; VehicleTrackSubposition nextTrackSubposition = VehicleTrackSubposition::MiniGolfBallPathC14; if (rand16 <= 0xA000) { @@ -9158,7 +9158,7 @@ int32_t Vehicle::NumPeepsUntilTrainTail() const void Vehicle::InvalidateWindow() { auto intent = Intent(INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW); - intent.putExtra(INTENT_EXTRA_VEHICLE, this); + intent.PutExtra(INTENT_EXTRA_VEHICLE, this); ContextBroadcastIntent(&intent); } diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 5afe239981..0e2dc72fca 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -83,14 +83,14 @@ money64 gScenarioCompanyValueRecord; std::string gScenarioFileName; -static void scenario_objective_check(); +static void ScenarioCheckObjective(); using namespace OpenRCT2; -void scenario_begin() +void ScenarioBegin() { GameLoadInit(); - scenario_reset(); + ScenarioReset(); if (gScenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen) ContextOpenWindowView(WV_PARK_OBJECTIVE); @@ -98,7 +98,7 @@ void scenario_begin() gScreenAge = 0; } -void scenario_reset() +void ScenarioReset() { // Set the scenario pseudo-random seeds Random::Rct2::Seed s{ 0x1234567F ^ Platform::GetTicks(), 0x789FABCD ^ Platform::GetTicks() }; @@ -185,7 +185,7 @@ void scenario_reset() gGamePaused = false; } -static void scenario_end() +static void ScenarioEnd() { GameResetSpeed(); WindowCloseByClass(WindowClass::Dropdown); @@ -197,39 +197,39 @@ static void scenario_end() * * rct2: 0x0066A752 */ -void scenario_failure() +void ScenarioFailure() { gScenarioCompletedCompanyValue = COMPANY_VALUE_ON_FAILED_OBJECTIVE; - scenario_end(); + ScenarioEnd(); } /** * * rct2: 0x0066A75E */ -void scenario_success() +void ScenarioSuccess() { auto companyValue = gCompanyValue; gScenarioCompletedCompanyValue = companyValue; peep_applause(); - if (scenario_repository_try_record_highscore(gScenarioFileName.c_str(), companyValue, nullptr)) + if (ScenarioRepositoryTryRecordHighscore(gScenarioFileName.c_str(), companyValue, nullptr)) { // Allow name entry gParkFlags |= PARK_FLAGS_SCENARIO_COMPLETE_NAME_INPUT; gScenarioCompanyValueRecord = companyValue; } - scenario_end(); + ScenarioEnd(); } /** * * rct2: 0x006695E8 */ -void scenario_success_submit_name(const char* name) +void ScenarioSuccessSubmitName(const char* name) { - if (scenario_repository_try_record_highscore(gScenarioFileName.c_str(), gScenarioCompanyValueRecord, name)) + if (ScenarioRepositoryTryRecordHighscore(gScenarioFileName.c_str(), gScenarioCompanyValueRecord, name)) { gScenarioCompletedBy = name; } @@ -240,7 +240,7 @@ void scenario_success_submit_name(const char* name) * Send a warning when entrance price is too high. * rct2: 0x0066A80E */ -static void scenario_entrance_fee_too_high_check() +static void ScenarioCheckEntranceFeeTooHigh() { const auto max_fee = add_clamp_money16(gTotalRideValueForMoney, gTotalRideValueForMoney / 2); @@ -261,7 +261,7 @@ static void scenario_entrance_fee_too_high_check() } } -void scenario_autosave_check() +void ScenarioAutosaveCheck() { if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE) return; @@ -296,7 +296,7 @@ void scenario_autosave_check() } } -static void scenario_day_update() +static void ScenarioDayUpdate() { finance_update_daily_profit(); peep_update_days_in_queue(); @@ -307,11 +307,11 @@ static void scenario_day_update() case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: case OBJECTIVE_FINISH_5_ROLLERCOASTERS: case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: - scenario_objective_check(); + ScenarioCheckObjective(); break; default: if (AllowEarlyCompletion()) - scenario_objective_check(); + ScenarioCheckObjective(); break; } @@ -323,7 +323,7 @@ static void scenario_day_update() ContextBroadcastIntent(&intent); } -static void scenario_week_update() +static void ScenarioWeekUpdate() { int32_t month = DateGetMonth(gDateMonthsElapsed); @@ -335,33 +335,33 @@ static void scenario_week_update() RideCheckAllReachable(); RideUpdateFavouritedStat(); - auto water_type = static_cast(object_entry_get_chunk(ObjectType::Water, 0)); + auto water_type = static_cast(ObjectEntryGetChunk(ObjectType::Water, 0)); if (month <= MONTH_APRIL && water_type != nullptr && water_type->flags & WATER_FLAGS_ALLOW_DUCKS) { // 100 attempts at finding some water to create a few ducks at for (int32_t i = 0; i < 100; i++) { - if (scenario_create_ducks()) + if (ScenarioCreateDucks()) break; } } } -static void scenario_fortnight_update() +static void ScenarioFortnightUpdate() { finance_pay_ride_upkeep(); } -static void scenario_month_update() +static void ScenarioMonthUpdate() { finance_shift_expenditure_table(); - scenario_objective_check(); - scenario_entrance_fee_too_high_check(); + ScenarioCheckObjective(); + ScenarioCheckEntranceFeeTooHigh(); award_update_all(); } -static void scenario_update_daynight_cycle() +static void ScenarioUpdateDayNightCycle() { float currentDayNightCycle = gDayNightCycle; gDayNightCycle = 0; @@ -402,7 +402,7 @@ static void scenario_update_daynight_cycle() * Scenario and finance related update iteration. * rct2: 0x006C44B1 */ -void scenario_update() +void ScenarioUpdate() { PROFILED_FUNCTION(); @@ -410,28 +410,28 @@ void scenario_update() { if (DateIsDayStart(gDateMonthTicks)) { - scenario_day_update(); + ScenarioDayUpdate(); } if (DateIsWeekStart(gDateMonthTicks)) { - scenario_week_update(); + ScenarioWeekUpdate(); } if (DateIsFortnightStart(gDateMonthTicks)) { - scenario_fortnight_update(); + ScenarioFortnightUpdate(); } if (DateIsMonthStart(gDateMonthTicks)) { - scenario_month_update(); + ScenarioMonthUpdate(); } } - scenario_update_daynight_cycle(); + ScenarioUpdateDayNightCycle(); } /** * * rct2: 0x006744A9 */ -bool scenario_create_ducks() +bool ScenarioCreateDucks() { // Check NxN area around centre tile defined by SquareSize constexpr int32_t SquareSize = 7; @@ -439,8 +439,8 @@ bool scenario_create_ducks() constexpr int32_t SquareRadiusSize = SquareCentre * 32; CoordsXY centrePos; - centrePos.x = SquareRadiusSize + (scenario_rand_max(gMapSize.x - SquareCentre) * 32); - centrePos.y = SquareRadiusSize + (scenario_rand_max(gMapSize.y - SquareCentre) * 32); + centrePos.x = SquareRadiusSize + (ScenarioRandMax(gMapSize.x - SquareCentre) * 32); + centrePos.y = SquareRadiusSize + (ScenarioRandMax(gMapSize.y - SquareCentre) * 32); Guard::Assert(MapIsLocationValid(centrePos)); @@ -481,10 +481,10 @@ bool scenario_create_ducks() centrePos.x += 16; centrePos.y += 16; - uint32_t duckCount = (scenario_rand() % 4) + 2; + uint32_t duckCount = (ScenarioRand() % 4) + 2; for (uint32_t i = 0; i < duckCount; i++) { - uint32_t r = scenario_rand(); + uint32_t r = ScenarioRand(); innerPos.x = (r >> 16) % SquareRadiusSize; innerPos.y = (r & 0xFFFF) % SquareRadiusSize; @@ -497,12 +497,12 @@ bool scenario_create_ducks() return true; } -const random_engine_t::state_type& scenario_rand_state() +const random_engine_t::state_type& ScenarioRandState() { return gScenarioRand.state(); }; -void scenario_rand_seed(random_engine_t::result_type s0, random_engine_t::result_type s1) +void ScenarioRandSeed(random_engine_t::result_type s0, random_engine_t::result_type s1) { Random::Rct2::Seed s{ s0, s1 }; gScenarioRand.seed(s); @@ -514,21 +514,21 @@ void scenario_rand_seed(random_engine_t::result_type s0, random_engine_t::result * * @return eax */ -random_engine_t::result_type scenario_rand() +random_engine_t::result_type ScenarioRand() { return gScenarioRand(); } -uint32_t scenario_rand_max(uint32_t max) +uint32_t ScenarioRandMax(uint32_t max) { if (max < 2) return 0; if ((max & (max - 1)) == 0) - return scenario_rand() & (max - 1); + return ScenarioRand() & (max - 1); uint32_t rand, cap = ~(static_cast(0)) - (~(static_cast(0)) % max) - 1; do { - rand = scenario_rand(); + rand = ScenarioRand(); } while (rand > cap); return rand % max; } @@ -537,7 +537,7 @@ uint32_t scenario_rand_max(uint32_t max) * Prepare rides, for the finish five rollercoasters objective. * rct2: 0x006788F7 */ -static ResultWithMessage scenario_prepare_rides_for_save() +static ResultWithMessage ScenarioPrepareRidesForSave() { int32_t isFiveCoasterObjective = gScenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS; uint8_t rcs = 0; @@ -596,10 +596,10 @@ static ResultWithMessage scenario_prepare_rides_for_save() * * rct2: 0x006726C7 */ -ResultWithMessage scenario_prepare_for_save() +ResultWithMessage ScenarioPrepareForSave() { // This can return false if the goal is 'Finish 5 roller coaster' and there are too few. - const auto prepareRidesResult = scenario_prepare_rides_for_save(); + const auto prepareRidesResult = ScenarioPrepareRidesForSave(); if (!prepareRidesResult.Successful) { return { false, prepareRidesResult.Message }; @@ -608,7 +608,7 @@ ResultWithMessage scenario_prepare_for_save() if (gScenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING) gParkFlags |= PARK_FLAGS_PARK_OPEN; - scenario_reset(); + ScenarioReset(); return { true }; } @@ -865,16 +865,16 @@ bool AllowEarlyCompletion() } } -static void scenario_objective_check() +static void ScenarioCheckObjective() { auto status = gScenarioObjective.Check(); if (status == ObjectiveStatus::Success) { - scenario_success(); + ScenarioSuccess(); } else if (status == ObjectiveStatus::Failure) { - scenario_failure(); + ScenarioFailure(); } } diff --git a/src/openrct2/scenario/Scenario.h b/src/openrct2/scenario/Scenario.h index 5e02cd19b5..cf078cdb3d 100644 --- a/src/openrct2/scenario/Scenario.h +++ b/src/openrct2/scenario/Scenario.h @@ -172,20 +172,20 @@ extern uint32_t gLastAutoSaveUpdate; extern std::string gScenarioFileName; -void scenario_begin(); -void scenario_reset(); -void scenario_update(); -bool scenario_create_ducks(); +void ScenarioBegin(); +void ScenarioReset(); +void ScenarioUpdate(); +bool ScenarioCreateDucks(); bool AllowEarlyCompletion(); -const random_engine_t::state_type& scenario_rand_state(); -void scenario_rand_seed(random_engine_t::result_type s0, random_engine_t::result_type s1); -random_engine_t::result_type scenario_rand(); -uint32_t scenario_rand_max(uint32_t max); +const random_engine_t::state_type& ScenarioRandState(); +void ScenarioRandSeed(random_engine_t::result_type s0, random_engine_t::result_type s1); +random_engine_t::result_type ScenarioRand(); +uint32_t ScenarioRandMax(uint32_t max); -ResultWithMessage scenario_prepare_for_save(); -int32_t scenario_save(u8string_view path, int32_t flags); -void scenario_failure(); -void scenario_success(); -void scenario_success_submit_name(const char* name); -void scenario_autosave_check(); +ResultWithMessage ScenarioPrepareForSave(); +int32_t ScenarioSave(u8string_view path, int32_t flags); +void ScenarioFailure(); +void ScenarioSuccess(); +void ScenarioSuccessSubmitName(const char* name); +void ScenarioAutosaveCheck(); diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 7e1b31ea49..893d021520 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -55,7 +55,7 @@ static int32_t ScenarioCategoryCompare(int32_t categoryA, int32_t categoryB) return 1; } -static int32_t scenario_index_entry_CompareByCategory(const scenario_index_entry& entryA, const scenario_index_entry& entryB) +static int32_t ScenarioIndexEntryCompareByCategory(const scenario_index_entry& entryA, const scenario_index_entry& entryB) { // Order by category if (entryA.category != entryB.category) @@ -78,7 +78,7 @@ static int32_t scenario_index_entry_CompareByCategory(const scenario_index_entry } } -static int32_t scenario_index_entry_CompareByIndex(const scenario_index_entry& entryA, const scenario_index_entry& entryB) +static int32_t ScenarioIndexEntryCompareByIndex(const scenario_index_entry& entryA, const scenario_index_entry& entryB) { // Order by source game if (entryA.source_game != entryB.source_game) @@ -95,7 +95,7 @@ static int32_t scenario_index_entry_CompareByIndex(const scenario_index_entry& e { if (entryA.category == entryB.category) { - return scenario_index_entry_CompareByCategory(entryA, entryB); + return ScenarioIndexEntryCompareByCategory(entryA, entryB); } return ScenarioCategoryCompare(entryA.category, entryB.category); @@ -111,11 +111,11 @@ static int32_t scenario_index_entry_CompareByIndex(const scenario_index_entry& e return entryA.source_index - entryB.source_index; case ScenarioSource::Real: - return scenario_index_entry_CompareByCategory(entryA, entryB); + return ScenarioIndexEntryCompareByCategory(entryA, entryB); } } -static void scenario_highscore_free(scenario_highscore_entry* highscore) +static void ScenarioHighscoreFree(scenario_highscore_entry* highscore) { SafeFree(highscore->fileName); SafeFree(highscore->name); @@ -323,7 +323,7 @@ private: } } - scenario_translate(&entry); + ScenarioTranslate(&entry); return entry; } }; @@ -582,14 +582,14 @@ private: { std::sort( _scenarios.begin(), _scenarios.end(), [](const scenario_index_entry& a, const scenario_index_entry& b) -> bool { - return scenario_index_entry_CompareByIndex(a, b) < 0; + return ScenarioIndexEntryCompareByIndex(a, b) < 0; }); } else { std::sort( _scenarios.begin(), _scenarios.end(), [](const scenario_index_entry& a, const scenario_index_entry& b) -> bool { - return scenario_index_entry_CompareByCategory(a, b) < 0; + return ScenarioIndexEntryCompareByCategory(a, b) < 0; }); } } @@ -715,7 +715,7 @@ private: { for (auto highscore : _highscores) { - scenario_highscore_free(highscore); + ScenarioHighscoreFree(highscore); } _highscores.clear(); } @@ -774,25 +774,25 @@ IScenarioRepository* GetScenarioRepository() return GetContext()->GetScenarioRepository(); } -void scenario_repository_scan() +void ScenarioRepositoryScan() { IScenarioRepository* repo = GetScenarioRepository(); repo->Scan(LocalisationService_GetCurrentLanguage()); } -size_t scenario_repository_get_count() +size_t ScenarioRepositoryGetCount() { IScenarioRepository* repo = GetScenarioRepository(); return repo->GetCount(); } -const scenario_index_entry* scenario_repository_get_by_index(size_t index) +const scenario_index_entry* ScenarioRepositoryGetByIndex(size_t index) { IScenarioRepository* repo = GetScenarioRepository(); return repo->GetByIndex(index); } -bool scenario_repository_try_record_highscore(const utf8* scenarioFileName, money64 companyValue, const utf8* name) +bool ScenarioRepositoryTryRecordHighscore(const utf8* scenarioFileName, money64 companyValue, const utf8* name) { IScenarioRepository* repo = GetScenarioRepository(); return repo->TryRecordHighscore(LocalisationService_GetCurrentLanguage(), scenarioFileName, companyValue, name); diff --git a/src/openrct2/scenario/ScenarioRepository.h b/src/openrct2/scenario/ScenarioRepository.h index a6c3554286..69af1b0c7b 100644 --- a/src/openrct2/scenario/ScenarioRepository.h +++ b/src/openrct2/scenario/ScenarioRepository.h @@ -92,9 +92,8 @@ struct IScenarioRepository const std::shared_ptr& env); [[nodiscard]] IScenarioRepository* GetScenarioRepository(); -void scenario_repository_scan(); -[[nodiscard]] size_t scenario_repository_get_count(); -[[nodiscard]] const scenario_index_entry* scenario_repository_get_by_index(size_t index); -[[nodiscard]] bool scenario_repository_try_record_highscore( - const utf8* scenarioFileName, money64 companyValue, const utf8* name); -void scenario_translate(scenario_index_entry* scenarioEntry); +void ScenarioRepositoryScan(); +[[nodiscard]] size_t ScenarioRepositoryGetCount(); +[[nodiscard]] const scenario_index_entry* ScenarioRepositoryGetByIndex(size_t index); +[[nodiscard]] bool ScenarioRepositoryTryRecordHighscore(const utf8* scenarioFileName, money64 companyValue, const utf8* name); +void ScenarioTranslate(scenario_index_entry* scenarioEntry); diff --git a/src/openrct2/scripting/bindings/game/ScContext.hpp b/src/openrct2/scripting/bindings/game/ScContext.hpp index 8582bb0763..5a33723767 100644 --- a/src/openrct2/scripting/bindings/game/ScContext.hpp +++ b/src/openrct2/scripting/bindings/game/ScContext.hpp @@ -239,7 +239,7 @@ namespace OpenRCT2::Scripting if (min >= max) return min; int32_t range = max - min; - return min + scenario_rand_max(range); + return min + ScenarioRandMax(range); } duk_ret_t formatString(duk_context* ctx) diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 83bb18ca12..9e40eae782 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -73,7 +73,7 @@ bool TitleScreen::PreviewSequence(size_t value) } else { - _currentSequence = title_get_config_sequence(); + _currentSequence = TitleGetConfigSequence(); if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) { TryLoadSequence(); @@ -92,7 +92,7 @@ void TitleScreen::StopPreviewingSequence() WindowUnfollowSprite(*mainWindow); } _previewingSequence = false; - _currentSequence = title_get_config_sequence(); + _currentSequence = TitleGetConfigSequence(); gPreviewingTitleSequenceInGame = false; } } @@ -200,7 +200,7 @@ void TitleScreen::ChangePresetSequence(size_t preset) return; } - const utf8* configId = title_sequence_manager_get_config_id(preset); + const utf8* configId = TitleSequenceManagerGetConfigID(preset); gConfigInterface.CurrentTitleSequencePreset = configId; if (!_previewingSequence) @@ -232,19 +232,19 @@ void TitleScreen::TitleInitialise() { bool RCT1Installed = false, RCT1AAInstalled = false, RCT1LLInstalled = false; int RCT1Count = 0; - size_t scenarioCount = scenario_repository_get_count(); + size_t scenarioCount = ScenarioRepositoryGetCount(); for (size_t s = 0; s < scenarioCount; s++) { - if (scenario_repository_get_by_index(s)->source_game == ScenarioSource::RCT1) + if (ScenarioRepositoryGetByIndex(s)->source_game == ScenarioSource::RCT1) { RCT1Count++; } - if (scenario_repository_get_by_index(s)->source_game == ScenarioSource::RCT1_AA) + if (ScenarioRepositoryGetByIndex(s)->source_game == ScenarioSource::RCT1_AA) { RCT1AAInstalled = true; } - if (scenario_repository_get_by_index(s)->source_game == ScenarioSource::RCT1_LL) + if (ScenarioRepositoryGetByIndex(s)->source_game == ScenarioSource::RCT1_LL) { RCT1LLInstalled = true; } @@ -267,7 +267,7 @@ void TitleScreen::TitleInitialise() { size_t total = TitleSequenceManager::GetCount(); random = util_rand() % static_cast(total); - const utf8* scName = title_sequence_manager_get_name(random); + const utf8* scName = TitleSequenceManagerGetName(random); safeSequence = true; if (scName == RCT1String) { @@ -284,10 +284,10 @@ void TitleScreen::TitleInitialise() } ChangePresetSequence(random); } - size_t seqId = title_get_config_sequence(); + size_t seqId = TitleGetConfigSequence(); if (seqId == SIZE_MAX) { - seqId = title_sequence_manager_get_index_for_config_id("*OPENRCT2"); + seqId = TitleSequenceManagerGetIndexForConfigID("*OPENRCT2"); if (seqId == SIZE_MAX) { seqId = 0; @@ -317,7 +317,7 @@ bool TitleScreen::TryLoadSequence(bool loadPreview) if (targetSequence != _currentSequence && !loadPreview) { // Forcefully change the preset to a preset that works. - const utf8* configId = title_sequence_manager_get_config_id(targetSequence); + const utf8* configId = TitleSequenceManagerGetConfigID(targetSequence); gConfigInterface.CurrentTitleSequencePreset = configId; } _currentSequence = targetSequence; @@ -341,7 +341,7 @@ bool TitleScreen::TryLoadSequence(bool loadPreview) return true; } -void title_load() +void TitleLoad() { if (_singleton != nullptr) { @@ -349,7 +349,7 @@ void title_load() } } -void title_create_windows() +void TitleCreateWindows() { if (_singleton != nullptr) { @@ -357,7 +357,7 @@ void title_create_windows() } } -void* title_get_sequence_player() +void* TitleGetSequencePlayer() { void* result = nullptr; if (_singleton != nullptr) @@ -367,7 +367,7 @@ void* title_get_sequence_player() return result; } -void title_sequence_change_preset(size_t preset) +void TitleSequenceChangePreset(size_t preset) { if (_singleton != nullptr) { @@ -375,7 +375,7 @@ void title_sequence_change_preset(size_t preset) } } -bool title_should_hide_version_info() +bool TitleShouldHideVersionInfo() { bool result = false; if (_singleton != nullptr) @@ -385,7 +385,7 @@ bool title_should_hide_version_info() return result; } -void title_set_hide_version_info(bool value) +void TitleSetHideVersionInfo(bool value) { if (_singleton != nullptr) { @@ -393,12 +393,12 @@ void title_set_hide_version_info(bool value) } } -size_t title_get_config_sequence() +size_t TitleGetConfigSequence() { - return title_sequence_manager_get_index_for_config_id(gConfigInterface.CurrentTitleSequencePreset.c_str()); + return TitleSequenceManagerGetIndexForConfigID(gConfigInterface.CurrentTitleSequencePreset.c_str()); } -size_t title_get_current_sequence() +size_t TitleGetCurrentSequence() { size_t result = 0; if (_singleton != nullptr) @@ -408,7 +408,7 @@ size_t title_get_current_sequence() return result; } -bool title_preview_sequence(size_t value) +bool TitlePreviewSequence(size_t value) { if (_singleton != nullptr) { @@ -417,7 +417,7 @@ bool title_preview_sequence(size_t value) return false; } -void title_stop_previewing_sequence() +void TitleStopPreviewingSequence() { if (_singleton != nullptr) { @@ -425,7 +425,7 @@ void title_stop_previewing_sequence() } } -bool title_is_previewing_sequence() +bool TitleIsPreviewingSequence() { if (_singleton != nullptr) { diff --git a/src/openrct2/title/TitleScreen.h b/src/openrct2/title/TitleScreen.h index 04dc170e7d..fdda7b4997 100644 --- a/src/openrct2/title/TitleScreen.h +++ b/src/openrct2/title/TitleScreen.h @@ -54,15 +54,15 @@ namespace OpenRCT2 // When testing title sequences within a normal game extern bool gPreviewingTitleSequenceInGame; -void title_load(); -void title_create_windows(); -void* title_get_sequence_player(); -void title_sequence_change_preset(size_t preset); -bool title_should_hide_version_info(); -void title_set_hide_version_info(bool value); -size_t title_get_config_sequence(); -size_t title_get_current_sequence(); -bool title_preview_sequence(size_t value); -void title_stop_previewing_sequence(); -bool title_is_previewing_sequence(); +void TitleLoad(); +void TitleCreateWindows(); +void* TitleGetSequencePlayer(); +void TitleSequenceChangePreset(size_t preset); +bool TitleShouldHideVersionInfo(); +void TitleSetHideVersionInfo(bool value); +size_t TitleGetConfigSequence(); +size_t TitleGetCurrentSequence(); +bool TitlePreviewSequence(size_t value); +void TitleStopPreviewingSequence(); +bool TitleIsPreviewingSequence(); void DrawOpenRCT2(rct_drawpixelinfo* dpi, const ScreenCoordsXY& screenCoords); diff --git a/src/openrct2/title/TitleSequenceManager.cpp b/src/openrct2/title/TitleSequenceManager.cpp index cd7b620200..5a4d157d37 100644 --- a/src/openrct2/title/TitleSequenceManager.cpp +++ b/src/openrct2/title/TitleSequenceManager.cpp @@ -279,12 +279,12 @@ namespace TitleSequenceManager } } // namespace TitleSequenceManager -size_t title_sequence_manager_get_count() +size_t TitleSequenceManagerGetCount() { return TitleSequenceManager::GetCount(); } -const utf8* title_sequence_manager_get_name(size_t index) +const utf8* TitleSequenceManagerGetName(size_t index) { auto item = TitleSequenceManager::GetItem(index); if (item == nullptr) @@ -294,7 +294,7 @@ const utf8* title_sequence_manager_get_name(size_t index) return item->Name.c_str(); } -const utf8* title_sequence_manager_get_path(size_t index) +const utf8* TitleSequenceManagerGetPath(size_t index) { auto item = TitleSequenceManager::GetItem(index); if (item == nullptr) @@ -304,7 +304,7 @@ const utf8* title_sequence_manager_get_path(size_t index) return item->Path.c_str(); } -const utf8* title_sequence_manager_get_config_id(size_t index) +const utf8* TitleSequenceManagerGetConfigID(size_t index) { auto item = TitleSequenceManager::GetItem(index); if (item == nullptr) @@ -323,7 +323,7 @@ const utf8* title_sequence_manager_get_config_id(size_t index) return name.c_str(); } -size_t title_sequence_manager_get_predefined_index(size_t index) +size_t TitleSequenceManagerGetPredefinedIndex(size_t index) { auto item = TitleSequenceManager::GetItem(index); if (item == nullptr) @@ -334,12 +334,12 @@ size_t title_sequence_manager_get_predefined_index(size_t index) return predefinedIndex; } -size_t title_sequence_manager_get_index_for_config_id(const utf8* configId) +size_t TitleSequenceManagerGetIndexForConfigID(const utf8* configId) { size_t count = TitleSequenceManager::GetCount(); for (size_t i = 0; i < count; i++) { - const utf8* cid = title_sequence_manager_get_config_id(i); + const utf8* cid = TitleSequenceManagerGetConfigID(i); if (String::Equals(cid, configId)) { return i; @@ -348,12 +348,12 @@ size_t title_sequence_manager_get_index_for_config_id(const utf8* configId) return SIZE_MAX; } -size_t title_sequence_manager_get_index_for_name(const utf8* name) +size_t TitleSequenceManagerGetIndexForName(const utf8* name) { size_t count = TitleSequenceManager::GetCount(); for (size_t i = 0; i < count; i++) { - const utf8* tn = title_sequence_manager_get_name(i); + const utf8* tn = TitleSequenceManagerGetName(i); if (String::Equals(tn, name)) { return i; @@ -362,27 +362,27 @@ size_t title_sequence_manager_get_index_for_name(const utf8* name) return SIZE_MAX; } -void title_sequence_manager_scan() +void TitleSequenceManagerScan() { TitleSequenceManager::Scan(); } -void title_sequence_manager_delete(size_t i) +void TitleSequenceManagerDelete(size_t i) { TitleSequenceManager::DeleteItem(i); } -size_t title_sequence_manager_rename(size_t i, const utf8* name) +size_t TitleSequenceManagerRename(size_t i, const utf8* name) { return TitleSequenceManager::RenameItem(i, name); } -size_t title_sequence_manager_duplicate(size_t i, const utf8* name) +size_t TitleSequenceManagerDuplicate(size_t i, const utf8* name) { return TitleSequenceManager::DuplicateItem(i, name); } -size_t title_sequence_manager_create(const utf8* name) +size_t TitleSequenceManagerCreate(const utf8* name) { return TitleSequenceManager::CreateItem(name); } diff --git a/src/openrct2/title/TitleSequenceManager.h b/src/openrct2/title/TitleSequenceManager.h index ad1e840e43..adb76ce8ed 100644 --- a/src/openrct2/title/TitleSequenceManager.h +++ b/src/openrct2/title/TitleSequenceManager.h @@ -35,15 +35,15 @@ namespace TitleSequenceManager constexpr const size_t PREDEFINED_INDEX_CUSTOM = std::numeric_limits::max(); -size_t title_sequence_manager_get_count(); -const utf8* title_sequence_manager_get_name(size_t index); -const utf8* title_sequence_manager_get_path(size_t index); -const utf8* title_sequence_manager_get_config_id(size_t index); -size_t title_sequence_manager_get_predefined_index(size_t index); -size_t title_sequence_manager_get_index_for_config_id(const utf8* configId); -size_t title_sequence_manager_get_index_for_name(const utf8* name); -void title_sequence_manager_scan(); -void title_sequence_manager_delete(size_t i); -size_t title_sequence_manager_rename(size_t i, const utf8* name); -size_t title_sequence_manager_duplicate(size_t i, const utf8* name); -size_t title_sequence_manager_create(const utf8* name); +size_t TitleSequenceManagerGetCount(); +const utf8* TitleSequenceManagerGetName(size_t index); +const utf8* TitleSequenceManagerGetPath(size_t index); +const utf8* TitleSequenceManagerGetConfigID(size_t index); +size_t TitleSequenceManagerGetPredefinedIndex(size_t index); +size_t TitleSequenceManagerGetIndexForConfigID(const utf8* configId); +size_t TitleSequenceManagerGetIndexForName(const utf8* name); +void TitleSequenceManagerScan(); +void TitleSequenceManagerDelete(size_t i); +size_t TitleSequenceManagerRename(size_t i, const utf8* name); +size_t TitleSequenceManagerDuplicate(size_t i, const utf8* name); +size_t TitleSequenceManagerCreate(const utf8* name); diff --git a/src/openrct2/windows/Intent.cpp b/src/openrct2/windows/Intent.cpp index 9f2e4842bd..614113ba6f 100644 --- a/src/openrct2/windows/Intent.cpp +++ b/src/openrct2/windows/Intent.cpp @@ -28,7 +28,7 @@ Intent::Intent(IntentAction intentAction) { } -Intent* Intent::putExtra(uint32_t key, uint32_t value) +Intent* Intent::PutExtra(uint32_t key, uint32_t value) { IntentData data = {}; data.intVal.unsignedInt = value; @@ -39,7 +39,7 @@ Intent* Intent::putExtra(uint32_t key, uint32_t value) return this; } -Intent* Intent::putExtra(uint32_t key, void* value) +Intent* Intent::PutExtra(uint32_t key, void* value) { IntentData data = {}; data.pointerVal = value; @@ -50,7 +50,7 @@ Intent* Intent::putExtra(uint32_t key, void* value) return this; } -Intent* Intent::putExtra(uint32_t key, int32_t value) +Intent* Intent::PutExtra(uint32_t key, int32_t value) { IntentData data = {}; data.intVal.signedInt = value; @@ -61,7 +61,7 @@ Intent* Intent::putExtra(uint32_t key, int32_t value) return this; } -Intent* Intent::putExtra(uint32_t key, std::string value) +Intent* Intent::PutExtra(uint32_t key, std::string value) { IntentData data = {}; data.stringVal = std::move(value); @@ -72,7 +72,7 @@ Intent* Intent::putExtra(uint32_t key, std::string value) return this; } -Intent* Intent::putExtra(uint32_t key, close_callback value) +Intent* Intent::PutExtra(uint32_t key, close_callback value) { IntentData data = {}; data.closeCallbackVal = value; diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index ff42ec9ca3..9cf4326cff 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -91,16 +91,16 @@ public: uint32_t GetUIntExtra(uint32_t key) const; int32_t GetSIntExtra(uint32_t key) const; close_callback GetCloseCallbackExtra(uint32_t key) const; - Intent* putExtra(uint32_t key, uint32_t value); - Intent* putExtra(uint32_t key, void* value); - Intent* putExtra(uint32_t key, int32_t value); - Intent* putExtra(uint32_t key, std::string value); - Intent* putExtra(uint32_t key, close_callback value); + Intent* PutExtra(uint32_t key, uint32_t value); + Intent* PutExtra(uint32_t key, void* value); + Intent* PutExtra(uint32_t key, int32_t value); + Intent* PutExtra(uint32_t key, std::string value); + Intent* PutExtra(uint32_t key, close_callback value); - template Intent* putExtra(uint32_t key, const TIdentifier& value) + template Intent* PutExtra(uint32_t key, const TIdentifier& value) { const auto val = value.ToUnderlying(); - return putExtra(key, static_cast(val)); + return PutExtra(key, static_cast(val)); } }; diff --git a/src/openrct2/windows/tile_inspector.h b/src/openrct2/windows/TileInspectorGlobals.h similarity index 100% rename from src/openrct2/windows/tile_inspector.h rename to src/openrct2/windows/TileInspectorGlobals.h diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index b1ee6b689d..07a7f266de 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -110,7 +110,7 @@ void ClimateReset(ClimateType climate) _weatherVolume = 1; } - ClimateDetermineFutureWeather(scenario_rand()); + ClimateDetermineFutureWeather(ScenarioRand()); } /** @@ -149,7 +149,7 @@ void ClimateUpdate() if (gClimateCurrent.Level == gClimateNext.Level) { gClimateCurrent.Weather = gClimateNext.Weather; - ClimateDetermineFutureWeather(scenario_rand()); + ClimateDetermineFutureWeather(ScenarioRand()); auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); ContextBroadcastIntent(&intent); } diff --git a/src/openrct2/world/LargeScenery.cpp b/src/openrct2/world/LargeScenery.cpp index c555e384c7..03da8e098e 100644 --- a/src/openrct2/world/LargeScenery.cpp +++ b/src/openrct2/world/LargeScenery.cpp @@ -93,7 +93,7 @@ LargeSceneryEntry* LargeSceneryElement::GetEntry() const const LargeSceneryObject* LargeSceneryElement::GetObject() const { - return static_cast(object_entry_get_object(ObjectType::LargeScenery, GetEntryIndex())); + return static_cast(ObjectEntryGetObject(ObjectType::LargeScenery, GetEntryIndex())); } uint8_t LargeSceneryElement::GetSequenceIndex() const diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index ea63ef1c7e..6dda548bdd 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -312,7 +312,7 @@ static void MapGenPlaceTrees() for (int32_t i = 0; i < object_entry_group_counts[EnumValue(ObjectType::SmallScenery)]; i++) { auto* sceneryEntry = GetSmallSceneryEntry(i); - auto entry = object_entry_get_object(ObjectType::SmallScenery, i); + auto entry = ObjectEntryGetObject(ObjectType::SmallScenery, i); if (sceneryEntry == nullptr) continue; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 6749e95b68..9e0b47ac1d 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -86,7 +86,7 @@ static PeepSpawn* GetRandomPeepSpawn() { if (!gPeepSpawns.empty()) { - return &gPeepSpawns[scenario_rand() % gPeepSpawns.size()]; + return &gPeepSpawns[ScenarioRand() % gPeepSpawns.size()]; } return nullptr; @@ -669,7 +669,7 @@ uint8_t Park::CalculateGuestInitialHappiness(uint8_t percentage) void Park::GenerateGuests() { // Generate a new guest for some probability - if (static_cast(scenario_rand() & 0xFFFF) < _guestGenerationProbability) + if (static_cast(ScenarioRand() & 0xFFFF) < _guestGenerationProbability) { bool difficultGeneration = (gParkFlags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) != 0; if (!difficultGeneration || _suggestedGuestMaximum + 150 >= gNumGuestsInPark) @@ -683,7 +683,7 @@ void Park::GenerateGuests() { // Random chance of guest generation auto probability = marketing_get_campaign_guest_generation_probability(campaign.Type); - auto random = scenario_rand_max(std::numeric_limits::max()); + auto random = ScenarioRandMax(std::numeric_limits::max()); if (random < probability) { GenerateGuestFromCampaign(campaign.Type); diff --git a/src/openrct2/world/Surface.cpp b/src/openrct2/world/Surface.cpp index 80df330cee..e340a62c7c 100644 --- a/src/openrct2/world/Surface.cpp +++ b/src/openrct2/world/Surface.cpp @@ -160,7 +160,7 @@ void SurfaceElement::UpdateGrassLength(const CoordsXY& coords) if (GrassLength & 8) { // Random growth rate (length nibble) - GrassLength |= scenario_rand() & 0x70; + GrassLength |= ScenarioRand() & 0x70; } else { diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 12cf843148..f025fec731 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -21,7 +21,7 @@ #include "../ride/Track.h" #include "../ride/TrackData.h" #include "../windows/Intent.h" -#include "../windows/tile_inspector.h" +#include "../windows/TileInspectorGlobals.h" #include "Banner.h" #include "Footpath.h" #include "LargeScenery.h" diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index 5cc9bddfc6..96df22863c 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -45,7 +45,7 @@ public: void SetUp() override { // Use a consistent random seed in every test - scenario_rand_seed(0x12345678, 0x87654321); + ScenarioRandSeed(0x12345678, 0x87654321); } static void TearDownTestCase() diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 4ed8be988d..1529db69c3 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -122,7 +122,7 @@ static void RecordGameStateSnapshot(std::unique_ptr& context, MemorySt auto& snapshot = snapshots->CreateSnapshot(); snapshots->Capture(snapshot); - snapshots->LinkSnapshot(snapshot, gCurrentTicks, scenario_rand_state().s0); + snapshots->LinkSnapshot(snapshot, gCurrentTicks, ScenarioRandState().s0); DataSerialiser snapShotDs(true, snapshotStream); snapshots->SerialiseSnapshot(snapshot, snapShotDs); }