diff --git a/src/openrct2-ui/TextComposition.cpp b/src/openrct2-ui/TextComposition.cpp index 4685441a5a..0811a31bad 100644 --- a/src/openrct2-ui/TextComposition.cpp +++ b/src/openrct2-ui/TextComposition.cpp @@ -178,7 +178,7 @@ void TextComposition::HandleMessage(const SDL_Event* e) if ((modifier & KEYBOARD_PRIMARY_MODIFIER) && _session.Length) { SDL_SetClipboardText(_session.Buffer); - context_show_error(STR_COPY_INPUT_TO_CLIPBOARD, STR_NONE, {}); + ContextShowError(STR_COPY_INPUT_TO_CLIPBOARD, STR_NONE, {}); } break; case SDLK_v: diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index a253f15b02..cbdf6f57c0 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -334,7 +334,7 @@ public: switch (e.type) { case SDL_QUIT: - context_quit(); + ContextQuit(); break; case SDL_WINDOWEVENT: if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index 6fdcdefaf2..e508e75936 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -120,8 +120,8 @@ void GameHandleInput() } else { - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); screenCoords.x = std::clamp(screenCoords.x, 0, screenWidth - 1); screenCoords.y = std::clamp(screenCoords.y, 0, screenHeight - 1); @@ -140,7 +140,7 @@ static MouseState GameGetNextInput(ScreenCoordsXY& screenCoords) RCTMouseData* input = GetMouseInput(); if (input == nullptr) { - const CursorState* cursorState = context_get_cursor_state(); + const CursorState* cursorState = ContextGetCursorState(); screenCoords = cursorState->position; return MouseState::Released; } @@ -181,7 +181,7 @@ static void InputScrollDragBegin(const ScreenCoordsXY& screenCoords, rct_window* _ticksSinceDragStart = 0; _dragScrollIndex = window_get_scroll_data_index(*w, widgetIndex); - context_hide_cursor(); + ContextHideCursor(); } /** @@ -222,7 +222,7 @@ static void InputScrollDragContinue(const ScreenCoordsXY& screenCoords, rct_wind ScreenCoordsXY fixedCursorPosition = { static_cast(std::ceil(gInputDragLast.x * gConfigGeneral.WindowScale)), static_cast(std::ceil(gInputDragLast.y * gConfigGeneral.WindowScale)) }; - context_set_cursor_position(fixedCursorPosition); + ContextSetCursorPosition(fixedCursorPosition); } /** @@ -234,7 +234,7 @@ static void InputScrollRight(const ScreenCoordsXY& screenCoords, MouseState stat rct_window* w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number); if (w == nullptr) { - context_show_cursor(); + ContextShowCursor(); _inputState = InputState::Reset; return; } @@ -251,7 +251,7 @@ static void InputScrollRight(const ScreenCoordsXY& screenCoords, MouseState stat break; case MouseState::RightRelease: _inputState = InputState::Reset; - context_show_cursor(); + ContextShowCursor(); break; case MouseState::LeftPress: case MouseState::LeftRelease: @@ -496,7 +496,7 @@ static void InputWindowResizeBegin(rct_window& w, WidgetIndex widgetIndex, const static void InputWindowResizeContinue(rct_window& w, const ScreenCoordsXY& screenCoords) { - if (screenCoords.y < static_cast(context_get_height()) - 2) + if (screenCoords.y < static_cast(ContextGetHeight()) - 2) { auto differentialCoords = screenCoords - gInputDragLast; int32_t targetWidth = _originalWindowWidth + differentialCoords.x - w.width; @@ -524,11 +524,11 @@ static void InputViewportDragBegin(rct_window& w) _dragWidget.window_classification = w.classification; _dragWidget.window_number = w.number; _ticksSinceDragStart = 0; - auto cursorPosition = context_get_cursor_position(); + auto cursorPosition = ContextGetCursorPosition(); gInputDragLast = cursorPosition; if (!gConfigGeneral.InvertViewportDrag) { - context_hide_cursor(); + ContextHideCursor(); } window_unfollow_sprite(w); @@ -540,8 +540,8 @@ static void InputViewportDragContinue() rct_window* w; rct_viewport* viewport; - auto newDragCoords = context_get_cursor_position(); - const CursorState* cursorState = context_get_cursor_state(); + auto newDragCoords = ContextGetCursorPosition(); + const CursorState* cursorState = ContextGetCursorState(); auto differentialCoords = newDragCoords - gInputDragLast; w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number); @@ -558,7 +558,7 @@ static void InputViewportDragContinue() _ticksSinceDragStart += gCurrentDeltaTime; if (viewport == nullptr) { - context_show_cursor(); + ContextShowCursor(); _inputState = InputState::Reset; } else if (differentialCoords.x != 0 || differentialCoords.y != 0) @@ -590,14 +590,14 @@ static void InputViewportDragContinue() } else { - context_set_cursor_position(gInputDragLast); + ContextSetCursorPosition(gInputDragLast); } } static void InputViewportDragEnd() { _inputState = InputState::Reset; - context_show_cursor(); + ContextShowCursor(); } #pragma endregion @@ -1494,7 +1494,7 @@ static void InputUpdateTooltip(rct_window* w, WidgetIndex widgetIndex, const Scr */ int32_t GetNextKey() { - uint8_t* keysPressed = const_cast(context_get_keys_pressed()); + uint8_t* keysPressed = const_cast(ContextGetKeysPressed()); for (int32_t i = 0; i < 221; i++) { if (keysPressed[i]) @@ -1520,7 +1520,7 @@ void SetCursor(CursorID cursor_id) { cursor_id = CursorID::DiagonalArrows; } - context_setcurrentcursor(cursor_id); + ContextSetCurrentCursor(cursor_id); } /** @@ -1570,23 +1570,23 @@ void GameHandleEdgeScroll() return; if (mainWindow->viewport == nullptr) return; - if (!context_has_focus()) + if (!ContextHasFocus()) return; scrollX = 0; scrollY = 0; // Scroll left / right - const CursorState* cursorState = context_get_cursor_state(); + const CursorState* cursorState = ContextGetCursorState(); if (cursorState->position.x == 0) scrollX = -1; - else if (cursorState->position.x >= context_get_width() - 1) + else if (cursorState->position.x >= ContextGetWidth() - 1) scrollX = 1; // Scroll up / down if (cursorState->position.y == 0) scrollY = -1; - else if (cursorState->position.y >= context_get_height() - 1) + else if (cursorState->position.y >= ContextGetHeight() - 1) scrollY = 1; InputScrollViewport(ScreenCoordsXY(scrollX, scrollY)); diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 22e1dd80a8..d66fd32273 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -49,7 +49,7 @@ static void OpenWindow(WindowClass wc) { if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) { - context_open_window(wc); + ContextOpenWindow(wc); } } @@ -171,13 +171,13 @@ static void ShortcutRemoveTopBottomToolbarToggle() { if (gScreenFlags == 0) { - context_open_window(WindowClass::TopToolbar); - context_open_window(WindowClass::BottomToolbar); + ContextOpenWindow(WindowClass::TopToolbar); + ContextOpenWindow(WindowClass::BottomToolbar); } else { - context_open_window(WindowClass::TopToolbar); - context_open_window_view(WV_EDITOR_BOTTOM_TOOLBAR); + ContextOpenWindow(WindowClass::TopToolbar); + ContextOpenWindowView(WV_EDITOR_BOTTOM_TOOLBAR); } } } @@ -269,7 +269,7 @@ static void ShortcutBuildNewRide() { if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) { - context_open_window(WindowClass::ConstructRide); + ContextOpenWindow(WindowClass::ConstructRide); } } } @@ -281,7 +281,7 @@ static void ShortcutShowFinancialInformation() if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) - context_open_window(WindowClass::Finances); + ContextOpenWindow(WindowClass::Finances); } static void ShortcutShowResearchInformation() @@ -291,7 +291,7 @@ static void ShortcutShowResearchInformation() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window_view(WV_RIDE_RESEARCH); + ContextOpenWindowView(WV_RIDE_RESEARCH); } } @@ -302,7 +302,7 @@ static void ShortcutShowRidesList() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WindowClass::RideList); + ContextOpenWindow(WindowClass::RideList); } } @@ -313,7 +313,7 @@ static void ShortcutShowParkInformation() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WindowClass::ParkInformation); + ContextOpenWindow(WindowClass::ParkInformation); } } @@ -324,7 +324,7 @@ static void ShortcutShowGuestList() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WindowClass::GuestList); + ContextOpenWindow(WindowClass::GuestList); } } @@ -335,7 +335,7 @@ static void ShortcutShowStaffList() if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) { - context_open_window(WindowClass::StaffList); + ContextOpenWindow(WindowClass::StaffList); } } @@ -345,7 +345,7 @@ static void ShortcutShowRecentMessages() return; if (!(gScreenFlags & SCREEN_FLAGS_EDITOR)) - context_open_window(WindowClass::RecentNews); + ContextOpenWindow(WindowClass::RecentNews); } static void ShortcutShowMap() @@ -355,7 +355,7 @@ static void ShortcutShowMap() if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gEditorStep == EditorStep::LandscapeEditor) if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) - context_open_window(WindowClass::Map); + ContextOpenWindow(WindowClass::Map); } static void ShortcutReduceGameSpeed() @@ -388,7 +388,7 @@ static void ShortcutOpenCheatWindow() window_close(*window); return; } - context_open_window(WindowClass::Cheats); + ContextOpenWindow(WindowClass::Cheats); } static void ShortcutOpenTransparencyWindow() @@ -396,7 +396,7 @@ static void ShortcutOpenTransparencyWindow() if (gScreenFlags != SCREEN_FLAGS_PLAYING) return; - context_open_window(WindowClass::Transparency); + ContextOpenWindow(WindowClass::Transparency); } static void ShortcutClearScenery() @@ -431,7 +431,7 @@ static void ShortcutQuickSaveGame() auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } @@ -476,8 +476,8 @@ static void ShortcutScaleUp() gConfigGeneral.WindowScale += 0.25f; ConfigSaveDefault(); gfx_invalidate_screen(); - context_trigger_resize(); - context_update_cursor_scale(); + ContextTriggerResize(); + ContextUpdateCursorScale(); } static void ShortcutScaleDown() @@ -486,8 +486,8 @@ static void ShortcutScaleDown() gConfigGeneral.WindowScale = std::max(0.5f, gConfigGeneral.WindowScale); ConfigSaveDefault(); gfx_invalidate_screen(); - context_trigger_resize(); - context_update_cursor_scale(); + ContextTriggerResize(); + ContextUpdateCursorScale(); } // Tile inspector shortcuts @@ -623,7 +623,7 @@ static void ShortcutToggleConsole() { console.Toggle(); } - else if (gConfigGeneral.DebuggingTools && !context_is_input_active()) + else if (gConfigGeneral.DebuggingTools && !ContextIsInputActive()) { window_cancel_textbox(); console.Toggle(); @@ -808,7 +808,7 @@ void ShortcutManager::RegisterDefaultShortcuts() }); RegisterShortcut(ShortcutId::InterfaceSceneryPicker, STR_SHORTCUT_OPEN_SCENERY_PICKER, []() { ShortcutOpenSceneryPicker(); }); - RegisterShortcut(ShortcutId::InterfaceShowOptions, STR_SHORTCUT_SHOW_OPTIONS, []() { context_open_window(WindowClass::Options); }); + RegisterShortcut(ShortcutId::InterfaceShowOptions, STR_SHORTCUT_SHOW_OPTIONS, []() { ContextOpenWindow(WindowClass::Options); }); RegisterShortcut(ShortcutId::InterfaceOpenTransparencyOptions, STR_SHORTCUT_OPEN_TRANSPARENCY_OPTIONS, "CTRL+T", []() { ShortcutOpenTransparencyWindow(); }); RegisterShortcut(ShortcutId::InterfaceOpenCheats, STR_SHORTCUT_OPEN_CHEATS_WINDOW, "CTRL+ALT+C", []() { ShortcutOpenCheatWindow(); }); RegisterShortcut(ShortcutId::InterfaceOpenMap, STR_SHORTCUT_SHOW_MAP, "TAB", []() { ShortcutShowMap(); }); @@ -913,7 +913,7 @@ void ShortcutManager::RegisterDefaultShortcuts() } else { - context_open_window(WindowClass::DebugPaint); + ContextOpenWindow(WindowClass::DebugPaint); } } }); diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index da4c5a4dc8..d8939d6a43 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -239,7 +239,7 @@ namespace Graph rct_drawpixelinfo* dpi, const money64* history, const int32_t historyCount, const ScreenCoordsXY& screenCoords, const int32_t modifier, const int32_t offset) { - const auto cursorPosition = context_get_cursor_position_scaled(); + const auto cursorPosition = ContextGetCursorPositionScaled(); const ScreenRect chartFrame{ screenCoords, screenCoords + ScreenCoordsXY{ ChartMaxWidth, ChartMaxHeight } }; if (!chartFrame.Contains(cursorPosition)) diff --git a/src/openrct2-ui/interface/InGameConsole.cpp b/src/openrct2-ui/interface/InGameConsole.cpp index a0368dae8f..1412a8b8b8 100644 --- a/src/openrct2-ui/interface/InGameConsole.cpp +++ b/src/openrct2-ui/interface/InGameConsole.cpp @@ -119,7 +119,7 @@ void InGameConsole::ClearInput() _consoleCurrentLine[0] = 0; if (_isOpen) { - context_start_text_input(_consoleCurrentLine, sizeof(_consoleCurrentLine)); + ContextStartTextInput(_consoleCurrentLine, sizeof(_consoleCurrentLine)); } } @@ -181,7 +181,7 @@ void InGameConsole::Open() _isOpen = true; ScrollToEnd(); RefreshCaret(); - _consoleTextInputSession = context_start_text_input(_consoleCurrentLine, sizeof(_consoleCurrentLine)); + _consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, sizeof(_consoleCurrentLine)); } void InGameConsole::Close() @@ -189,7 +189,7 @@ void InGameConsole::Close() _consoleTextInputSession = nullptr; _isOpen = false; Invalidate(); - context_stop_text_input(); + ContextStopTextInput(); } void InGameConsole::Hide() @@ -243,7 +243,7 @@ void InGameConsole::Invalidate() const void InGameConsole::Update() { _consoleTopLeft = { 0, 0 }; - _consoleBottomRight = { context_get_width(), 322 }; + _consoleBottomRight = { ContextGetWidth(), 322 }; if (_isOpen) { diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index cb8bee03e3..e0683f44ae 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -186,7 +186,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) { auto intent = Intent(WD_VEHICLE); intent.putExtra(INTENT_EXTRA_VEHICLE, entity); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case EntityType::Guest: @@ -194,7 +194,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) { auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, entity); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case EntityType::Balloon: @@ -227,11 +227,11 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords) { auto intent = Intent(WD_TRACK); intent.putExtra(INTENT_EXTRA_TILE_ELEMENT, info.Element); - context_open_intent(&intent); + ContextOpenIntent(&intent); return true; } case ViewportInteractionItem::ParkEntrance: - context_open_window(WindowClass::ParkInformation); + ContextOpenWindow(WindowClass::ParkInformation); return true; default: return false; @@ -587,7 +587,7 @@ bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords) ViewportInteractionRemoveLargeScenery(info.Element, info.Loc); break; case ViewportInteractionItem::Banner: - context_open_detail_window(WD_BANNER, info.Element->AsBanner()->GetIndex().ToUnderlying()); + ContextOpenDetailWindow(WD_BANNER, info.Element->AsBanner()->GetIndex().ToUnderlying()); break; } @@ -675,7 +675,7 @@ static void ViewportInteractionRemoveParkWall(TileElement* tileElement, const Co auto* wallEntry = tileElement->AsWall()->GetEntry(); if (wallEntry->scrolling_mode != SCROLLING_MODE_NONE) { - context_open_detail_window(WD_SIGN_SMALL, tileElement->AsWall()->GetBannerIndex().ToUnderlying()); + ContextOpenDetailWindow(WD_SIGN_SMALL, tileElement->AsWall()->GetBannerIndex().ToUnderlying()); } else { @@ -696,7 +696,7 @@ static void ViewportInteractionRemoveLargeScenery(TileElement* tileElement, cons if (sceneryEntry->scrolling_mode != SCROLLING_MODE_NONE) { auto bannerIndex = tileElement->AsLargeScenery()->GetBannerIndex(); - context_open_detail_window(WD_SIGN, bannerIndex.ToUnderlying()); + ContextOpenDetailWindow(WD_SIGN, bannerIndex.ToUnderlying()); } else { diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 81cae78812..fdc4ab02e0 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -61,17 +61,17 @@ static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int3 return false; if (loc.y <= TOP_TOOLBAR_HEIGHT && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) return false; - if (loc.x + width > context_get_width()) + if (loc.x + width > ContextGetWidth()) return false; - if (loc.y + height > context_get_height()) + if (loc.y + height > ContextGetHeight()) return false; return WindowFitsBetweenOthers(loc, width, height); } static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height) { - uint16_t screenWidth = context_get_width(); - uint16_t screenHeight = context_get_height(); + uint16_t screenWidth = ContextGetWidth(); + uint16_t screenHeight = ContextGetHeight(); int32_t unk; unk = -(width / 4); @@ -511,7 +511,7 @@ static bool WindowOtherWheelInput(rct_window& w, WidgetIndex widgetIndex, int32_ void WindowAllWheelInput() { // Get wheel value - auto cursorState = context_get_cursor_state(); + auto cursorState = ContextGetCursorState(); int32_t absolute_wheel = cursorState->wheel; int32_t relative_wheel = absolute_wheel - _previousAbsoluteWheel; int32_t pixel_scroll = relative_wheel * WindowScrollPixels; diff --git a/src/openrct2-ui/scripting/ScUi.hpp b/src/openrct2-ui/scripting/ScUi.hpp index f96f50201c..ca18b06c40 100644 --- a/src/openrct2-ui/scripting/ScUi.hpp +++ b/src/openrct2-ui/scripting/ScUi.hpp @@ -122,11 +122,11 @@ namespace OpenRCT2::Scripting private: int32_t width_get() const { - return context_get_width(); + return ContextGetWidth(); } int32_t height_get() const { - return context_get_height(); + return ContextGetHeight(); } int32_t windows_get() const { diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index 84ce538873..fc1421c8a2 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -326,7 +326,7 @@ namespace OpenRCT2::Title { gLoadKeepWindowsOpen = true; CloseParkSpecificWindows(); - context_load_park_from_stream(stream); + ContextLoadParkFromStream(stream); } else { @@ -381,7 +381,7 @@ namespace OpenRCT2::Title ResetEntitySpatialIndices(); reset_all_sprite_quadrant_placements(); auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); ScenerySetDefaultPlacementConfiguration(); News::InitQueue(); load_palette(); diff --git a/src/openrct2-ui/windows/About.cpp b/src/openrct2-ui/windows/About.cpp index d46b9ce7cb..3109c53c91 100644 --- a/src/openrct2-ui/windows/About.cpp +++ b/src/openrct2-ui/windows/About.cpp @@ -113,10 +113,10 @@ public: OpenRCT2::GetContext()->GetUiContext()->OpenURL("https://discord.gg/ZXZd8D8"); break; case WIDX_CHANGELOG: - context_open_window(WindowClass::Changelog); + ContextOpenWindow(WindowClass::Changelog); break; case WIDX_NEW_VERSION: - context_open_window_view(WV_NEW_VERSION_INFO); + ContextOpenWindowView(WV_NEW_VERSION_INFO); break; case WIDX_COPY_BUILD_INFO: SDL_SetClipboardText(gVersionInfoFull); diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 0ca1c60a4d..e6db56da45 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -120,8 +120,8 @@ public: void OnResize() override { - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); max_width = (screenWidth * 4) / 5; max_height = (screenHeight * 4) / 5; @@ -307,8 +307,8 @@ rct_window* WindowChangelogOpen(int personality) if (window == nullptr) { // Create a new centred window - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); int32_t width = (screenWidth * 4) / 5; int32_t height = (screenHeight * 4) / 5; diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index 980085635e..8b243bde16 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -1044,7 +1044,7 @@ private: { if (!gCheatsShowAllOperatingModes) { - context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } CheatsSet(CheatType::ShowAllOperatingModes, !gCheatsShowAllOperatingModes); } @@ -1053,7 +1053,7 @@ private: { if (!gCheatsShowVehiclesFromOtherTrackTypes) { - context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } CheatsSet(CheatType::ShowVehiclesFromOtherTrackTypes, !gCheatsShowVehiclesFromOtherTrackTypes); } @@ -1062,7 +1062,7 @@ private: { if (!gCheatsDisableTrainLengthLimit) { - context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } CheatsSet(CheatType::DisableTrainLengthLimit, !gCheatsDisableTrainLengthLimit); } @@ -1074,7 +1074,7 @@ private: { if (!gCheatsAllowArbitraryRideTypeChanges) { - context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } CheatsSet(CheatType::AllowArbitraryRideTypeChanges, !gCheatsAllowArbitraryRideTypeChanges); } @@ -1092,7 +1092,7 @@ private: { if (!gCheatsAllowTrackPlaceInvalidHeights) { - context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); + ContextShowError(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {}); } CheatsSet(CheatType::AllowTrackPlaceInvalidHeights, !gCheatsAllowTrackPlaceInvalidHeights); } diff --git a/src/openrct2-ui/windows/ClearScenery.cpp b/src/openrct2-ui/windows/ClearScenery.cpp index d1c2ca030e..5da7d472bd 100644 --- a/src/openrct2-ui/windows/ClearScenery.cpp +++ b/src/openrct2-ui/windows/ClearScenery.cpp @@ -204,7 +204,7 @@ rct_window* WindowClearSceneryOpen() if (w != nullptr) return w; - w = WindowCreate(WindowClass::ClearScenery, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + w = WindowCreate(WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); if (w != nullptr) return w; diff --git a/src/openrct2-ui/windows/DebugPaint.cpp b/src/openrct2-ui/windows/DebugPaint.cpp index 26903dc635..3ae7a9fb02 100644 --- a/src/openrct2-ui/windows/DebugPaint.cpp +++ b/src/openrct2-ui/windows/DebugPaint.cpp @@ -146,7 +146,7 @@ public: rct_window* WindowDebugPaintOpen() { auto* window = WindowFocusOrCreate( - WindowClass::DebugPaint, { 16, context_get_height() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT, + WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT, WF_STICK_TO_FRONT | WF_TRANSPARENT); return window; diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 39da0cebe4..c5f628644f 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -315,8 +315,8 @@ private: const auto ddWidth = ItemWidth * NumColumns + 3; const auto ddHeight = ItemHeight * NumRows + 3; - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); auto boundedScreenPos = screenPos; if (screenPos.x + ddWidth > screenWidth) boundedScreenPos.x = std::max(0, screenWidth - ddWidth); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 0675671b4a..2948dd2b21 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -71,7 +71,7 @@ public: (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowClass::EditorScenarioBottomToolbar : WindowClass::EditorTrackBottomToolbar); - uint16_t screenWidth = context_get_width(); + uint16_t screenWidth = ContextGetWidth(); widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200; widgets[WIDX_NEXT_IMAGE].right = screenWidth - 1; widgets[WIDX_NEXT_STEP_BUTTON].left = screenWidth - 198; @@ -159,14 +159,14 @@ private: set_all_scenery_items_invented(); ScenerySetDefaultPlacementConfiguration(); gEditorStep = EditorStep::LandscapeEditor; - context_open_window(WindowClass::Map); + ContextOpenWindow(WindowClass::Map); gfx_invalidate_screen(); } void JumpBackToInventionListSetUp() const { window_close_all(); - context_open_window(WindowClass::EditorInventionList); + ContextOpenWindow(WindowClass::EditorInventionList); gEditorStep = EditorStep::InventionsListSetUp; gfx_invalidate_screen(); } @@ -174,7 +174,7 @@ private: void JumpBackToOptionsSelection() const { window_close_all(); - context_open_window(WindowClass::EditorScenarioOptions); + ContextOpenWindow(WindowClass::EditorScenarioOptions); gEditorStep = EditorStep::OptionsSelection; gfx_invalidate_screen(); } @@ -190,7 +190,7 @@ private: return true; } - context_show_error(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {}); + ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {}); w = window_find_by_class(WindowClass::EditorObjectSelection); if (w != nullptr) { @@ -208,11 +208,11 @@ private: finish_object_selection(); if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { - context_open_window(WindowClass::ConstructRide); + ContextOpenWindow(WindowClass::ConstructRide); } else { - context_open_window(WindowClass::Map); + ContextOpenWindow(WindowClass::Map); } } @@ -222,12 +222,12 @@ private: if (checksPassed) { window_close_all(); - context_open_window(WindowClass::EditorInventionList); + ContextOpenWindow(WindowClass::EditorInventionList); gEditorStep = EditorStep::InventionsListSetUp; } else { - context_show_error(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, errorString, {}); + ContextShowError(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, errorString, {}); } gfx_invalidate_screen(); @@ -236,7 +236,7 @@ private: void JumpForwardToOptionsSelection() const { window_close_all(); - context_open_window(WindowClass::EditorScenarioOptions); + ContextOpenWindow(WindowClass::EditorScenarioOptions); gEditorStep = EditorStep::OptionsSelection; gfx_invalidate_screen(); } @@ -244,7 +244,7 @@ private: void JumpForwardToObjectiveSelection() const { window_close_all(); - context_open_window(WindowClass::EditorObjectiveOptions); + ContextOpenWindow(WindowClass::EditorObjectiveOptions); gEditorStep = EditorStep::ObjectiveSelection; gfx_invalidate_screen(); } @@ -254,7 +254,7 @@ private: const auto savePrepareResult = scenario_prepare_for_save(); if (!savePrepareResult.Successful) { - context_show_error(STR_UNABLE_TO_SAVE_SCENARIO_FILE, savePrepareResult.Message, {}); + ContextShowError(STR_UNABLE_TO_SAVE_SCENARIO_FILE, savePrepareResult.Message, {}); gfx_invalidate_screen(); return; } @@ -263,7 +263,7 @@ private: auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO); intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); - context_open_intent(&intent); + ContextOpenIntent(&intent); } void HidePreviousStepButton() @@ -393,7 +393,7 @@ private: rct_window* WindowEditorBottomToolbarOpen() { auto* window = WindowCreate( - WindowClass::BottomToolbar, ScreenCoordsXY(0, context_get_height() - 32), context_get_width(), 32, + WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); return window; diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 034754e732..1f37bc4ee1 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -314,12 +314,12 @@ public: } auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); VisibleListDispose(); intent = Intent(INTENT_ACTION_REFRESH_SCENERY); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } void OnUpdate() override @@ -412,7 +412,7 @@ public: auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_TRACK); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case WIDX_FILTER_TEXT_BOX: @@ -589,7 +589,7 @@ public: Invalidate(); - const CursorState* state = context_get_cursor_state(); + const CursorState* state = ContextGetCursorState(); OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, state->position.x); if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) @@ -620,7 +620,7 @@ public: StringId error_title = (inputFlags & INPUT_FLAG_EDITOR_OBJECT_SELECT) ? STR_UNABLE_TO_SELECT_THIS_OBJECT : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT; - context_show_error(error_title, objectSelectResult.Message, {}); + ContextShowError(error_title, objectSelectResult.Message, {}); return; } @@ -636,12 +636,12 @@ public: const auto errorMessage = _gSceneryGroupPartialSelectError.value(); if (errorMessage == STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED) { - context_show_error( + ContextShowError( STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, {}); } else { - context_show_error( + ContextShowError( errorMessage, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, Formatter::Common()); } } @@ -1507,7 +1507,7 @@ private: auto intent = Intent(WindowClass::TrackDesignList); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, rideType); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, entry_index); - context_open_intent(&intent); + ContextOpenIntent(&intent); } }; @@ -1605,5 +1605,5 @@ void EditorLoadSelectedObjects() load_palette(); } if (showFallbackWarning) - context_show_error(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter::Common()); + ContextShowError(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter::Common()); } diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 4766f79eeb..4092b4b6f8 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -436,7 +436,7 @@ static void WindowEditorObjectiveOptionsArg1Increase(rct_window* w) case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: if (gScenarioObjective.Currency >= 2000000.00_GBP) { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } else { @@ -447,7 +447,7 @@ static void WindowEditorObjectiveOptionsArg1Increase(rct_window* w) case OBJECTIVE_MONTHLY_FOOD_INCOME: if (gScenarioObjective.Currency >= 2000000.00_GBP) { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } else { @@ -458,7 +458,7 @@ static void WindowEditorObjectiveOptionsArg1Increase(rct_window* w) case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: if (gScenarioObjective.MinimumLength >= 5000) { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } else { @@ -469,7 +469,7 @@ static void WindowEditorObjectiveOptionsArg1Increase(rct_window* w) case OBJECTIVE_FINISH_5_ROLLERCOASTERS: if (gScenarioObjective.MinimumExcitement >= FIXED_2DP(9, 90)) { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } else { @@ -480,7 +480,7 @@ static void WindowEditorObjectiveOptionsArg1Increase(rct_window* w) default: if (gScenarioObjective.NumGuests >= 5000) { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } else { @@ -500,7 +500,7 @@ static void WindowEditorObjectiveOptionsArg1Decrease(rct_window* w) case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE: if (gScenarioObjective.Currency <= 1000.00_GBP) { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } else { @@ -511,7 +511,7 @@ static void WindowEditorObjectiveOptionsArg1Decrease(rct_window* w) case OBJECTIVE_MONTHLY_FOOD_INCOME: if (gScenarioObjective.Currency <= 1000.00_GBP) { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } else { @@ -522,7 +522,7 @@ static void WindowEditorObjectiveOptionsArg1Decrease(rct_window* w) case OBJECTIVE_10_ROLLERCOASTERS_LENGTH: if (gScenarioObjective.MinimumLength <= 1000) { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } else { @@ -533,7 +533,7 @@ static void WindowEditorObjectiveOptionsArg1Decrease(rct_window* w) case OBJECTIVE_FINISH_5_ROLLERCOASTERS: if (gScenarioObjective.MinimumExcitement <= FIXED_2DP(4, 00)) { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } else { @@ -544,7 +544,7 @@ static void WindowEditorObjectiveOptionsArg1Decrease(rct_window* w) default: if (gScenarioObjective.NumGuests <= 250) { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } else { @@ -559,7 +559,7 @@ static void WindowEditorObjectiveOptionsArg2Increase(rct_window* w) { if (gScenarioObjective.Year >= 25) { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } else { @@ -572,7 +572,7 @@ static void WindowEditorObjectiveOptionsArg2Decrease(rct_window* w) { if (gScenarioObjective.Year <= 1) { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } else { diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index 6fd2100fae..3b62c41e72 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -432,7 +432,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_CASH, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_CASH, STR_NONE, {}); } Invalidate(); break; @@ -445,7 +445,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_CASH, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_CASH, STR_NONE, {}); } Invalidate(); break; @@ -458,7 +458,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_INIT_LOAN, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_INIT_LOAN, STR_NONE, {}); } Invalidate(); break; @@ -471,7 +471,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_INIT_LOAN, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_INIT_LOAN, STR_NONE, {}); } Invalidate(); break; @@ -484,7 +484,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_MAX_LOAN, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_MAX_LOAN, STR_NONE, {}); } Invalidate(); break; @@ -497,7 +497,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_MAX_LOAN, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_MAX_LOAN, STR_NONE, {}); } Invalidate(); break; @@ -510,7 +510,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE, {}); } Invalidate(); break; @@ -523,7 +523,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE, {}); } Invalidate(); break; @@ -696,7 +696,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -709,7 +709,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -722,7 +722,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -735,7 +735,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -748,7 +748,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -761,7 +761,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -774,7 +774,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -787,7 +787,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -970,7 +970,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -983,7 +983,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -996,7 +996,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -1009,7 +1009,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -1022,7 +1022,7 @@ private: } else { - context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {}); } Invalidate(); break; @@ -1035,7 +1035,7 @@ private: } else { - context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); + ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {}); } Invalidate(); break; diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 962a8209f8..81d41c14bb 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -143,9 +143,9 @@ rct_window* WindowErrorOpen(std::string_view title, std::string_view message) width = width + 3; int32_t height = (numLines + 1) * font_get_line_height(FontStyle::Medium) + 4; - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); - const CursorState* state = context_get_cursor_state(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); + const CursorState* state = ContextGetCursorState(); ScreenCoordsXY windowPosition = state->position - ScreenCoordsXY(width / 2, -26); windowPosition.x = std::clamp(windowPosition.x, 0, screenWidth); windowPosition.y = std::max(22, windowPosition.y); diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 8d80757179..7089d18f2c 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -768,7 +768,7 @@ public: { if (widgetIndex >= WIDX_CAMPAIGN_1 && widgetIndex <= WIDX_CAMPAIGN_6) { - context_open_detail_window(WD_NEW_CAMPAIGN, widgetIndex - WIDX_CAMPAIGN_1); + ContextOpenDetailWindow(WD_NEW_CAMPAIGN, widgetIndex - WIDX_CAMPAIGN_1); } } diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index 25a90d2481..668a13aef0 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -107,8 +107,8 @@ static void WindowGameBottomToolbarInvalidateDirtyWidgets(rct_window* w); */ rct_window* WindowGameBottomToolbarOpen() { - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); // Figure out how much line height we have to work with. uint32_t line_height = font_get_line_height(FontStyle::Medium); @@ -142,18 +142,18 @@ static void WindowGameBottomToolbarMouseup(rct_window* w, WidgetIndex widgetInde case WIDX_LEFT_OUTSET: case WIDX_MONEY: if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) - context_open_window(WindowClass::Finances); + ContextOpenWindow(WindowClass::Finances); break; case WIDX_GUESTS: - context_open_window_view(WV_PARK_GUESTS); + ContextOpenWindowView(WV_PARK_GUESTS); break; case WIDX_PARK_RATING: - context_open_window_view(WV_PARK_RATING); + ContextOpenWindowView(WV_PARK_RATING); break; case WIDX_MIDDLE_INSET: if (News::IsQueueEmpty()) { - context_open_window(WindowClass::RecentNews); + ContextOpenWindow(WindowClass::RecentNews); } else { @@ -183,7 +183,7 @@ static void WindowGameBottomToolbarMouseup(rct_window* w, WidgetIndex widgetInde break; case WIDX_RIGHT_OUTSET: case WIDX_DATE: - context_open_window(WindowClass::RecentNews); + ContextOpenWindow(WindowClass::RecentNews); break; } } @@ -224,7 +224,7 @@ static void WindowGameBottomToolbarInvalidate(rct_window* w) // Reset dimensions as appropriate -- in case we're switching languages. w->height = line_height * 2 + 12; - w->windowPos.y = context_get_height() - w->height; + w->windowPos.y = ContextGetHeight() - w->height; // Change height of widgets in accordance with line height. w->widgets[WIDX_LEFT_OUTSET].bottom = w->widgets[WIDX_MIDDLE_OUTSET].bottom = w->widgets[WIDX_RIGHT_OUTSET].bottom @@ -255,7 +255,7 @@ static void WindowGameBottomToolbarInvalidate(rct_window* w) w->widgets[WIDX_DATE].bottom = line_height + 1; // Anchor the middle and right panel to the right - int32_t x = context_get_width(); + int32_t x = ContextGetWidth(); w->width = x; x--; window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right = x; diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 0c73615375..3f3dc37938 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1289,7 +1289,7 @@ private: auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, list_item_positions[index]); - context_open_intent(&intent); + ContextOpenIntent(&intent); } void OnScrollMouseOverRides(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 628125c1aa..5634d7cdb0 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -282,7 +282,7 @@ public: Close(); break; case WIDX_MAP: - context_open_window(WindowClass::Map); + ContextOpenWindow(WindowClass::Map); break; case WIDX_TRACKING: _trackingOnly = !_trackingOnly; diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index d97ad8d42f..397a50d103 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -372,7 +372,7 @@ private: if (!Platform::EnsureDirectoryExists(destPath.c_str())) { log_error("Unable to create directory '%s'", destPath.c_str()); - context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); return; } @@ -381,7 +381,7 @@ private: if (File::Exists(destPath)) { log_info("%s already exists, prompting user for a different track design name", destPath.c_str()); - context_show_error(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE, {}); + ContextShowError(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE, {}); WindowTextInputRawOpen( this, WIDX_INSTALL, STR_SELECT_NEW_NAME_FOR_TRACK_DESIGN, STR_AN_EXISTING_TRACK_DESIGN_ALREADY_HAS_THIS_NAME, {}, _trackName.c_str(), 255); @@ -394,7 +394,7 @@ private: } else { - context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); } } } @@ -405,7 +405,7 @@ rct_window* WindowInstallTrackOpen(const utf8* path) auto trackDesign = TrackDesignImport(path); if (trackDesign == nullptr) { - context_show_error(STR_UNABLE_TO_LOAD_FILE, STR_NONE, {}); + ContextShowError(STR_UNABLE_TO_LOAD_FILE, STR_NONE, {}); return nullptr; } @@ -427,8 +427,8 @@ rct_window* WindowInstallTrackOpen(const utf8* path) gTrackDesignSceneryToggle = false; _currentTrackPieceDirection = 2; - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); auto screenPos = ScreenCoordsXY{ screenWidth / 2 - 201, std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200) }; auto* window = WindowFocusOrCreate(WindowClass::InstallTrack, screenPos, WW, WH, 0); diff --git a/src/openrct2-ui/windows/Land.cpp b/src/openrct2-ui/windows/Land.cpp index 99233a0b87..a6544b7dd5 100644 --- a/src/openrct2-ui/windows/Land.cpp +++ b/src/openrct2-ui/windows/Land.cpp @@ -340,5 +340,5 @@ private: rct_window* WindowLandOpen() { - return WindowFocusOrCreate(WindowClass::Land, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + return WindowFocusOrCreate(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); } diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index 62aa2f433d..a0d4867918 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -402,5 +402,5 @@ private: rct_window* WindowLandRightsOpen() { return WindowFocusOrCreate( - WindowClass::LandRights, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + WindowClass::LandRights, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); } diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 091017102a..0692e23de2 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -576,7 +576,7 @@ static void WindowLoadsaveTextinput(rct_window* w, WidgetIndex widgetIndex, char if (!Platform::IsFilenameValid(text)) { - context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); + ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); return; } @@ -587,7 +587,7 @@ static void WindowLoadsaveTextinput(rct_window* w, WidgetIndex widgetIndex, char const u8string path = Path::Combine(_directory, text); if (!Platform::EnsureDirectoryExists(path)) { - context_show_error(STR_UNABLE_TO_CREATE_FOLDER, STR_NONE, {}); + ContextShowError(STR_UNABLE_TO_CREATE_FOLDER, STR_NONE, {}); return; } @@ -959,7 +959,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) { if (!IsValidPath(path)) { - context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); + ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); return; } @@ -991,7 +991,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) } else { - context_show_error(STR_SAVE_GAME, STR_GAME_SAVE_FAILED, {}); + ContextShowError(STR_SAVE_GAME, STR_GAME_SAVE_FAILED, {}); WindowLoadsaveInvokeCallback(MODAL_RESULT_FAIL, pathBuffer); } break; @@ -1007,7 +1007,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) else { // Not the best message... - context_show_error(STR_LOAD_LANDSCAPE, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, {}); + ContextShowError(STR_LOAD_LANDSCAPE, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, {}); WindowLoadsaveInvokeCallback(MODAL_RESULT_FAIL, pathBuffer); } break; @@ -1024,7 +1024,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) } else { - context_show_error(STR_SAVE_LANDSCAPE, STR_LANDSCAPE_SAVE_FAILED, {}); + ContextShowError(STR_SAVE_LANDSCAPE, STR_LANDSCAPE_SAVE_FAILED, {}); WindowLoadsaveInvokeCallback(MODAL_RESULT_FAIL, pathBuffer); } break; @@ -1047,7 +1047,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) } else { - context_show_error(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {}); + ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {}); gEditorStep = EditorStep::ObjectiveSelection; WindowLoadsaveInvokeCallback(MODAL_RESULT_FAIL, pathBuffer); } @@ -1059,7 +1059,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) SetAndSaveConfigPath(gConfigGeneral.LastSaveTrackDirectory, pathBuffer); auto intent = Intent(WindowClass::InstallTrack); intent.putExtra(INTENT_EXTRA_PATH, std::string{ pathBuffer }); - context_open_intent(&intent); + ContextOpenIntent(&intent); window_close_by_class(WindowClass::Loadsave); WindowLoadsaveInvokeCallback(MODAL_RESULT_OK, pathBuffer); break; @@ -1084,7 +1084,7 @@ static void WindowLoadsaveSelect(rct_window* w, const char* path) } else { - context_show_error(STR_FILE_DIALOG_TITLE_SAVE_TRACK, STR_TRACK_SAVE_FAILED, {}); + ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_TRACK, STR_TRACK_SAVE_FAILED, {}); WindowLoadsaveInvokeCallback(MODAL_RESULT_FAIL, path); } break; diff --git a/src/openrct2-ui/windows/Main.cpp b/src/openrct2-ui/windows/Main.cpp index 0275b32955..15345a5eb8 100644 --- a/src/openrct2-ui/windows/Main.cpp +++ b/src/openrct2-ui/windows/Main.cpp @@ -73,6 +73,5 @@ private: */ rct_window* WindowMainOpen() { - return WindowCreate( - WindowClass::MainWindow, { 0, 0 }, context_get_width(), context_get_height(), WF_STICK_TO_BACK); + return WindowCreate(WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK); } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 2d905e8d6b..d6ca8e0a61 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -271,7 +271,7 @@ public: _mapWidthAndHeightLinked = !_mapWidthAndHeightLinked; break; case WIDX_MAP_GENERATOR: - context_open_window(WindowClass::Mapgen); + ContextOpenWindow(WindowClass::Mapgen); break; default: if (widgetIndex >= WIDX_PEOPLE_TAB && widgetIndex <= WIDX_RIDES_TAB) diff --git a/src/openrct2-ui/windows/MapGen.cpp b/src/openrct2-ui/windows/MapGen.cpp index aae52da7a0..348a1ccd1e 100644 --- a/src/openrct2-ui/windows/MapGen.cpp +++ b/src/openrct2-ui/windows/MapGen.cpp @@ -1180,7 +1180,7 @@ static void WindowMapgenHeightmapLoadsaveCallback(int32_t result, const utf8* pa } // The window needs to be open while using the map - rct_window* const w = context_open_window(WindowClass::Mapgen); + rct_window* const w = ContextOpenWindow(WindowClass::Mapgen); _heightmapLoaded = true; WindowMapgenSetPage(w, WINDOW_MAPGEN_PAGE_HEIGHTMAP); @@ -1207,7 +1207,7 @@ static void WindowMapgenHeightmapMouseup(rct_window* w, WidgetIndex widgetIndex) auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowMapgenHeightmapLoadsaveCallback)); - context_open_intent(&intent); + ContextOpenIntent(&intent); return; } case WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP: diff --git a/src/openrct2-ui/windows/MapTooltip.cpp b/src/openrct2-ui/windows/MapTooltip.cpp index 5ebada2ae4..0fa177a0b8 100644 --- a/src/openrct2-ui/windows/MapTooltip.cpp +++ b/src/openrct2-ui/windows/MapTooltip.cpp @@ -65,7 +65,7 @@ void WindowMapTooltipUpdateVisibility() return; } - const CursorState* state = context_get_cursor_state(); + const CursorState* state = ContextGetCursorState(); auto cursor = state->position; auto cursorChange = cursor - _lastCursor; @@ -104,7 +104,7 @@ static void WindowMapTooltipOpen() constexpr int32_t width = 200; constexpr int32_t height = 44; - const CursorState* state = context_get_cursor_state(); + const CursorState* state = ContextGetCursorState(); ScreenCoordsXY pos = { state->position.x - (width / 2), state->position.y + 15 }; w = window_find_by_class(WindowClass::MapTooltip); diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 9c7424d323..90883ea862 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -130,7 +130,7 @@ public: { auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } } diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 1684842a62..381ffe7f84 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -340,7 +340,7 @@ public: News::OpenSubject(News::ItemType::Research, gResearchLastItem->rawValue); break; case WIDX_RESEARCH_FUNDING_BUTTON: - context_open_window_view(WV_FINANCES_RESEARCH); + ContextOpenWindowView(WV_FINANCES_RESEARCH); break; case WIDX_GROUP_BY_TRACK_TYPE: gConfigInterface.ListRideVehiclesSeparately = !gConfigInterface.ListRideVehiclesSeparately; @@ -530,7 +530,7 @@ private: auto intent = Intent(WindowClass::TrackDesignList); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, item.Type); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.EntryIndex); - context_open_intent(&intent); + ContextOpenIntent(&intent); return; } diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 5988abf2a3..cd21f03765 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -75,7 +75,7 @@ public: Close(); break; case WIDX_SETTINGS: - context_open_window(WindowClass::NotificationOptions); + ContextOpenWindow(WindowClass::NotificationOptions); break; } } diff --git a/src/openrct2-ui/windows/ObjectLoadError.cpp b/src/openrct2-ui/windows/ObjectLoadError.cpp index f9cbbca4a7..c218863891 100644 --- a/src/openrct2-ui/windows/ObjectLoadError.cpp +++ b/src/openrct2-ui/windows/ObjectLoadError.cpp @@ -110,7 +110,7 @@ private: if (_downloadStatusInfo == DownloadStatusInfo()) { - context_force_close_window_by_class(WindowClass::NetworkStatus); + ContextForceCloseWindowByClass(WindowClass::NetworkStatus); } else { @@ -136,7 +136,7 @@ private: auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string(str_downloading_objects)); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { _downloadingObjects = false; }); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } } diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index b23c0a18b8..cba4c21b9d 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -792,16 +792,16 @@ private: gConfigGeneral.WindowScale += 0.25f; ConfigSaveDefault(); gfx_invalidate_screen(); - context_trigger_resize(); - context_update_cursor_scale(); + ContextTriggerResize(); + ContextUpdateCursorScale(); break; case WIDX_SCALE_DOWN: gConfigGeneral.WindowScale -= 0.25f; gConfigGeneral.WindowScale = std::max(0.5f, gConfigGeneral.WindowScale); ConfigSaveDefault(); gfx_invalidate_screen(); - context_trigger_resize(); - context_update_cursor_scale(); + ContextTriggerResize(); + ContextUpdateCursorScale(); break; } } @@ -821,7 +821,7 @@ private: gConfigGeneral.FullscreenHeight = resolution.Height; if (gConfigGeneral.FullscreenMode == static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)) - context_set_fullscreen_mode(static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)); + ContextSetFullscreenMode(static_cast(OpenRCT2::Ui::FULLSCREEN_MODE::FULLSCREEN)); ConfigSaveDefault(); gfx_invalidate_screen(); @@ -831,7 +831,7 @@ private: case WIDX_FULLSCREEN_DROPDOWN: if (dropdownIndex != gConfigGeneral.FullscreenMode) { - context_set_fullscreen_mode(dropdownIndex); + ContextSetFullscreenMode(dropdownIndex); gConfigGeneral.FullscreenMode = static_cast(dropdownIndex); ConfigSaveDefault(); @@ -1188,7 +1188,7 @@ private: if (dropdownIndex == EnumValue(CurrencyType::Custom) + 1) { // Add 1 because the separator occupies a position gConfigGeneral.CurrencyFormat = static_cast(dropdownIndex - 1); - context_open_window(WindowClass::CustomCurrencyConfig); + ContextOpenWindow(WindowClass::CustomCurrencyConfig); } else { @@ -1222,7 +1222,7 @@ private: if (language_open(fallbackLanguage)) { // It worked, so we can say it with error message in-game - context_show_error(STR_LANGUAGE_LOAD_FAILED, STR_NONE, {}); + ContextShowError(STR_LANGUAGE_LOAD_FAILED, STR_NONE, {}); } // report error to console regardless log_error("Failed to open language file."); @@ -1530,7 +1530,7 @@ private: switch (widgetIndex) { case WIDX_HOTKEY_DROPDOWN: - context_open_window(WindowClass::KeyboardShortcutList); + ContextOpenWindow(WindowClass::KeyboardShortcutList); break; case WIDX_SCREEN_EDGE_SCROLLING: gConfigGeneral.EdgeScrolling ^= 1; @@ -1540,7 +1540,7 @@ private: case WIDX_TRAP_CURSOR: gConfigGeneral.TrapCursor ^= 1; ConfigSaveDefault(); - context_set_cursor_trap(gConfigGeneral.TrapCursor); + ContextSetCursorTrap(gConfigGeneral.TrapCursor); Invalidate(); break; case WIDX_ZOOM_TO_CURSOR: @@ -1596,7 +1596,7 @@ private: Invalidate(); break; case WIDX_THEMES_BUTTON: - context_open_window(WindowClass::Themes); + ContextOpenWindow(WindowClass::Themes); Invalidate(); break; } @@ -1904,21 +1904,21 @@ private: gConfigGeneral.RCT1Path = std::move(rct1path); gConfigInterface.ScenarioselectLastTab = 0; ConfigSaveDefault(); - context_show_error(STR_RESTART_REQUIRED, STR_NONE, {}); + ContextShowError(STR_RESTART_REQUIRED, STR_NONE, {}); } else { - context_show_error(STR_PATH_TO_RCT1_IS_WRONG_VERSION, STR_NONE, {}); + ContextShowError(STR_PATH_TO_RCT1_IS_WRONG_VERSION, STR_NONE, {}); } } else { - context_show_error(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, STR_NONE, {}); + ContextShowError(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, STR_NONE, {}); } } else { - context_show_error(STR_PATH_TO_RCT1_WRONG_ERROR, STR_NONE, {}); + ContextShowError(STR_PATH_TO_RCT1_WRONG_ERROR, STR_NONE, {}); } } Invalidate(); @@ -1933,7 +1933,7 @@ private: Invalidate(); break; case WIDX_ASSET_PACKS: - context_open_window(WindowClass::AssetPacks); + ContextOpenWindow(WindowClass::AssetPacks); break; } } diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 9e378289e3..ec24a12710 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -413,7 +413,7 @@ private: switch (widgetIndex) { case WIDX_BUY_LAND_RIGHTS: - context_open_window(WindowClass::LandRights); + ContextOpenWindow(WindowClass::LandRights); break; case WIDX_LOCATE: ScrollToViewport(); @@ -1336,8 +1336,8 @@ rct_window* WindowParkObjectiveOpen() if (wnd != nullptr) { wnd->Invalidate(); - wnd->windowPos.x = context_get_width() / 2 - 115; - wnd->windowPos.y = context_get_height() / 2 - 87; + wnd->windowPos.x = ContextGetWidth() / 2 - 115; + wnd->windowPos.y = ContextGetHeight() / 2 - 87; wnd->Invalidate(); } return wnd; diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 174c80f579..c0d5e43ebb 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -288,7 +288,7 @@ private: rct_window* WindowPatrolAreaOpen(EntityId staffId) { auto w = WindowFocusOrCreate( - WindowClass::PatrolArea, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); if (w != nullptr) { w->SetStaffId(staffId); diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index fa2b5d77d8..531d978b55 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1365,7 +1365,7 @@ rct_window* WindowRideOpenVehicle(Vehicle* vehicle) { auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, peep); - context_open_intent(&intent); + ContextOpenIntent(&intent); openedPeepWindow = 1; break; @@ -1651,7 +1651,7 @@ static void WindowRideMainMouseup(rct_window* w, WidgetIndex widgetIndex) WindowRideRename(w); break; case WIDX_DEMOLISH: - context_open_detail_window(WD_DEMOLISH_RIDE, w->number); + ContextOpenDetailWindow(WD_DEMOLISH_RIDE, w->number); break; case WIDX_CLOSE_LIGHT: case WIDX_SIMULATE_LIGHT: @@ -3746,12 +3746,12 @@ static void WindowRideLocateMechanic(rct_window* w) mechanic = ride_find_closest_mechanic(ride, 1); if (mechanic == nullptr) - context_show_error(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {}); + ContextShowError(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {}); else { auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, mechanic); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } @@ -3804,7 +3804,7 @@ static void WindowRideMaintenanceMouseup(rct_window* w, WidgetIndex widgetIndex) WindowRideLocateMechanic(w); break; case WIDX_REFURBISH_RIDE: - context_open_detail_window(WD_REFURBISH_RIDE, w->number); + ContextOpenDetailWindow(WD_REFURBISH_RIDE, w->number); break; } } @@ -3877,7 +3877,7 @@ static void WindowRideMaintenanceMousedown(rct_window* w, WidgetIndex widgetInde } if (num_items == 1) { - context_show_error(STR_DEBUG_NO_BREAKDOWNS_AVAILABLE, STR_NONE, {}); + ContextShowError(STR_DEBUG_NO_BREAKDOWNS_AVAILABLE, STR_NONE, {}); } else { @@ -3987,11 +3987,11 @@ static void WindowRideMaintenanceDropdown(rct_window* w, WidgetIndex widgetIndex if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)) { - context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_ALREADY_BROKEN, {}); + ContextShowError(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_ALREADY_BROKEN, {}); } else if (ride->status == RideStatus::Closed) { - context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED, {}); + ContextShowError(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED, {}); } else { @@ -5362,7 +5362,7 @@ static void WindowRideMeasurementsDesignSave(rct_window* w) auto errMessage = _trackDesign->CreateTrackDesignScenery(tds); if (errMessage != STR_NONE) { - context_show_error(STR_CANT_SAVE_TRACK_DESIGN, errMessage, {}); + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, errMessage, {}); return; } } @@ -5374,7 +5374,7 @@ static void WindowRideMeasurementsDesignSave(rct_window* w) intent.putExtra(INTENT_EXTRA_PATH, trackName); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(&TrackDesignCallback)); - context_open_intent(&intent); + ContextOpenIntent(&intent); } /** @@ -6850,7 +6850,7 @@ static void WindowRideCustomerMouseup(rct_window* w, WidgetIndex widgetIndex) auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingAboutRide)); intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case WIDX_SHOW_GUESTS_ON_RIDE: @@ -6858,7 +6858,7 @@ static void WindowRideCustomerMouseup(rct_window* w, WidgetIndex widgetIndex) auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsOnRide)); intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case WIDX_SHOW_GUESTS_QUEUING: @@ -6866,7 +6866,7 @@ static void WindowRideCustomerMouseup(rct_window* w, WidgetIndex widgetIndex) auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsInQueue)); intent.putExtra(INTENT_EXTRA_RIDE_ID, w->number); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 3bb749ecd0..3a59cdb983 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -288,7 +288,7 @@ public: currentRide->SetToDefaultInspectionInterval(); auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, currentRide->id.ToUnderlying()); - context_open_intent(&intent); + ContextOpenIntent(&intent); } else { @@ -2773,7 +2773,7 @@ rct_window* WindowRideConstructionOpen() switch (rtd.ConstructionWindowContext) { case RideConstructionWindowContext::Maze: - return context_open_window_view(WV_MAZE_CONSTRUCTION); + return ContextOpenWindowView(WV_MAZE_CONSTRUCTION); case RideConstructionWindowContext::Default: return WindowCreate( WindowClass::RideConstruction, ScreenCoordsXY(0, 29), 166, 394, WF_NO_AUTO_CLOSE); @@ -3324,7 +3324,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) } auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); MapInvalidateMapSelectionTiles(); return; } @@ -3466,7 +3466,7 @@ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoor */ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) { - const CursorState* state = context_get_cursor_state(); + const CursorState* state = ContextGetCursorState(); rct_window* w; @@ -3552,7 +3552,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) _currentTrackBegin.z = z; _currentTrackSelectionFlags = 0; auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); w = window_find_by_class(WindowClass::RideConstruction); if (w == nullptr) break; @@ -3595,7 +3595,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) _trackPlaceShiftState = false; } auto intent2 = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); - context_broadcast_intent(&intent2); + ContextBroadcastIntent(&intent2); break; } z += 16; diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 4d2db46c5f..b40fc4778c 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -412,7 +412,7 @@ public: { auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex.ToUnderlying()); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 8ef75b052b..2492be7fd7 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -167,7 +167,7 @@ public: } Close(); intent->putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowSavePromptCallback)); - context_open_intent(intent.get()); + ContextOpenIntent(intent.get()); break; } case WIDX_DONT_SAVE: diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 14679ae1de..8b2d12d5df 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -160,7 +160,7 @@ public: _activeTabIndex = 0; } - window_move_position(*this, { context_get_width() - GetRequiredWidth(), 0x1D }); + window_move_position(*this, { ContextGetWidth() - GetRequiredWidth(), 0x1D }); window_push_others_below(*this); } @@ -220,7 +220,7 @@ public: } else { - context_show_error(STR_CANT_DO_THIS, STR_PERMISSION_DENIED, {}); + ContextShowError(STR_CANT_DO_THIS, STR_PERMISSION_DENIED, {}); } Invalidate(); break; @@ -315,7 +315,7 @@ public: if (!_selectedScenery.IsUndefined()) { // Find out what scenery the cursor is over - const CursorState* state = context_get_cursor_state(); + const CursorState* state = ContextGetCursorState(); WidgetIndex widgetIndex = window_find_widget_from_point(*this, state->position); if (widgetIndex == WIDX_SCENERY_LIST) { @@ -342,7 +342,7 @@ public: void OnUpdate() override { - const CursorState* state = context_get_cursor_state(); + const CursorState* state = ContextGetCursorState(); rct_window* other = window_find_from_point(state->position); if (other == this) { @@ -718,7 +718,7 @@ public: gWindowSceneryRotation = rotation.value(); } gWindowSceneryEyedropperEnabled = false; - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, context_get_width() / 2); + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, ContextGetWidth() / 2); _hoverCounter = -16; gSceneryPlaceCost = MONEY32_UNDEFINED; Invalidate(); diff --git a/src/openrct2-ui/windows/ServerList.cpp b/src/openrct2-ui/windows/ServerList.cpp index 2c0c9fb72b..dd8496bb89 100644 --- a/src/openrct2-ui/windows/ServerList.cpp +++ b/src/openrct2-ui/windows/ServerList.cpp @@ -183,7 +183,7 @@ static void WindowServerListMouseup(rct_window* w, WidgetIndex widgetIndex) { Formatter ft; ft.Add(server.Version.c_str()); - context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); + ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); } } break; @@ -195,7 +195,7 @@ static void WindowServerListMouseup(rct_window* w, WidgetIndex widgetIndex) WindowTextInputOpen(w, widgetIndex, STR_ADD_SERVER, STR_ENTER_HOSTNAME_OR_IP_ADDRESS, {}, STR_NONE, 0, 128); break; case WIDX_START_SERVER: - context_open_window(WindowClass::ServerStart); + ContextOpenWindow(WindowClass::ServerStart); break; } } @@ -222,7 +222,7 @@ static void WindowServerListDropdown(rct_window* w, WidgetIndex widgetIndex, int { Formatter ft; ft.Add(server.Version.c_str()); - context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); + ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft); } break; case DDIDX_FAVOURITE: @@ -516,7 +516,7 @@ static void JoinServer(std::string address) if (!network_begin_client(address, port)) { - context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {}); + ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {}); } } diff --git a/src/openrct2-ui/windows/ServerStart.cpp b/src/openrct2-ui/windows/ServerStart.cpp index 788da6e27d..c6bba0558c 100644 --- a/src/openrct2-ui/windows/ServerStart.cpp +++ b/src/openrct2-ui/windows/ServerStart.cpp @@ -141,7 +141,7 @@ public: auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(LoadSaveCallback)); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } } diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 159450aec8..bb8f709ec2 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -382,7 +382,7 @@ private: { auto intent = Intent(WindowClass::FirePrompt); intent.putExtra(INTENT_EXTRA_PEEP, staff); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case WIDX_RENAME: diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index d8cae32b7d..862e3d2a52 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -147,7 +147,7 @@ public: } break; case WIDX_STAFF_LIST_MAP: - context_open_window(WindowClass::Map); + ContextOpenWindow(WindowClass::Map); break; case WIDX_STAFF_LIST_QUICK_FIRE: _quickFireMode = !_quickFireMode; @@ -358,7 +358,7 @@ public: { auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, peep); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } break; @@ -462,7 +462,7 @@ public: { auto ft = Formatter(); ft.Add(GetStaffNamingConvention(GetSelectedStaffType()).Plural); - context_show_error(STR_NO_THING_IN_PARK_YET, STR_NONE, ft); + ContextShowError(STR_NO_THING_IN_PARK_YET, STR_NONE, ft); } } } @@ -532,7 +532,7 @@ private: auto* staff = GetEntity(actionResult.StaffEntityId); auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, staff); - context_open_intent(&intent); + ContextOpenIntent(&intent); }); GameActions::Execute(&hireStaffAction); diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index 6bc98d5683..e9a205cfdd 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -111,7 +111,7 @@ public: _buffer.resize(maxLength); safe_strcpy(_buffer.data(), std::string(text).c_str(), maxLength); _maxInputLength = maxLength; - gTextInput = context_start_text_input(_buffer.data(), maxLength); + gTextInput = ContextStartTextInput(_buffer.data(), maxLength); } void SetCallback(std::function callback, std::function cancelCallback) @@ -124,7 +124,7 @@ public: { // Make sure that we take it out of the text input // mode otherwise problems may occur. - context_stop_text_input(); + ContextStopTextInput(); } void OnPeriodicUpdate() override @@ -154,12 +154,12 @@ public: { case WIDX_CANCEL: case WIDX_CLOSE: - context_stop_text_input(); + ContextStopTextInput(); ExecuteCallback(false); window_close(*this); break; case WIDX_OKAY: - context_stop_text_input(); + ContextStopTextInput(); ExecuteCallback(true); window_close(*this); } @@ -298,7 +298,7 @@ public: void OnReturnPressed() { - context_stop_text_input(); + ContextStopTextInput(); ExecuteCallback(true); window_close(*this); } diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index dbb29c0696..c2fde36cc6 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -517,7 +517,7 @@ public: case WIDX_THEMES_RCT1_RIDE_LIGHTS: if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { @@ -529,7 +529,7 @@ public: case WIDX_THEMES_RCT1_PARK_LIGHTS: if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { @@ -541,7 +541,7 @@ public: case WIDX_THEMES_RCT1_SCENARIO_FONT: if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { @@ -553,7 +553,7 @@ public: case WIDX_THEMES_RCT1_BOTTOM_TOOLBAR: if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { @@ -584,7 +584,7 @@ public: case WIDX_THEMES_DELETE_BUTTON: if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { @@ -594,7 +594,7 @@ public: case WIDX_THEMES_RENAME_BUTTON: if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {}); } else { @@ -659,12 +659,12 @@ public: } else { - context_show_error(STR_THEMES_ERR_NAME_ALREADY_EXISTS, STR_NONE, {}); + ContextShowError(STR_THEMES_ERR_NAME_ALREADY_EXISTS, STR_NONE, {}); } } else { - context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); + ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {}); } break; } @@ -706,7 +706,7 @@ public: { if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); } else { @@ -736,7 +736,7 @@ public: { if (ThemeGetFlags() & UITHEME_FLAG_PREDEFINED) { - context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); + ContextShowError(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {}); } else { diff --git a/src/openrct2-ui/windows/TitleExit.cpp b/src/openrct2-ui/windows/TitleExit.cpp index 4904b6d20e..cb0c5ea687 100644 --- a/src/openrct2-ui/windows/TitleExit.cpp +++ b/src/openrct2-ui/windows/TitleExit.cpp @@ -42,7 +42,7 @@ class TitleExitWindow final : public Window switch (widgetIndex) { case WIDX_EXIT: - context_quit(); + ContextQuit(); // game_do_command(0, 1, 0, 0, 5, 3, 0); break; }; @@ -61,6 +61,6 @@ class TitleExitWindow final : public Window rct_window* WindowTitleExitOpen() { return WindowCreate( - WindowClass::TitleExit, ScreenCoordsXY(context_get_width() - 40, context_get_height() - 64), 40, 64, + WindowClass::TitleExit, ScreenCoordsXY(ContextGetWidth() - 40, ContextGetHeight() - 64), 40, 64, WF_STICK_TO_BACK | WF_TRANSPARENT); } diff --git a/src/openrct2-ui/windows/TitleMenu.cpp b/src/openrct2-ui/windows/TitleMenu.cpp index 4da24ce6ff..afb857395a 100644 --- a/src/openrct2-ui/windows/TitleMenu.cpp +++ b/src/openrct2-ui/windows/TitleMenu.cpp @@ -112,7 +112,7 @@ public: } width = x; widgets[WIDX_NEW_VERSION].right = width; - windowPos.x = (context_get_width() - width) / 2; + windowPos.x = (ContextGetWidth() - width) / 2; colours[1] = TRANSLUCENT(COLOUR_LIGHT_ORANGE); InitScrollWidgets(); @@ -161,11 +161,11 @@ public: { window_close_by_class(WindowClass::ScenarioSelect); window_close_by_class(WindowClass::Loadsave); - context_open_window(WindowClass::ServerList); + ContextOpenWindow(WindowClass::ServerList); } break; case WIDX_NEW_VERSION: - context_open_window_view(WV_NEW_VERSION_INFO); + ContextOpenWindowView(WV_NEW_VERSION_INFO); break; } } @@ -283,6 +283,6 @@ rct_window* WindowTitleMenuOpen() { const uint16_t windowHeight = MenuButtonDims.height + UpdateButtonDims.height; return WindowCreate( - WindowClass::TitleMenu, ScreenCoordsXY(0, context_get_height() - 182), 0, windowHeight, + WindowClass::TitleMenu, ScreenCoordsXY(0, ContextGetHeight() - 182), 0, windowHeight, WF_STICK_TO_BACK | WF_TRANSPARENT | WF_NO_BACKGROUND); } diff --git a/src/openrct2-ui/windows/TitleOptions.cpp b/src/openrct2-ui/windows/TitleOptions.cpp index da2dba3456..6161f68ed4 100644 --- a/src/openrct2-ui/windows/TitleOptions.cpp +++ b/src/openrct2-ui/windows/TitleOptions.cpp @@ -39,7 +39,7 @@ public: switch (widgetIndex) { case WIDX_OPTIONS: - context_open_window(WindowClass::Options); + ContextOpenWindow(WindowClass::Options); break; } } @@ -59,7 +59,7 @@ rct_window* WindowTitleOptionsOpen() if (window == nullptr) { window = WindowCreate( - WindowClass::TitleOptions, ScreenCoordsXY(context_get_width() - 80, 0), 80, 15, WF_STICK_TO_BACK | WF_TRANSPARENT); + WindowClass::TitleOptions, ScreenCoordsXY(ContextGetWidth() - 80, 0), 80, 15, WF_STICK_TO_BACK | WF_TRANSPARENT); } return window; diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index ef91d76523..8b77bf41ef 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -44,8 +44,8 @@ public: window_tooltip_widgets[WIDX_BACKGROUND].right = width; window_tooltip_widgets[WIDX_BACKGROUND].bottom = height; - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); screenCoords.x = std::clamp(screenCoords.x - (width / 2), 0, screenWidth - width); // TODO The cursor size will be relative to the window DPI. diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index d249ace61a..026010de8d 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -338,7 +338,7 @@ static int16_t _unkF64F0A; rct_window* WindowTopToolbarOpen() { rct_window* window = WindowCreate( - ScreenCoordsXY(0, 0), context_get_width(), TOP_TOOLBAR_HEIGHT + 1, &window_top_toolbar_events, WindowClass::TopToolbar, + ScreenCoordsXY(0, 0), ContextGetWidth(), TOP_TOOLBAR_HEIGHT + 1, &window_top_toolbar_events, WindowClass::TopToolbar, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND); window->widgets = window_top_toolbar_widgets; @@ -385,35 +385,35 @@ static void WindowTopToolbarMouseup(rct_window* w, WidgetIndex widgetIndex) if (!tool_set(*w, WIDX_SCENERY, Tool::Arrow)) { input_set_flag(INPUT_FLAG_6, true); - context_open_window(WindowClass::Scenery); + ContextOpenWindow(WindowClass::Scenery); } break; case WIDX_PATH: ToggleFootpathWindow(); break; case WIDX_CONSTRUCT_RIDE: - context_open_window(WindowClass::ConstructRide); + ContextOpenWindow(WindowClass::ConstructRide); break; case WIDX_RIDES: - context_open_window(WindowClass::RideList); + ContextOpenWindow(WindowClass::RideList); break; case WIDX_PARK: - context_open_window(WindowClass::ParkInformation); + ContextOpenWindow(WindowClass::ParkInformation); break; case WIDX_STAFF: - context_open_window(WindowClass::StaffList); + ContextOpenWindow(WindowClass::StaffList); break; case WIDX_GUESTS: - context_open_window(WindowClass::GuestList); + ContextOpenWindow(WindowClass::GuestList); break; case WIDX_FINANCES: - context_open_window(WindowClass::Finances); + ContextOpenWindow(WindowClass::Finances); break; case WIDX_RESEARCH: - context_open_window(WindowClass::Research); + ContextOpenWindow(WindowClass::Research); break; case WIDX_NEWS: - context_open_window(WindowClass::RecentNews); + ContextOpenWindow(WindowClass::RecentNews); break; case WIDX_MUTE: OpenRCT2::Audio::ToggleAllSounds(); @@ -425,7 +425,7 @@ static void WindowTopToolbarMouseup(rct_window* w, WidgetIndex widgetIndex) } else { - context_show_error(STR_CHAT_UNAVAILABLE, STR_NONE, {}); + ContextShowError(STR_CHAT_UNAVAILABLE, STR_NONE, {}); } break; } @@ -575,7 +575,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int { auto intent = Intent(WindowClass::ScenarioSelect); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowTopToolbarScenarioselectCallback)); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case DDIDX_LOAD_GAME: @@ -594,7 +594,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_LANDSCAPE); intent.putExtra(INTENT_EXTRA_PATH, gScenarioName); - context_open_intent(&intent); + ContextOpenIntent(&intent); } else { @@ -603,10 +603,10 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int } break; case DDIDX_ABOUT: - context_open_window(WindowClass::About); + ContextOpenWindow(WindowClass::About); break; case DDIDX_OPTIONS: - context_open_window(WindowClass::Options); + ContextOpenWindow(WindowClass::Options); break; case DDIDX_SCREENSHOT: gScreenshotCountdown = 10; @@ -624,7 +624,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int } break; case DDIDX_UPDATE_AVAILABLE: - context_open_window_view(WV_NEW_VERSION_INFO); + ContextOpenWindowView(WV_NEW_VERSION_INFO); break; case DDIDX_QUIT_TO_MENU: { @@ -635,7 +635,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int break; } case DDIDX_EXIT_OPENRCT2: - context_quit(); + ContextQuit(); break; } break; @@ -803,7 +803,7 @@ static void WindowTopToolbarInvalidate(rct_window* w) } // Align right hand side toolbar buttons - int32_t screenWidth = context_get_width(); + int32_t screenWidth = ContextGetWidth(); firstAlignment = 1; x = std::max(640, screenWidth); for (size_t i = 0; i < std::size(right_aligned_widgets_order); ++i) @@ -1999,7 +1999,7 @@ static void WindowTopToolbarSceneryToolDown(const ScreenCoordsXY& windowPos, rct { auto data = result->GetData(); OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position); - context_open_detail_window(WD_BANNER, data.bannerId.ToUnderlying()); + ContextOpenDetailWindow(WD_BANNER, data.bannerId.ToUnderlying()); } }); GameActions::Execute(&bannerPlaceAction); @@ -3333,13 +3333,13 @@ static void TopToolbarMapMenuDropdown(int16_t dropdownIndex) switch (dropdownIndex) { case 0: - context_open_window(WindowClass::Map); + ContextOpenWindow(WindowClass::Map); break; case 1: - context_open_window(WindowClass::Viewport); + ContextOpenWindow(WindowClass::Viewport); break; case 2: - context_open_window(WindowClass::Mapgen); + ContextOpenWindow(WindowClass::Mapgen); break; } } @@ -3519,23 +3519,23 @@ static void TopToolbarCheatsMenuDropdown(int16_t dropdownIndex) switch (dropdownIndex) { case DDIDX_CHEATS: - context_open_window(WindowClass::Cheats); + ContextOpenWindow(WindowClass::Cheats); break; case DDIDX_TILE_INSPECTOR: - context_open_window(WindowClass::TileInspector); + ContextOpenWindow(WindowClass::TileInspector); break; case DDIDX_OBJECT_SELECTION: window_close_all(); - context_open_window(WindowClass::EditorObjectSelection); + ContextOpenWindow(WindowClass::EditorObjectSelection); break; case DDIDX_INVENTIONS_LIST: - context_open_window(WindowClass::EditorInventionList); + ContextOpenWindow(WindowClass::EditorInventionList); break; case DDIDX_SCENARIO_OPTIONS: - context_open_window(WindowClass::EditorScenarioOptions); + ContextOpenWindow(WindowClass::EditorScenarioOptions); break; case DDIDX_OBJECTIVE_OPTIONS: - context_open_window(WindowClass::EditorObjectiveOptions); + ContextOpenWindow(WindowClass::EditorObjectiveOptions); break; case DDIDX_ENABLE_SANDBOX_MODE: CheatsSet(CheatType::SandboxMode, !gCheatsSandboxMode); @@ -3593,7 +3593,7 @@ static void TopToolbarDebugMenuDropdown(int16_t dropdownIndex) case DDIDX_DEBUG_PAINT: if (window_find_by_class(WindowClass::DebugPaint) == nullptr) { - context_open_window(WindowClass::DebugPaint); + ContextOpenWindow(WindowClass::DebugPaint); } else { @@ -3612,7 +3612,7 @@ static void TopToolbarNetworkMenuDropdown(int16_t dropdownIndex) switch (dropdownIndex) { case DDIDX_MULTIPLAYER: - context_open_window(WindowClass::Multiplayer); + ContextOpenWindow(WindowClass::Multiplayer); break; case DDIDX_MULTIPLAYER_RECONNECT: network_reconnect(); @@ -3767,7 +3767,7 @@ static void TopToolbarViewMenuDropdown(int16_t dropdownIndex) case DDIDX_VIEW_CLIPPING: if (window_find_by_class(WindowClass::ViewClipping) == nullptr) { - context_open_window(WindowClass::ViewClipping); + ContextOpenWindow(WindowClass::ViewClipping); } else { @@ -3779,7 +3779,7 @@ static void TopToolbarViewMenuDropdown(int16_t dropdownIndex) w->viewport->flags ^= VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES; break; case DDIDX_TRANSPARENCY: - context_open_window(WindowClass::Transparency); + ContextOpenWindow(WindowClass::Transparency); break; default: return; @@ -3796,7 +3796,7 @@ static void ToggleFootpathWindow() { if (window_find_by_class(WindowClass::Footpath) == nullptr) { - context_open_window(WindowClass::Footpath); + ContextOpenWindow(WindowClass::Footpath); } else { @@ -3822,7 +3822,7 @@ static void ToggleLandWindow(rct_window* topToolbar, WidgetIndex widgetIndex) show_gridlines(); tool_set(*topToolbar, widgetIndex, Tool::DigDown); input_set_flag(INPUT_FLAG_6, true); - context_open_window(WindowClass::Land); + ContextOpenWindow(WindowClass::Land); } } @@ -3842,7 +3842,7 @@ static void ToggleClearSceneryWindow(rct_window* topToolbar, WidgetIndex widgetI show_gridlines(); tool_set(*topToolbar, widgetIndex, Tool::Crosshair); input_set_flag(INPUT_FLAG_6, true); - context_open_window(WindowClass::ClearScenery); + ContextOpenWindow(WindowClass::ClearScenery); } } @@ -3863,7 +3863,7 @@ static void ToggleWaterWindow(rct_window* topToolbar, WidgetIndex widgetIndex) show_gridlines(); tool_set(*topToolbar, widgetIndex, Tool::WaterDown); input_set_flag(INPUT_FLAG_6, true); - context_open_window(WindowClass::Water); + ContextOpenWindow(WindowClass::Water); } } diff --git a/src/openrct2-ui/windows/TrackDesignManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp index 9a33fbda8c..eece1badd5 100644 --- a/src/openrct2-ui/windows/TrackDesignManage.cpp +++ b/src/openrct2-ui/windows/TrackDesignManage.cpp @@ -148,12 +148,12 @@ void TrackDesignManageWindow::OnTextInput(WidgetIndex widgetIndex, std::string_v } else if (text.empty()) { - context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_NONE, {}); + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NONE, {}); return; } else if (!Platform::IsFilenameValid(text)) { - context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS, {}); + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS, {}); return; } @@ -165,7 +165,7 @@ void TrackDesignManageWindow::OnTextInput(WidgetIndex widgetIndex, std::string_v } else { - context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED, {}); + ContextShowError(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED, {}); } } @@ -183,8 +183,8 @@ static void WindowTrackDeletePromptOpen(TrackDesignFileRef* tdFileRef) { window_close_by_class(WindowClass::TrackDeletePrompt); - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); auto trackDeletePromptWindow = std::make_unique(tdFileRef); WindowCreate( std::move(trackDeletePromptWindow), WindowClass::TrackDeletePrompt, ScreenCoordsXY( @@ -217,7 +217,7 @@ void TrackDeletePromptWindow::OnMouseUp(WidgetIndex widgetIndex) } else { - context_show_error(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED, {}); + ContextShowError(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED, {}); } break; } diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 0b5f57acaf..9c4d508e94 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -129,7 +129,7 @@ public: auto intent = Intent(WindowClass::TrackDesignList); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, _window_track_list_item.Type); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, _window_track_list_item.EntryIndex); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } } @@ -241,7 +241,7 @@ public: { auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, rideId.ToUnderlying()); - context_open_intent(&intent); + ContextOpenIntent(&intent); auto wnd = window_find_by_class(WindowClass::TrackDesignPlace); window_close(*wnd); } diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index 6222bded35..a75d13c76b 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -123,7 +123,7 @@ private: // Displays a message if the ride can't load, fix #4080 if (_loadedTrackDesign == nullptr) { - context_show_error(STR_CANT_BUILD_THIS_HERE, STR_TRACK_LOAD_FAILED_ERROR, {}); + ContextShowError(STR_CANT_BUILD_THIS_HERE, STR_TRACK_LOAD_FAILED_ERROR, {}); return; } @@ -138,19 +138,19 @@ private: { auto intent = Intent(WindowClass::ManageTrackDesign); intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); - context_open_intent(&intent); + ContextOpenIntent(&intent); } else { if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED && (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE)) { - context_show_error(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE, {}); + ContextShowError(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE, {}); } auto intent = Intent(WindowClass::TrackDesignPlace); intent.putExtra(INTENT_EXTRA_TRACK_DESIGN, tdRef); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } @@ -276,7 +276,7 @@ public: Close(); if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { - context_open_window(WindowClass::ConstructRide); + ContextOpenWindow(WindowClass::ConstructRide); } break; case WIDX_FILTER_STRING: @@ -749,8 +749,8 @@ rct_window* WindowTrackListOpen(const RideSelection item) ScreenCoordsXY screenPos{}; if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); screenPos = { screenWidth / 2 - 300, std::max(TOP_TOOLBAR_HEIGHT + 1, screenHeight / 2 - 200) }; } else diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index 891f15beeb..8441c2eaab 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -161,8 +161,8 @@ public: void OnResize() override { - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); max_width = (screenWidth * 4) / 5; max_height = (screenHeight * 4) / 5; @@ -210,8 +210,8 @@ public: rct_window* WindowViewportOpen() { - int32_t screenWidth = context_get_width(); - int32_t screenHeight = context_get_height(); + int32_t screenWidth = ContextGetWidth(); + int32_t screenHeight = ContextGetHeight(); int32_t width = (screenWidth / 2); int32_t height = (screenHeight / 2); diff --git a/src/openrct2-ui/windows/Water.cpp b/src/openrct2-ui/windows/Water.cpp index c921a80d8c..032aaea2a2 100644 --- a/src/openrct2-ui/windows/Water.cpp +++ b/src/openrct2-ui/windows/Water.cpp @@ -187,5 +187,5 @@ private: rct_window* WindowWaterOpen() { - return WindowFocusOrCreate(WindowClass::Water, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0); + return WindowFocusOrCreate(WindowClass::Water, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0); } diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 399954b21b..2735288c52 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -324,7 +324,7 @@ namespace OpenRCT2 void Quit() override { gSavePromptMode = PromptMode::Quit; - context_open_window(WindowClass::SavePrompt); + ContextOpenWindow(WindowClass::SavePrompt); } bool Initialise() final override @@ -1355,12 +1355,12 @@ namespace OpenRCT2 } // namespace OpenRCT2 -void context_init() +void ContextInit() { GetContext()->GetUiContext()->GetWindowManager()->Init(); } -bool context_load_park_from_stream(void* stream) +bool ContextLoadParkFromStream(void* stream) { return GetContext()->LoadParkFromStream(static_cast(stream), ""); } @@ -1375,170 +1375,170 @@ void openrct2_finish() GetContext()->Finish(); } -void context_setcurrentcursor(CursorID cursor) +void ContextSetCurrentCursor(CursorID cursor) { GetContext()->GetUiContext()->SetCursor(cursor); } -void context_update_cursor_scale() +void ContextUpdateCursorScale() { GetContext()->GetUiContext()->SetCursorScale(static_cast(std::round(gConfigGeneral.WindowScale))); } -void context_hide_cursor() +void ContextHideCursor() { GetContext()->GetUiContext()->SetCursorVisible(false); } -void context_show_cursor() +void ContextShowCursor() { GetContext()->GetUiContext()->SetCursorVisible(true); } -ScreenCoordsXY context_get_cursor_position() +ScreenCoordsXY ContextGetCursorPosition() { return GetContext()->GetUiContext()->GetCursorPosition(); } -ScreenCoordsXY context_get_cursor_position_scaled() +ScreenCoordsXY ContextGetCursorPositionScaled() { - auto cursorCoords = context_get_cursor_position(); + auto cursorCoords = ContextGetCursorPosition(); // Compensate for window scaling. return { static_cast(std::ceil(cursorCoords.x / gConfigGeneral.WindowScale)), static_cast(std::ceil(cursorCoords.y / gConfigGeneral.WindowScale)) }; } -void context_set_cursor_position(const ScreenCoordsXY& cursorPosition) +void ContextSetCursorPosition(const ScreenCoordsXY& cursorPosition) { GetContext()->GetUiContext()->SetCursorPosition(cursorPosition); } -const CursorState* context_get_cursor_state() +const CursorState* ContextGetCursorState() { return GetContext()->GetUiContext()->GetCursorState(); } -const uint8_t* context_get_keys_state() +const uint8_t* ContextGetKeysState() { return GetContext()->GetUiContext()->GetKeysState(); } -const uint8_t* context_get_keys_pressed() +const uint8_t* ContextGetKeysPressed() { return GetContext()->GetUiContext()->GetKeysPressed(); } -TextInputSession* context_start_text_input(utf8* buffer, size_t maxLength) +TextInputSession* ContextStartTextInput(utf8* buffer, size_t maxLength) { return GetContext()->GetUiContext()->StartTextInput(buffer, maxLength); } -void context_stop_text_input() +void ContextStopTextInput() { GetContext()->GetUiContext()->StopTextInput(); } -bool context_is_input_active() +bool ContextIsInputActive() { return GetContext()->GetUiContext()->IsTextInputActive(); } -void context_trigger_resize() +void ContextTriggerResize() { return GetContext()->GetUiContext()->TriggerResize(); } -void context_set_fullscreen_mode(int32_t mode) +void ContextSetFullscreenMode(int32_t mode) { return GetContext()->GetUiContext()->SetFullscreenMode(static_cast(mode)); } -void context_recreate_window() +void ContextRecreateWindow() { GetContext()->GetUiContext()->RecreateWindow(); } -int32_t context_get_width() +int32_t ContextGetWidth() { return GetContext()->GetUiContext()->GetWidth(); } -int32_t context_get_height() +int32_t ContextGetHeight() { return GetContext()->GetUiContext()->GetHeight(); } -bool context_has_focus() +bool ContextHasFocus() { return GetContext()->GetUiContext()->HasFocus(); } -void context_set_cursor_trap(bool value) +void ContextSetCursorTrap(bool value) { GetContext()->GetUiContext()->SetCursorTrap(value); } -rct_window* context_open_window(WindowClass wc) +rct_window* ContextOpenWindow(WindowClass wc) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); return windowManager->OpenWindow(wc); } -rct_window* context_open_window_view(uint8_t wc) +rct_window* ContextOpenWindowView(uint8_t wc) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); return windowManager->OpenView(wc); } -rct_window* context_open_detail_window(uint8_t type, int32_t id) +rct_window* ContextOpenDetailWindow(uint8_t type, int32_t id) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); return windowManager->OpenDetails(type, id); } -rct_window* context_open_intent(Intent* intent) +rct_window* ContextOpenIntent(Intent* intent) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); return windowManager->OpenIntent(intent); } -void context_broadcast_intent(Intent* intent) +void ContextBroadcastIntent(Intent* intent) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->BroadcastIntent(*intent); } -void context_force_close_window_by_class(WindowClass windowClass) +void ContextForceCloseWindowByClass(WindowClass windowClass) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->ForceClose(windowClass); } -rct_window* context_show_error(StringId title, StringId message, const Formatter& args) +rct_window* ContextShowError(StringId title, StringId message, const Formatter& args) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); return windowManager->ShowError(title, message, args); } -void context_update_map_tooltip() +void ContextUpdateMapTooltip() { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->UpdateMapTooltip(); } -void context_handle_input() +void ContextHandleInput() { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->HandleInput(); } -void context_input_handle_keyboard(bool isTitle) +void ContextInputHandleKeyboard(bool isTitle) { auto windowManager = GetContext()->GetUiContext()->GetWindowManager(); windowManager->HandleKeyboard(isTitle); } -void context_quit() +void ContextQuit() { GetContext()->Quit(); } diff --git a/src/openrct2/Context.h b/src/openrct2/Context.h index e286d3327b..10115fa00a 100644 --- a/src/openrct2/Context.h +++ b/src/openrct2/Context.h @@ -189,38 +189,38 @@ namespace constexpr float GAME_MIN_TIME_SCALE = 0.1f; constexpr float GAME_MAX_TIME_SCALE = 5.0f; -void context_init(); -void context_setcurrentcursor(CursorID cursor); -void context_update_cursor_scale(); -void context_hide_cursor(); -void context_show_cursor(); -ScreenCoordsXY context_get_cursor_position(); -ScreenCoordsXY context_get_cursor_position_scaled(); -void context_set_cursor_position(const ScreenCoordsXY& cursorPosition); -const CursorState* context_get_cursor_state(); -const uint8_t* context_get_keys_state(); -const uint8_t* context_get_keys_pressed(); -TextInputSession* context_start_text_input(utf8* buffer, size_t maxLength); -void context_stop_text_input(); -bool context_is_input_active(); -void context_trigger_resize(); -void context_set_fullscreen_mode(int32_t mode); -void context_recreate_window(); -int32_t context_get_width(); -int32_t context_get_height(); -bool context_has_focus(); -void context_set_cursor_trap(bool value); -rct_window* context_open_window(WindowClass wc); -rct_window* context_open_detail_window(uint8_t type, int32_t id); -rct_window* context_open_window_view(uint8_t view); -rct_window* context_show_error(StringId title, StringId message, const class Formatter& args); -rct_window* context_open_intent(Intent* intent); -void context_broadcast_intent(Intent* intent); -void context_force_close_window_by_class(WindowClass wc); -void context_update_map_tooltip(); -void context_handle_input(); -void context_input_handle_keyboard(bool isTitle); -void context_quit(); -bool context_load_park_from_stream(void* stream); +void ContextInit(); +void ContextSetCurrentCursor(CursorID cursor); +void ContextUpdateCursorScale(); +void ContextHideCursor(); +void ContextShowCursor(); +ScreenCoordsXY ContextGetCursorPosition(); +ScreenCoordsXY ContextGetCursorPositionScaled(); +void ContextSetCursorPosition(const ScreenCoordsXY& cursorPosition); +const CursorState* ContextGetCursorState(); +const uint8_t* ContextGetKeysState(); +const uint8_t* ContextGetKeysPressed(); +TextInputSession* ContextStartTextInput(utf8* buffer, size_t maxLength); +void ContextStopTextInput(); +bool ContextIsInputActive(); +void ContextTriggerResize(); +void ContextSetFullscreenMode(int32_t mode); +void ContextRecreateWindow(); +int32_t ContextGetWidth(); +int32_t ContextGetHeight(); +bool ContextHasFocus(); +void ContextSetCursorTrap(bool value); +rct_window* ContextOpenWindow(WindowClass wc); +rct_window* ContextOpenDetailWindow(uint8_t type, int32_t id); +rct_window* ContextOpenWindowView(uint8_t view); +rct_window* ContextShowError(StringId title, StringId message, const class Formatter& args); +rct_window* ContextOpenIntent(Intent* intent); +void ContextBroadcastIntent(Intent* intent); +void ContextForceCloseWindowByClass(WindowClass wc); +void ContextUpdateMapTooltip(); +void ContextHandleInput(); +void ContextInputHandleKeyboard(bool isTitle); +void ContextQuit(); +bool ContextLoadParkFromStream(void* stream); bool ContextOpenCommonFileDialog(utf8* outFilename, OpenRCT2::Ui::FileDialogDesc& desc, size_t outSize); u8string ContextOpenCommonFileDialog(OpenRCT2::Ui::FileDialogDesc& desc); diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 3e4506036c..371857da07 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -91,9 +91,9 @@ namespace Editor static rct_window* OpenEditorWindows() { - auto* main = context_open_window(WindowClass::MainWindow); - context_open_window(WindowClass::TopToolbar); - context_open_window_view(WV_EDITOR_BOTTOM_TOOLBAR); + auto* main = ContextOpenWindow(WindowClass::MainWindow); + ContextOpenWindow(WindowClass::TopToolbar); + ContextOpenWindowView(WV_EDITOR_BOTTOM_TOOLBAR); return main; } @@ -128,7 +128,7 @@ namespace Editor auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(ConvertSaveToScenarioCallback)); - context_open_intent(&intent); + ContextOpenIntent(&intent); } static void ConvertSaveToScenarioCallback(int32_t result, const utf8* path) @@ -377,7 +377,7 @@ namespace Editor object_manager_unload_all_objects(); } - context_open_window(WindowClass::EditorObjectSelection); + ContextOpenWindow(WindowClass::EditorObjectSelection); break; case EditorStep::InventionsListSetUp: if (window_find_by_class(WindowClass::EditorInventionList) != nullptr) @@ -385,7 +385,7 @@ namespace Editor return; } - context_open_window(WindowClass::EditorInventionList); + ContextOpenWindow(WindowClass::EditorInventionList); break; case EditorStep::OptionsSelection: if (window_find_by_class(WindowClass::EditorScenarioOptions) != nullptr) @@ -393,7 +393,7 @@ namespace Editor return; } - context_open_window(WindowClass::EditorScenarioOptions); + ContextOpenWindow(WindowClass::EditorScenarioOptions); break; case EditorStep::ObjectiveSelection: if (window_find_by_class(WindowClass::EditorObjectiveOptions) != nullptr) @@ -401,7 +401,7 @@ namespace Editor return; } - context_open_window(WindowClass::EditorObjectiveOptions); + ContextOpenWindow(WindowClass::EditorObjectiveOptions); break; case EditorStep::LandscapeEditor: case EditorStep::SaveScenario: diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 937547ac54..b6b31b3395 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -686,7 +686,7 @@ int32_t editor_remove_unused_objects() editor_object_flags_free(); auto intent = Intent(INTENT_ACTION_REFRESH_SCENERY); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); return numUnselectedObjects; } diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 773b768049..9f44f8e555 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -122,10 +122,10 @@ void game_reduce_game_speed() */ void game_create_windows() { - context_open_window(WindowClass::MainWindow); - context_open_window(WindowClass::TopToolbar); - context_open_window(WindowClass::BottomToolbar); - window_resize_gui(context_get_width(), context_get_height()); + ContextOpenWindow(WindowClass::MainWindow); + ContextOpenWindow(WindowClass::TopToolbar); + ContextOpenWindow(WindowClass::BottomToolbar); + window_resize_gui(ContextGetWidth(), ContextGetHeight()); } enum @@ -327,7 +327,7 @@ static void load_landscape() { auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE); - context_open_intent(&intent); + ContextOpenIntent(&intent); } void rct2_to_utf8_self(char* buffer, size_t length) @@ -485,7 +485,7 @@ void game_load_init() ScenerySetDefaultPlacementConfiguration(); auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); gWindowUpdateTicks = 0; @@ -494,7 +494,7 @@ void game_load_init() if (!gOpenRCT2Headless) { intent = Intent(INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); window_update_all(); } @@ -616,7 +616,7 @@ std::unique_ptr create_save_game_as_intent() void save_game_as() { auto intent = create_save_game_as_intent(); - context_open_intent(intent.get()); + ContextOpenIntent(intent.get()); } static void limit_autosave_count(const size_t numberOfFilesToKeep, bool processLandscapeFolder) @@ -756,7 +756,7 @@ void game_load_or_quit_no_save_prompt() auto intent = Intent(WindowClass::Loadsave); intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME); intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(game_load_or_quit_no_save_prompt_callback)); - context_open_intent(&intent); + ContextOpenIntent(&intent); } break; } diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 29b7caf678..9efe08eae6 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -78,11 +78,11 @@ void GameState::InitAll(const TileCoordsXY& mapSize) gNextGuestNumber = 1; - context_init(); + ContextInit(); ScenerySetDefaultPlacementConfiguration(); auto intent = Intent(INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); load_palette(); @@ -228,9 +228,9 @@ void GameState::Tick() gWindowMapFlashingFlags |= MapFlashingFlags::FlashStaff; gWindowMapFlashingFlags &= ~MapFlashingFlags::StaffListOpen; - context_update_map_tooltip(); + ContextUpdateMapTooltip(); - context_handle_input(); + ContextHandleInput(); } // Always perform autosave check, even when paused diff --git a/src/openrct2/Input.cpp b/src/openrct2/Input.cpp index edd7df1a98..2a0178abbd 100644 --- a/src/openrct2/Input.cpp +++ b/src/openrct2/Input.cpp @@ -29,7 +29,7 @@ widget_ref gCurrentToolWidget; */ void title_handle_keyboard_input() { - context_input_handle_keyboard(true); + ContextInputHandleKeyboard(true); } /** @@ -38,7 +38,7 @@ void title_handle_keyboard_input() */ void game_handle_keyboard_input() { - context_input_handle_keyboard(false); + ContextInputHandleKeyboard(false); } void input_set_flag(INPUT_FLAGS flag, bool on) diff --git a/src/openrct2/Intro.cpp b/src/openrct2/Intro.cpp index 91901489b3..15b472fca1 100644 --- a/src/openrct2/Intro.cpp +++ b/src/openrct2/Intro.cpp @@ -69,7 +69,7 @@ void intro_update() _introStateCounter += 5; // Check if logo is off the screen...ish - if (_introStateCounter > context_get_height() - 120) + if (_introStateCounter > ContextGetHeight() - 120) { _introStateCounter = -116; gIntroState = IntroState::DeveloperBegin; @@ -86,7 +86,7 @@ void intro_update() _introStateCounter += 5; // Check if logo is almost scrolled to the bottom - if (!_chainLiftFinished && _introStateCounter >= context_get_height() + 40 - 421) + if (!_chainLiftFinished && _introStateCounter >= ContextGetHeight() + 40 - 421) { _chainLiftFinished = true; @@ -102,7 +102,7 @@ void intro_update() } // Check if logo is off the screen...ish - if (_introStateCounter >= context_get_height() + 40) + if (_introStateCounter >= ContextGetHeight() + 40) { // Stop the track friction sound if (_soundChannel != nullptr) @@ -170,7 +170,7 @@ void intro_update() void intro_draw(rct_drawpixelinfo* dpi) { - int32_t screenWidth = context_get_width(); + int32_t screenWidth = ContextGetWidth(); switch (gIntroState) { @@ -242,7 +242,7 @@ void intro_draw(rct_drawpixelinfo* dpi) static void screen_intro_process_mouse_input() { - if (context_get_cursor_state()->any == CURSOR_PRESSED) + if (ContextGetCursorState()->any == CURSOR_PRESSED) { screen_intro_skip_part(); } @@ -254,7 +254,7 @@ static void screen_intro_process_mouse_input() */ static void screen_intro_process_keyboard_input() { - const uint8_t* keys = context_get_keys_state(); + const uint8_t* keys = ContextGetKeysState(); for (int i = 0; i < 256; i++) { if (keys[i] != 0) @@ -282,7 +282,7 @@ static void screen_intro_skip_part() static void screen_intro_draw_logo(rct_drawpixelinfo* dpi) { - int32_t screenWidth = context_get_width(); + int32_t screenWidth = ContextGetWidth(); int32_t imageWidth = 640; int32_t imageX = (screenWidth - imageWidth) / 2; diff --git a/src/openrct2/actions/BannerSetColourAction.cpp b/src/openrct2/actions/BannerSetColourAction.cpp index 7a1c8f090d..9bf9ada550 100644 --- a/src/openrct2/actions/BannerSetColourAction.cpp +++ b/src/openrct2/actions/BannerSetColourAction.cpp @@ -95,7 +95,7 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const { auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); intent.putExtra(INTENT_EXTRA_BANNER_INDEX, index); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); banner->colour = _primaryColour; MapInvalidateTileZoom1({ _loc, _loc.z, _loc.z + 32 }); diff --git a/src/openrct2/actions/BannerSetNameAction.cpp b/src/openrct2/actions/BannerSetNameAction.cpp index 28513af6ee..f2c9b85040 100644 --- a/src/openrct2/actions/BannerSetNameAction.cpp +++ b/src/openrct2/actions/BannerSetNameAction.cpp @@ -66,7 +66,7 @@ GameActions::Result BannerSetNameAction::Execute() const auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); intent.putExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); scrolling_text_invalidate(); gfx_invalidate_screen(); diff --git a/src/openrct2/actions/BannerSetStyleAction.cpp b/src/openrct2/actions/BannerSetStyleAction.cpp index b88823cbad..8e38985423 100644 --- a/src/openrct2/actions/BannerSetStyleAction.cpp +++ b/src/openrct2/actions/BannerSetStyleAction.cpp @@ -153,7 +153,7 @@ GameActions::Result BannerSetStyleAction::Execute() const auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); intent.putExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); return res; } diff --git a/src/openrct2/actions/GuestSetNameAction.cpp b/src/openrct2/actions/GuestSetNameAction.cpp index 26627b3213..f7c051d6c7 100644 --- a/src/openrct2/actions/GuestSetNameAction.cpp +++ b/src/openrct2/actions/GuestSetNameAction.cpp @@ -97,7 +97,7 @@ GameActions::Result GuestSetNameAction::Execute() const gfx_invalidate_screen(); auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); auto res = GameActions::Result(); res.Position = guest->GetLocation(); diff --git a/src/openrct2/actions/LoadOrQuitAction.cpp b/src/openrct2/actions/LoadOrQuitAction.cpp index 82a0f1ee0e..8409f164fd 100644 --- a/src/openrct2/actions/LoadOrQuitAction.cpp +++ b/src/openrct2/actions/LoadOrQuitAction.cpp @@ -42,7 +42,7 @@ GameActions::Result LoadOrQuitAction::Execute() const { case LoadOrQuitModes::OpenSavePrompt: gSavePromptMode = _savePromptMode; - context_open_window(WindowClass::SavePrompt); + ContextOpenWindow(WindowClass::SavePrompt); break; case LoadOrQuitModes::CloseSavePrompt: window_close_by_class(WindowClass::SavePrompt); diff --git a/src/openrct2/actions/RideSetVehicleAction.cpp b/src/openrct2/actions/RideSetVehicleAction.cpp index 76e091e745..1ed84e90c4 100644 --- a/src/openrct2/actions/RideSetVehicleAction.cpp +++ b/src/openrct2/actions/RideSetVehicleAction.cpp @@ -202,7 +202,7 @@ GameActions::Result RideSetVehicleAction::Execute() const auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE); intent.putExtra(INTENT_EXTRA_RIDE_ID, _rideIndex.ToUnderlying()); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); gfx_invalidate_screen(); return res; diff --git a/src/openrct2/actions/SignSetStyleAction.cpp b/src/openrct2/actions/SignSetStyleAction.cpp index d09baff81e..f35643b13a 100644 --- a/src/openrct2/actions/SignSetStyleAction.cpp +++ b/src/openrct2/actions/SignSetStyleAction.cpp @@ -106,7 +106,7 @@ GameActions::Result SignSetStyleAction::Execute() const auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); intent.putExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); return GameActions::Result(); } diff --git a/src/openrct2/actions/StaffSetCostumeAction.cpp b/src/openrct2/actions/StaffSetCostumeAction.cpp index 35599fcdf2..779e665331 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.cpp +++ b/src/openrct2/actions/StaffSetCostumeAction.cpp @@ -99,7 +99,7 @@ GameActions::Result StaffSetCostumeAction::Execute() const window_invalidate_by_number(WindowClass::Peep, _spriteIndex); auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); auto res = GameActions::Result(); res.Position = staff->GetLocation(); diff --git a/src/openrct2/actions/StaffSetNameAction.cpp b/src/openrct2/actions/StaffSetNameAction.cpp index 920d84298b..b5b99cff63 100644 --- a/src/openrct2/actions/StaffSetNameAction.cpp +++ b/src/openrct2/actions/StaffSetNameAction.cpp @@ -79,7 +79,7 @@ GameActions::Result StaffSetNameAction::Execute() const gfx_invalidate_screen(); auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); auto res = GameActions::Result(); res.Position = staff->GetLocation(); diff --git a/src/openrct2/actions/StaffSetOrdersAction.cpp b/src/openrct2/actions/StaffSetOrdersAction.cpp index d5674b355a..d8d4fbd425 100644 --- a/src/openrct2/actions/StaffSetOrdersAction.cpp +++ b/src/openrct2/actions/StaffSetOrdersAction.cpp @@ -65,7 +65,7 @@ GameActions::Result StaffSetOrdersAction::Execute() const window_invalidate_by_number(WindowClass::Peep, _spriteIndex); auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); auto res = GameActions::Result(); res.Position = staff->GetLocation(); diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index f820824b79..7c8e35c6a7 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -658,7 +658,7 @@ void load_palette() */ void gfx_invalidate_screen() { - gfx_set_dirty_blocks({ { 0, 0 }, { context_get_width(), context_get_height() } }); + gfx_set_dirty_blocks({ { 0, 0 }, { ContextGetWidth(), ContextGetHeight() } }); } /* @@ -843,7 +843,7 @@ void RefreshVideo(bool recreateWindow) { if (recreateWindow) { - context_recreate_window(); + ContextRecreateWindow(); } else { @@ -859,7 +859,7 @@ void RefreshVideo(bool recreateWindow) void ToggleWindowedMode() { int32_t targetMode = gConfigGeneral.FullscreenMode == 0 ? 2 : 0; - context_set_fullscreen_mode(targetMode); + ContextSetFullscreenMode(targetMode); gConfigGeneral.FullscreenMode = targetMode; ConfigSaveDefault(); } diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index a7edb8e62c..652e49dc96 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -5639,7 +5639,7 @@ void Guest::UpdateEnteringPark() increment_guests_in_park(); decrement_guests_heading_for_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } /** @@ -5668,7 +5668,7 @@ void Guest::UpdateLeavingPark() DestinationTolerance = 5; decrement_guests_in_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); Var37 = 1; window_invalidate_by_class(WindowClass::GuestList); diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 5b59414de8..715daaf105 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -713,7 +713,7 @@ void peep_sprite_remove(Peep* peep) EntityRemove(peep); auto intent = Intent(wasGuest ? INTENT_ACTION_REFRESH_GUEST_LIST : INTENT_ACTION_REFRESH_STAFF_LIST); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } /** @@ -728,7 +728,7 @@ void Peep::Remove() { decrement_guests_in_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } if (State == PeepState::EnteringPark) { @@ -1353,7 +1353,7 @@ void peep_applause() } // Play applause noise - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Applause, 0, context_get_width() / 2); + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Applause, 0, ContextGetWidth() / 2); } /** @@ -1655,7 +1655,7 @@ void peep_set_map_tooltip(Peep* peep) auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } /** @@ -2629,7 +2629,7 @@ void peep_update_names(bool realNames) } auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); gfx_invalidate_screen(); } diff --git a/src/openrct2/interface/Chat.cpp b/src/openrct2/interface/Chat.cpp index 382ffd8300..27a02d8341 100644 --- a/src/openrct2/interface/Chat.cpp +++ b/src/openrct2/interface/Chat.cpp @@ -55,13 +55,13 @@ bool chat_available() void chat_open() { gChatOpen = true; - _chatTextInputSession = context_start_text_input(_chatCurrentLine, sizeof(_chatCurrentLine)); + _chatTextInputSession = ContextStartTextInput(_chatCurrentLine, sizeof(_chatCurrentLine)); } void chat_close() { gChatOpen = false; - context_stop_text_input(); + ContextStopTextInput(); } void chat_toggle() @@ -99,9 +99,9 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor) } _chatLeft = 10; - _chatRight = std::min((context_get_width() - 10), CHAT_MAX_WINDOW_WIDTH); + _chatRight = std::min((ContextGetWidth() - 10), CHAT_MAX_WINDOW_WIDTH); _chatWidth = _chatRight - _chatLeft; - _chatBottom = context_get_height() - 45; + _chatBottom = ContextGetHeight() - 45; _chatTop = _chatBottom - 10; char* inputLine = _chatCurrentLine; diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index f2d2ff4006..a2216ab991 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1069,8 +1069,8 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv) gConfigGeneral.WindowScale = std::clamp(newScale, 0.5f, 5.0f); ConfigSaveDefault(); gfx_invalidate_screen(); - context_trigger_resize(); - context_update_cursor_scale(); + ContextTriggerResize(); + ContextUpdateCursorScale(); console.Execute("get window_scale"); } else if (argv[0] == "window_limit" && invalidArguments(&invalidArgs, int_valid[0])) @@ -1262,7 +1262,7 @@ static int32_t cc_load_object(InteractiveConsole& console, const arguments_t& ar ScenerySetDefaultPlacementConfiguration(); auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); gWindowUpdateTicks = 0; gfx_invalidate_screen(); @@ -1330,7 +1330,7 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv) { // Only this window should be open for safety reasons window_close_all(); - context_open_window(WindowClass::EditorObjectSelection); + ContextOpenWindow(WindowClass::EditorObjectSelection); } } else if (argv[0] == "inventions_list" && invalidArguments(&invalidTitle, !title)) @@ -1341,12 +1341,12 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv) } else { - context_open_window(WindowClass::EditorInventionList); + ContextOpenWindow(WindowClass::EditorInventionList); } } else if (argv[0] == "scenario_options" && invalidArguments(&invalidTitle, !title)) { - context_open_window(WindowClass::EditorScenarioOptions); + ContextOpenWindow(WindowClass::EditorScenarioOptions); } else if (argv[0] == "objective_options" && invalidArguments(&invalidTitle, !title)) { @@ -1356,16 +1356,16 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv) } else { - context_open_window(WindowClass::EditorObjectiveOptions); + ContextOpenWindow(WindowClass::EditorObjectiveOptions); } } else if (argv[0] == "options") { - context_open_window(WindowClass::Options); + ContextOpenWindow(WindowClass::Options); } else if (argv[0] == "themes") { - context_open_window(WindowClass::Themes); + ContextOpenWindow(WindowClass::Themes); } else if (invalidTitle) { diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index 5b9545285e..d1d2b0c1aa 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -90,11 +90,11 @@ void screenshot_check() if (!screenshotPath.empty()) { - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 100, context_get_width() / 2); + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 100, ContextGetWidth() / 2); } else { - context_show_error(STR_SCREENSHOT_FAILED, STR_NONE, {}); + ContextShowError(STR_SCREENSHOT_FAILED, STR_NONE, {}); } // redraw_weather(); @@ -379,12 +379,12 @@ void screenshot_giant() Formatter ft; ft.Add(STR_STRING); ft.Add(filename.c_str()); - context_show_error(STR_SCREENSHOT_SAVED_AS, STR_NONE, ft); + ContextShowError(STR_SCREENSHOT_SAVED_AS, STR_NONE, ft); } catch (const std::exception& e) { log_error("%s", e.what()); - context_show_error(STR_SCREENSHOT_FAILED, STR_NONE, {}); + ContextShowError(STR_SCREENSHOT_FAILED, STR_NONE, {}); } ReleaseDPI(dpi); diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 4c0b5efbcd..89adaa2ae0 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -464,8 +464,8 @@ static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewp { int32_t left = std::max(viewport->pos.x, 0); int32_t top = std::max(viewport->pos.y, 0); - int32_t right = std::min(viewport->pos.x + viewport->width, context_get_width()); - int32_t bottom = std::min(viewport->pos.y + viewport->height, context_get_height()); + int32_t right = std::min(viewport->pos.x + viewport->width, ContextGetWidth()); + int32_t bottom = std::min(viewport->pos.y + viewport->height, ContextGetHeight()); if (left >= right) return; @@ -490,7 +490,7 @@ static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewp viewport->pos.x = 0; } - int32_t eax = viewport->pos.x + viewport->width - context_get_width(); + int32_t eax = viewport->pos.x + viewport->width - ContextGetWidth(); if (eax > 0) { viewport->width -= eax; @@ -511,7 +511,7 @@ static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewp viewport->pos.y = 0; } - eax = viewport->pos.y + viewport->height - context_get_height(); + eax = viewport->pos.y + viewport->height - ContextGetHeight(); if (eax > 0) { viewport->height -= eax; diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 408d4ff284..436686b36e 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -743,7 +743,7 @@ void window_push_others_right(rct_window& window) return; w->Invalidate(); - if (window.windowPos.x + window.width + 13 >= context_get_width()) + if (window.windowPos.x + window.width + 13 >= ContextGetWidth()) return; auto push_amount = window.windowPos.x + window.width - w->windowPos.x + 3; w->windowPos.x += push_amount; @@ -773,7 +773,7 @@ void window_push_others_below(rct_window& w1) return; // Check if there is room to push it down - if (w1.windowPos.y + w1.height + 80 >= context_get_height()) + if (w1.windowPos.y + w1.height + 80 >= ContextGetHeight()) return; // Invalidate the window's current area @@ -955,7 +955,7 @@ void window_viewport_get_map_coords_by_cursor( const rct_window& w, int32_t* map_x, int32_t* map_y, int32_t* offset_x, int32_t* offset_y) { // Get mouse position to offset against. - auto mouseCoords = context_get_cursor_position_scaled(); + auto mouseCoords = ContextGetCursorPositionScaled(); // Compute map coordinate by mouse position. auto viewportPos = w.viewport->ScreenToViewportCoord(mouseCoords); @@ -996,7 +996,7 @@ void window_viewport_centre_tile_around_cursor(rct_window& w, int32_t map_x, int } // Get mouse position to offset against. - auto mouseCoords = context_get_cursor_position_scaled(); + auto mouseCoords = ContextGetCursorPositionScaled(); // Rebase mouse position onto centre of window, and compensate for zoom level. int32_t rebased_x = w.viewport->zoom.ApplyTo((w.width >> 1) - mouseCoords.x); @@ -1879,7 +1879,7 @@ static void window_snap_right(rct_window& w, int32_t proximity) leftMost = std::min(leftMost, w2->windowPos.x); }); - auto screenWidth = context_get_width(); + auto screenWidth = ContextGetWidth(); if (screenWidth >= wLeftProximity && screenWidth <= wRightProximity) leftMost = std::min(leftMost, screenWidth); @@ -1909,7 +1909,7 @@ static void window_snap_bottom(rct_window& w, int32_t proximity) topMost = std::min(topMost, w2->windowPos.y); }); - auto screenHeight = context_get_height(); + auto screenHeight = ContextGetHeight(); if (screenHeight >= wTopProximity && screenHeight <= wBottomProximity) topMost = std::min(topMost, screenHeight); @@ -1922,7 +1922,7 @@ void window_move_and_snap(rct_window& w, ScreenCoordsXY newWindowCoords, int32_t auto originalPos = w.windowPos; int32_t minY = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 1 : TOP_TOOLBAR_HEIGHT + 2; - newWindowCoords.y = std::clamp(newWindowCoords.y, minY, context_get_height() - 34); + newWindowCoords.y = std::clamp(newWindowCoords.y, minY, ContextGetHeight() - 34); if (snapProximity > 0) { @@ -1983,7 +1983,7 @@ void window_start_textbox( // from crashing the game. gTextBoxInput[maxLength - 1] = '\0'; - gTextInput = context_start_text_input(gTextBoxInput, maxLength); + gTextInput = ContextStartTextInput(gTextBoxInput, maxLength); } void window_cancel_textbox() @@ -1997,7 +1997,7 @@ void window_cancel_textbox() } gCurrentTextBox.window.classification = WindowClass::Null; gCurrentTextBox.window.number = 0; - context_stop_text_input(); + ContextStopTextInput(); gUsingWidgetTextBox = false; if (w != nullptr) { diff --git a/src/openrct2/management/Finance.cpp b/src/openrct2/management/Finance.cpp index 37f1148d41..9b2cc77aeb 100644 --- a/src/openrct2/management/Finance.cpp +++ b/src/openrct2/management/Finance.cpp @@ -97,7 +97,7 @@ void finance_payment(money64 amount, ExpenditureType type) } auto intent = Intent(INTENT_ACTION_UPDATE_CASH); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } /** diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index c6679d2015..1f4ee7bc25 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -115,7 +115,7 @@ void News::InitQueue() } auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } uint16_t News::ItemQueues::IncrementTicks() @@ -130,7 +130,7 @@ static void TickCurrent() if (ticks == 1 && (gScreenFlags == SCREEN_FLAGS_PLAYING)) { // Play sound - OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::NewsItem, 0, context_get_width() / 2); + OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::NewsItem, 0, ContextGetWidth() / 2); } } @@ -161,7 +161,7 @@ void News::UpdateCurrentItem() return; auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); // Update the current news item TickCurrent(); @@ -196,7 +196,7 @@ void News::ItemQueues::ArchiveCurrent() // Invalidate current news item bar auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } /** @@ -367,7 +367,7 @@ void News::OpenSubject(News::ItemType type, int32_t subject) { auto intent = Intent(WindowClass::Ride); intent.putExtra(INTENT_EXTRA_RIDE_ID, subject); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case News::ItemType::PeepOnRide: @@ -378,12 +378,12 @@ void News::OpenSubject(News::ItemType type, int32_t subject) { auto intent = Intent(WindowClass::Peep); intent.putExtra(INTENT_EXTRA_PEEP, peep); - context_open_intent(&intent); + ContextOpenIntent(&intent); } break; } case News::ItemType::Money: - context_open_window(WindowClass::Finances); + ContextOpenWindow(WindowClass::Finances); break; case News::ItemType::Research: { @@ -393,13 +393,13 @@ void News::OpenSubject(News::ItemType type, int32_t subject) auto intent = Intent(INTENT_ACTION_NEW_RIDE_OF_TYPE); intent.putExtra(INTENT_EXTRA_RIDE_TYPE, item.baseRideType); intent.putExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX, item.entryIndex); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } auto intent = Intent(INTENT_ACTION_NEW_SCENERY); intent.putExtra(INTENT_EXTRA_SCENERY_GROUP_ENTRY_INDEX, item.entryIndex); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case News::ItemType::Peeps: @@ -407,14 +407,14 @@ void News::OpenSubject(News::ItemType type, int32_t subject) auto intent = Intent(WindowClass::GuestList); intent.putExtra(INTENT_EXTRA_GUEST_LIST_FILTER, static_cast(GuestListFilterType::GuestsThinkingX)); intent.putExtra(INTENT_EXTRA_RIDE_ID, subject); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } case News::ItemType::Award: - context_open_window_view(WV_PARK_AWARDS); + ContextOpenWindowView(WV_PARK_AWARDS); break; case News::ItemType::Graph: - context_open_window_view(WV_PARK_RATING); + ContextOpenWindowView(WV_PARK_RATING); break; case News::ItemType::Null: case News::ItemType::Blank: @@ -437,7 +437,7 @@ void News::DisableNewsItems(News::ItemType type, uint32_t assoc) if (&newsItem == &gNewsItems.Current()) { auto intent = Intent(INTENT_ACTION_INVALIDATE_TICKER_NEWS); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } }); diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index c97ffc9ca0..04938821a0 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -566,7 +566,7 @@ void NetworkBase::UpdateClient() auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_resolving }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); - context_open_intent(&intent); + ContextOpenIntent(&intent); } break; } @@ -581,7 +581,7 @@ void NetworkBase::UpdateClient() auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_connecting }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); - context_open_intent(&intent); + ContextOpenIntent(&intent); server_connect_time = Platform::GetTicks(); } @@ -598,7 +598,7 @@ void NetworkBase::UpdateClient() auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_authenticating }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); - context_open_intent(&intent); + ContextOpenIntent(&intent); break; } default: @@ -610,8 +610,8 @@ void NetworkBase::UpdateClient() } Close(); - context_force_close_window_by_class(WindowClass::NetworkStatus); - context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {}); + ContextForceCloseWindowByClass(WindowClass::NetworkStatus); + ContextShowError(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {}); break; } } @@ -624,7 +624,7 @@ void NetworkBase::UpdateClient() // Do not show disconnect message window when password window closed/canceled if (_serverConnection->AuthStatus == NetworkAuth::RequirePassword) { - context_force_close_window_by_class(WindowClass::NetworkStatus); + ContextForceCloseWindowByClass(WindowClass::NetworkStatus); } else { @@ -642,7 +642,7 @@ void NetworkBase::UpdateClient() auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_disconnected }); - context_open_intent(&intent); + ContextOpenIntent(&intent); } window_close_by_class(WindowClass::Multiplayer); Close(); @@ -794,7 +794,7 @@ bool NetworkBase::CheckDesynchronizaton() auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); - context_open_intent(&intent); + ContextOpenIntent(&intent); if (!gConfigNetwork.StayConnected) { @@ -2248,7 +2248,7 @@ void NetworkBase::Client_Handle_AUTH(NetworkConnection& connection, NetworkPacke connection.Disconnect(); break; case NetworkAuth::RequirePassword: - context_open_window_view(WV_NETWORK_PASSWORD); + ContextOpenWindowView(WV_NETWORK_PASSWORD); break; case NetworkAuth::UnknownKeyDisallowed: connection.SetLastDisconnectReason(STR_MULTIPLAYER_UNKNOWN_KEY_DISALLOWED); @@ -2325,7 +2325,7 @@ void NetworkBase::Client_Handle_OBJECTS_LIST(NetworkConnection& connection, Netw auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ objectListMsg }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); - context_open_intent(&intent); + ContextOpenIntent(&intent); uint8_t objectType{}; packet >> objectType; @@ -2462,7 +2462,7 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync }); - context_open_intent(&intent); + ContextOpenIntent(&intent); } } } @@ -2671,7 +2671,7 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti auto intent = Intent(WindowClass::NetworkStatus); intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_downloading_map }); intent.putExtra(INTENT_EXTRA_CALLBACK, []() -> void { ::GetContext()->GetNetwork().Close(); }); - context_open_intent(&intent); + ContextOpenIntent(&intent); std::memcpy(&chunk_buffer[offset], const_cast(static_cast(packet.Read(chunksize))), chunksize); if (offset + chunksize == size) @@ -2679,7 +2679,7 @@ void NetworkBase::Client_Handle_MAP([[maybe_unused]] NetworkConnection& connecti // Allow queue processing of game actions again. GameActions::ResumeQueue(); - context_force_close_window_by_class(WindowClass::NetworkStatus); + ContextForceCloseWindowByClass(WindowClass::NetworkStatus); game_unload_scripts(); game_notify_map_change(); @@ -3063,7 +3063,7 @@ void NetworkBase::Client_Handle_SHOWERROR([[maybe_unused]] NetworkConnection& co { StringId title, message; packet >> title >> message; - context_show_error(title, message, {}); + ContextShowError(title, message, {}); } void NetworkBase::Client_Handle_GROUPLIST([[maybe_unused]] NetworkConnection& connection, NetworkPacket& packet) diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index de777a633e..9a5eb9ce97 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -2326,7 +2326,7 @@ int32_t scenario_save(u8string_view path, int32_t flags) Formatter ft; ft.Add(e.what()); - context_show_error(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_STRING, ft); + ContextShowError(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_STRING, ft); gfx_invalidate_screen(); auto ctx = OpenRCT2::GetContext(); diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index ee812506ad..bf07e4440b 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -986,13 +986,13 @@ std::unique_ptr Ride::SaveToTrackDesign(TrackDesignState& tds) cons { if (!(lifecycle_flags & RIDE_LIFECYCLE_TESTED)) { - context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); return nullptr; } if (!ride_has_ratings(this)) { - context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {}); return nullptr; } @@ -1000,7 +1000,7 @@ std::unique_ptr Ride::SaveToTrackDesign(TrackDesignState& tds) cons auto errMessage = td->CreateTrackDesign(tds, *this); if (errMessage != STR_NONE) { - context_show_error(STR_CANT_SAVE_TRACK_DESIGN, errMessage, {}); + ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, errMessage, {}); return nullptr; } @@ -2390,7 +2390,7 @@ static void ride_track_set_map_tooltip(TileElement* tileElement) ride->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -2406,7 +2406,7 @@ static void ride_queue_banner_set_map_tooltip(TileElement* tileElement) ride->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -2430,7 +2430,7 @@ static void ride_station_set_map_tooltip(TileElement* tileElement) ride->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -2477,7 +2477,7 @@ static void ride_entrance_set_map_tooltip(TileElement* tileElement) ft.Add(queueLength); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } else { @@ -2497,7 +2497,7 @@ static void ride_entrance_set_map_tooltip(TileElement* tileElement) ft.Add(stationIndex.ToUnderlying() + 1); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } } @@ -5312,7 +5312,7 @@ void Ride::Crash(uint8_t vehicleIndex) // Open ride window for crashed vehicle auto intent = Intent(WD_VEHICLE); intent.putExtra(INTENT_EXTRA_VEHICLE, vehicle); - rct_window* w = context_open_intent(&intent); + rct_window* w = ContextOpenIntent(&intent); rct_viewport* viewport = window_get_viewport(w); if (w != nullptr && viewport != nullptr) diff --git a/src/openrct2/ride/RideAudio.cpp b/src/openrct2/ride/RideAudio.cpp index a3512b5eb6..ef546c0366 100644 --- a/src/openrct2/ride/RideAudio.cpp +++ b/src/openrct2/ride/RideAudio.cpp @@ -397,11 +397,11 @@ namespace OpenRCT2::RideAudio else { auto x2 = (viewport->pos.x + viewport->zoom.ApplyInversedTo(rotatedCoords.x - viewport->viewPos.x)) * 0x10000; - auto screenWidth = std::max(context_get_width(), 64); + auto screenWidth = std::max(ContextGetWidth(), 64); auto panX = ((x2 / screenWidth) - 0x8000) >> 4; auto y2 = (viewport->pos.y + viewport->zoom.ApplyInversedTo(rotatedCoords.y - viewport->viewPos.y)) * 0x10000; - auto screenHeight = std::max(context_get_height(), 64); + auto screenHeight = std::max(ContextGetHeight(), 64); auto panY = ((y2 / screenHeight) - 0x8000) >> 4; auto volX = CalculateVolume(panX); diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 7e28446e40..9c8896df72 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -97,20 +97,20 @@ static int32_t ride_check_if_construction_allowed(Ride* ride) rct_ride_entry* rideEntry = ride->GetRideEntry(); if (rideEntry == nullptr) { - context_show_error(STR_INVALID_RIDE_TYPE, STR_CANT_EDIT_INVALID_RIDE_TYPE, ft); + ContextShowError(STR_INVALID_RIDE_TYPE, STR_CANT_EDIT_INVALID_RIDE_TYPE, ft); return 0; } if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) { ride->FormatNameTo(ft); - context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING, ft); + ContextShowError(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING, ft); return 0; } if (ride->status != RideStatus::Closed && ride->status != RideStatus::Simulating) { ride->FormatNameTo(ft); - context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST, ft); + ContextShowError(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST, ft); return 0; } @@ -971,7 +971,7 @@ static bool ride_modify_maze(const CoordsXYE& tileElement) gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); return true; } } @@ -1003,7 +1003,7 @@ bool ride_modify(const CoordsXYE& input) { Formatter ft; ride->FormatNameTo(ft); - context_show_error( + ContextShowError( STR_CANT_START_CONSTRUCTION_ON, STR_LOCAL_AUTHORITY_FORBIDS_DEMOLITION_OR_MODIFICATIONS_TO_THIS_RIDE, ft); return false; } diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 35819e4738..16664f51f6 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -96,7 +96,7 @@ void track_design_save_select_tile_element( auto result = track_design_save_add_tile_element(interactionType, loc, tileElement); if (!result.IsSuccess) { - context_show_error(STR_SAVE_TRACK_SCENERY_UNABLE_TO_SELECT_ADDITIONAL_ITEM_OF_SCENERY, result.Message, {}); + ContextShowError(STR_SAVE_TRACK_SCENERY_UNABLE_TO_SELECT_ADDITIONAL_ITEM_OF_SCENERY, result.Message, {}); } } } diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 4e552b796f..f86b989254 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -856,7 +856,7 @@ OpenRCT2::Audio::VehicleSoundParams Vehicle::CreateSoundParam(uint16_t priority) panX = g_music_tracking_viewport->zoom.ApplyInversedTo(panX); panX += g_music_tracking_viewport->pos.x; - uint16_t screenWidth = context_get_width(); + uint16_t screenWidth = ContextGetWidth(); if (screenWidth < 64) { screenWidth = 64; @@ -867,7 +867,7 @@ OpenRCT2::Audio::VehicleSoundParams Vehicle::CreateSoundParam(uint16_t priority) panY = g_music_tracking_viewport->zoom.ApplyInversedTo(panY); panY += g_music_tracking_viewport->pos.y; - uint16_t screenHeight = context_get_height(); + uint16_t screenHeight = ContextGetHeight(); if (screenHeight < 64) { screenHeight = 64; @@ -5219,7 +5219,7 @@ void Vehicle::KillPassengers(Ride* curRide) { decrement_guests_in_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } peep_sprite_remove(curPeep); } @@ -5705,7 +5705,7 @@ void Vehicle::SetMapToolbar() const curRide->FormatStatusTo(ft); auto intent = Intent(INTENT_ACTION_SET_MAP_TOOLTIP); intent.putExtra(INTENT_EXTRA_FORMATTER, &ft); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -9152,7 +9152,7 @@ void Vehicle::InvalidateWindow() { auto intent = Intent(INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW); intent.putExtra(INTENT_EXTRA_VEHICLE, this); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } void Vehicle::UpdateCrossings() const diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index ff7fa97132..00374bad0e 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -94,7 +94,7 @@ void scenario_begin() scenario_reset(); if (gScenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen) - context_open_window_view(WV_PARK_OBJECTIVE); + ContextOpenWindowView(WV_PARK_OBJECTIVE); gScreenAge = 0; } @@ -191,7 +191,7 @@ static void scenario_end() game_reset_speed(); window_close_by_class(WindowClass::Dropdown); window_close_all_except_flags(WF_STICK_TO_BACK | WF_STICK_TO_FRONT); - context_open_window_view(WV_PARK_OBJECTIVE); + ContextOpenWindowView(WV_PARK_OBJECTIVE); } /** @@ -321,7 +321,7 @@ static void scenario_day_update() gParkRatingCasualtyPenalty = std::max(0, gParkRatingCasualtyPenalty - casualtyPenaltyModifier); auto intent = Intent(INTENT_ACTION_UPDATE_DATE); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } static void scenario_week_update() diff --git a/src/openrct2/scripting/bindings/world/ScPark.cpp b/src/openrct2/scripting/bindings/world/ScPark.cpp index 91d6b68317..629e187c61 100644 --- a/src/openrct2/scripting/bindings/world/ScPark.cpp +++ b/src/openrct2/scripting/bindings/world/ScPark.cpp @@ -56,7 +56,7 @@ namespace OpenRCT2::Scripting { gCash = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -73,7 +73,7 @@ namespace OpenRCT2::Scripting { gParkRating = std::min(std::max(0, value), 999); auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -89,7 +89,7 @@ namespace OpenRCT2::Scripting { gBankLoan = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -105,7 +105,7 @@ namespace OpenRCT2::Scripting { gMaxBankLoan = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -171,7 +171,7 @@ namespace OpenRCT2::Scripting { gParkValue = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -187,7 +187,7 @@ namespace OpenRCT2::Scripting { gCompanyValue = value; auto intent = Intent(INTENT_ACTION_UPDATE_CASH); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 1ca091e7ea..5a95c3c095 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -131,7 +131,7 @@ void TitleScreen::Load() OpenRCT2::Audio::StopAll(); GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE); viewport_init_all(); - context_open_window(WindowClass::MainWindow); + ContextOpenWindow(WindowClass::MainWindow); CreateWindows(); TitleInitialise(); OpenRCT2::Audio::PlayTitleMusic(); @@ -139,7 +139,7 @@ void TitleScreen::Load() if (gOpenRCT2ShowChangelog) { gOpenRCT2ShowChangelog = false; - context_open_window(WindowClass::Changelog); + ContextOpenWindow(WindowClass::Changelog); } if (_sequencePlayer != nullptr) @@ -182,12 +182,12 @@ void TitleScreen::Tick() input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, false); - context_update_map_tooltip(); + ContextUpdateMapTooltip(); window_dispatch_update_all(); gSavedAge++; - context_handle_input(); + ContextHandleInput(); gInUpdateCode = false; } @@ -215,11 +215,11 @@ void TitleScreen::ChangePresetSequence(size_t preset) */ void TitleScreen::CreateWindows() { - context_open_window(WindowClass::TitleMenu); - context_open_window(WindowClass::TitleExit); - context_open_window(WindowClass::TitleOptions); - context_open_window(WindowClass::TitleLogo); - window_resize_gui(context_get_width(), context_get_height()); + ContextOpenWindow(WindowClass::TitleMenu); + ContextOpenWindow(WindowClass::TitleExit); + ContextOpenWindow(WindowClass::TitleOptions); + ContextOpenWindow(WindowClass::TitleLogo); + window_resize_gui(ContextGetWidth(), ContextGetHeight()); _hideVersionInfo = false; } diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index 17f96b3b64..e3d2bb5545 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -120,7 +120,7 @@ money32 place_provisional_track_piece( static std::tuple window_ride_construction_update_state_get_track_element() { auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_PIECES); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); uint8_t startSlope = _previousTrackSlopeEnd; uint8_t endSlope = _currentTrackSlopeEnd; @@ -397,7 +397,7 @@ bool window_ride_construction_update_state( void window_ride_construction_update_active_elements() { auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_ACTIVE_ELEMENTS); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } /** @@ -418,11 +418,11 @@ bool scenery_tool_is_active() void SceneryInit() { auto intent = Intent(INTENT_ACTION_INIT_SCENERY); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } void ScenerySetDefaultPlacementConfiguration() { auto intent = Intent(INTENT_ACTION_SET_DEFAULT_SCENERY_CONFIG); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index 3c75df8bd4..0adbba936f 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -132,7 +132,7 @@ void ClimateUpdate() if (gClimateUpdateTimer == 960) { auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } gClimateUpdateTimer--; } @@ -151,7 +151,7 @@ void ClimateUpdate() gClimateCurrent.Weather = gClimateNext.Weather; ClimateDetermineFutureWeather(scenario_rand()); auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } else if (gClimateNext.Level <= WeatherLevel::Heavy) { @@ -170,7 +170,7 @@ void ClimateUpdate() { gClimateCurrent.Temperature = ClimateStepWeatherLevel(gClimateCurrent.Temperature, gClimateNext.Temperature); auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } } diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 70422cd559..f84f7beadb 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -203,7 +203,7 @@ std::vector GetReorganisedTileElementsWithoutGhosts() static void ReorganiseTileElements(size_t capacity) { - context_setcurrentcursor(CursorID::ZZZ); + ContextSetCurrentCursor(CursorID::ZZZ); std::vector newElements; newElements.reserve(std::max(MIN_TILE_ELEMENTS, capacity)); @@ -448,7 +448,7 @@ void MapInit(const TileCoordsXY& size) MapAnimationAutoCreate(); auto intent = Intent(INTENT_ACTION_MAP); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } /** @@ -1363,7 +1363,7 @@ void MapRemoveProvisionalElements() if ((network_get_mode() != NETWORK_MODE_NONE) && window_find_by_class(WindowClass::TrackDesignPlace) != nullptr) { auto intent = Intent(INTENT_ACTION_TRACK_DESIGN_REMOVE_PROVISIONAL); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } @@ -1388,7 +1388,7 @@ void MapRestoreProvisionalElements() if ((network_get_mode() != NETWORK_MODE_NONE) && window_find_by_class(WindowClass::TrackDesignPlace) != nullptr) { auto intent = Intent(INTENT_ACTION_TRACK_DESIGN_RESTORE_PROVISIONAL); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } } diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index 8800886f6a..645e4ab23d 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -693,7 +693,7 @@ bool MapGenLoadHeightmap(const utf8* path) auto height = std::min(image.Height, MAXIMUM_MAP_SIZE_PRACTICAL); if (width != image.Width || height != image.Height) { - context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_HEIHGT_MAP_TOO_BIG, {}); + ContextShowError(STR_HEIGHT_MAP_ERROR, STR_ERROR_HEIHGT_MAP_TOO_BIG, {}); } // Allocate memory for the height map values, one byte pixel @@ -722,10 +722,10 @@ bool MapGenLoadHeightmap(const utf8* path) switch (format) { case IMAGE_FORMAT::BITMAP: - context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_BITMAP, {}); + ContextShowError(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_BITMAP, {}); break; case IMAGE_FORMAT::PNG_32: - context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_PNG, {}); + ContextShowError(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_PNG, {}); break; default: log_error("Unable to load height map image: %s", e.what()); @@ -829,7 +829,7 @@ void MapGenGenerateFromHeightmap(mapgen_settings* settings) if (minValue == maxValue) { - context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_CANNOT_NORMALIZE, {}); + ContextShowError(STR_HEIGHT_MAP_ERROR, STR_ERROR_CANNOT_NORMALIZE, {}); return; } } diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 21a919e9ce..d497728742 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -183,7 +183,7 @@ void ParkSetForcedRating(int32_t rating) auto& park = GetContext()->GetGameState()->GetPark(); gParkRating = park.CalculateParkRating(); auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } int32_t ParkGetForcedRating() @@ -325,7 +325,7 @@ void Park::Update(const Date& date) window_invalidate_by_class(WindowClass::Finances); auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); } // Every ~102 seconds @@ -773,7 +773,7 @@ void Park::UpdateHistories() // Invalidate relevant windows auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); - context_broadcast_intent(&intent); + ContextBroadcastIntent(&intent); window_invalidate_by_class(WindowClass::ParkInformation); window_invalidate_by_class(WindowClass::Finances); }