diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 899fafdad6..db0318a741 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index b64c47f785..7a800e5d19 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index b2cf64979e..b28dd77dbd 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -189,7 +189,7 @@ static void ShortcutRemoveTopBottomToolbarToggle() ContextOpenWindow(WindowClass::editorStepController); // next step } } - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } static void ShortcutAdjustLand() @@ -459,7 +459,7 @@ static void ShortcutScaleUp() { Config::Get().general.windowScale += 0.25f; Config::Save(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); ContextTriggerResize(); ContextUpdateCursorScale(); } @@ -469,7 +469,7 @@ static void ShortcutScaleDown() Config::Get().general.windowScale -= 0.25f; Config::Get().general.windowScale = std::max(0.5f, Config::Get().general.windowScale); Config::Save(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); ContextTriggerResize(); ContextUpdateCursorScale(); } @@ -739,7 +739,7 @@ static void ShortcutToggleTransparentWater() Config::Get().general.transparentWater ^= 1; Config::Save(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } #pragma endregion @@ -805,7 +805,7 @@ void ShortcutManager::registerDefaultShortcuts() ChatToggle(); } }); - registerShortcut(ShortcutId::kInterfaceScaleToggleWindowMode, STR_SHORTCUT_WINDOWED_MODE_TOGGLE, "ALT+RETURN", ToggleWindowedMode); + registerShortcut(ShortcutId::kInterfaceScaleToggleWindowMode, STR_SHORTCUT_WINDOWED_MODE_TOGGLE, "ALT+RETURN", Drawing::ToggleWindowedMode); registerShortcut(ShortcutId::kInterfaceScaleIncrease, STR_SHORTCUT_SCALE_UP, ShortcutScaleUp); registerShortcut(ShortcutId::kInterfaceScaleDecrease, STR_SHORTCUT_SCALE_DOWN, ShortcutScaleDown); registerShortcut(ShortcutId::kInterfaceOpenLand, STR_SHORTCUT_ADJUST_LAND, "F1", ShortcutAdjustLand); diff --git a/src/openrct2-ui/interface/FileBrowser.cpp b/src/openrct2-ui/interface/FileBrowser.cpp index 4c6e7b2ed0..4a08fbb937 100644 --- a/src/openrct2-ui/interface/FileBrowser.cpp +++ b/src/openrct2-ui/interface/FileBrowser.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::FileBrowser { InvokeCallback(ModalResult::ok, pathBuffer); windowMgr->CloseByClass(WindowClass::loadsave); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } else { @@ -310,7 +310,7 @@ namespace OpenRCT2::Ui::FileBrowser if (editorScene->LoadLandscape(pathBuffer)) { gCurrentLoadedPath = pathBuffer; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); InvokeCallback(ModalResult::ok, pathBuffer); } else @@ -381,7 +381,7 @@ namespace OpenRCT2::Ui::FileBrowser gFirstTimeSaving = false; windowMgr->CloseByClass(WindowClass::loadsave); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); InvokeCallback(ModalResult::ok, pathBuffer); } @@ -400,7 +400,7 @@ namespace OpenRCT2::Ui::FileBrowser { gCurrentLoadedPath = pathBuffer; windowMgr->CloseByClass(WindowClass::loadsave); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); InvokeCallback(ModalResult::ok, pathBuffer); } else diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index c41da7aa1d..9e5e908543 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index 57daa0e829..7664e56f50 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -20,9 +20,10 @@ #include #include #include +#include #include -#include #include +#include #include #include #include @@ -280,7 +281,7 @@ void InGameConsole::Update() { _lastMainViewport = mainViewport->viewPos; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } } } diff --git a/src/openrct2-ui/interface/Theme.cpp b/src/openrct2-ui/interface/Theme.cpp index f0b06ddbde..230493331b 100644 --- a/src/openrct2-ui/interface/Theme.cpp +++ b/src/openrct2-ui/interface/Theme.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -621,7 +622,7 @@ namespace OpenRCT2::Ui CurrentTheme = theme; CurrentThemePath.clear(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } static void LoadTheme(const std::string& path) diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 413cb33694..555cc78341 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -19,6 +19,7 @@ #include #include #include + #include #include #include #include diff --git a/src/openrct2-ui/scripting/ScGraphicsContext.hpp b/src/openrct2-ui/scripting/ScGraphicsContext.hpp index 61ff36115f..6d0d147cbb 100644 --- a/src/openrct2-ui/scripting/ScGraphicsContext.hpp +++ b/src/openrct2-ui/scripting/ScGraphicsContext.hpp @@ -15,6 +15,7 @@ #include #include + #include #include #include #include diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index 438af7909f..34bdf88abe 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -76,37 +77,37 @@ namespace OpenRCT2::Ui::Windows { case WIDX_TOGGLE_SHOW_WIDE_PATHS: gPaintWidePathsAsGhost = !gPaintWidePathsAsGhost; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_TOGGLE_SHOW_BLOCKED_TILES: gPaintBlockedTiles = !gPaintBlockedTiles; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_TOGGLE_SHOW_SEGMENT_HEIGHTS: gShowSupportSegmentHeights = !gShowSupportSegmentHeights; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_TOGGLE_SHOW_BOUND_BOXES: gPaintBoundingBoxes = !gPaintBoundingBoxes; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_TOGGLE_SHOW_DIRTY_VISUALS: gShowDirtyVisuals = !gShowDirtyVisuals; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_TOGGLE_STABLE_PAINT_SORT: gPaintStableSort = !gPaintStableSort; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_TOGGLE_FORCE_REDRAW: gPaintForceRedraw = !gPaintForceRedraw; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; } } diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index f9a0bde650..dc56c8e051 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -487,7 +488,7 @@ namespace OpenRCT2::Ui::Windows { objectManager.UnloadObjects({ descriptor }); objectManager.LoadObject(descriptor, entryIndex); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } } break; diff --git a/src/openrct2-ui/windows/EditorStepController.cpp b/src/openrct2-ui/windows/EditorStepController.cpp index e3257ec9be..269ebd4683 100644 --- a/src/openrct2-ui/windows/EditorStepController.cpp +++ b/src/openrct2-ui/windows/EditorStepController.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index 3c1a242946..6217e8e28d 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -330,7 +331,7 @@ namespace OpenRCT2::Ui::Windows } MapGenerator::generate(&mapgenSettings); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } #pragma region Base page diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index d7a3671a70..3f6a209b2a 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 8e8c927871..8ee740c496 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -191,7 +192,7 @@ namespace OpenRCT2::Ui::Windows { HideGridlines(); ClearPatrolAreaToRender(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override @@ -241,7 +242,7 @@ namespace OpenRCT2::Ui::Windows if (PatrolAreaToolIsActive()) { SetPatrolAreaToRender(_staffId); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } else { @@ -249,7 +250,7 @@ namespace OpenRCT2::Ui::Windows { ShowGridlines(); SetPatrolAreaToRender(_staffId); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } } } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 98001fd4f1..fb0b632254 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/ScenarioSelect.cpp b/src/openrct2-ui/windows/ScenarioSelect.cpp index 4020d1284f..bf60727fbb 100644 --- a/src/openrct2-ui/windows/ScenarioSelect.cpp +++ b/src/openrct2-ui/windows/ScenarioSelect.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 0813a5fcf9..2a00a71342 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index c4a772e8f8..d14eafc007 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index ae9506e3e6..4c191efd27 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -125,10 +124,10 @@ namespace OpenRCT2::Ui::Windows Rectangle::filter(rt, { { left + 2, top + 0 }, { right - 2, top + 0 } }, FilterPaletteID::paletteDarken3); // Corners - GfxFilterPixel(rt, { left + 1, top + 1 }, FilterPaletteID::paletteDarken3); - GfxFilterPixel(rt, { right - 1, top + 1 }, FilterPaletteID::paletteDarken3); - GfxFilterPixel(rt, { left + 1, bottom - 1 }, FilterPaletteID::paletteDarken3); - GfxFilterPixel(rt, { right - 1, bottom - 1 }, FilterPaletteID::paletteDarken3); + Rectangle::filterPixel(rt, { left + 1, top + 1 }, FilterPaletteID::paletteDarken3); + Rectangle::filterPixel(rt, { right - 1, top + 1 }, FilterPaletteID::paletteDarken3); + Rectangle::filterPixel(rt, { left + 1, bottom - 1 }, FilterPaletteID::paletteDarken3); + Rectangle::filterPixel(rt, { right - 1, bottom - 1 }, FilterPaletteID::paletteDarken3); // Text left = windowPos.x + ((width + 1) / 2) - 1; diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 75ddf4b21e..07e3b9f31b 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -128,7 +129,7 @@ namespace OpenRCT2::Ui::Windows _previousClipSelectionB = gClipSelectionB; gClipSelectionA = { 0, 0 }; gClipSelectionB = { kMaximumMapSizeBig - 1, kMaximumMapSizeBig - 1 }; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_CLIP_CLEAR: if (IsActive()) @@ -138,7 +139,7 @@ namespace OpenRCT2::Ui::Windows } gClipSelectionA = { 0, 0 }; gClipSelectionB = { kMaximumMapSizeBig - 1, kMaximumMapSizeBig - 1 }; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case WIDX_CLIP_SEE_THROUGH_CHECKBOX_ENABLE: { @@ -263,7 +264,7 @@ namespace OpenRCT2::Ui::Windows gClipSelectionB = gMapSelectPositionB; _toolActive = false; ToolCancel(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void onPrepareDraw() override diff --git a/src/openrct2/actions/cheats/CheatSetAction.cpp b/src/openrct2/actions/cheats/CheatSetAction.cpp index 61a766e1c0..caf94687b3 100644 --- a/src/openrct2/actions/cheats/CheatSetAction.cpp +++ b/src/openrct2/actions/cheats/CheatSetAction.cpp @@ -17,7 +17,7 @@ #include "../../core/EnumUtils.hpp" #include "../../core/Guard.hpp" #include "../../drawing/Colour.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../entity/Duck.h" #include "../../entity/EntityList.h" #include "../../entity/EntityRegistry.h" @@ -457,7 +457,7 @@ namespace OpenRCT2::GameActions } } - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void CheatSetAction::WaterPlants() const @@ -473,7 +473,7 @@ namespace OpenRCT2::GameActions } } while (TileElementIteratorNext(&it)); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void CheatSetAction::FixVandalism() const @@ -492,7 +492,7 @@ namespace OpenRCT2::GameActions it.element->asPath()->setIsBroken(false); } while (TileElementIteratorNext(&it)); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void CheatSetAction::RemoveLitter(GameState_t& gameState) const @@ -519,7 +519,7 @@ namespace OpenRCT2::GameActions } while (TileElementIteratorNext(&it)); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void CheatSetAction::FixBrokenRides(GameState_t& gameState) const @@ -766,7 +766,7 @@ namespace OpenRCT2::GameActions auto* windowMgr = Ui::GetWindowManager(); windowMgr->InvalidateByClass(WindowClass::ride); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void CheatSetAction::SetStaffSpeed(uint8_t value) const @@ -855,6 +855,6 @@ namespace OpenRCT2::GameActions } } while (TileElementIteratorNext(&it)); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } } // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/general/MapChangeSizeAction.cpp b/src/openrct2/actions/general/MapChangeSizeAction.cpp index 77f66e57bd..5e11e5986c 100644 --- a/src/openrct2/actions/general/MapChangeSizeAction.cpp +++ b/src/openrct2/actions/general/MapChangeSizeAction.cpp @@ -11,7 +11,7 @@ #include "../../Context.h" #include "../../GameState.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../scripting/ScriptEngine.h" #include "../../ui/UiContext.h" #include "../../ui/WindowManager.h" @@ -88,7 +88,7 @@ namespace OpenRCT2::GameActions Park::UpdateSize(park); windowManager->BroadcastIntent(Intent(INTENT_ACTION_MAP)); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); auto& hookEngine = ctx->GetScriptEngine().GetHookEngine(); if (hookEngine.HasSubscriptions(OpenRCT2::Scripting::HookType::mapResize)) diff --git a/src/openrct2/actions/park/ParkSetNameAction.cpp b/src/openrct2/actions/park/ParkSetNameAction.cpp index 129411a400..aa8ebdc2a4 100644 --- a/src/openrct2/actions/park/ParkSetNameAction.cpp +++ b/src/openrct2/actions/park/ParkSetNameAction.cpp @@ -10,7 +10,7 @@ #include "ParkSetNameAction.h" #include "../../Diagnostic.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../world/Park.h" #include "../../world/ParkData.h" @@ -54,7 +54,7 @@ namespace OpenRCT2::GameActions { park.name = _name; Drawing::ScrollingText::invalidate(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } return Result(); } diff --git a/src/openrct2/actions/peep/GuestSetNameAction.cpp b/src/openrct2/actions/peep/GuestSetNameAction.cpp index 15068820f6..90b49f4aa1 100644 --- a/src/openrct2/actions/peep/GuestSetNameAction.cpp +++ b/src/openrct2/actions/peep/GuestSetNameAction.cpp @@ -12,7 +12,7 @@ #include "../../Context.h" #include "../../Diagnostic.h" #include "../../GameState.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../entity/EntityRegistry.h" #include "../../localisation/StringIds.h" #include "../../windows/Intent.h" @@ -93,7 +93,7 @@ namespace OpenRCT2::GameActions // Easter egg functions are for guests only guest->handleEasterEggName(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST); ContextBroadcastIntent(&intent); diff --git a/src/openrct2/actions/peep/StaffFireAction.cpp b/src/openrct2/actions/peep/StaffFireAction.cpp index 08c2891c09..c6922a388e 100644 --- a/src/openrct2/actions/peep/StaffFireAction.cpp +++ b/src/openrct2/actions/peep/StaffFireAction.cpp @@ -11,7 +11,7 @@ #include "../../Diagnostic.h" #include "../../GameState.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../entity/EntityRegistry.h" #include "../../entity/Staff.h" #include "../../ui/WindowManager.h" @@ -80,7 +80,7 @@ namespace OpenRCT2::GameActions PeepEntityRemove(staff); // Due to patrol areas best to invalidate the whole screen on removal of staff - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return Result(); } diff --git a/src/openrct2/actions/peep/StaffSetColourAction.cpp b/src/openrct2/actions/peep/StaffSetColourAction.cpp index 5e58bb5336..dc0962ad0f 100644 --- a/src/openrct2/actions/peep/StaffSetColourAction.cpp +++ b/src/openrct2/actions/peep/StaffSetColourAction.cpp @@ -10,7 +10,7 @@ #include "StaffSetColourAction.h" #include "../../Diagnostic.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../entity/EntityList.h" #include "../../entity/Staff.h" #include "../../localisation/StringIds.h" @@ -70,7 +70,7 @@ namespace OpenRCT2::GameActions } } - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return Result(); } } // namespace OpenRCT2::GameActions diff --git a/src/openrct2/actions/peep/StaffSetNameAction.cpp b/src/openrct2/actions/peep/StaffSetNameAction.cpp index 48edc5e45c..adce8142d2 100644 --- a/src/openrct2/actions/peep/StaffSetNameAction.cpp +++ b/src/openrct2/actions/peep/StaffSetNameAction.cpp @@ -12,7 +12,7 @@ #include "../../Context.h" #include "../../Diagnostic.h" #include "../../GameState.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../entity/EntityRegistry.h" #include "../../entity/Staff.h" #include "../../localisation/StringIds.h" @@ -82,7 +82,7 @@ namespace OpenRCT2::GameActions return Result(Status::unknown, STR_CANT_NAME_GUEST, kStringIdNone); } - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); ContextBroadcastIntent(&intent); diff --git a/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp b/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp index 37eb3c6167..690fc22f22 100644 --- a/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp +++ b/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp @@ -11,7 +11,7 @@ #include "../../Diagnostic.h" #include "../../GameState.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../entity/EntityRegistry.h" #include "../../entity/PatrolArea.h" #include "../../entity/Staff.h" @@ -99,7 +99,7 @@ namespace OpenRCT2::GameActions break; case StaffSetPatrolAreaMode::clearAll: staff->clearPatrolArea(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; } UpdateConsolidatedPatrolAreas(); diff --git a/src/openrct2/actions/ride/RideDemolishAction.cpp b/src/openrct2/actions/ride/RideDemolishAction.cpp index 4caada4462..5067a837c5 100644 --- a/src/openrct2/actions/ride/RideDemolishAction.cpp +++ b/src/openrct2/actions/ride/RideDemolishAction.cpp @@ -13,7 +13,7 @@ #include "../../Diagnostic.h" #include "../../Game.h" #include "../../GameState.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../drawing/ScrollingText.h" #include "../../entity/EntityList.h" #include "../../management/NewsItem.h" @@ -170,7 +170,7 @@ namespace OpenRCT2::GameActions windowMgr->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST)); Drawing::ScrollingText::invalidate(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return res; } diff --git a/src/openrct2/actions/ride/RideSetAppearanceAction.cpp b/src/openrct2/actions/ride/RideSetAppearanceAction.cpp index b68c7f53b5..47b9855070 100644 --- a/src/openrct2/actions/ride/RideSetAppearanceAction.cpp +++ b/src/openrct2/actions/ride/RideSetAppearanceAction.cpp @@ -10,7 +10,7 @@ #include "RideSetAppearanceAction.h" #include "../../Diagnostic.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../localisation/StringIds.h" #include "../../ride/Ride.h" #include "../../ui/WindowManager.h" @@ -100,15 +100,15 @@ namespace OpenRCT2::GameActions { case RideSetAppearanceType::trackColourMain: ride->trackColours[_index].main = static_cast(_value); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case RideSetAppearanceType::trackColourAdditional: ride->trackColours[_index].additional = static_cast(_value); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case RideSetAppearanceType::trackColourSupports: ride->trackColours[_index].supports = static_cast(_value); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case RideSetAppearanceType::vehicleColourBody: ride->vehicleColours[_index].Body = static_cast(_value); @@ -132,7 +132,7 @@ namespace OpenRCT2::GameActions break; case RideSetAppearanceType::entranceStyle: ride->entranceStyle = _value; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; case RideSetAppearanceType::sellingItemColourIsRandom: ride->flags.set(RideFlag::randomShopColours, static_cast(_value)); diff --git a/src/openrct2/actions/ride/RideSetNameAction.cpp b/src/openrct2/actions/ride/RideSetNameAction.cpp index 802a0b6c90..e2f6556d07 100644 --- a/src/openrct2/actions/ride/RideSetNameAction.cpp +++ b/src/openrct2/actions/ride/RideSetNameAction.cpp @@ -10,7 +10,7 @@ #include "RideSetNameAction.h" #include "../../Diagnostic.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../drawing/ScrollingText.h" #include "../../localisation/StringIds.h" #include "../../ride/Ride.h" @@ -79,7 +79,7 @@ namespace OpenRCT2::GameActions } Drawing::ScrollingText::invalidate(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); // Refresh windows that display ride name auto windowManager = Ui::GetWindowManager(); diff --git a/src/openrct2/actions/ride/RideSetSettingAction.cpp b/src/openrct2/actions/ride/RideSetSettingAction.cpp index 7455c82fd0..2f5b34bb05 100644 --- a/src/openrct2/actions/ride/RideSetSettingAction.cpp +++ b/src/openrct2/actions/ride/RideSetSettingAction.cpp @@ -12,7 +12,7 @@ #include "../../Context.h" #include "../../Diagnostic.h" #include "../../GameState.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../object/MusicObject.h" #include "../../object/ObjectManager.h" #include "../../ride/Ride.h" @@ -237,7 +237,7 @@ namespace OpenRCT2::GameActions case RideSetSetting::rideType: ride->type = _value; ride->updateRideTypeForAllPieces(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); break; } diff --git a/src/openrct2/actions/ride/RideSetVehicleAction.cpp b/src/openrct2/actions/ride/RideSetVehicleAction.cpp index ecea6d7b1d..84d5128186 100644 --- a/src/openrct2/actions/ride/RideSetVehicleAction.cpp +++ b/src/openrct2/actions/ride/RideSetVehicleAction.cpp @@ -14,7 +14,7 @@ #include "../../Diagnostic.h" #include "../../GameState.h" #include "../../core/EnumUtils.hpp" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../localisation/StringIds.h" #include "../../management/Research.h" #include "../../object/ObjectManager.h" @@ -222,7 +222,7 @@ namespace OpenRCT2::GameActions intent.PutExtra(INTENT_EXTRA_RIDE_ID, _rideIndex.ToUnderlying()); ContextBroadcastIntent(&intent); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return res; } diff --git a/src/openrct2/actions/scenery/BannerSetNameAction.cpp b/src/openrct2/actions/scenery/BannerSetNameAction.cpp index 43027a2364..0f7fc2d697 100644 --- a/src/openrct2/actions/scenery/BannerSetNameAction.cpp +++ b/src/openrct2/actions/scenery/BannerSetNameAction.cpp @@ -11,7 +11,7 @@ #include "../../Context.h" #include "../../Diagnostic.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../drawing/ScrollingText.h" #include "../../localisation/StringIds.h" #include "../../windows/Intent.h" @@ -93,7 +93,7 @@ namespace OpenRCT2::GameActions ContextBroadcastIntent(&intent); Drawing::ScrollingText::invalidate(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return Result(); } diff --git a/src/openrct2/actions/scenery/BannerSetStyleAction.cpp b/src/openrct2/actions/scenery/BannerSetStyleAction.cpp index 22723dd825..0744a70aa0 100644 --- a/src/openrct2/actions/scenery/BannerSetStyleAction.cpp +++ b/src/openrct2/actions/scenery/BannerSetStyleAction.cpp @@ -11,7 +11,7 @@ #include "../../Context.h" #include "../../Diagnostic.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../drawing/ScrollingText.h" #include "../../localisation/StringIdType.h" #include "../../management/Finance.h" @@ -179,7 +179,7 @@ namespace OpenRCT2::GameActions ContextBroadcastIntent(&intent); Drawing::ScrollingText::invalidate(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return res; } diff --git a/src/openrct2/actions/scenery/SignSetNameAction.cpp b/src/openrct2/actions/scenery/SignSetNameAction.cpp index dfb3b3cc32..e3ba4ebbcf 100644 --- a/src/openrct2/actions/scenery/SignSetNameAction.cpp +++ b/src/openrct2/actions/scenery/SignSetNameAction.cpp @@ -10,7 +10,7 @@ #include "SignSetNameAction.h" #include "../../Diagnostic.h" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../drawing/ScrollingText.h" #include "../../localisation/StringIds.h" #include "../../world/Banner.h" @@ -108,7 +108,7 @@ namespace OpenRCT2::GameActions } Drawing::ScrollingText::invalidate(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return Result(); } } // namespace OpenRCT2::GameActions diff --git a/src/openrct2/drawing/Drawing.Screen.cpp b/src/openrct2/drawing/Drawing.Screen.cpp new file mode 100644 index 0000000000..7101464189 --- /dev/null +++ b/src/openrct2/drawing/Drawing.Screen.cpp @@ -0,0 +1,43 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "Drawing.Screen.h" + +#include "../Context.h" +#include "../config/Config.h" +#include "../interface/ScreenCoords.hpp" +#include "NewDrawing.h" +#include "Palette.h" + +namespace OpenRCT2::Drawing +{ + /** + * + * rct2: 0x006ED7E5 + */ + void GfxInvalidateScreen() + { + GfxSetDirtyBlocks({ { 0, 0 }, { ContextGetWidth(), ContextGetHeight() } }); + } + + void RefreshVideo() + { + ContextRecreateWindow(); + DrawingEngineSetPalette(gPalette); + GfxInvalidateScreen(); + } + + void ToggleWindowedMode() + { + int32_t rt = Config::Get().general.fullscreenMode == 0 ? 2 : 0; + ContextSetFullscreenMode(rt); + Config::Get().general.fullscreenMode = rt; + Config::Save(); + } +} // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/Drawing.Screen.h b/src/openrct2/drawing/Drawing.Screen.h new file mode 100644 index 0000000000..8c3290deb3 --- /dev/null +++ b/src/openrct2/drawing/Drawing.Screen.h @@ -0,0 +1,17 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +namespace OpenRCT2::Drawing +{ + void GfxInvalidateScreen(); + void RefreshVideo(); + void ToggleWindowedMode(); +} // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 32a97531d3..b625934d1c 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -9,24 +9,19 @@ #include "Drawing.h" -#include "../Context.h" #include "../Game.h" #include "../GameState.h" #include "../SpriteIds.h" -#include "../config/Config.h" #include "../interface/ScreenCoords.hpp" #include "Drawing.Sprite.h" #include "FilterPaletteIds.h" #include "Font.h" -#include "NewDrawing.h" -#include "Palette.h" +#include "Line.h" #include "Rectangle.h" #include "RenderTarget.h" #include "Text.h" -#include #include -#include using namespace OpenRCT2; using namespace OpenRCT2::Drawing; @@ -379,46 +374,6 @@ const TranslucentWindowPalette kTranslucentWindowPalettes[kColourNumTotal] = { }; // clang-format on -ImageCatalogue ImageId::GetCatalogue() const -{ - auto index = GetIndex(); - if (index >= SPR_TEMP_BEGIN && index < SPR_TEMP_END) - { - return ImageCatalogue::temporary; - } - if (index < SPR_RCTC_G1_END) - { - return ImageCatalogue::g1; - } - if (index < SPR_G2_END) - { - return ImageCatalogue::g2; - } - if (index < SPR_CSG_END) - { - return ImageCatalogue::csg; - } - if (index < SPR_IMAGE_LIST_END) - { - return ImageCatalogue::object; - } - return ImageCatalogue::unknown; -} - -void GfxFilterPixel(RenderTarget& rt, const ScreenCoordsXY& coords, FilterPaletteID palette) -{ - Rectangle::filter(rt, { coords, coords }, palette); -} - -/** - * - * rct2: 0x006ED7E5 - */ -void GfxInvalidateScreen() -{ - GfxSetDirtyBlocks({ { 0, 0 }, { ContextGetWidth(), ContextGetHeight() } }); -} - /* * * rct2: 0x006EE53B @@ -506,21 +461,6 @@ FilterPaletteID GetGlassPaletteId(Colour c) return kGlassPaletteIds[EnumValue(c)]; } -void RefreshVideo() -{ - ContextRecreateWindow(); - DrawingEngineSetPalette(Drawing::gPalette); - GfxInvalidateScreen(); -} - -void ToggleWindowedMode() -{ - int32_t rt = Config::Get().general.fullscreenMode == 0 ? 2 : 0; - ContextSetFullscreenMode(rt); - Config::Get().general.fullscreenMode = rt; - Config::Save(); -} - void DebugRT(RenderTarget& rt) { ScreenCoordsXY topLeft = { rt.x, rt.y }; diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 7f1a4ec557..360cd20399 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -48,20 +48,9 @@ extern bool gPaintForceRedraw; bool ClipRenderTarget( OpenRCT2::Drawing::RenderTarget& dst, OpenRCT2::Drawing::RenderTarget& src, const ScreenCoordsXY& coords, int32_t width, int32_t height); -void GfxSetDirtyBlocks(const ScreenRect& rect); -void GfxInvalidateScreen(); // other void GfxClear(OpenRCT2::Drawing::RenderTarget& rt, OpenRCT2::Drawing::PaletteIndex paletteIndex); -void GfxFilterPixel( - OpenRCT2::Drawing::RenderTarget& rt, const ScreenCoordsXY& coords, OpenRCT2::Drawing::FilterPaletteID palette); - -// line -void GfxDrawLine(OpenRCT2::Drawing::RenderTarget& rt, const ScreenLine& line, OpenRCT2::Drawing::PaletteIndex colour); -void GfxDrawLineSoftware(OpenRCT2::Drawing::RenderTarget& rt, const ScreenLine& line, OpenRCT2::Drawing::PaletteIndex colour); -void GfxDrawDashedLine( - OpenRCT2::Drawing::RenderTarget& rt, const ScreenLine& screenLine, int32_t dashedLineSegmentLength, - OpenRCT2::Drawing::PaletteIndex colour); // sprite (NewDrawing.cpp functions that use the drawing engine) void FASTCALL GfxDrawSprite(OpenRCT2::Drawing::RenderTarget& rt, ImageId image_id, const ScreenCoordsXY& coords); @@ -76,7 +65,4 @@ void FASTCALL GfxDrawSpriteRawMasked( std::optional GetPaletteG1Index(OpenRCT2::Drawing::FilterPaletteID paletteId); std::optional GetPaletteMapForColour(OpenRCT2::Drawing::FilterPaletteID paletteId); -void RefreshVideo(); -void ToggleWindowedMode(); - void DebugRT(OpenRCT2::Drawing::RenderTarget& rt); diff --git a/src/openrct2/drawing/ImageId.cpp b/src/openrct2/drawing/ImageId.cpp new file mode 100644 index 0000000000..2adc967913 --- /dev/null +++ b/src/openrct2/drawing/ImageId.cpp @@ -0,0 +1,38 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "ImageId.hpp" + +#include "../SpriteIds.h" + +ImageCatalogue ImageId::GetCatalogue() const +{ + auto index = GetIndex(); + if (index >= SPR_TEMP_BEGIN && index < SPR_TEMP_END) + { + return ImageCatalogue::temporary; + } + if (index < SPR_RCTC_G1_END) + { + return ImageCatalogue::g1; + } + if (index < SPR_G2_END) + { + return ImageCatalogue::g2; + } + if (index < SPR_CSG_END) + { + return ImageCatalogue::csg; + } + if (index < SPR_IMAGE_LIST_END) + { + return ImageCatalogue::object; + } + return ImageCatalogue::unknown; +} diff --git a/src/openrct2/drawing/Line.cpp b/src/openrct2/drawing/Line.cpp index 14bcb12e59..f2a84471eb 100644 --- a/src/openrct2/drawing/Line.cpp +++ b/src/openrct2/drawing/Line.cpp @@ -7,164 +7,213 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "Line.h" + +#include "../interface/ScreenCoords.hpp" #include "Drawing.h" +#include "IDrawingContext.h" +#include "IDrawingEngine.h" #include "RenderTarget.h" #include -using namespace OpenRCT2::Drawing; - -/** - * Draws a horizontal line of specified colour to a buffer. - * rct2: 0x0068474C - */ -static void GfxDrawLineOnBuffer(RenderTarget& rt, PaletteIndex colour, const ScreenCoordsXY& coords, int32_t no_pixels) +namespace OpenRCT2::Drawing { - ScreenCoordsXY offset{ coords.x - rt.x, coords.y - rt.y }; - - const int32_t width = rt.width; - const int32_t height = rt.height; - - // Check to make sure point is in the y range - if (offset.y < 0) - return; - if (offset.y >= height) - return; - // Check to make sure we are drawing at least a pixel - if (!no_pixels) - no_pixels++; - - // If x coord outside range leave - if (offset.x < 0) + /** + * Draws a horizontal line of specified colour to a buffer. + * rct2: 0x0068474C + */ + static void GfxDrawLineOnBuffer(RenderTarget& rt, PaletteIndex colour, const ScreenCoordsXY& coords, int32_t no_pixels) { - // Unless the number of pixels is enough to be in range - no_pixels += offset.x; - if (no_pixels <= 0) + ScreenCoordsXY offset{ coords.x - rt.x, coords.y - rt.y }; + + const int32_t width = rt.width; + const int32_t height = rt.height; + + // Check to make sure point is in the y range + if (offset.y < 0) return; - // Resets starting point to 0 as we don't draw outside the range - offset.x = 0; - } - - // Ensure that the end point of the line is within range - if (offset.x + no_pixels - width > 0) - { - // If the end point has any pixels outside range - // cut them off. If there are now no pixels return. - no_pixels -= offset.x + no_pixels - width; - if (no_pixels <= 0) + if (offset.y >= height) return; + // Check to make sure we are drawing at least a pixel + if (!no_pixels) + no_pixels++; + + // If x coord outside range leave + if (offset.x < 0) + { + // Unless the number of pixels is enough to be in range + no_pixels += offset.x; + if (no_pixels <= 0) + return; + // Resets starting point to 0 as we don't draw outside the range + offset.x = 0; + } + + // Ensure that the end point of the line is within range + if (offset.x + no_pixels - width > 0) + { + // If the end point has any pixels outside range + // cut them off. If there are now no pixels return. + no_pixels -= offset.x + no_pixels - width; + if (no_pixels <= 0) + return; + } + + // Get the buffer we are drawing to and move to the first coordinate. + PaletteIndex* bits_pointer = reinterpret_cast(rt.bits + offset.y * rt.LineStride() + offset.x); + + // Draw the line to the specified colour + for (; no_pixels > 0; --no_pixels, ++bits_pointer) + { + *bits_pointer = colour; + } } - // Get the buffer we are drawing to and move to the first coordinate. - PaletteIndex* bits_pointer = reinterpret_cast(rt.bits + offset.y * rt.LineStride() + offset.x); + /** + * Draws a line on rt if within rt boundaries + * rct2: 0x00684466 + * rt (edi) + * x1 (ax) + * y1 (bx) + * x2 (cx) + * y2 (dx) + * colour (ebp) + */ - // Draw the line to the specified colour - for (; no_pixels > 0; --no_pixels, ++bits_pointer) + void GfxDrawLineSoftware(RenderTarget& rt, const ScreenLine& line, PaletteIndex colour) { - *bits_pointer = colour; - } -} + const ZoomLevel zoom = rt.zoom_level; + int32_t x1 = zoom.ApplyInversedTo(line.GetX1()); + int32_t x2 = zoom.ApplyInversedTo(line.GetX2()); + int32_t y1 = zoom.ApplyInversedTo(line.GetY1()); + int32_t y2 = zoom.ApplyInversedTo(line.GetY2()); + // Check to make sure the line is within the drawing area + if ((x1 < rt.x) && (x2 < rt.x)) + { + return; + } -/** - * Draws a line on rt if within rt boundaries - * rct2: 0x00684466 - * rt (edi) - * x1 (ax) - * y1 (bx) - * x2 (cx) - * y2 (dx) - * colour (ebp) - */ + if ((y1 < rt.y) && (y2 < rt.y)) + { + return; + } -void GfxDrawLineSoftware(RenderTarget& rt, const ScreenLine& line, PaletteIndex colour) -{ - const ZoomLevel zoom = rt.zoom_level; - int32_t x1 = zoom.ApplyInversedTo(line.GetX1()); - int32_t x2 = zoom.ApplyInversedTo(line.GetX2()); - int32_t y1 = zoom.ApplyInversedTo(line.GetY1()); - int32_t y2 = zoom.ApplyInversedTo(line.GetY2()); - // Check to make sure the line is within the drawing area - if ((x1 < rt.x) && (x2 < rt.x)) - { - return; - } + if ((x1 > (rt.x + rt.width)) && (x2 > (rt.x + rt.width))) + { + return; + } - if ((y1 < rt.y) && (y2 < rt.y)) - { - return; - } + if ((y1 > (rt.y + rt.height)) && (y2 > (rt.y + rt.height))) + { + return; + } - if ((x1 > (rt.x + rt.width)) && (x2 > (rt.x + rt.width))) - { - return; - } + // Bresenham's algorithm - if ((y1 > (rt.y + rt.height)) && (y2 > (rt.y + rt.height))) - { - return; - } - - // Bresenham's algorithm - - // If vertical plot points upwards - int32_t steep = std::abs(y2 - y1) > std::abs(x2 - x1); - if (steep) - { - int32_t temp_y2 = y2; - int32_t temp_x2 = x2; - y2 = x1; - x2 = y1; - y1 = temp_x2; - x1 = temp_y2; - } - - // If line is right to left swap direction - if (x1 > x2) - { - int32_t temp_y2 = y2; - int32_t temp_x2 = x2; - y2 = y1; - x2 = x1; - y1 = temp_y2; - x1 = temp_x2; - } - - int32_t delta_x = x2 - x1; - int32_t delta_y = std::abs(y2 - y1); - int32_t error = delta_x / 2; - int32_t y_step; - int32_t y = y1; - - // Direction of step - if (y1 < y2) - y_step = 1; - else - y_step = -1; - - for (int32_t x = x1, x_start = x1, length = 1; x < x2; ++x, ++length) - { - // Vertical lines are drawn 1 pixel at a time + // If vertical plot points upwards + int32_t steep = std::abs(y2 - y1) > std::abs(x2 - x1); if (steep) - GfxDrawLineOnBuffer(rt, colour, { y, x }, 1); - - error -= delta_y; - if (error < 0) { - // Non vertical lines are drawn with as many pixels in a horizontal line as possible - if (!steep) - GfxDrawLineOnBuffer(rt, colour, { x_start, y }, length); - - // Reset non vertical line vars - x_start = x + 1; - length = 0; // NB: will be incremented in next iteration - y += y_step; - error += delta_x; + int32_t temp_y2 = y2; + int32_t temp_x2 = x2; + y2 = x1; + x2 = y1; + y1 = temp_x2; + x1 = temp_y2; } - // Catch the case of the last line - if (x + 1 == x2 && !steep) + // If line is right to left swap direction + if (x1 > x2) { - GfxDrawLineOnBuffer(rt, colour, { x_start, y }, length); + int32_t temp_y2 = y2; + int32_t temp_x2 = x2; + y2 = y1; + x2 = x1; + y1 = temp_y2; + x1 = temp_x2; + } + + int32_t delta_x = x2 - x1; + int32_t delta_y = std::abs(y2 - y1); + int32_t error = delta_x / 2; + int32_t y_step; + int32_t y = y1; + + // Direction of step + if (y1 < y2) + y_step = 1; + else + y_step = -1; + + for (int32_t x = x1, x_start = x1, length = 1; x < x2; ++x, ++length) + { + // Vertical lines are drawn 1 pixel at a time + if (steep) + GfxDrawLineOnBuffer(rt, colour, { y, x }, 1); + + error -= delta_y; + if (error < 0) + { + // Non vertical lines are drawn with as many pixels in a horizontal line as possible + if (!steep) + GfxDrawLineOnBuffer(rt, colour, { x_start, y }, length); + + // Reset non vertical line vars + x_start = x + 1; + length = 0; // NB: will be incremented in next iteration + y += y_step; + error += delta_x; + } + + // Catch the case of the last line + if (x + 1 == x2 && !steep) + { + GfxDrawLineOnBuffer(rt, colour, { x_start, y }, length); + } } } -} + + void GfxDrawLine(RenderTarget& rt, const ScreenLine& line, PaletteIndex colour) + { + auto drawingEngine = rt.DrawingEngine; + if (drawingEngine != nullptr) + { + IDrawingContext* dc = drawingEngine->GetDrawingContext(); + dc->DrawLine(rt, colour, line); + } + } + + void GfxDrawDashedLine( + RenderTarget& rt, const ScreenLine& screenLine, const int32_t dashedLineSegmentLength, const PaletteIndex colour) + { + assert(dashedLineSegmentLength > 0); + + const auto drawingEngine = rt.DrawingEngine; + if (drawingEngine != nullptr) + { + constexpr int32_t kPrecisionFactor = 1000; + + const int32_t dashedLineLength = std::hypot( + screenLine.GetX2() - screenLine.GetX1(), screenLine.GetY2() - screenLine.GetY1()); + const int32_t lineSegmentCount = dashedLineLength / dashedLineSegmentLength / 2; + if (lineSegmentCount == 0) + { + return; + } + + const int32_t lineXDist = std::abs(screenLine.GetX2() - screenLine.GetX1()); + const int32_t lineYDist = std::abs(screenLine.GetY2() - screenLine.GetY1()); + const int32_t dxPrecise = kPrecisionFactor * lineXDist / lineSegmentCount / 2; + const int32_t dyPrecise = kPrecisionFactor * lineYDist / lineSegmentCount / 2; + IDrawingContext* dc = drawingEngine->GetDrawingContext(); + + for (int32_t i = 0, x, y; i < lineSegmentCount; ++i) + { + x = screenLine.GetX1() + dxPrecise * i * 2 / kPrecisionFactor; + y = screenLine.GetY1() + dyPrecise * i * 2 / kPrecisionFactor; + dc->DrawLine(rt, colour, { { x, y }, { x + dxPrecise / kPrecisionFactor, y + dyPrecise / kPrecisionFactor } }); + } + } + } +} // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/Line.h b/src/openrct2/drawing/Line.h new file mode 100644 index 0000000000..a532ea3a2f --- /dev/null +++ b/src/openrct2/drawing/Line.h @@ -0,0 +1,25 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +struct ScreenLine; + +namespace OpenRCT2::Drawing +{ + enum class PaletteIndex : uint8_t; + struct RenderTarget; + + void GfxDrawLine(RenderTarget& rt, const ScreenLine& line, PaletteIndex colour); + void GfxDrawLineSoftware(RenderTarget& rt, const ScreenLine& line, PaletteIndex colour); + void GfxDrawDashedLine( + RenderTarget& rt, const ScreenLine& screenLine, int32_t dashedLineSegmentLength, PaletteIndex colour); +} // namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/NewDrawing.cpp b/src/openrct2/drawing/NewDrawing.cpp index 11e026f6d8..983a76f7ac 100644 --- a/src/openrct2/drawing/NewDrawing.cpp +++ b/src/openrct2/drawing/NewDrawing.cpp @@ -163,49 +163,6 @@ void GfxClear(RenderTarget& rt, PaletteIndex paletteIndex) } } -void GfxDrawLine(RenderTarget& rt, const ScreenLine& line, PaletteIndex colour) -{ - auto drawingEngine = rt.DrawingEngine; - if (drawingEngine != nullptr) - { - IDrawingContext* dc = drawingEngine->GetDrawingContext(); - dc->DrawLine(rt, colour, line); - } -} - -void GfxDrawDashedLine( - RenderTarget& rt, const ScreenLine& screenLine, const int32_t dashedLineSegmentLength, const PaletteIndex colour) -{ - assert(dashedLineSegmentLength > 0); - - const auto drawingEngine = rt.DrawingEngine; - if (drawingEngine != nullptr) - { - constexpr int32_t kPrecisionFactor = 1000; - - const int32_t dashedLineLength = std::hypot( - screenLine.GetX2() - screenLine.GetX1(), screenLine.GetY2() - screenLine.GetY1()); - const int32_t lineSegmentCount = dashedLineLength / dashedLineSegmentLength / 2; - if (lineSegmentCount == 0) - { - return; - } - - const int32_t lineXDist = std::abs(screenLine.GetX2() - screenLine.GetX1()); - const int32_t lineYDist = std::abs(screenLine.GetY2() - screenLine.GetY1()); - const int32_t dxPrecise = kPrecisionFactor * lineXDist / lineSegmentCount / 2; - const int32_t dyPrecise = kPrecisionFactor * lineYDist / lineSegmentCount / 2; - IDrawingContext* dc = drawingEngine->GetDrawingContext(); - - for (int32_t i = 0, x, y; i < lineSegmentCount; ++i) - { - x = screenLine.GetX1() + dxPrecise * i * 2 / kPrecisionFactor; - y = screenLine.GetY1() + dyPrecise * i * 2 / kPrecisionFactor; - dc->DrawLine(rt, colour, { { x, y }, { x + dxPrecise / kPrecisionFactor, y + dyPrecise / kPrecisionFactor } }); - } - } -} - void FASTCALL GfxDrawSprite(RenderTarget& rt, const ImageId imageId, const ScreenCoordsXY& coords) { auto drawingEngine = rt.DrawingEngine; diff --git a/src/openrct2/drawing/NewDrawing.h b/src/openrct2/drawing/NewDrawing.h index 5f6d1547c3..598e49e1e9 100644 --- a/src/openrct2/drawing/NewDrawing.h +++ b/src/openrct2/drawing/NewDrawing.h @@ -17,6 +17,7 @@ namespace OpenRCT2::Drawing } enum class DrawingEngine : int32_t; +struct ScreenRect; DrawingEngine drawing_engine_get_type(); bool DrawingEngineRequiresNewWindow(DrawingEngine srcEngine, DrawingEngine dstEngine); @@ -30,3 +31,4 @@ OpenRCT2::Drawing::RenderTarget& DrawingEngineGetRT(); bool DrawingEngineHasDirtyOptimisations(); void DrawingEngineInvalidateImage(uint32_t image); void DrawingEngineSetVSync(bool vsync); +void GfxSetDirtyBlocks(const ScreenRect& rect); diff --git a/src/openrct2/drawing/Palette.cpp b/src/openrct2/drawing/Palette.cpp index 9cd5ffdf36..2204073cd4 100644 --- a/src/openrct2/drawing/Palette.cpp +++ b/src/openrct2/drawing/Palette.cpp @@ -17,8 +17,8 @@ #include "../object/WaterEntry.h" #include "../util/Util.h" #include "../world/Weather.h" +#include "Drawing.Screen.h" #include "Drawing.Sprite.h" -#include "Drawing.h" #include "FilterPaletteIds.h" #include "LightFX.h" #include "NewDrawing.h" diff --git a/src/openrct2/drawing/PickupPeep.cpp b/src/openrct2/drawing/PickupPeep.cpp index b4eaa402de..f20cf678b8 100644 --- a/src/openrct2/drawing/PickupPeep.cpp +++ b/src/openrct2/drawing/PickupPeep.cpp @@ -8,6 +8,7 @@ #include "Drawing.Sprite.h" #include "Drawing.h" #include "ImageId.hpp" +#include "NewDrawing.h" #include "RenderTarget.h" namespace OpenRCT2::Drawing diff --git a/src/openrct2/drawing/Rectangle.cpp b/src/openrct2/drawing/Rectangle.cpp index 0ac8aab2fe..8e95428d90 100644 --- a/src/openrct2/drawing/Rectangle.cpp +++ b/src/openrct2/drawing/Rectangle.cpp @@ -153,4 +153,9 @@ namespace OpenRCT2::Drawing::Rectangle dc->FilterRect(rt, palette, rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom()); } } + + void filterPixel(RenderTarget& rt, const ScreenCoordsXY& coords, FilterPaletteID palette) + { + filter(rt, { coords, coords }, palette); + } } // namespace OpenRCT2::Drawing::Rectangle diff --git a/src/openrct2/drawing/Rectangle.h b/src/openrct2/drawing/Rectangle.h index 773b4d2a80..695a329488 100644 --- a/src/openrct2/drawing/Rectangle.h +++ b/src/openrct2/drawing/Rectangle.h @@ -11,6 +11,7 @@ #include +struct ScreenCoordsXY; struct ScreenRect; namespace OpenRCT2 @@ -51,4 +52,5 @@ namespace OpenRCT2::Drawing::Rectangle RenderTarget& rt, const ScreenRect& rect, ColourWithFlags colour, BorderStyle borderStyle = BorderStyle::outset, FillBrightness brightness = FillBrightness::light, FillMode fillMode = FillMode::standard); void filter(RenderTarget& rt, const ScreenRect& rect, FilterPaletteID palette); + void filterPixel(RenderTarget& rt, const ScreenCoordsXY& coords, FilterPaletteID palette); } // namespace OpenRCT2::Drawing::Rectangle diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index 657229ff2c..4bd3fd35fd 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -17,12 +17,14 @@ #include "../interface/Window.h" #include "../scenes/intro/IntroScene.h" #include "BlendColourMap.h" +#include "Drawing.Screen.h" #include "Drawing.Sprite.h" #include "Drawing.String.h" #include "Drawing.h" #include "IDrawingEngine.h" #include "InvalidationGrid.h" #include "LightFX.h" +#include "Line.h" #include "TTF.h" #include "WeatherDrawer.h" diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 3aa64de276..e9c3cfeb10 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -21,7 +21,7 @@ #include "../core/EnumUtils.hpp" #include "../core/Guard.hpp" #include "../core/String.hpp" -#include "../drawing/Drawing.h" +#include "../drawing/Drawing.Screen.h" #include "../drawing/PickupPeep.h" #include "../entity/Balloon.h" #include "../entity/EntityList.h" @@ -2581,7 +2581,7 @@ namespace OpenRCT2 auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST); ContextBroadcastIntent(&intent); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } void IncrementGuestsInPark() diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index ce043c994d..0f2c7f6497 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -15,8 +15,8 @@ #include "../audio/AudioMixer.h" #include "../core/UTF8.h" #include "../drawing/Drawing.String.h" -#include "../drawing/Drawing.h" #include "../drawing/FilterPaletteIds.h" +#include "../drawing/NewDrawing.h" #include "../drawing/Rectangle.h" #include "../drawing/Text.h" #include "../interface/ColourWithFlags.h" diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index d40d30b6da..480bc443ca 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -32,7 +32,7 @@ #include "../core/Guard.hpp" #include "../core/Path.hpp" #include "../core/String.hpp" -#include "../drawing/Drawing.h" +#include "../drawing/Drawing.Screen.h" #include "../drawing/Image.h" #include "../entity/Balloon.h" #include "../entity/EntityList.h" @@ -922,7 +922,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar float newScale = static_cast(0.001 * std::trunc(1000 * double_val[0])); Config::Get().general.windowScale = std::clamp(newScale, 0.5f, 5.0f); Config::Save(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); ContextTriggerResize(); ContextUpdateCursorScale(); console.Execute("get window_scale"); @@ -1020,7 +1020,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar console.WriteLineError("Invalid variable."); } - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } else { @@ -1114,7 +1114,7 @@ static void ConsoleCommandLoadObject(InteractiveConsole& console, const argument ContextBroadcastIntent(&ridesIntent); gWindowUpdateTicks = 0; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); console.WriteLine("Object file loaded."); } diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 2e5d91bd32..02815e55da 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -17,6 +17,7 @@ #include "../core/Guard.hpp" #include "../core/JobPool.h" #include "../core/Numerics.hpp" +#include "../drawing/Drawing.Screen.h" #include "../drawing/Drawing.Sprite.h" #include "../drawing/Drawing.h" #include "../drawing/IDrawingEngine.h" @@ -472,7 +473,7 @@ namespace OpenRCT2 } else { - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } } diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index b7caea7092..7572892c1c 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -15,8 +15,8 @@ #include "../OpenRCT2.h" #include "../audio/Audio.h" #include "../config/Config.h" +#include "../drawing/Drawing.Screen.h" #include "../drawing/Drawing.String.h" -#include "../drawing/Drawing.h" #include "../drawing/RenderTarget.h" #include "../entity/EntityRegistry.h" #include "../ride/RideAudio.h" @@ -870,7 +870,7 @@ static constexpr float kWindowScrollLocations[][2] = { WindowResizeGuiCentredWindows(width, height); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } /** diff --git a/src/openrct2/interface/WindowBase.cpp b/src/openrct2/interface/WindowBase.cpp index a0229f7ef4..4be93cc135 100644 --- a/src/openrct2/interface/WindowBase.cpp +++ b/src/openrct2/interface/WindowBase.cpp @@ -1,7 +1,7 @@ #include "WindowBase.h" #include "../config/Config.h" -#include "../drawing/Drawing.h" +#include "../drawing/NewDrawing.h" #include "Cursors.h" #include "Viewport.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index b5bc6be0ce..9cd0795813 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -253,6 +253,7 @@ + @@ -264,6 +265,7 @@ + @@ -901,12 +903,14 @@ + + diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index eb7cd93792..c851cd0ee6 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -24,7 +24,7 @@ #include "../core/File.h" #include "../core/Guard.hpp" #include "../core/Json.hpp" -#include "../drawing/Drawing.h" +#include "../drawing/Drawing.Screen.h" #include "../entity/EntityRegistry.h" #include "../entity/EntityTweener.h" #include "../localisation/Formatter.h" @@ -204,7 +204,7 @@ namespace OpenRCT2::Network scriptEngine.RemoveNetworkPlugins(); #endif - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); _requireClose = false; } diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index d62475f30d..6c23548fd3 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -17,6 +17,7 @@ #include "../drawing/Drawing.String.h" #include "../drawing/Drawing.h" #include "../drawing/Font.h" +#include "../drawing/Line.h" #include "../interface/Viewport.h" #include "../localisation/Currency.h" #include "../localisation/Formatting.h" diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 1c5a5832d1..5b159f3a34 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -16,6 +16,7 @@ #include "../drawing/Drawing.String.h" #include "../drawing/Drawing.h" #include "../drawing/IDrawingEngine.h" +#include "../drawing/NewDrawing.h" #include "../drawing/Palette.h" #include "../drawing/PickupPeep.h" #include "../drawing/Text.h" diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 85f32e7829..f1a7002a72 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -23,7 +23,7 @@ #include "../core/OrcaStream.hpp" #include "../core/Path.hpp" #include "../core/String.hpp" -#include "../drawing/Drawing.h" +#include "../drawing/Drawing.Screen.h" #include "../entity/Balloon.h" #include "../entity/Duck.h" #include "../entity/EntityList.h" @@ -2776,10 +2776,10 @@ int32_t ScenarioSave(GameState_t& gameState, u8string_view path, int32_t flags) Formatter ft; ft.Add(e.what()); ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_STRING, ft); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); if (result && !(flags & S6_SAVE_FLAG_AUTOMATIC)) { diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index ad518f1663..d6ae864d87 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -24,7 +24,7 @@ #include "../core/EnumUtils.hpp" #include "../core/Guard.hpp" #include "../core/Numerics.hpp" -#include "../drawing/Drawing.h" +#include "../drawing/Drawing.Screen.h" #include "../entity/EntityList.h" #include "../entity/EntityRegistry.h" #include "../entity/Peep.h" @@ -4453,7 +4453,7 @@ namespace OpenRCT2 const auto& rtd = ride.getRideTypeDescriptor(); if (rtd.specialType == RtdSpecialType::spaceRings || rtd.flags.has(RtdFlag::vehicleIsIntegral)) { - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } auto& entities = getGameState().entities; diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 96544b3c93..581d8f3425 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -9,7 +9,7 @@ #include "../Context.h" #include "../Diagnostic.h" -#include "../drawing/Drawing.h" +#include "../drawing/Drawing.Screen.h" #include "../interface/Viewport.h" #include "../localisation/Formatter.h" #include "../localisation/StringIds.h" @@ -111,7 +111,7 @@ void TrackDesignSaveSelectNearbyScenery(RideId rideIndex) } } while (TileElementIteratorNext(&it)); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } /** @@ -121,7 +121,7 @@ void TrackDesignSaveSelectNearbyScenery(RideId rideIndex) void TrackDesignSaveResetScenery() { TrackDesignSaveInit(); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } bool TrackDesignSaveContainsTileElement(const TileElement* tileElement) diff --git a/src/openrct2/scenes/editor/EditorController.cpp b/src/openrct2/scenes/editor/EditorController.cpp index 4fd3e905d3..87d80d1c84 100644 --- a/src/openrct2/scenes/editor/EditorController.cpp +++ b/src/openrct2/scenes/editor/EditorController.cpp @@ -16,7 +16,7 @@ #include "../../actions/ResultWithMessage.h" #include "../../audio/Audio.h" #include "../../core/EnumUtils.hpp" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../drawing/Palette.h" #include "../../entity/EntityList.h" #include "../../entity/Guest.h" @@ -721,7 +721,7 @@ namespace OpenRCT2::Editor } gameState.editorStep = Editor::Step::rollerCoasterDesigner; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } else { @@ -731,7 +731,7 @@ namespace OpenRCT2::Editor ContextBroadcastIntent(&intent); gameState.editorStep = Editor::Step::landscapeEditor; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } } diff --git a/src/openrct2/scenes/title/TitleScene.cpp b/src/openrct2/scenes/title/TitleScene.cpp index 9ca14c5c69..882036952d 100644 --- a/src/openrct2/scenes/title/TitleScene.cpp +++ b/src/openrct2/scenes/title/TitleScene.cpp @@ -18,7 +18,7 @@ #include "../../audio/Audio.h" #include "../../config/Config.h" #include "../../core/Console.hpp" -#include "../../drawing/Drawing.h" +#include "../../drawing/Drawing.Screen.h" #include "../../drawing/Palette.h" #include "../../interface/Screenshot.h" #include "../../interface/Window.h" @@ -311,7 +311,7 @@ bool TitleScene::TryLoadSequence(bool loadPreview) Config::Get().interface.currentTitleSequencePreset = configId; } _currentSequence = targetSequence; - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return true; } targetSequence = (targetSequence + 1) % numSequences; diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index bfd6026a13..ac3a4c89b3 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -14,7 +14,7 @@ #include "../../../Context.h" #include "../../../GameState.h" #include "../../../core/EnumMap.hpp" - #include "../../../drawing/Drawing.h" + #include "../../../drawing/Drawing.Screen.h" #include "../../../ui/WindowManager.h" #include "../../../windows/Intent.h" #include "../../../world/Park.h" @@ -322,7 +322,7 @@ namespace OpenRCT2::Scripting if (park.name != valueStr) { park.name = std::move(valueStr); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } return JS_UNDEFINED; } @@ -343,7 +343,7 @@ namespace OpenRCT2::Scripting const auto flag = kParkFlagMap[key]; auto& gameState = getGameState(); gameState.park.flags.set(flag, value); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); return JS_UNDEFINED; } diff --git a/src/openrct2/world/Weather.cpp b/src/openrct2/world/Weather.cpp index 8959ec83ca..03e4b95b60 100644 --- a/src/openrct2/world/Weather.cpp +++ b/src/openrct2/world/Weather.cpp @@ -18,7 +18,7 @@ #include "../audio/AudioChannel.h" #include "../config/Config.h" #include "../core/EnumUtils.hpp" -#include "../drawing/Drawing.h" +#include "../drawing/Drawing.Screen.h" #include "../drawing/FilterPaletteIds.h" #include "../object/ClimateObject.h" #include "../object/ObjectManager.h" @@ -189,7 +189,7 @@ namespace OpenRCT2::Weather { gameState.weatherCurrent.weatherGloom = stepWeatherLevel( gameState.weatherCurrent.weatherGloom, gameState.weatherNext.weatherGloom); - GfxInvalidateScreen(); + Drawing::GfxInvalidateScreen(); } } else