From a73df7e376bfa52b3e70461f1b81940fbb904a9f Mon Sep 17 00:00:00 2001 From: Duncan Date: Tue, 7 Jun 2022 08:26:58 +0100 Subject: [PATCH] Remove Editor Main (#17348) * Remove editor main window * Remove editor main completely * Update src/openrct2/Editor.cpp Co-authored-by: Hielke Morsink Co-authored-by: Hielke Morsink --- src/openrct2-ui/WindowManager.cpp | 2 - src/openrct2-ui/libopenrct2ui.vcxproj | 3 +- src/openrct2-ui/windows/EditorMain.cpp | 66 -------------------------- src/openrct2/Editor.cpp | 24 ++++++---- src/openrct2/interface/Window.h | 1 - 5 files changed, 17 insertions(+), 79 deletions(-) delete mode 100644 src/openrct2-ui/windows/EditorMain.cpp diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 14a7594dce..0db2c86057 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -167,8 +167,6 @@ public: return WindowNetworkStatusOpenPassword(); case WV_EDITOR_BOTTOM_TOOLBAR: return WindowEditorBottomToolbarOpen(); - case WV_EDITOR_MAIN: - return WindowEditorMainOpen(); case WV_CHANGELOG: return WindowChangelogOpen(WV_CHANGELOG); case WV_NEW_VERSION_INFO: diff --git a/src/openrct2-ui/libopenrct2ui.vcxproj b/src/openrct2-ui/libopenrct2ui.vcxproj index 585572a032..d4c27ae45d 100644 --- a/src/openrct2-ui/libopenrct2ui.vcxproj +++ b/src/openrct2-ui/libopenrct2ui.vcxproj @@ -140,7 +140,6 @@ - @@ -229,4 +228,4 @@ - + \ No newline at end of file diff --git a/src/openrct2-ui/windows/EditorMain.cpp b/src/openrct2-ui/windows/EditorMain.cpp deleted file mode 100644 index 80e01505d6..0000000000 --- a/src/openrct2-ui/windows/EditorMain.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014-2020 OpenRCT2 developers - * - * For a complete list of all authors, please refer to contributors.md - * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 - * - * OpenRCT2 is licensed under the GNU General Public License version 3. - *****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -static void WindowEditorMainPaint(rct_window* w, rct_drawpixelinfo* dpi); - -// clang-format off -static rct_window_event_list window_editor_main_events([](auto& events) { - events.paint = &WindowEditorMainPaint; -}); -// clang-format on - -static rct_widget window_editor_main_widgets[] = { - MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::Viewport, WindowColour::Primary, STR_VIEWPORT), - WIDGETS_END, -}; - -/** - * Creates the main editor window that holds the main viewport. - * rct2: 0x0066EF38 - */ -rct_window* WindowEditorMainOpen() -{ - window_editor_main_widgets[0].right = context_get_width(); - window_editor_main_widgets[0].bottom = context_get_height(); - rct_window* window = WindowCreate( - ScreenCoordsXY(0, 0), window_editor_main_widgets[0].right, window_editor_main_widgets[0].bottom, - &window_editor_main_events, WC_MAIN_WINDOW, WF_STICK_TO_BACK); - window->widgets = window_editor_main_widgets; - - viewport_create(window, window->windowPos, window->width, window->height, Focus(CoordsXYZ(0x0FFF, 0x0FFF, 0))); - window->viewport->flags |= 0x0400; - - gCurrentRotation = 0; - gShowGridLinesRefCount = 0; - gShowLandRightsRefCount = 0; - gShowConstuctionRightsRefCount = 0; - WindowFootpathResetSelectedPath(); - - context_open_window(WC_TOP_TOOLBAR); - context_open_window_view(WV_EDITOR_BOTTOM_TOOLBAR); - - return window_get_main(); -} - -/** - * - * rct2: 0x0066FC97 - * This function immediately jumps to 0x00685BE1 - */ -static void WindowEditorMainPaint(rct_window* w, rct_drawpixelinfo* dpi) -{ - viewport_render(dpi, w->viewport, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } }); -} diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index fa639cbc58..457d5f8d41 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -89,6 +89,14 @@ namespace Editor } } + static rct_window* OpenEditorWindows() + { + auto* main = context_open_window(WC_MAIN_WINDOW); + context_open_window(WC_TOP_TOOLBAR); + context_open_window_view(WV_EDITOR_BOTTOM_TOOLBAR); + return main; + } + /** * * rct2: 0x0066FFE1 @@ -103,7 +111,7 @@ namespace Editor gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; gScenarioCategory = SCENARIO_CATEGORY_OTHER; viewport_init_all(); - rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); + rct_window* mainWindow = OpenEditorWindows(); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); load_palette(); gScreenAge = 0; @@ -142,7 +150,7 @@ namespace Editor gEditorStep = EditorStep::ObjectiveSelection; gScenarioCategory = SCENARIO_CATEGORY_OTHER; viewport_init_all(); - context_open_window_view(WV_EDITOR_MAIN); + OpenEditorWindows(); FinaliseMainView(); gScreenAge = 0; } @@ -163,7 +171,7 @@ namespace Editor SetAllLandOwned(); gEditorStep = EditorStep::ObjectSelection; viewport_init_all(); - rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); + rct_window* mainWindow = OpenEditorWindows(); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); load_palette(); } @@ -184,7 +192,7 @@ namespace Editor SetAllLandOwned(); gEditorStep = EditorStep::ObjectSelection; viewport_init_all(); - rct_window* mainWindow = context_open_window_view(WV_EDITOR_MAIN); + rct_window* mainWindow = OpenEditorWindows(); mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ()); load_palette(); } @@ -246,7 +254,7 @@ namespace Editor gScreenAge = 0; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; viewport_init_all(); - context_open_window_view(WV_EDITOR_MAIN); + OpenEditorWindows(); FinaliseMainView(); return true; } @@ -260,7 +268,7 @@ namespace Editor gScreenAge = 0; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; viewport_init_all(); - context_open_window_view(WV_EDITOR_MAIN); + OpenEditorWindows(); FinaliseMainView(); return true; } @@ -290,7 +298,7 @@ namespace Editor gScreenAge = 0; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; viewport_init_all(); - context_open_window_view(WV_EDITOR_MAIN); + OpenEditorWindows(); FinaliseMainView(); return true; } @@ -311,7 +319,7 @@ namespace Editor gScreenAge = 0; gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR; viewport_init_all(); - context_open_window_view(WV_EDITOR_MAIN); + OpenEditorWindows(); FinaliseMainView(); return true; } diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 12d29cab80..d0f6b4a2d6 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -485,7 +485,6 @@ enum WV_MAZE_CONSTRUCTION, WV_NETWORK_PASSWORD, WV_EDITOR_BOTTOM_TOOLBAR, - WV_EDITOR_MAIN, WV_CHANGELOG, WV_NEW_VERSION_INFO, };