mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 05:53:02 +01:00
Rename ViewportInitAll to ContextResetSubsystems (#25690)
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "Game.h"
|
||||
#include "GameState.h"
|
||||
#include "GameStateSnapshots.h"
|
||||
#include "Input.h"
|
||||
#include "OpenRCT2.h"
|
||||
#include "ParkImporter.h"
|
||||
#include "PlatformEnvironment.h"
|
||||
@@ -42,6 +43,7 @@
|
||||
#include "drawing/Image.h"
|
||||
#include "drawing/LightFX.h"
|
||||
#include "entity/EntityTweener.h"
|
||||
#include "entity/PatrolArea.h"
|
||||
#include "interface/Chat.h"
|
||||
#include "interface/StdInOutConsole.h"
|
||||
#include "interface/Viewport.h"
|
||||
@@ -72,6 +74,7 @@
|
||||
#include "ui/UiContext.h"
|
||||
#include "ui/WindowManager.h"
|
||||
#include "world/MapAnimation.h"
|
||||
#include "world/MapSelection.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
@@ -533,9 +536,8 @@ namespace OpenRCT2
|
||||
Drawing::LightFx::Init();
|
||||
}
|
||||
|
||||
ViewportInitAll();
|
||||
|
||||
ContextInit();
|
||||
ResetSubsystems();
|
||||
|
||||
if (!gOpenRCT2Headless)
|
||||
{
|
||||
@@ -555,6 +557,28 @@ namespace OpenRCT2
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* rct2: 0x006E6EAC
|
||||
*/
|
||||
void ResetSubsystems() override
|
||||
{
|
||||
if (!gOpenRCT2NoGraphics)
|
||||
{
|
||||
ColoursInitMaps();
|
||||
}
|
||||
|
||||
WindowInitAll();
|
||||
|
||||
gInputFlags.clearAll();
|
||||
InputSetState(InputState::Reset);
|
||||
gPressedWidget.windowClassification = WindowClass::null;
|
||||
gPickupPeepImage = ImageId();
|
||||
ResetTooltipNotShown();
|
||||
gMapSelectFlags.clearAll();
|
||||
ClearPatrolAreaToRender();
|
||||
TextinputCancel();
|
||||
}
|
||||
|
||||
private:
|
||||
void InitialiseRepositories()
|
||||
{
|
||||
@@ -1600,6 +1624,11 @@ namespace OpenRCT2
|
||||
GetWindowManager()->Init();
|
||||
}
|
||||
|
||||
void ContextResetSubsystems()
|
||||
{
|
||||
GetContext()->ResetSubsystems();
|
||||
}
|
||||
|
||||
bool ContextLoadParkFromStream(void* stream)
|
||||
{
|
||||
return GetContext()->LoadParkFromStream(static_cast<IStream*>(stream), "");
|
||||
|
||||
@@ -119,6 +119,8 @@ namespace OpenRCT2
|
||||
virtual int32_t RunOpenRCT2(int argc, const char** argv) = 0;
|
||||
|
||||
virtual bool Initialise() = 0;
|
||||
virtual void ResetSubsystems() = 0;
|
||||
|
||||
virtual void InitialiseDrawingEngine() = 0;
|
||||
virtual void DisposeDrawingEngine() = 0;
|
||||
|
||||
@@ -151,6 +153,7 @@ namespace OpenRCT2
|
||||
[[nodiscard]] IContext* GetContext();
|
||||
|
||||
void ContextInit();
|
||||
void ContextResetSubsystems();
|
||||
void ContextSetCurrentCursor(CursorID cursor);
|
||||
void ContextUpdateCursorScale();
|
||||
void ContextHideCursor();
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "entity/Guest.h"
|
||||
#include "entity/PatrolArea.h"
|
||||
#include "entity/Staff.h"
|
||||
#include "interface/Viewport.h"
|
||||
#include "interface/WindowBase.h"
|
||||
#include "localisation/LocalisationService.h"
|
||||
#include "management/Finance.h"
|
||||
@@ -118,7 +117,7 @@ namespace OpenRCT2::Editor
|
||||
gameState.park.flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
gameState.scenarioOptions.category = Scenario::Category::other;
|
||||
ObjectListLoad();
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
WindowBase* mainWindow = OpenEditorWindows();
|
||||
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
||||
LoadPalette();
|
||||
@@ -161,7 +160,7 @@ namespace OpenRCT2::Editor
|
||||
gLegacyScene = LegacyScene::scenarioEditor;
|
||||
gameState.editorStep = EditorStep::OptionsSelection;
|
||||
gameState.scenarioOptions.category = Scenario::Category::other;
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
OpenEditorWindows();
|
||||
FinaliseMainView();
|
||||
gScreenAge = 0;
|
||||
@@ -195,7 +194,7 @@ namespace OpenRCT2::Editor
|
||||
gameState.editorStep = EditorStep::ObjectSelection;
|
||||
SetAllLandOwned();
|
||||
ObjectListLoad();
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
WindowBase* mainWindow = OpenEditorWindows();
|
||||
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
||||
LoadPalette();
|
||||
@@ -223,7 +222,7 @@ namespace OpenRCT2::Editor
|
||||
SetAllLandOwned();
|
||||
gameState.editorStep = EditorStep::ObjectSelection;
|
||||
ObjectListLoad();
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
WindowBase* mainWindow = OpenEditorWindows();
|
||||
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
||||
LoadPalette();
|
||||
@@ -263,7 +262,7 @@ namespace OpenRCT2::Editor
|
||||
getGameState().editorStep = EditorStep::LandscapeEditor;
|
||||
gScreenAge = 0;
|
||||
gLegacyScene = LegacyScene::scenarioEditor;
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
OpenEditorWindows();
|
||||
FinaliseMainView();
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ void GameLoadInit()
|
||||
|
||||
if (!gLoadKeepWindowsOpen)
|
||||
{
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
GameCreateWindows();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "../Diagnostic.h"
|
||||
#include "../Game.h"
|
||||
#include "../GameState.h"
|
||||
#include "../Input.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Guard.hpp"
|
||||
@@ -24,7 +23,6 @@
|
||||
#include "../drawing/Rectangle.h"
|
||||
#include "../entity/EntityList.h"
|
||||
#include "../entity/Guest.h"
|
||||
#include "../entity/PatrolArea.h"
|
||||
#include "../entity/Staff.h"
|
||||
#include "../interface/Cursors.h"
|
||||
#include "../object/LargeSceneryEntry.h"
|
||||
@@ -39,7 +37,6 @@
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../world/Climate.h"
|
||||
#include "../world/Map.h"
|
||||
#include "../world/MapSelection.h"
|
||||
#include "../world/tile_element/LargeSceneryElement.h"
|
||||
#include "../world/tile_element/SmallSceneryElement.h"
|
||||
#include "../world/tile_element/TileElement.h"
|
||||
@@ -90,31 +87,6 @@ namespace OpenRCT2
|
||||
static void ViewportUpdateSmartFollowVehicle(WindowBase* window);
|
||||
static void ViewportInvalidate(const Viewport* viewport, const ScreenRect& screenRect);
|
||||
|
||||
/**
|
||||
* This is not a viewport function. It is used to setup many variables for
|
||||
* multiple things.
|
||||
* rct2: 0x006E6EAC
|
||||
*/
|
||||
void ViewportInitAll()
|
||||
{
|
||||
if (!gOpenRCT2NoGraphics)
|
||||
{
|
||||
ColoursInitMaps();
|
||||
}
|
||||
|
||||
WindowInitAll();
|
||||
|
||||
// ?
|
||||
gInputFlags.clearAll();
|
||||
InputSetState(InputState::Reset);
|
||||
gPressedWidget.windowClassification = WindowClass::null;
|
||||
gPickupPeepImage = ImageId();
|
||||
ResetTooltipNotShown();
|
||||
gMapSelectFlags.clearAll();
|
||||
ClearPatrolAreaToRender();
|
||||
TextinputCancel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts between 3d point of a sprite to 2d coordinates for centring on that
|
||||
* sprite
|
||||
|
||||
@@ -183,7 +183,6 @@ namespace OpenRCT2
|
||||
// rct2: 0x014234BC
|
||||
extern Viewport* gMusicTrackingViewport;
|
||||
|
||||
void ViewportInitAll();
|
||||
std::optional<ScreenCoordsXY> centre2dCoordinates(const CoordsXYZ& loc, Viewport* viewport);
|
||||
void ViewportCreate(WindowBase& w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus);
|
||||
void ViewportRemove(Viewport* viewport);
|
||||
|
||||
@@ -37,7 +37,7 @@ void PreloaderScene::Load()
|
||||
|
||||
gLegacyScene = LegacyScene::playing;
|
||||
gameStateInitAll(getGameState(), kDefaultMapSize);
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
ContextOpenWindow(WindowClass::mainWindow);
|
||||
WindowSetFlagForAllViewports(VIEWPORT_FLAG_RENDERING_INHIBITED, true);
|
||||
WindowResizeGui(ContextGetWidth(), ContextGetHeight());
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "../../core/Console.hpp"
|
||||
#include "../../drawing/Text.h"
|
||||
#include "../../interface/Screenshot.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../network/Network.h"
|
||||
#include "../../network/NetworkBase.h"
|
||||
#include "../../scenario/ScenarioRepository.h"
|
||||
@@ -107,7 +106,7 @@ void TitleScene::Load()
|
||||
GetContext().GetNetwork().Close();
|
||||
#endif
|
||||
gameStateInitAll(getGameState(), kDefaultMapSize);
|
||||
ViewportInitAll();
|
||||
ContextResetSubsystems();
|
||||
ContextOpenWindow(WindowClass::mainWindow);
|
||||
|
||||
TitleInitialise();
|
||||
|
||||
Reference in New Issue
Block a user