diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 0157b6847f..b567d2e5f6 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -687,7 +687,7 @@ public: { if (loc.x < 0) return false; - if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (loc.y <= kTopToolbarHeight && gLegacyScene != LegacyScene::titleSequence) return false; if (loc.x + width > ContextGetWidth()) return false; @@ -708,7 +708,7 @@ public: unk = screenWidth + (unk * 2); if (loc.x > unk) return false; - if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (loc.y <= kTopToolbarHeight && gLegacyScene != LegacyScene::titleSequence) return false; unk = screenHeight - (height / 4); if (loc.y > unk) @@ -726,7 +726,7 @@ public: else if (screenPos.x + width > screenWidth) screenPos.x = screenWidth - width; - auto toolbarAllowance = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 0 : (kTopToolbarHeight + 1); + auto toolbarAllowance = gLegacyScene == LegacyScene::titleSequence ? 0 : (kTopToolbarHeight + 1); if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance) screenPos.y = toolbarAllowance; else if (screenPos.y + height - toolbarAllowance > screenHeight) @@ -1025,7 +1025,7 @@ public: { CloseByClass(WindowClass::Dropdown); - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { if (GetGameState().EditorStep != EditorStep::LandscapeEditor) return; diff --git a/src/openrct2-ui/audio/AudioMixer.cpp b/src/openrct2-ui/audio/AudioMixer.cpp index a9a99b7665..e7e72fa33e 100644 --- a/src/openrct2-ui/audio/AudioMixer.cpp +++ b/src/openrct2-ui/audio/AudioMixer.cpp @@ -306,7 +306,7 @@ int32_t AudioMixer::ApplyVolume(const IAudioChannel* channel, void* buffer, size volumeAdjust *= _adjustSoundVolume; // Cap sound volume on title screen so music is more audible - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) { volumeAdjust = std::min(volumeAdjust, 0.75f); } diff --git a/src/openrct2-ui/input/InputManager.cpp b/src/openrct2-ui/input/InputManager.cpp index ce73541c38..ea3bd81305 100644 --- a/src/openrct2-ui/input/InputManager.cpp +++ b/src/openrct2-ui/input/InputManager.cpp @@ -112,7 +112,7 @@ void InputManager::Process() void InputManager::HandleViewScrolling() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto& console = GetInGameConsole(); diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index d3a6f7d5f3..2eb21c2ceb 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -320,7 +320,8 @@ namespace OpenRCT2 switch (widget->type) { case WindowWidgetType::Viewport: - if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))) + if (!(gLegacyScene == LegacyScene::trackDesignsManager + || gLegacyScene == LegacyScene::titleSequence)) { InputViewportDragBegin(*w); } @@ -1655,7 +1656,8 @@ namespace OpenRCT2 mainWindow = WindowGetMain(); if (mainWindow == nullptr) return; - if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))) + if ((mainWindow->flags & WF_NO_SCROLLING) + || (gLegacyScene == LegacyScene::trackDesignsManager || gLegacyScene == LegacyScene::titleSequence)) return; if (mainWindow->viewport == nullptr) return; diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index f071bbca14..a5decc97e7 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -55,7 +55,7 @@ using namespace OpenRCT2::Ui::Windows; static void OpenWindow(WindowClass wc) { - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { ContextOpenWindow(wc); } @@ -63,7 +63,7 @@ static void OpenWindow(WindowClass wc) static void RotateCamera(int32_t direction) { - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { ViewportRotateAll(direction); } @@ -71,7 +71,7 @@ static void RotateCamera(int32_t direction) static void ToggleViewFlag(int32_t viewportFlag) { - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { auto window = WindowGetMain(); if (window != nullptr) @@ -84,7 +84,7 @@ static void ToggleViewFlag(int32_t viewportFlag) static void ShortcutRotateConstructionObject() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto* windowMgr = GetWindowManager(); @@ -152,7 +152,7 @@ static void ShortcutRemoveTopBottomToolbarToggle() { auto* windowMgr = GetWindowManager(); - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) { if (windowMgr->FindByClass(WindowClass::TitleLogo) != nullptr) { @@ -177,7 +177,7 @@ static void ShortcutRemoveTopBottomToolbarToggle() } else { - if (gScreenFlags == 0) + if (gLegacyScene == LegacyScene::playing) { ContextOpenWindow(WindowClass::TopToolbar); ContextOpenWindow(WindowClass::BottomToolbar); @@ -194,13 +194,13 @@ static void ShortcutRemoveTopBottomToolbarToggle() static void ShortcutAdjustLand() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) return; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) return; ToggleLandWindow(); @@ -208,13 +208,13 @@ static void ShortcutAdjustLand() static void ShortcutAdjustWater() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) return; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) return; ToggleWaterWindow(); @@ -222,13 +222,13 @@ static void ShortcutAdjustWater() static void ShortcutBuildScenery() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) return; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) return; ToggleSceneryWindow(); @@ -236,13 +236,13 @@ static void ShortcutBuildScenery() static void ShortcutBuildPaths() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) return; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) return; ToggleFootpathWindow(); @@ -250,12 +250,12 @@ static void ShortcutBuildPaths() static void ShortcutBuildNewRide() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)) + if (gLegacyScene != LegacyScene::scenarioEditor) { - if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) + if (!(isInTrackDesignerOrManager())) { ContextOpenWindow(WindowClass::ConstructRide); } @@ -264,20 +264,20 @@ static void ShortcutBuildNewRide() static void ShortcutShowFinancialInformation() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) + if (!(isInTrackDesignerOrManager())) if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY)) ContextOpenWindow(WindowClass::Finances); } static void ShortcutShowResearchInformation() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { ContextOpenWindowView(WV_RIDE_RESEARCH); } @@ -285,10 +285,10 @@ static void ShortcutShowResearchInformation() static void ShortcutShowRidesList() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { ContextOpenWindow(WindowClass::RideList); } @@ -296,10 +296,10 @@ static void ShortcutShowRidesList() static void ShortcutShowParkInformation() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { ContextOpenWindow(WindowClass::ParkInformation); } @@ -307,10 +307,10 @@ static void ShortcutShowParkInformation() static void ShortcutShowGuestList() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { ContextOpenWindow(WindowClass::GuestList); } @@ -318,10 +318,10 @@ static void ShortcutShowGuestList() static void ShortcutShowStaffList() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { ContextOpenWindow(WindowClass::StaffList); } @@ -329,26 +329,26 @@ static void ShortcutShowStaffList() static void ShortcutShowRecentMessages() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) ContextOpenWindow(WindowClass::RecentNews); } static void ShortcutShowMap() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().EditorStep == EditorStep::LandscapeEditor) - if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) + if (gLegacyScene != LegacyScene::scenarioEditor || GetGameState().EditorStep == EditorStep::LandscapeEditor) + if (!(isInTrackDesignerOrManager())) ContextOpenWindow(WindowClass::Map); } static void ShortcutReduceGameSpeed() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; if (NetworkGetMode() == NETWORK_MODE_NONE) @@ -357,7 +357,7 @@ static void ShortcutReduceGameSpeed() static void ShortcutIncreaseGameSpeed() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; if (NetworkGetMode() == NETWORK_MODE_NONE) @@ -366,7 +366,7 @@ static void ShortcutIncreaseGameSpeed() static void ShortcutOpenCheatWindow() { - if (gScreenFlags != SCREEN_FLAGS_PLAYING) + if (gLegacyScene != LegacyScene::playing) return; // Check if window is already open @@ -387,7 +387,7 @@ static void ShortcutOpenKeyboardShortcutsWindow() static void ShortcutOpenTransparencyWindow() { - if (gScreenFlags != SCREEN_FLAGS_PLAYING) + if (gLegacyScene != LegacyScene::playing) return; ContextOpenWindow(WindowClass::Transparency); @@ -395,13 +395,13 @@ static void ShortcutOpenTransparencyWindow() static void ShortcutClearScenery() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) return; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) return; ToggleClearSceneryWindow(); @@ -410,12 +410,12 @@ static void ShortcutClearScenery() static void ShortcutQuickSaveGame() { // Do a quick save in playing mode and a regular save in Scenario Editor mode. In other cases, don't do anything. - if (gScreenFlags == SCREEN_FLAGS_PLAYING) + if (gLegacyScene == LegacyScene::playing) { ToolCancel(); SaveGame(); } - else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + else if (gLegacyScene == LegacyScene::scenarioEditor) { auto intent = Intent(WindowClass::Loadsave); intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); @@ -426,7 +426,7 @@ static void ShortcutQuickSaveGame() static void ShortcutLoadGame() { - if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) + if (!(isInTrackDesignerOrManager())) { auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt); GameActions::Execute(&loadOrQuitAction); @@ -435,8 +435,9 @@ static void ShortcutLoadGame() static void ShortcutOpenSceneryPicker() { - if ((gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) - || (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor)) + if ((gLegacyScene == LegacyScene::titleSequence || gLegacyScene == LegacyScene::trackDesigner + || gLegacyScene == LegacyScene::trackDesignsManager) + || (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor)) return; auto* windowMgr = GetWindowManager(); @@ -628,7 +629,7 @@ static void ShortcutToggleConsole() static void ShortcutConstructionTurnLeft() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto* windowMgr = GetWindowManager(); @@ -645,7 +646,7 @@ static void ShortcutConstructionTurnLeft() static void ShortcutConstructionTurnRight() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto* windowMgr = GetWindowManager(); @@ -662,7 +663,7 @@ static void ShortcutConstructionTurnRight() static void ShortcutConstructionSlopeUp() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto* windowMgr = GetWindowManager(); @@ -679,7 +680,7 @@ static void ShortcutConstructionSlopeUp() static void ShortcutConstructionBuildCurrent() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto* windowMgr = GetWindowManager(); @@ -696,7 +697,7 @@ static void ShortcutConstructionBuildCurrent() static void ShortcutConstructionSlopeDown() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto* windowMgr = GetWindowManager(); @@ -713,7 +714,7 @@ static void ShortcutConstructionSlopeDown() static void ShortcutConstructionDemolishCurrent() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; auto* windowMgr = GetWindowManager(); @@ -730,7 +731,7 @@ static void ShortcutConstructionDemolishCurrent() static void ShortcutToggleTransparentWater() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; Config::Get().general.TransparentWater ^= 1; @@ -752,7 +753,7 @@ void ShortcutManager::RegisterDefaultShortcuts() }); RegisterShortcut(ShortcutId::kInterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() { auto* windowMgr = GetWindowManager(); - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)) + if (gLegacyScene != LegacyScene::scenarioEditor) { windowMgr->CloseAll(); } @@ -763,7 +764,7 @@ void ShortcutManager::RegisterDefaultShortcuts() }); RegisterShortcut(ShortcutId::kInterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject); RegisterShortcut(ShortcutId::kInterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() { - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { auto* windowMgr = GetWindowManager(); auto window = windowMgr->FindByClass(WindowClass::Error); @@ -778,7 +779,7 @@ void ShortcutManager::RegisterDefaultShortcuts() } }); RegisterShortcut(ShortcutId::kInterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() { - if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER))) + if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager) { auto pauseToggleAction = PauseToggleAction(); GameActions::Execute(&pauseToggleAction); @@ -796,7 +797,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut( ShortcutId::kInterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, ShortcutToggleClearanceChecks); RegisterShortcut(ShortcutId::kInterfaceMultiplayerChat, STR_SHORTCUT_SEND_MESSAGE, "C", []() { - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && ChatAvailable()) + if (gLegacyScene != LegacyScene::titleSequence && ChatAvailable()) { ChatToggle(); } @@ -894,13 +895,13 @@ void ShortcutManager::RegisterDefaultShortcuts() // Debug RegisterShortcut(ShortcutId::kDebugToggleConsole, STR_CONSOLE, "`", ShortcutToggleConsole); RegisterShortcut(ShortcutId::kDebugAdvanceTick, STR_SHORTCUT_ADVANCE_TO_NEXT_TICK, []() { - if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER))) + if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager) { gDoSingleUpdate = true; } }); RegisterShortcut(ShortcutId::kDebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() { - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { auto* windowMgr = GetWindowManager(); auto window = windowMgr->FindByClass(WindowClass::DebugPaint); diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 28c0d83988..5fa01dca23 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -83,11 +83,11 @@ namespace OpenRCT2::Ui { InteractionInfo info{}; // No click input for scenario editor or track manager - if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER)) + if (gLegacyScene == LegacyScene::scenarioEditor || gLegacyScene == LegacyScene::trackDesignsManager) return info; // - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) return info; info = GetMapCoordinatesFromPos( @@ -100,7 +100,7 @@ namespace OpenRCT2::Ui auto sprite = info.Entity; // Allows only balloons to be popped and ducks to be quacked in title screen - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) { if (info.interactionType == ViewportInteractionItem::Entity && (sprite->Is() || sprite->Is())) return info; @@ -270,11 +270,11 @@ namespace OpenRCT2::Ui int32_t i; InteractionInfo info{}; // No click input for title screen or track manager - if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_MANAGER)) + if (gLegacyScene == LegacyScene::titleSequence || gLegacyScene == LegacyScene::trackDesignsManager) return info; // - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) return info; constexpr auto flags = static_cast( @@ -287,7 +287,7 @@ namespace OpenRCT2::Ui case ViewportInteractionItem::Entity: { auto sprite = info.Entity; - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || sprite->Type != EntityType::Vehicle) + if (gLegacyScene == LegacyScene::scenarioEditor || sprite->Type != EntityType::Vehicle) { info.interactionType = ViewportInteractionItem::None; return info; @@ -311,7 +311,7 @@ namespace OpenRCT2::Ui } case ViewportInteractionItem::Ride: { - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { info.interactionType = ViewportInteractionItem::None; return info; @@ -510,7 +510,7 @@ namespace OpenRCT2::Ui return info; } case ViewportInteractionItem::ParkEntrance: - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) break; if (tileElement->GetType() != TileElementType::Entrance) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 2e902a8b02..0a2ce19c1a 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -149,7 +149,7 @@ namespace OpenRCT2 */ static void WindowViewportWheelInput(WindowBase& w, int32_t wheel) { - if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene == LegacyScene::trackDesignsManager || gLegacyScene == LegacyScene::titleSequence) return; if (wheel < 0) @@ -914,7 +914,7 @@ namespace OpenRCT2::Ui::Windows void WindowMoveAndSnap(WindowBase& w, ScreenCoordsXY newWindowCoords, int32_t snapProximity) { auto originalPos = w.windowPos; - int32_t minY = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 1 : kTopToolbarHeight + 2; + int32_t minY = gLegacyScene == LegacyScene::titleSequence ? 1 : kTopToolbarHeight + 2; newWindowCoords.y = std::clamp(newWindowCoords.y, minY, ContextGetHeight() - 34); @@ -1121,13 +1121,13 @@ namespace OpenRCT2::Ui::Windows if (mainWindow == nullptr) return; - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep != EditorStep::LandscapeEditor) return; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) return; if (zoomIn) diff --git a/src/openrct2-ui/ride/VehicleSounds.cpp b/src/openrct2-ui/ride/VehicleSounds.cpp index 9d85af9713..0491a63473 100644 --- a/src/openrct2-ui/ride/VehicleSounds.cpp +++ b/src/openrct2-ui/ride/VehicleSounds.cpp @@ -105,10 +105,10 @@ namespace OpenRCT2::Audio static bool SoundCanPlay(const Vehicle& vehicle) { - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) return false; - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) return false; if (vehicle.sound1_id == SoundId::Null && vehicle.sound2_id == SoundId::Null) diff --git a/src/openrct2-ui/scripting/ScTitleSequence.hpp b/src/openrct2-ui/scripting/ScTitleSequence.hpp index f9d93c9b3a..ec28ee06d2 100644 --- a/src/openrct2-ui/scripting/ScTitleSequence.hpp +++ b/src/openrct2-ui/scripting/ScTitleSequence.hpp @@ -266,7 +266,7 @@ namespace OpenRCT2::Scripting // Unless we are already in the game, we have to re-create the windows // so that the game toolbars are created. - if (gScreenFlags == SCREEN_FLAGS_PLAYING) + if (gLegacyScene == LegacyScene::playing) { gLoadKeepWindowsOpen = true; } @@ -480,7 +480,7 @@ namespace OpenRCT2::Scripting { duk_error(ctx, DUK_ERR_ERROR, "Failed to load title sequence"); } - else if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + else if (gLegacyScene != LegacyScene::titleSequence) { gPreviewingTitleSequenceInGame = true; } diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index a09ed02b92..c71aa09177 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -587,7 +587,7 @@ static StringId window_cheats_page_titles[] = { widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(gameState.Cheats.selectedStaffSpeed)]; } - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) { SetWidgetDisabled(WIDX_TAB_2, true); SetWidgetDisabled(WIDX_TAB_3, true); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 459f36082a..024c7c97a0 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -72,8 +72,8 @@ namespace OpenRCT2::Ui::Windows { ColourSchemeUpdateByClass( this, - (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowClass::EditorScenarioBottomToolbar - : WindowClass::EditorTrackBottomToolbar); + gLegacyScene == LegacyScene::scenarioEditor ? WindowClass::EditorScenarioBottomToolbar + : WindowClass::EditorTrackBottomToolbar); uint16_t screenWidth = ContextGetWidth(); widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200; @@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PREVIOUS_IMAGE].type = WindowWidgetType::ImgBtn; widgets[WIDX_NEXT_IMAGE].type = WindowWidgetType::ImgBtn; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { HidePreviousStepButton(); HideNextStepButton(); @@ -103,7 +103,7 @@ namespace OpenRCT2::Ui::Windows { HideNextStepButton(); } - else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)) + else if (gLegacyScene != LegacyScene::trackDesigner) { if (GetNumFreeEntities() != kMaxEntities || GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED) { @@ -140,7 +140,7 @@ namespace OpenRCT2::Ui::Windows auto& gameState = GetGameState(); if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON) { - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner || (GetNumFreeEntities() == kMaxEntities && !(gameState.Park.Flags & PARK_FLAGS_SPRITES_INITIALISED))) { ((this)->*(kPreviousButtonMouseUp[EnumValue(gameState.EditorStep)]))(); @@ -200,7 +200,7 @@ namespace OpenRCT2::Ui::Windows return; FinishObjectSelection(); - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) { ContextOpenWindow(WindowClass::ConstructRide); } @@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows int16_t textY = widgets[WIDX_PREVIOUS_IMAGE].top + 6 + windowPos.y; StringId stringId = kEditorStepNames[EnumValue(GetGameState().EditorStep) - 1]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; DrawTextBasic(dpi, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE }); @@ -350,7 +350,7 @@ namespace OpenRCT2::Ui::Windows int16_t textY = widgets[WIDX_NEXT_IMAGE].top + 6 + windowPos.y; StringId stringId = kEditorStepNames[EnumValue(GetGameState().EditorStep) + 1]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; DrawTextBasic(dpi, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE }); diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 093ab6e84f..0017d5598d 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -163,7 +163,7 @@ namespace OpenRCT2::Ui::Windows ResearchRemoveFlags(); // When used in-game (as a cheat) - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { gSilentResearch = true; ResearchResetCurrentItem(); @@ -447,7 +447,7 @@ namespace OpenRCT2::Ui::Windows pressed_widgets |= 1uLL << WIDX_PREVIEW; pressed_widgets |= 1uLL << WIDX_TAB_1; - widgets[WIDX_CLOSE].type = gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WindowWidgetType::Empty + widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty : WindowWidgetType::CloseBox; ResizeFrameWithPage(); diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index f05d002bf4..34030ffe42 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -309,7 +309,7 @@ namespace OpenRCT2::Ui::Windows if (_loadedObject != nullptr) _loadedObject->Unload(); - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) { ResearchPopulateListRandom(); } @@ -364,14 +364,14 @@ namespace OpenRCT2::Ui::Windows switch (widgetIndex) { case WIDX_CLOSE: - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !EditorObjectSelectionWindowCheck()) + if (!(gLegacyScene == LegacyScene::trackDesignsManager) && !EditorObjectSelectionWindowCheck()) return; - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) { FinishObjectSelection(); } - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { GameNotifyMapChange(); GameUnloadScripts(); @@ -501,8 +501,9 @@ namespace OpenRCT2::Ui::Windows gDropdownItems[ddIdx].Format = STR_TOGGLE_OPTION; } - // Track manager cannot select multiple, so only show selection filters if not in track manager - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + // Track designs manager cannot select multiple, so only show selection filters if not in track designs + // manager + if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { numSelectionItems = 3; gDropdownItems[DDIX_FILTER_SEPARATOR].Format = 0; @@ -526,7 +527,7 @@ namespace OpenRCT2::Ui::Windows } } - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { Dropdown::SetChecked(DDIX_FILTER_SELECTED, IsFilterActive(FILTER_SELECTED)); Dropdown::SetChecked(DDIX_FILTER_NONSELECTED, IsFilterActive(FILTER_NONSELECTED)); @@ -603,7 +604,7 @@ namespace OpenRCT2::Ui::Windows const CursorState* state = ContextGetCursorState(); Audio::Play(Audio::SoundId::Click1, 0, state->position.x); - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { const auto objectSelectResult = WindowEditorObjectSelectionSelectObject( 0, INPUT_FLAG_EDITOR_OBJECT_SELECT, listItem->repositoryItem); @@ -722,7 +723,7 @@ namespace OpenRCT2::Ui::Windows if (screenCoords.y + kScrollableRowHeight >= dpi.y && screenCoords.y <= dpi.y + dpi.height) { // Draw checkbox - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !(*listItem.flags & 0x20)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager) && !(*listItem.flags & 0x20)) GfxFillRectInset( dpi, { { 2, screenCoords.y }, { 11, screenCoords.y + 10 } }, colours[1], INSET_RECT_F_E0); @@ -736,7 +737,8 @@ namespace OpenRCT2::Ui::Windows } // Draw checkmark - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && (*listItem.flags & ObjectSelectionFlags::Selected)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager) + && (*listItem.flags & ObjectSelectionFlags::Selected)) { screenCoords.x = 2; auto darkness = highlighted ? TextDarkness::ExtraDark : TextDarkness::Dark; @@ -747,7 +749,7 @@ namespace OpenRCT2::Ui::Windows DrawText(dpi, screenCoords, { colour2, FontStyle::Medium, darkness }, kCheckMarkString); } - screenCoords.x = gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15; + screenCoords.x = gLegacyScene == LegacyScene::trackDesignsManager ? 0 : 15; utf8 itemBuffer[512]{}; auto bufferWithColour = strcpy(itemBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}"); @@ -778,7 +780,7 @@ namespace OpenRCT2::Ui::Windows // Draw text String::safeUtf8Copy(buffer, listItem.repositoryItem->Name.c_str(), 256 - (buffer - bufferWithColour)); - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { while (*buffer != 0 && *buffer != 9) buffer++; @@ -846,12 +848,12 @@ namespace OpenRCT2::Ui::Windows // Set window title and buttons auto& titleWidget = widgets[WIDX_TITLE]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { titleWidget.text = STR_TRACK_DESIGNS_MANAGER_SELECT_RIDE_TYPE; installTrackWidget.type = WindowWidgetType::Button; } - else if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + else if (gLegacyScene == LegacyScene::trackDesigner) { titleWidget.text = STR_ROLLER_COASTER_DESIGNER_SELECT_RIDE_TYPES_VEHICLES; installTrackWidget.type = WindowWidgetType::Empty; @@ -912,7 +914,7 @@ namespace OpenRCT2::Ui::Windows else widgets[WIDX_RELOAD_OBJECT].type = WindowWidgetType::Empty; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TRACK_DESIGNER)) + if (gLegacyScene == LegacyScene::trackDesignsManager || gLegacyScene == LegacyScene::trackDesigner) { for (size_t i = 1; i < std::size(ObjectSelectionPages); i++) { @@ -1045,7 +1047,7 @@ namespace OpenRCT2::Ui::Windows ColourMapA[colours[1].colour].darkest); // Draw number of selected items - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { auto screenPos = windowPos + ScreenCoordsXY{ 3, height - 13 }; @@ -1397,7 +1399,7 @@ namespace OpenRCT2::Ui::Windows bool FilterSelected(uint8_t objectFlag) { // Track Manager has no concept of selection filtering, so always return true - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { return true; } @@ -1664,7 +1666,7 @@ namespace OpenRCT2::Ui::Windows { LOG_ERROR("Failed to load entry %s", std::string(descriptor.GetName()).c_str()); } - else if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + else if (!isInEditorMode()) { // Defaults selected items to researched (if in-game) auto objectType = loadedObject->GetObjectType(); diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 9bcaf3e394..73f8317648 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -843,8 +843,8 @@ namespace OpenRCT2::Ui::Windows break; } - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; + widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; AnchorBorderWidgets(); } @@ -1092,8 +1092,8 @@ namespace OpenRCT2::Ui::Windows { SetPressedTab(); - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; + widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; AnchorBorderWidgets(); } diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index e9e08222bf..e7f6163801 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -535,7 +535,7 @@ namespace OpenRCT2::Ui::Windows break; } - if (gScreenFlags == SCREEN_FLAGS_PLAYING) + if (gLegacyScene == LegacyScene::playing) { auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::Finances); @@ -594,8 +594,8 @@ namespace OpenRCT2::Ui::Windows SetWidgetPressed(WIDX_FORBID_MARKETING, gameState.Park.Flags & PARK_FLAGS_FORBID_MARKETING_CAMPAIGN); - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; + widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; AnchorBorderWidgets(); } @@ -844,8 +844,8 @@ namespace OpenRCT2::Ui::Windows SetWidgetPressed(WIDX_GUEST_PREFER_LESS_INTENSE_RIDES, gameState.Park.Flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES); SetWidgetPressed(WIDX_GUEST_PREFER_MORE_INTENSE_RIDES, gameState.Park.Flags & PARK_FLAGS_PREF_MORE_INTENSE_RIDES); - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; + widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; AnchorBorderWidgets(); } @@ -1163,8 +1163,8 @@ namespace OpenRCT2::Ui::Windows SetWidgetPressed(WIDX_HARD_PARK_RATING, gameState.Park.Flags & PARK_FLAGS_DIFFICULT_PARK_RATING); SetWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.Park.Flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION); - widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty - : WindowWidgetType::CloseBox; + widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WindowWidgetType::Empty + : WindowWidgetType::CloseBox; AnchorBorderWidgets(); } diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index d9200c49ee..357a86e9b9 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -670,7 +670,7 @@ namespace OpenRCT2::Ui::Windows uint32_t numPathTypes = 0; // If the game is in sandbox mode, also show paths that are normally restricted to the scenario editor - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); _dropdownEntries.clear(); std::optional defaultIndex; diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 781f809430..c8ac3f6450 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -700,7 +700,7 @@ namespace OpenRCT2::Ui::Windows void WindowGameBottomToolbarInvalidateNewsItem() { - if (gScreenFlags == SCREEN_FLAGS_PLAYING) + if (gLegacyScene == LegacyScene::playing) { auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateWidgetByClass(WindowClass::BottomToolbar, WIDX_MIDDLE_OUTSET); diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 4ce87aa3e5..8fe9e6c8ca 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -98,7 +98,7 @@ namespace OpenRCT2::Ui::Windows bool IsOwnershipMode() const { - return (gScreenFlags & SCREEN_FLAGS_EDITOR) != 0 || GetGameState().Cheats.sandboxMode; + return isInEditorMode() != 0 || GetGameState().Cheats.sandboxMode; } void SwitchToMode(LandRightsMode mode) diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index a2376901a4..5e8ebf8503 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -320,7 +320,7 @@ namespace OpenRCT2::Ui::Windows const bool isSave = (type & 0x01) == LOADSAVETYPE_SAVE; // Pause the game if not on title scene, nor in network play. - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && NetworkGetMode() == NETWORK_MODE_NONE) + if (gLegacyScene != LegacyScene::titleSequence && NetworkGetMode() == NETWORK_MODE_NONE) { gGamePaused |= GAME_PAUSED_MODAL; Audio::StopAll(); @@ -367,7 +367,7 @@ namespace OpenRCT2::Ui::Windows Config::Save(); // Unpause the game if not on title scene, nor in network play. - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && NetworkGetMode() == NETWORK_MODE_NONE) + if (gLegacyScene != LegacyScene::titleSequence && NetworkGetMode() == NETWORK_MODE_NONE) { gGamePaused &= ~GAME_PAUSED_MODAL; Audio::Resume(); diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index f506bff240..0e1fa3ed22 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -74,7 +74,7 @@ namespace OpenRCT2::Ui::Windows static bool isEditorOrSandbox() { - return (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode; + return gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode; } static constexpr StringId WINDOW_TITLE = STR_MAP_LABEL; @@ -1100,7 +1100,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_PEOPLE_STARTING_POSITION].type = WindowWidgetType::FlatBtn; // Only show this in the scenario editor, even when in sandbox mode. - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) widgets[WIDX_MAP_GENERATOR].type = WindowWidgetType::FlatBtn; widgets[WIDX_MAP_SIZE_SPINNER_Y].type = WindowWidgetType::Spinner; diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 05bf067ac0..1418662157 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -403,7 +403,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_TAB_7].type = WindowWidgetType::Tab; widgets[WIDX_FILTER_TEXT_BOX].string = _filter.data(); - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) widgets[WIDX_TAB_7].type = WindowWidgetType::Empty; if (_currentTab == RESEARCH_TAB) @@ -1056,7 +1056,7 @@ namespace OpenRCT2::Ui::Windows void WindowNewRideInitVars() { // If we are in the track designer, default to the Roller Coaster tab - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) { NewRideWindow::SetOpeningPage(ROLLER_COASTER_TAB); } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 865529e69c..5f6a9e26bb 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1381,7 +1381,7 @@ namespace OpenRCT2::Ui::Windows || (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) != 0) disabledTabs |= (1uLL << WIDX_TAB_9); // 0x1000 - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) != 0) + if (gLegacyScene == LegacyScene::trackDesigner) disabledTabs |= (1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_6 | 1uLL << WIDX_TAB_9 | 1uLL << WIDX_TAB_10); // 0x3280 const auto* rideEntry = GetRideEntryByIndex(ride->subtype); diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 7649e2407a..7eb367f094 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -94,7 +94,7 @@ namespace OpenRCT2::Ui::Windows void OnOpen() override { - bool canSave = !(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)); + bool canSave = !(isInTrackDesignerOrManager()); if (canSave) SetWidgets(_savePromptWidgets); @@ -116,11 +116,11 @@ namespace OpenRCT2::Ui::Windows if (canSave) { StringId stringId = window_save_prompt_labels[EnumValue(_promptMode)][0]; - if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gLegacyScene == LegacyScene::scenarioEditor) { stringId = STR_LOAD_LANDSCAPE_PROMPT_TITLE; } - else if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + else if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gLegacyScene == LegacyScene::scenarioEditor) { stringId = STR_QUIT_SCENARIO_EDITOR; } @@ -144,7 +144,8 @@ namespace OpenRCT2::Ui::Windows void OnMouseUp(WidgetIndex widgetIndex) override { - if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (gLegacyScene == LegacyScene::titleSequence || gLegacyScene == LegacyScene::trackDesigner + || gLegacyScene == LegacyScene::trackDesignsManager) { switch (widgetIndex) { @@ -165,7 +166,7 @@ namespace OpenRCT2::Ui::Windows { std::unique_ptr intent; - if (gScreenFlags & (SCREEN_FLAGS_EDITOR)) + if (isInEditorMode()) { intent = std::make_unique(WindowClass::Loadsave); intent->PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); @@ -210,7 +211,7 @@ namespace OpenRCT2::Ui::Windows } // do not show save prompt if we're in the title demo and click on load game - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) { GameLoadOrQuitNoSavePrompt(); return nullptr; @@ -248,7 +249,7 @@ namespace OpenRCT2::Ui::Windows int32_t width = WW_SAVE; int32_t height = WH_SAVE; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) { width = WW_QUIT; height = WH_QUIT; diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index fa5f601300..939add7e66 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -691,7 +691,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::FlatBtn; } - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode) + if (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) { widgets[WIDX_RESTRICT_SCENERY].type = WindowWidgetType::Button; if (IsSceneryItemRestricted(tabSelectedScenery)) diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 1eaeedf7d2..91a78d076e 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -425,16 +425,16 @@ namespace OpenRCT2::Ui::Windows // New game is only available in the normal game. Skip one position to avoid incorrect mappings in the menus // of the other modes. - if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR)) + if (gLegacyScene == LegacyScene::scenarioEditor) selectedIndex += 1; // Quicksave is only available in the normal game. Skip one position to avoid incorrect mappings in the // menus of the other modes. - if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR) && selectedIndex > DDIDX_LOAD_GAME) + if (gLegacyScene == LegacyScene::scenarioEditor && selectedIndex > DDIDX_LOAD_GAME) selectedIndex += 1; // Track designer and track designs manager start with Screenshot, not Load/save - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) selectedIndex += DDIDX_SCREENSHOT; // The "Update available" menu item is only available when there is one @@ -461,7 +461,7 @@ namespace OpenRCT2::Ui::Windows SaveGame(); break; case DDIDX_SAVE_GAME_AS: - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { auto intent = Intent(WindowClass::Loadsave); intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); @@ -644,7 +644,7 @@ namespace OpenRCT2::Ui::Windows if (!Config::Get().interface.ToolbarShowRotateAnticlockwise) widgets[WIDX_ROTATE_ANTI_CLOCKWISE].type = WindowWidgetType::Empty; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR || gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::scenarioEditor || gLegacyScene == LegacyScene::trackDesignsManager) { widgets[WIDX_PAUSE].type = WindowWidgetType::Empty; } @@ -655,7 +655,7 @@ namespace OpenRCT2::Ui::Windows void ApplyEditorMode() { - if ((gScreenFlags & SCREEN_FLAGS_EDITOR) == 0) + if (isInEditorMode() == 0) { return; } @@ -1184,7 +1184,7 @@ namespace OpenRCT2::Ui::Windows auto i = 0; gDropdownItems[i++].Format = STR_SHORTCUT_SHOW_MAP; gDropdownItems[i++].Format = STR_EXTRA_VIEWPORT; - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && GetGameState().EditorStep == EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep == EditorStep::LandscapeEditor) { gDropdownItems[i++].Format = STR_MAPGEN_MENU_ITEM; } @@ -1216,7 +1216,7 @@ namespace OpenRCT2::Ui::Windows void TopToolbar::MapMenuDropdown(int16_t dropdownIndex) { int32_t customStartIndex = 3; - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && GetGameState().EditorStep == EditorStep::LandscapeEditor) + if (gLegacyScene == LegacyScene::scenarioEditor && GetGameState().EditorStep == EditorStep::LandscapeEditor) { customStartIndex++; } @@ -1326,7 +1326,7 @@ namespace OpenRCT2::Ui::Windows void TopToolbar::InitFileMenu(Widget& widget) { int32_t numItems = 0; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) { gDropdownItems[numItems++].Format = STR_SCREENSHOT; gDropdownItems[numItems++].Format = STR_GIANT_SCREENSHOT; @@ -1340,14 +1340,14 @@ namespace OpenRCT2::Ui::Windows gDropdownItems[numItems++].Format = STR_OPTIONS; gDropdownItems[numItems++].Format = kStringIdEmpty; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) gDropdownItems[numItems++].Format = STR_QUIT_ROLLERCOASTER_DESIGNER; else gDropdownItems[numItems++].Format = STR_QUIT_TRACK_DESIGNS_MANAGER; gDropdownItems[numItems++].Format = STR_EXIT_OPENRCT2; } - else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + else if (gLegacyScene == LegacyScene::scenarioEditor) { gDropdownItems[numItems++].Format = STR_LOAD_LANDSCAPE; gDropdownItems[numItems++].Format = kStringIdEmpty; @@ -1427,7 +1427,7 @@ namespace OpenRCT2::Ui::Windows Dropdown::SetDisabled(DDIDX_OBJECTIVE_OPTIONS, true); } - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) { Dropdown::SetDisabled(DDIDX_OBJECT_SELECTION, true); Dropdown::SetDisabled(DDIDX_INVENTIONS_LIST, true); diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 293b487e56..dc7d4fc700 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -118,7 +118,7 @@ namespace OpenRCT2::Ui::Windows void SelectFromList(int32_t listIndex) { OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, this->windowPos.x + (this->width / 2)); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { if (listIndex == 0) { @@ -143,7 +143,7 @@ namespace OpenRCT2::Ui::Windows uint16_t trackDesignIndex = _filteredTrackIds[listIndex]; TrackDesignFileRef* tdRef = &_trackDesigns[trackDesignIndex]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { auto intent = Intent(WindowClass::ManageTrackDesign); intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); @@ -166,7 +166,7 @@ namespace OpenRCT2::Ui::Windows int32_t GetListItemFromPosition(const ScreenCoordsXY& screenCoords) { size_t maxItems = _filteredTrackIds.size(); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { // Extra item: custom design maxItems++; @@ -221,7 +221,7 @@ namespace OpenRCT2::Ui::Windows LoadDesignsList(_window_track_list_item); - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { widgets[WIDX_BACK].type = WindowWidgetType::Empty; } @@ -235,7 +235,7 @@ namespace OpenRCT2::Ui::Windows _reloadTrackDesigns = false; // Start with first track highlighted selected_list_item = 0; - if (_trackDesigns.size() != 0 && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (_trackDesigns.size() != 0 && !(gLegacyScene == LegacyScene::trackDesignsManager)) { selected_list_item = 1; } @@ -263,7 +263,7 @@ namespace OpenRCT2::Ui::Windows // to do it again. Otherwise, this window will get // another close signal from the track manager load function, // try to load the track manager again, and an infinite loop will result. - if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && gScreenAge != 0) + if ((gLegacyScene == LegacyScene::trackDesignsManager) && gScreenAge != 0) { auto* windowMgr = Ui::GetWindowManager(); windowMgr->CloseByNumber(WindowClass::ManageTrackDesign, number); @@ -291,7 +291,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_BACK: Close(); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { ContextOpenWindow(WindowClass::ConstructRide); } @@ -301,7 +301,7 @@ namespace OpenRCT2::Ui::Windows break; case WIDX_FILTER_CLEAR: // Keep the highlighted item selected - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { if (selected_list_item != -1 && _filteredTrackIds.size() > static_cast(selected_list_item)) selected_list_item = _filteredTrackIds[selected_list_item]; @@ -324,7 +324,7 @@ namespace OpenRCT2::Ui::Windows ScreenSize OnScrollGetSize(const int32_t scrollIndex) override { size_t numItems = _filteredTrackIds.size(); - if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (!(gLegacyScene == LegacyScene::trackDesignsManager)) { // Extra item: custom design numItems++; @@ -388,7 +388,7 @@ namespace OpenRCT2::Ui::Windows } Formatter::Common().Add(stringId); - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { widgets[WIDX_TITLE].text = STR_TRACK_DESIGNS; widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_RENAME_OR_DELETE_IT; @@ -399,7 +399,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_BUILD_IT_TIP; } - if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) || selected_list_item != 0) + if ((gLegacyScene == LegacyScene::trackDesignsManager) || selected_list_item != 0) { pressed_widgets |= 1uLL << WIDX_TRACK_PREVIEW; disabled_widgets &= ~(1uLL << WIDX_TRACK_PREVIEW); @@ -454,7 +454,7 @@ namespace OpenRCT2::Ui::Windows DrawWidgets(dpi); int32_t listItemIndex = selected_list_item; - if ((gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) == 0) + if ((gLegacyScene == LegacyScene::trackDesignsManager) == 0) { // Because the first item in the list is "Build a custom design", lower the index by one listItemIndex--; @@ -517,7 +517,7 @@ namespace OpenRCT2::Ui::Windows // Warnings if ((_loadedTrackDesign->gameStateData.hasFlag(TrackDesignGameStateFlag::VehicleUnavailable)) - && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + && !(gLegacyScene == LegacyScene::trackDesignsManager)) { // Vehicle design not available DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE }); @@ -677,7 +677,7 @@ namespace OpenRCT2::Ui::Windows auto screenCoords = ScreenCoordsXY{ 0, 0 }; size_t listIndex = 0; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { if (_trackDesigns.empty()) { @@ -762,7 +762,7 @@ namespace OpenRCT2::Ui::Windows windowMgr->CloseConstructionWindows(); ScreenCoordsXY screenPos{}; - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { int32_t screenWidth = ContextGetWidth(); int32_t screenHeight = ContextGetHeight(); diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index a67c572302..0a95d9d7f9 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -106,7 +106,7 @@ namespace OpenRCT2::Editor Audio::StopAll(); ObjectListLoad(); gameStateInitAll(gameState, kDefaultMapSize); - gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; + gLegacyScene = LegacyScene::scenarioEditor; gameState.EditorStep = EditorStep::ObjectSelection; gameState.Park.Flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; @@ -146,7 +146,7 @@ namespace OpenRCT2::Editor auto& gameState = GetGameState(); ScenarioReset(gameState); - gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; + gLegacyScene = LegacyScene::scenarioEditor; gameState.EditorStep = EditorStep::ObjectiveSelection; gameState.ScenarioCategory = SCENARIO_CATEGORY_OTHER; ViewportInitAll(); @@ -166,7 +166,7 @@ namespace OpenRCT2::Editor context->SetActiveScene(context->GetGameScene()); Audio::StopAll(); - gScreenFlags = SCREEN_FLAGS_TRACK_DESIGNER; + gLegacyScene = LegacyScene::trackDesigner; gScreenAge = 0; ObjectManagerUnloadAllObjects(); @@ -191,7 +191,7 @@ namespace OpenRCT2::Editor context->SetActiveScene(context->GetGameScene()); Audio::StopAll(); - gScreenFlags = SCREEN_FLAGS_TRACK_MANAGER; + gLegacyScene = LegacyScene::trackDesignsManager; gScreenAge = 0; ObjectManagerUnloadAllObjects(); @@ -233,7 +233,7 @@ namespace OpenRCT2::Editor GetGameState().EditorStep = EditorStep::LandscapeEditor; gScreenAge = 0; - gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; + gLegacyScene = LegacyScene::scenarioEditor; ViewportInitAll(); OpenEditorWindows(); FinaliseMainView(); @@ -319,7 +319,7 @@ namespace OpenRCT2::Editor */ void OpenWindowsForCurrentStep() { - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { return; } @@ -339,7 +339,7 @@ namespace OpenRCT2::Editor return; } - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { ObjectManagerUnloadAllObjects(); } @@ -417,7 +417,7 @@ namespace OpenRCT2::Editor } // No checks beyond this point apply to the track designer or track designs manager. - const bool isTrackDesignerManager = gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER); + const bool isTrackDesignerManager = isInTrackDesignerOrManager(); if (isTrackDesignerManager) { return { ObjectType::none, kStringIdNone }; diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 2fedbab368..e674634400 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -325,12 +325,12 @@ void Sub6AB211() _numAvailableObjectsForType[EnumValue(objectType)]++; } - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) { SetupTrackDesignerObjects(); } - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { SetupTrackManagerObjects(); } @@ -338,10 +338,10 @@ void Sub6AB211() SetupInUseSelectionFlags(); ResetSelectedObjectCountAndSize(); - if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) + if (!(isInTrackDesignerOrManager())) { // To prevent it breaking in scenario mode. - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { WindowEditorObjectSelectionSelectDefaultObjects(); } @@ -511,7 +511,7 @@ void ResetSelectedObjectCountAndSize() void FinishObjectSelection() { auto& gameState = GetGameState(); - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) { SetEveryRideTypeInvented(); SetEveryRideEntryInvented(); diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 700bbb1ad6..f7052a9d96 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -574,7 +574,7 @@ void GameAutosave() auto subDirectory = DIRID::SAVE; const char* fileExtension = ".park"; uint32_t saveFlags = 0x80000000; - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) { subDirectory = DIRID::LANDSCAPE; fileExtension = ".park"; @@ -591,7 +591,7 @@ void GameAutosave() currentDate.day, currentTime.hour, currentTime.minute, currentTime.second, fileExtension); int32_t autosavesToKeep = Config::Get().general.AutosaveAmount; - LimitAutosaveCount(autosavesToKeep - 1, (gScreenFlags & SCREEN_FLAGS_EDITOR)); + LimitAutosaveCount(autosavesToKeep - 1, isInEditorMode()); auto env = GetContext()->GetPlatformEnvironment(); auto autosaveDir = Path::Combine(env->GetDirectoryPath(DIRBASE::USER, subDirectory), u8"autosave"); @@ -656,7 +656,7 @@ void GameLoadOrQuitNoSavePrompt() auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::CloseSavePrompt); GameActions::Execute(&loadOrQuitAction); ToolCancel(); - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { LoadLandscape(); } diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 474f8425f2..86186d39df 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -215,13 +215,13 @@ namespace OpenRCT2 } // Always perform autosave check, even when paused - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && !(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) + if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::trackDesigner + && gLegacyScene != LegacyScene::trackDesignsManager) { ScenarioAutosaveCheck(); } - if (didRunSingleFrame && GameIsNotPaused() && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (didRunSingleFrame && GameIsNotPaused() && gLegacyScene != LegacyScene::titleSequence) { PauseToggle(); } @@ -315,7 +315,7 @@ namespace OpenRCT2 UpdateAllMiscEntities(); Ride::UpdateAll(); - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!isInEditorMode()) { Park::Update(gameState, gameState.Date); } diff --git a/src/openrct2/OpenRCT2.cpp b/src/openrct2/OpenRCT2.cpp index bb624c7d1c..e4030b2471 100644 --- a/src/openrct2/OpenRCT2.cpp +++ b/src/openrct2/OpenRCT2.cpp @@ -9,6 +9,8 @@ #include "OpenRCT2.h" +#include "core/EnumUtils.hpp" + StartupAction gOpenRCT2StartupAction = StartupAction::Title; utf8 gOpenRCT2StartupActionPath[512] = { 0 }; u8string gCustomUserDataPath = {}; @@ -25,8 +27,18 @@ bool gOpenRCT2ShowChangelog; bool gOpenRCT2SilentBreakpad; uint32_t gCurrentDrawCount = 0; -uint8_t gScreenFlags; +LegacyScene gLegacyScene; uint32_t gScreenAge; PromptMode gSavePromptMode; bool gSilentReplays = false; + +bool isInEditorMode() +{ + return EnumValue(gLegacyScene) >= EnumValue(LegacyScene::scenarioEditor); +} + +bool isInTrackDesignerOrManager() +{ + return gLegacyScene == LegacyScene::trackDesigner || gLegacyScene == LegacyScene::trackDesignsManager; +} diff --git a/src/openrct2/OpenRCT2.h b/src/openrct2/OpenRCT2.h index e81b6c7032..37dbcbe4bc 100644 --- a/src/openrct2/OpenRCT2.h +++ b/src/openrct2/OpenRCT2.h @@ -22,18 +22,20 @@ enum class StartupAction Edit }; -enum +enum class LegacyScene : uint8_t { // Although this is labeled a flag it actually means when // zero the screen is in playing mode. - SCREEN_FLAGS_PLAYING = 0, - SCREEN_FLAGS_TITLE_DEMO = 1, - SCREEN_FLAGS_SCENARIO_EDITOR = 2, - SCREEN_FLAGS_TRACK_DESIGNER = 4, - SCREEN_FLAGS_TRACK_MANAGER = 8, - SCREEN_FLAGS_EDITOR = (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER), + playing, + titleSequence, + scenarioEditor, + trackDesigner, + trackDesignsManager, }; +bool isInEditorMode(); +bool isInTrackDesignerOrManager(); + extern StartupAction gOpenRCT2StartupAction; extern utf8 gOpenRCT2StartupActionPath[512]; extern u8string gCustomUserDataPath; @@ -56,7 +58,7 @@ extern std::string gNetworkStartAddress; #endif extern uint32_t gCurrentDrawCount; -extern uint8_t gScreenFlags; +extern LegacyScene gLegacyScene; extern uint32_t gScreenAge; extern PromptMode gSavePromptMode; diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp index 4b79c27d5a..bdd5fe661b 100644 --- a/src/openrct2/actions/ClearAction.cpp +++ b/src/openrct2/actions/ClearAction.cpp @@ -242,6 +242,6 @@ void ClearAction::ResetClearLargeSceneryFlag() bool ClearAction::MapCanClearAt(const CoordsXY& location) { - return (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode + return gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode || MapIsLocationOwnedOrHasRights(location); } diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp index 2ffa29ea4b..31ace71a41 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp @@ -60,7 +60,7 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp index 5f535602bd..0ac204eb18 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp @@ -52,7 +52,7 @@ GameActions::Result FootpathAdditionRemoveAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp index 39e39116bf..04917393c9 100644 --- a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp +++ b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp @@ -78,7 +78,7 @@ GameActions::Result FootpathLayoutPlaceAction::Query() const GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index 24deb95fbc..caee7601f8 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -86,7 +86,7 @@ GameActions::Result FootpathPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -446,7 +446,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul { FootpathRemoveEdgesAt(_loc, pathElement->as()); } - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) + if (gLegacyScene == LegacyScene::scenarioEditor && !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { AutomaticallySetPeepSpawn(); } diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp index 3b27978224..5f28e5b376 100644 --- a/src/openrct2/actions/FootpathRemoveAction.cpp +++ b/src/openrct2/actions/FootpathRemoveAction.cpp @@ -59,7 +59,7 @@ GameActions::Result FootpathRemoveAction::Query() const GameActions::Status::InvalidParameters, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) + if (!(gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK); diff --git a/src/openrct2/actions/LandBuyRightsAction.cpp b/src/openrct2/actions/LandBuyRightsAction.cpp index 4e76034d20..fc0d282fa9 100644 --- a/src/openrct2/actions/LandBuyRightsAction.cpp +++ b/src/openrct2/actions/LandBuyRightsAction.cpp @@ -133,8 +133,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& return res; } - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 - || (surfaceElement->GetOwnership() & OWNERSHIP_AVAILABLE) == 0) + if (gLegacyScene == LegacyScene::scenarioEditor || (surfaceElement->GetOwnership() & OWNERSHIP_AVAILABLE) == 0) { return GameActions::Result( GameActions::Status::NotOwned, kErrorTitles[EnumValue(_setting)], STR_LAND_NOT_FOR_SALE); @@ -153,7 +152,7 @@ GameActions::Result LandBuyRightsAction::MapBuyLandRightsForTile(const CoordsXY& return res; } - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 + if (gLegacyScene == LegacyScene::scenarioEditor || (surfaceElement->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) == 0) { return GameActions::Result( diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp index f0140b74f7..47623c0728 100644 --- a/src/openrct2/actions/LandLowerAction.cpp +++ b/src/openrct2/actions/LandLowerAction.cpp @@ -95,7 +95,7 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp index 00c3a52b4a..b6ae57f5c8 100644 --- a/src/openrct2/actions/LandRaiseAction.cpp +++ b/src/openrct2/actions/LandRaiseAction.cpp @@ -96,7 +96,7 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index a6c77d596a..65799a5ad8 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -71,7 +71,7 @@ GameActions::Result LandSetHeightAction::Query() const return GameActions::Result(GameActions::Status::Disallowed, kStringIdNone, errorMessage); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gameState.Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode) { if (!MapIsLocationInPark(_coords)) { diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index 75988cdd8d..15ec2b1dd1 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -84,7 +84,7 @@ GameActions::Result LandSetRightsAction::QueryExecute(bool isExecuting) const res.Position = centre; res.Expenditure = ExpenditureType::LandPurchase; - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, kStringIdNone, STR_LAND_NOT_FOR_SALE); } diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index c312d378f6..297ae91c5c 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -174,7 +174,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationOwned({ curTile, zLow }) + if (gLegacyScene != LegacyScene::scenarioEditor && !MapIsLocationOwned({ curTile, zLow }) && !gameState.Cheats.sandboxMode) { return GameActions::Result( diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.cpp b/src/openrct2/actions/LargeSceneryRemoveAction.cpp index 772208f532..bc3663a6fc 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.cpp +++ b/src/openrct2/actions/LargeSceneryRemoveAction.cpp @@ -88,7 +88,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + currentTileRotatedOffset; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (GetGameState().Park.Flags & PARK_FLAGS_FORBID_TREE_REMOVAL) { @@ -168,7 +168,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + rotatedCurrentTile; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z })) { diff --git a/src/openrct2/actions/LargeScenerySetColourAction.cpp b/src/openrct2/actions/LargeScenerySetColourAction.cpp index 96f2768bb7..11192bb9d4 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.cpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.cpp @@ -127,7 +127,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) auto rotatedTileCoords = CoordsXYZ{ CoordsXY{ tile.offset }.Rotate(_loc.direction), tile.offset.z }; auto currentTile = CoordsXYZ{ baseTile.x, baseTile.y, baseTile.z } + rotatedTileCoords; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationOwned(currentTile)) { diff --git a/src/openrct2/actions/ParkEntrancePlaceAction.cpp b/src/openrct2/actions/ParkEntrancePlaceAction.cpp index 87971a7bed..44544a0168 100644 --- a/src/openrct2/actions/ParkEntrancePlaceAction.cpp +++ b/src/openrct2/actions/ParkEntrancePlaceAction.cpp @@ -56,7 +56,7 @@ void ParkEntrancePlaceAction::Serialise(DataSerialiser& stream) GameActions::Result ParkEntrancePlaceAction::Query() const { - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_CANT_BUILD_THIS_HERE, kStringIdNone); } diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp index 906f718f34..44ad178e0b 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp +++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp @@ -43,7 +43,7 @@ void ParkEntranceRemoveAction::Serialise(DataSerialiser& stream) GameActions::Result ParkEntranceRemoveAction::Query() const { - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_CANT_REMOVE_THIS, kStringIdNone); } diff --git a/src/openrct2/actions/PeepSpawnPlaceAction.cpp b/src/openrct2/actions/PeepSpawnPlaceAction.cpp index 71f7452def..1af1fc9560 100644 --- a/src/openrct2/actions/PeepSpawnPlaceAction.cpp +++ b/src/openrct2/actions/PeepSpawnPlaceAction.cpp @@ -45,7 +45,7 @@ void PeepSpawnPlaceAction::Serialise(DataSerialiser& stream) GameActions::Result PeepSpawnPlaceAction::Query() const { - if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (!isInEditorMode() && !GetGameState().Cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotInEditorMode, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, kStringIdNone); } diff --git a/src/openrct2/actions/ScenarioSetSettingAction.cpp b/src/openrct2/actions/ScenarioSetSettingAction.cpp index c816e0d5d4..b7d52bda69 100644 --- a/src/openrct2/actions/ScenarioSetSettingAction.cpp +++ b/src/openrct2/actions/ScenarioSetSettingAction.cpp @@ -52,7 +52,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const switch (_setting) { case ScenarioSetSetting::NoMoney: - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { if (_value != 0) { @@ -151,7 +151,7 @@ GameActions::Result ScenarioSetSettingAction::Execute() const gameState.ConstructionRightsPrice = std::clamp(_value, 5.00_GBP, 200.00_GBP); break; case ScenarioSetSetting::ParkChargeMethod: - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { if (_value == 0) { diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.cpp b/src/openrct2/actions/SmallSceneryPlaceAction.cpp index ee4a801e94..f7f429bd90 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.cpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.cpp @@ -172,7 +172,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const } auto& gameState = GetGameState(); - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gameState.Cheats.sandboxMode + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode && !MapIsLocationOwned({ _loc.x, _loc.y, targetHeight })) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.cpp b/src/openrct2/actions/SmallSceneryRemoveAction.cpp index c22f41dab3..ba799d93fb 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.cpp +++ b/src/openrct2/actions/SmallSceneryRemoveAction.cpp @@ -74,7 +74,7 @@ GameActions::Result SmallSceneryRemoveAction::Query() const res.Expenditure = ExpenditureType::Landscaping; res.Position = _loc; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) + if (gLegacyScene != LegacyScene::scenarioEditor && !(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !GetGameState().Cheats.sandboxMode) { // Check if allowed to remove item diff --git a/src/openrct2/actions/SmallScenerySetColourAction.cpp b/src/openrct2/actions/SmallScenerySetColourAction.cpp index 9e9455350a..3493037745 100644 --- a/src/openrct2/actions/SmallScenerySetColourAction.cpp +++ b/src/openrct2/actions/SmallScenerySetColourAction.cpp @@ -83,7 +83,7 @@ GameActions::Result SmallScenerySetColourAction::QueryExecute(bool isExecuting) return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationOwned(_loc)) { diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 26c8ca98cb..1ed467a2be 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -88,7 +88,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const auto& gameState = GetGameState(); // Do nothing if not in editor, sandbox mode or landscaping is forbidden - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gameState.Cheats.sandboxMode + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode && (gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)) { return GameActions::Result( @@ -105,7 +105,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (!LocationValid(coords)) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gameState.Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode) { if (!MapIsLocationInPark(coords)) continue; @@ -173,7 +173,7 @@ GameActions::Result SurfaceSetStyleAction::Execute() const if (!LocationValid(coords)) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(coords)) continue; diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 158067f1a5..987bab0a9e 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -91,7 +91,7 @@ GameActions::Result WallPlaceAction::Query() const auto& gameState = GetGameState(); auto mapSizeMax = GetMapSizeMaxXY(); - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) + if (gLegacyScene != LegacyScene::scenarioEditor && !(GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN) && !gameState.Cheats.sandboxMode) { if (_loc.z == 0) diff --git a/src/openrct2/actions/WallRemoveAction.cpp b/src/openrct2/actions/WallRemoveAction.cpp index e1f32726f2..d325f985d9 100644 --- a/src/openrct2/actions/WallRemoveAction.cpp +++ b/src/openrct2/actions/WallRemoveAction.cpp @@ -50,7 +50,7 @@ GameActions::Result WallRemoveAction::Query() const } const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST; - if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode + if (!isGhost && gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); diff --git a/src/openrct2/actions/WallSetColourAction.cpp b/src/openrct2/actions/WallSetColourAction.cpp index 7293988486..0b0e07c105 100644 --- a/src/openrct2/actions/WallSetColourAction.cpp +++ b/src/openrct2/actions/WallSetColourAction.cpp @@ -67,7 +67,7 @@ GameActions::Result WallSetColourAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_OFF_EDGE_OF_MAP); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationInPark(_loc) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !MapIsLocationInPark(_loc) && !GetGameState().Cheats.sandboxMode) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/WaterLowerAction.cpp b/src/openrct2/actions/WaterLowerAction.cpp index a25f4be1b3..efebd58720 100644 --- a/src/openrct2/actions/WaterLowerAction.cpp +++ b/src/openrct2/actions/WaterLowerAction.cpp @@ -80,7 +80,7 @@ GameActions::Result WaterLowerAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -139,7 +139,7 @@ uint8_t WaterLowerAction::GetLowestHeight(const MapRange& validRange) const { for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += kCoordsXYStep) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/WaterRaiseAction.cpp b/src/openrct2/actions/WaterRaiseAction.cpp index 68b51702a8..3d7f846288 100644 --- a/src/openrct2/actions/WaterRaiseAction.cpp +++ b/src/openrct2/actions/WaterRaiseAction.cpp @@ -80,7 +80,7 @@ GameActions::Result WaterRaiseAction::QueryExecute(bool isExecuting) const if (surfaceElement == nullptr) continue; - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { @@ -152,7 +152,7 @@ uint16_t WaterRaiseAction::GetHighestHeight(const MapRange& validRange) const { for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += kCoordsXYStep) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ x, y })) { diff --git a/src/openrct2/actions/WaterSetHeightAction.cpp b/src/openrct2/actions/WaterSetHeightAction.cpp index 1940e75885..7ff53baad7 100644 --- a/src/openrct2/actions/WaterSetHeightAction.cpp +++ b/src/openrct2/actions/WaterSetHeightAction.cpp @@ -52,7 +52,7 @@ GameActions::Result WaterSetHeightAction::Query() const res.Position = { _coords, _height * kCoordsZStep }; auto& gameState = GetGameState(); - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gameState.Cheats.sandboxMode + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode && gameState.Park.Flags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES) { return GameActions::Result(GameActions::Status::Disallowed, kStringIdNone, STR_FORBIDDEN_BY_THE_LOCAL_AUTHORITY); @@ -69,7 +69,7 @@ GameActions::Result WaterSetHeightAction::Query() const return GameActions::Result(GameActions::Status::NotOwned, kStringIdNone, STR_LAND_NOT_OWNED_BY_PARK); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gameState.Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.Cheats.sandboxMode) { if (!MapIsLocationInPark(_coords)) { diff --git a/src/openrct2/audio/Audio.cpp b/src/openrct2/audio/Audio.cpp index 22e1aaf0bb..f82412d4bc 100644 --- a/src/openrct2/audio/Audio.cpp +++ b/src/openrct2/audio/Audio.cpp @@ -294,7 +294,7 @@ namespace OpenRCT2::Audio void PlayTitleMusic() { - if (gGameSoundsOff || !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) || IntroIsPlaying()) + if (gGameSoundsOff || gLegacyScene != LegacyScene::titleSequence || IntroIsPlaying()) { StopTitleMusic(); return; diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 425775d7a1..bf73321437 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -5155,7 +5155,7 @@ void Guest::UpdateRideShopInteract() } // Do not play toilet flush sound on title screen as it's considered loud and annoying - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::ToiletFlush, GetLocation()); } diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index 4f26a79f84..370e4b0318 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -177,7 +177,7 @@ void MoneyEffect::Paint(PaintSession& session, int32_t imageDirection) const { PROFILED_FUNCTION(); - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) { // Don't render any money in the title screen. return; diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index d4946d7016..688101df9c 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -200,7 +200,7 @@ void PeepUpdateAll() { PROFILED_FUNCTION(); - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) return; const auto currentTicks = GetGameState().CurrentTicks; @@ -1317,7 +1317,7 @@ void PeepUpdateCrowdNoise() if (!Config::Get().sound.SoundEnabled) return; - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) return; auto viewport = g_music_tracking_viewport; diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index b7db3e31c3..5b4dd16ec1 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1198,7 +1198,7 @@ static void ConsoleCommandOpen(InteractiveConsole& console, const arguments_t& a { if (!argv.empty()) { - bool title = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) != 0; + bool title = gLegacyScene == LegacyScene::titleSequence; bool invalidTitle = false; if (argv[0] == "object_selection" && InvalidArguments(&invalidTitle, !title)) { diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 9408b1bc65..1ba5381434 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -465,7 +465,7 @@ int32_t CommandLineForScreenshot(const char** argv, int32_t argc, ScreenshotOpti throw std::runtime_error("Failed to load park."); } - gScreenFlags = SCREEN_FLAGS_PLAYING; + gLegacyScene = LegacyScene::playing; Viewport viewport{}; if (giantScreenshot) diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 02447a5016..2b4ac2dd96 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -708,7 +708,7 @@ namespace OpenRCT2 return; } - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { int32_t height = (TileElementHeight({ sprite->x, sprite->y }))-16; int32_t underground = sprite->z < height; diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 6e0dcb9dd8..161c065ec8 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -315,7 +315,7 @@ static constexpr float kWindowScrollLocations[][2] = { auto screenCoords = Translate3DTo2DWithZ(w.viewport->rotation, coords); int32_t i = 0; - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { bool found = false; while (!found) @@ -724,7 +724,7 @@ static constexpr float kWindowScrollLocations[][2] = { void WindowResizeGui(int32_t width, int32_t height) { WindowResizeGuiScenarioEditor(width, height); - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) return; auto* windowMgr = Ui::GetWindowManager(); diff --git a/src/openrct2/management/Finance.cpp b/src/openrct2/management/Finance.cpp index cd3dd51808..bab162a3d4 100644 --- a/src/openrct2/management/Finance.cpp +++ b/src/openrct2/management/Finance.cpp @@ -49,7 +49,7 @@ bool FinanceCheckMoneyRequired(uint32_t flags) { if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) return false; - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) return false; if (flags & GAME_COMMAND_FLAG_NO_SPEND) return false; diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index f7c21dd824..686c987eb6 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -129,7 +129,7 @@ static void TickCurrent() { int32_t ticks = GetGameState().NewsItems.IncrementTicks(); // Only play news item sound when in normal playing mode - if (ticks == 1 && (gScreenFlags == SCREEN_FLAGS_PLAYING)) + if (ticks == 1 && (gLegacyScene == LegacyScene::playing)) { // Play sound OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::NewsItem, 0, ContextGetWidth() / 2); diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index 22d0564d47..1c780fd5e0 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -313,10 +313,9 @@ void ResearchUpdate() { PROFILED_FUNCTION(); - int32_t editorScreenFlags, researchLevel, currentResearchProgress; + int32_t researchLevel, currentResearchProgress; - editorScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER; - if (gScreenFlags & editorScreenFlags) + if (isInEditorMode()) { return; } @@ -634,7 +633,7 @@ bool SceneryGroupIsInvented(int32_t sgIndex) } // All scenery is temporarily invented when in the scenario editor - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) { return true; } diff --git a/src/openrct2/network/DiscordService.cpp b/src/openrct2/network/DiscordService.cpp index f78f342081..40660ccc0a 100644 --- a/src/openrct2/network/DiscordService.cpp +++ b/src/openrct2/network/DiscordService.cpp @@ -88,7 +88,7 @@ void DiscordService::RefreshPresence() const std::string state; std::string details; - switch (gScreenFlags) + switch (gLegacyScene) { default: details = GetParkName(); @@ -127,16 +127,16 @@ void DiscordService::RefreshPresence() const discordPresence.instance = 1; } break; - case SCREEN_FLAGS_TITLE_DEMO: + case LegacyScene::titleSequence: details = "In Menus"; break; - case SCREEN_FLAGS_SCENARIO_EDITOR: + case LegacyScene::scenarioEditor: details = "In Scenario Editor"; break; - case SCREEN_FLAGS_TRACK_DESIGNER: + case LegacyScene::trackDesigner: details = "In Track Designer"; break; - case SCREEN_FLAGS_TRACK_MANAGER: + case LegacyScene::trackDesignsManager: details = "In Track Designs Manager"; break; } diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 23fb5f87e5..400f394d05 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -96,7 +96,7 @@ void Painter::PaintReplayNotice(DrawPixelInfo& dpi, const char* text) static bool ShouldShowFPS() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return true; auto* windowMgr = Ui::GetWindowManager(); @@ -119,7 +119,7 @@ void Painter::PaintFPS(DrawPixelInfo& dpi) screenCoords.x = screenCoords.x - (stringWidth / 2); // Move counter below toolbar if buttons are centred - const bool isTitle = gScreenFlags == SCREEN_FLAGS_TITLE_DEMO; + const bool isTitle = gLegacyScene == LegacyScene::titleSequence; if (!isTitle && Config::Get().interface.ToolbarButtonsCentred) { screenCoords.y = kTopToolbarHeight + 3; diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index d950e82dbc..07524d9614 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1091,7 +1091,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con const uint8_t image_offset = Byte97B444[surfaceShape]; ImageId imageId; - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) { imageId = ImageId(SPR_TERRAIN_TRACK_DESIGNER); } @@ -1125,7 +1125,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con auto& gameState = GetGameState(); // Draw Peep Spawns - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gameState.Cheats.sandboxMode) + if ((gLegacyScene == LegacyScene::scenarioEditor || gameState.Cheats.sandboxMode) && session.ViewFlags & VIEWPORT_FLAG_LAND_OWNERSHIP) { const CoordsXY& pos = session.MapPosition; @@ -1274,7 +1274,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con } if ((session.ViewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) && !(session.ViewFlags & VIEWPORT_FLAG_HIDE_BASE) - && !(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) + && !(isInTrackDesignerOrManager())) { const uint8_t image_offset = Byte97B444[surfaceShape]; ImageId imageId; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index c802fffc66..e9bc3cfa28 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -962,7 +962,7 @@ void Ride::UpdateAll() PROFILED_FUNCTION(); // Remove all rides if scenario editor - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) { switch (GetGameState().EditorStep) { @@ -1302,7 +1302,7 @@ static void RideInspectionUpdate(Ride& ride) { if (GetGameState().CurrentTicks & 2047) return; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) return; ride.last_inspection++; @@ -1370,7 +1370,7 @@ static void RideBreakdownUpdate(Ride& ride) if (currentTicks & 255) return; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gLegacyScene == LegacyScene::trackDesigner) return; if (ride.lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) @@ -2063,7 +2063,7 @@ void RideMeasurementsUpdate() { PROFILED_FUNCTION(); - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) return; // For each ride measurement @@ -5265,7 +5265,7 @@ void Ride::Crash(uint8_t vehicleIndex) { Vehicle* vehicle = GetEntity(vehicles[vehicleIndex]); - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && vehicle != nullptr) + if (gLegacyScene != LegacyScene::titleSequence && vehicle != nullptr) { // Open ride window for crashed vehicle auto intent = Intent(WD_VEHICLE); diff --git a/src/openrct2/ride/RideAudio.cpp b/src/openrct2/ride/RideAudio.cpp index 0772df9842..a1838c4afc 100644 --- a/src/openrct2/ride/RideAudio.cpp +++ b/src/openrct2/ride/RideAudio.cpp @@ -254,7 +254,7 @@ namespace OpenRCT2::RideAudio */ void UpdateMusicChannels() { - if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 || (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) != 0) + if (gLegacyScene == LegacyScene::scenarioEditor || gLegacyScene == LegacyScene::titleSequence) return; // TODO Allow circus music (CSS24) to play if ride music is disabled (that should be sound) @@ -381,7 +381,7 @@ namespace OpenRCT2::RideAudio */ void UpdateMusicInstance(Ride& ride, const CoordsXYZ& rideCoords, uint16_t sampleRate) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && g_music_tracking_viewport != nullptr) + if (gLegacyScene != LegacyScene::scenarioEditor && !gGameSoundsOff && g_music_tracking_viewport != nullptr) { auto rotatedCoords = Translate3DTo2DWithZ(GetCurrentRotation(), rideCoords); auto viewport = g_music_tracking_viewport; diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index 5addede1f8..6d998e718d 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -192,7 +192,7 @@ void RideRatingsUpdateAll() { PROFILED_FUNCTION(); - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) return; for (auto& updateState : GetGameState().RideRatingUpdateStates) diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 046f452833..23935d825e 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -2062,7 +2062,7 @@ void TrackDesignDrawPreview(TrackDesign& td, uint8_t* pixels) StashMap(); TrackDesignPreviewClearMap(); - if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + if (gLegacyScene == LegacyScene::trackDesignsManager) { TrackDesignLoadSceneryObjects(td); } diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 32dbad646d..d464afa59c 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -606,10 +606,10 @@ void VehicleUpdateAll() { PROFILED_FUNCTION(); - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) return; - if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) + if (gLegacyScene == LegacyScene::trackDesigner && GetGameState().EditorStep != EditorStep::RollercoasterDesigner) return; for (auto vehicle : TrainManager::View()) diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 866f7abc5a..205472e155 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -355,7 +355,7 @@ static void ScenarioUpdateDayNightCycle() float currentDayNightCycle = gDayNightCycle; gDayNightCycle = 0; - if (gScreenFlags == SCREEN_FLAGS_PLAYING && Config::Get().general.DayNightCycle) + if (gLegacyScene == LegacyScene::playing && Config::Get().general.DayNightCycle) { float monthFraction = GetDate().GetMonthTicks() / static_cast(kTicksPerMonth); if (monthFraction < (1 / 8.0f)) @@ -395,7 +395,7 @@ void ScenarioUpdate(GameState_t& gameState) { PROFILED_FUNCTION(); - if (gScreenFlags == SCREEN_FLAGS_PLAYING) + if (gLegacyScene == LegacyScene::playing) { auto& date = GetDate(); if (date.IsDayStart()) diff --git a/src/openrct2/scenes/game/GameScene.cpp b/src/openrct2/scenes/game/GameScene.cpp index ce944d5f30..09ea6cdc22 100644 --- a/src/openrct2/scenes/game/GameScene.cpp +++ b/src/openrct2/scenes/game/GameScene.cpp @@ -22,7 +22,7 @@ void GameScene::Load() { LOG_VERBOSE("GameScene::Load()"); - gScreenFlags = SCREEN_FLAGS_PLAYING; + gLegacyScene = LegacyScene::playing; LOG_VERBOSE("GameScene::Load() finished"); } diff --git a/src/openrct2/scenes/preloader/PreloaderScene.cpp b/src/openrct2/scenes/preloader/PreloaderScene.cpp index b2e1d5cada..c4292e1bda 100644 --- a/src/openrct2/scenes/preloader/PreloaderScene.cpp +++ b/src/openrct2/scenes/preloader/PreloaderScene.cpp @@ -34,7 +34,7 @@ void PreloaderScene::Load() { LOG_VERBOSE("PreloaderScene::Load()"); - gScreenFlags = SCREEN_FLAGS_PLAYING; + gLegacyScene = LegacyScene::playing; gameStateInitAll(GetGameState(), kDefaultMapSize); ViewportInitAll(); ContextOpenWindow(WindowClass::MainWindow); diff --git a/src/openrct2/scenes/title/Command/SetLocation.cpp b/src/openrct2/scenes/title/Command/SetLocation.cpp index 61f50898d1..8d4556cb67 100644 --- a/src/openrct2/scenes/title/Command/SetLocation.cpp +++ b/src/openrct2/scenes/title/Command/SetLocation.cpp @@ -26,10 +26,10 @@ namespace OpenRCT2::Title int32_t z = TileElementHeight(loc); // Prevent scroll adjustment due to window placement when in-game - auto oldScreenFlags = gScreenFlags; - gScreenFlags = SCREEN_FLAGS_TITLE_DEMO; + auto oldLegacyScene = gLegacyScene; + gLegacyScene = LegacyScene::titleSequence; w->SetLocation({ loc, z }); - gScreenFlags = oldScreenFlags; + gLegacyScene = oldLegacyScene; ViewportUpdatePosition(w); } diff --git a/src/openrct2/scenes/title/TitleScene.cpp b/src/openrct2/scenes/title/TitleScene.cpp index 58c77c6ca3..75de64a255 100644 --- a/src/openrct2/scenes/title/TitleScene.cpp +++ b/src/openrct2/scenes/title/TitleScene.cpp @@ -53,7 +53,7 @@ bool TitleScene::PreviewSequence(size_t value) _previewingSequence = TryLoadSequence(true); if (_previewingSequence) { - if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) + if (gLegacyScene != LegacyScene::titleSequence) { gPreviewingTitleSequenceInGame = true; } @@ -61,7 +61,7 @@ bool TitleScene::PreviewSequence(size_t value) else { _currentSequence = TitleGetConfigSequence(); - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) { TryLoadSequence(); } @@ -98,7 +98,7 @@ void TitleScene::Load() PauseToggle(); } - gScreenFlags = SCREEN_FLAGS_TITLE_DEMO; + gLegacyScene = LegacyScene::titleSequence; gScreenAge = 0; gCurrentLoadedPath.clear(); diff --git a/src/openrct2/scripting/bindings/game/ScContext.hpp b/src/openrct2/scripting/bindings/game/ScContext.hpp index 7cc04ec8a1..1a2e14547e 100644 --- a/src/openrct2/scripting/bindings/game/ScContext.hpp +++ b/src/openrct2/scripting/bindings/game/ScContext.hpp @@ -114,13 +114,13 @@ namespace OpenRCT2::Scripting std::string mode_get() { - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return "title"; - else if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + else if (gLegacyScene == LegacyScene::scenarioEditor) return "scenario_editor"; - else if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + else if (gLegacyScene == LegacyScene::trackDesigner) return "track_designer"; - else if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) + else if (gLegacyScene == LegacyScene::trackDesignsManager) return "track_manager"; return "normal"; } diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index 3380170590..317ddcef1f 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -131,7 +131,7 @@ void ClimateUpdate() auto& gameState = GetGameState(); // Only do climate logic if playing (not in scenario editor or title screen) - if (gScreenFlags & (~SCREEN_FLAGS_PLAYING)) + if (gLegacyScene != LegacyScene::playing) return; if (!GetGameState().Cheats.freezeWeather) @@ -234,7 +234,7 @@ void ClimateUpdateSound() if (!OpenRCT2::Audio::IsAvailable()) return; - if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) + if (gLegacyScene == LegacyScene::titleSequence) return; ClimateUpdateWeatherSound(); diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index b6faece633..bbb44b855c 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -561,7 +561,7 @@ static void Loc6A6D7E( FootpathNeighbourList* neighbourList) { auto targetPos = CoordsXY{ initialTileElementPos } + CoordsDirectionDelta[direction]; - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode) && MapIsEdge(targetPos)) + if ((gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode) && MapIsEdge(targetPos)) { if (query) { @@ -1808,7 +1808,7 @@ void FootpathRemoveEdgesAt(const CoordsXY& footpathPos, TileElement* tileElement static ObjectEntryIndex FootpathGetDefaultSurface(bool queue) { - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); for (ObjectEntryIndex i = 0; i < kMaxFootpathSurfaceObjects; i++) { auto pathEntry = GetPathSurfaceEntry(i); @@ -1832,7 +1832,7 @@ static bool FootpathIsSurfaceEntryOkay(ObjectEntryIndex index, bool queue) auto pathEntry = GetPathSurfaceEntry(index); if (pathEntry != nullptr) { - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); if (!showEditorPaths && (pathEntry->Flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR)) { return false; @@ -1860,7 +1860,7 @@ static ObjectEntryIndex FootpathGetDefaultRailings() static bool FootpathIsLegacyPathEntryOkay(ObjectEntryIndex index) { - bool showEditorPaths = ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || GetGameState().Cheats.sandboxMode); + bool showEditorPaths = (gLegacyScene == LegacyScene::scenarioEditor || GetGameState().Cheats.sandboxMode); auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); auto footpathObj = objManager.GetLoadedObject(index); if (footpathObj != nullptr) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index dae538fb7a..c0635c9bc0 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -759,7 +759,7 @@ void MapUpdatePathWideFlags() { PROFILED_FUNCTION(); - if (gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) + if (isInTrackDesignerOrManager()) { return; } @@ -827,7 +827,7 @@ bool MapIsEdge(const CoordsXY& coords) bool MapCanBuildAt(const CoordsXYZ& loc) { - if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) + if (gLegacyScene == LegacyScene::scenarioEditor) return true; if (GetGameState().Cheats.sandboxMode) return true; @@ -965,7 +965,7 @@ uint8_t MapGetLowestLandHeight(const MapRange& range) if (surfaceElement != nullptr && min_height > surfaceElement->BaseHeight) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { @@ -994,7 +994,7 @@ uint8_t MapGetHighestLandHeight(const MapRange& range) auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ xi, yi }); if (surfaceElement != nullptr) { - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !GetGameState().Cheats.sandboxMode) + if (gLegacyScene != LegacyScene::scenarioEditor && !GetGameState().Cheats.sandboxMode) { if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { @@ -1260,8 +1260,7 @@ void MapUpdateTiles() { PROFILED_FUNCTION(); - int32_t ignoreScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER; - if (gScreenFlags & ignoreScreenFlags) + if (isInEditorMode()) return; auto& gameState = GetGameState(); diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 8ef8b2e618..e656c74d20 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -303,7 +303,7 @@ void SceneryRemoveGhostToolPlacement() bool IsSceneryAvailableToBuild(const ScenerySelection& item) { // All scenery can be built when in the scenario editor - if (gScreenFlags & SCREEN_FLAGS_EDITOR) + if (isInEditorMode()) { return true; } @@ -317,7 +317,7 @@ bool IsSceneryAvailableToBuild(const ScenerySelection& item) } } - if (!gameState.Cheats.sandboxMode && !(gScreenFlags & SCREEN_FLAGS_EDITOR)) + if (!gameState.Cheats.sandboxMode && !isInEditorMode()) { if (IsSceneryItemRestricted(item)) { diff --git a/test/tests/TileElements.cpp b/test/tests/TileElements.cpp index 60936b550f..9cd3b1b328 100644 --- a/test/tests/TileElements.cpp +++ b/test/tests/TileElements.cpp @@ -39,7 +39,7 @@ protected: GameLoadInit(); // Changed in some tests. Store to restore its value - _gScreenFlags = gScreenFlags; + _gLegacyScene = gLegacyScene; SUCCEED(); } @@ -48,16 +48,16 @@ protected: if (_context) _context.reset(); - gScreenFlags = _gScreenFlags; + gLegacyScene = _gLegacyScene; } private: static std::shared_ptr _context; - static uint8_t _gScreenFlags; + static LegacyScene _gLegacyScene; }; std::shared_ptr TileElementWantsFootpathConnection::_context; -uint8_t TileElementWantsFootpathConnection::_gScreenFlags; +LegacyScene TileElementWantsFootpathConnection::_gLegacyScene; TEST_F(TileElementWantsFootpathConnection, FlatPath) { @@ -157,8 +157,7 @@ TEST_F(TileElementWantsFootpathConnection, MapEdge) // This tile is a single, unconnected footpath on the map edge - on load, GetEdges() returns 0 auto* pathElement = MapGetFootpathElement(TileCoordsXYZ{ 1, 4, 14 }.ToCoordsXYZ()); - // Enable flag to simulate enabling the scenario editor - gScreenFlags |= SCREEN_FLAGS_SCENARIO_EDITOR; + gLegacyScene = LegacyScene::scenarioEditor; // Calculate the connected edges and set the appropriate edge flags // FIXME: The footpath functions should only take PathElement and not TileElement. diff --git a/test/tests/TileElementsView.cpp b/test/tests/TileElementsView.cpp index 2f488b633f..79f868bdef 100644 --- a/test/tests/TileElementsView.cpp +++ b/test/tests/TileElementsView.cpp @@ -46,7 +46,7 @@ protected: GameLoadInit(); // Changed in some tests. Store to restore its value - _gScreenFlags = gScreenFlags; + _gLegacyScene = gLegacyScene; SUCCEED(); } @@ -55,16 +55,16 @@ protected: if (_context) _context.reset(); - gScreenFlags = _gScreenFlags; + gLegacyScene = _gLegacyScene; } private: static std::shared_ptr _context; - static uint8_t _gScreenFlags; + static LegacyScene _gLegacyScene; }; std::shared_ptr TileElementsViewTests::_context; -uint8_t TileElementsViewTests::_gScreenFlags; +LegacyScene TileElementsViewTests::_gLegacyScene; template std::vector BuildListManual(const CoordsXY& pos)