From e1ee7ceb9cebad78bdda03be884df1ab1baab35d Mon Sep 17 00:00:00 2001 From: Jaredl-Dev <260281143+Jaredl-Dev@users.noreply.github.com> Date: Thu, 6 Aug 2026 22:24:17 -0700 Subject: [PATCH 1/2] unify(shell): Merge Shell from Zero Hour (#3070) --- .../Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp | 5 +++++ Generals/Code/Main/CMakeLists.txt | 2 ++ Generals/Code/Tools/GUIEdit/CMakeLists.txt | 2 ++ Generals/Code/Tools/WorldBuilder/CMakeLists.txt | 2 ++ 4 files changed, 11 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 909e27a0e21..16a42b692a5 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -514,8 +514,13 @@ void Shell::showShell( Bool runInit ) if (!TheGlobalData->m_shellMapOn && m_screenCount == 0) + { +#ifdef RTS_PROFILE_LEGACY + Profile::StopRange("init"); +#endif //else push( "Menus/MainMenu.wnd" ); + } m_isShellActive = TRUE; } diff --git a/Generals/Code/Main/CMakeLists.txt b/Generals/Code/Main/CMakeLists.txt index f40c7434bdf..1740b3c28e6 100644 --- a/Generals/Code/Main/CMakeLists.txt +++ b/Generals/Code/Main/CMakeLists.txt @@ -10,6 +10,8 @@ endif() target_link_libraries(g_generals PRIVATE binkstub comctl32 + core_debug + core_profile_legacy d3d8 d3dx8 dinput8 diff --git a/Generals/Code/Tools/GUIEdit/CMakeLists.txt b/Generals/Code/Tools/GUIEdit/CMakeLists.txt index 1fefa4bb91f..901619e8d52 100644 --- a/Generals/Code/Tools/GUIEdit/CMakeLists.txt +++ b/Generals/Code/Tools/GUIEdit/CMakeLists.txt @@ -47,6 +47,8 @@ target_include_directories(g_guiedit PRIVATE target_link_libraries(g_guiedit PRIVATE comctl32 + core_debug + core_profile_legacy d3d8lib g_gameengine g_gameenginedevice diff --git a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt index 1a65bb55d3d..31024fea84a 100644 --- a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt +++ b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt @@ -211,6 +211,8 @@ target_precompile_headers(g_worldbuilder PRIVATE ) target_link_libraries(g_worldbuilder PRIVATE + core_debug + core_profile_legacy d3d8lib core_browserdispatch g_gameengine From 94e9145490b20a071ee1b250da5e488ccf3da884 Mon Sep 17 00:00:00 2001 From: Jaredl-Dev <260281143+Jaredl-Dev@users.noreply.github.com> Date: Thu, 6 Aug 2026 22:28:38 -0700 Subject: [PATCH 2/2] unify(shell): Move Shell to Core (#3070) --- Core/GameEngine/CMakeLists.txt | 11 +- .../GameEngine/Include/GameClient/Shell.h | 0 .../Include/GameClient/ShellHooks.h | 0 .../Include/GameClient/ShellMenuScheme.h | 0 .../Source/GameClient/GUI/Shell/Shell.cpp | 0 .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 0 Core/Libraries/Source/profile/CMakeLists.txt | 1 + Generals/Code/GameEngine/CMakeLists.txt | 10 +- .../GameEngine/Include/GameClient/Shell.h | 205 ---- .../Include/GameClient/ShellHooks.h | 81 -- .../Include/GameClient/ShellMenuScheme.h | 152 --- .../Source/GameClient/GUI/Shell/Shell.cpp | 898 ------------------ .../GameClient/GUI/Shell/ShellMenuScheme.cpp | 323 ------- Generals/Code/Main/CMakeLists.txt | 2 - Generals/Code/Tools/GUIEdit/CMakeLists.txt | 2 - .../Code/Tools/WorldBuilder/CMakeLists.txt | 2 - GeneralsMD/Code/GameEngine/CMakeLists.txt | 10 +- GeneralsMD/Code/Main/CMakeLists.txt | 2 - GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt | 2 - .../Code/Tools/WorldBuilder/CMakeLists.txt | 2 - scripts/cpp/unify_move_files.py | 6 + 21 files changed, 23 insertions(+), 1686 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/Shell.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/ShellHooks.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/ShellMenuScheme.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp (100%) delete mode 100644 Generals/Code/GameEngine/Include/GameClient/Shell.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/ShellHooks.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/ShellMenuScheme.h delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 0f36ff63383..0b48d20c4eb 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -220,9 +220,9 @@ set(GAMEENGINE_SRC Include/GameClient/SelectionInfo.h Include/GameClient/SelectionXlat.h # Include/GameClient/Shadow.h -# Include/GameClient/Shell.h -# Include/GameClient/ShellHooks.h -# Include/GameClient/ShellMenuScheme.h + Include/GameClient/Shell.h + Include/GameClient/ShellHooks.h + Include/GameClient/ShellMenuScheme.h Include/GameClient/Smudge.h Include/GameClient/Snow.h Include/GameClient/Statistics.h @@ -799,8 +799,8 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/IMEManager.cpp Source/GameClient/GUI/LoadScreen.cpp Source/GameClient/GUI/ProcessAnimateWindow.cpp -# Source/GameClient/GUI/Shell/Shell.cpp -# Source/GameClient/GUI/Shell/ShellMenuScheme.cpp + Source/GameClient/GUI/Shell/Shell.cpp + Source/GameClient/GUI/Shell/ShellMenuScheme.cpp Source/GameClient/GUI/WindowLayout.cpp Source/GameClient/GUI/WindowVideoManager.cpp Source/GameClient/GUI/WinInstanceData.cpp @@ -1179,6 +1179,7 @@ target_include_directories(corei_gameengine_private INTERFACE target_link_libraries(corei_gameengine_private INTERFACE corei_always + core_profile_legacy ) target_compile_definitions(corei_gameengine_private INTERFACE diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h b/Core/GameEngine/Include/GameClient/Shell.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h rename to Core/GameEngine/Include/GameClient/Shell.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h b/Core/GameEngine/Include/GameClient/ShellHooks.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h rename to Core/GameEngine/Include/GameClient/ShellHooks.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellMenuScheme.h b/Core/GameEngine/Include/GameClient/ShellMenuScheme.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ShellMenuScheme.h rename to Core/GameEngine/Include/GameClient/ShellMenuScheme.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Core/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp rename to Core/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Core/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp rename to Core/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp diff --git a/Core/Libraries/Source/profile/CMakeLists.txt b/Core/Libraries/Source/profile/CMakeLists.txt index b0db6bd2dc9..0bdbb3c0fc1 100644 --- a/Core/Libraries/Source/profile/CMakeLists.txt +++ b/Core/Libraries/Source/profile/CMakeLists.txt @@ -32,6 +32,7 @@ target_precompile_headers(core_profile_legacy PRIVATE ) target_link_libraries(core_profile_legacy PRIVATE + core_debug core_wwcommon corei_always ) diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 138424cf0d3..0db74569602 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -205,9 +205,9 @@ set(GAMEENGINE_SRC # Include/GameClient/SelectionInfo.h # Include/GameClient/SelectionXlat.h Include/GameClient/Shadow.h - Include/GameClient/Shell.h - Include/GameClient/ShellHooks.h - Include/GameClient/ShellMenuScheme.h +# Include/GameClient/Shell.h +# Include/GameClient/ShellHooks.h +# Include/GameClient/ShellMenuScheme.h # Include/GameClient/Statistics.h # Include/GameClient/TerrainRoads.h # Include/GameClient/TerrainVisual.h @@ -741,8 +741,8 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/IMEManager.cpp # Source/GameClient/GUI/LoadScreen.cpp # Source/GameClient/GUI/ProcessAnimateWindow.cpp - Source/GameClient/GUI/Shell/Shell.cpp - Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +# Source/GameClient/GUI/Shell/Shell.cpp +# Source/GameClient/GUI/Shell/ShellMenuScheme.cpp # Source/GameClient/GUI/WindowLayout.cpp # Source/GameClient/GUI/WindowVideoManager.cpp # Source/GameClient/GUI/WinInstanceData.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/Shell.h b/Generals/Code/GameEngine/Include/GameClient/Shell.h deleted file mode 100644 index 9c5c75fbed3..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Shell.h +++ /dev/null @@ -1,205 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Shell.h ////////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, September 2001 -// Description: Shell menu representations -// -// Using The Shell: -// ---------------- -// -// The Shell makes use of the window layouts to represent screens. You can push and -// pop screens on the stack so that you don't have to keep track of how you got -// to which screen. -// -// Here is what happens when you push a layout on the shell stack: -// 1) The layout name is stored as a "pending push" -// 2) The top of the stack has the Shutdown() method run -// 3) The Shutdown() method (or other mechanisms like Update()) will call -// Shell::shutdownComplete() when the shutdown process for that layout is "complete" -// 4) Shell::shutdownComplete() sees the "pending push" in the shell -// 5) "Pending push" layout is then loaded from disk and the pending push state is cleared -// 6) The new layout is put on the top of the stack -// 7) The new layout Init() method is called -// -// Here is what happens when you pop the top of the stack -// 1) The stack sets a "pending pop" as in progress -// 2) The top layout of the stack has the Shutdown() method called -// 3) The Shutdown() method (or other mechanisms like Update()) will call -// Shell::shutdownComplete() when the shutdown process for that layout is "complete" -// 4) Shell::shutdownComplete() sees the "pending pop" in the shell -// 5) The "pending pop" layout is then destroyed and removed from the stack -// 6) The new top of the stack has the Init() method run -// -// Window Layouts and the Shell: -// ----------------------------- -// -// Window Layouts in the shell need the following functions to work property, these -// can be assigned from the GUIEdit window layout tool: -// -// - Init() [OPTIONAL] -// This is called as a result of a push or pop operation (see above for more info) -// The window layout is loaded from disk and then this Init() -// method is run. All shell layout Init() methods should show -// the layout windows. At this point you could move windows -// to starting positions, set a state that the Update() method looks at to -// "animate" the windows to the desired positions. -// -// - Update() [OPTIONAL] -// This is called once at a rate of "shellUpdateDelay" for EVERY screen on the shell -// stack. It does not matter if the screen is on the top, or is hidden, or -// anything, this is always called. Each update is run starting with the screen -// at the top of the stack and progressing to the bottom of the stack. -// States could be set in the Init() or Shutdown() methods of the layout -// that the Update() looks at and reacts to appropriately if desired. -// -// - Shutdown() [REQUIRED] -// This is called when a layout is popped off the stack, or when a new layout -// is pushed on top of this one (see above for more detail on what happens -// during the push/pop process). You can switch into a "shutdown" state and -// animate the layout appropriately in the Update() method for the layout. -// When shutdown is actually complete you should hide the all windows in -// the layout and then you are REQUIRED to notify the shell by calling -// the Shell::shutdownComplete() method. -// -// Shutdown() is also required to be able to handle the parameter "immediatePop". -// If this parameter is TRUE it means that when control returns from the -// shutdown function that the layout will immediately be popped off the -// stack. We need to be able to handle this when in code we want to -// traverse back down the stack rapidly (like when we lose connection to -// an online service, we might pop all the way back to the login screen) -// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class WindowLayout; -class AnimateWindowManager; -class GameWindow; -class ShellMenuSchemeManager; - -enum AnimTypes CPP_11(: Int); - -//------------------------------------------------------------------------------------------------- -/** This is the interface to the shell system to load, display, and - * manage screen menu shell system layouts */ -//------------------------------------------------------------------------------------------------- -class Shell : public SubsystemInterface -{ - -public: - - Shell(); - virtual ~Shell() override; - - // Inhertited from subsystem ==================================================================== - virtual void init() override; - virtual void reset() override; - virtual void update() override; - //=============================================================================================== - - void recreateWindowLayouts(); - - void showShellMap(Bool useShellMap ); ///< access function to turn on and off the shell map - - void hide( Bool hide ); ///< show/hide all shell layouts - - // pseudo-stack operations for manipulating layouts - void push( AsciiString filename, Bool shutdownImmediate = FALSE ); ///< load new screen on top, optionally doing an immediate shutdown - void pop(); ///< pop top layout - void popImmediate(); ///< pop now, don't wait for shutdown - void showShell( Bool runInit = TRUE ); ///< init the top of stack - void hideShell(); ///< shutdown the top of stack - WindowLayout *top(); ///< return top layout - - void shutdownComplete( WindowLayout *layout, Bool impendingPush = FALSE ); ///< layout has completed shutdown - - WindowLayout *findScreenByFilename( AsciiString filename ); ///< find screen - Bool isShellActive() { return m_isShellActive; } ///< Returns true if the shell is active - - void registerWithAnimateManager( GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt delayMS = 0); - Bool isAnimFinished(); - void reverseAnimatewindow(); - Bool isAnimReversed(); - - void loadScheme( AsciiString name ); - ShellMenuSchemeManager *getShellMenuSchemeManager() { return m_schemeManager; } - - Int getScreenCount() const { return m_screenCount; } ///< Return the current number of screens - WindowLayout *getScreenLayout( Int index ) const; - - WindowLayout *getSaveLoadMenuLayout(); ///< create if necessary and return layout for save load menu - WindowLayout *getPopupReplayLayout(); ///< create if necessary and return layout for replay save menu - WindowLayout *getOptionsLayout( Bool create ); ///< return layout for options menu, create if necessary and we are allowed to. - void destroyOptionsLayout(); ///< destroy the shell's options layout. - -protected: - - void construct(); - void deconstruct(); - - void linkScreen( WindowLayout *screen ); ///< link screen to list - void unlinkScreen( WindowLayout *screen ); ///< remove screen from list - - void doPush( AsciiString layoutFile ); ///< workhorse for push action - void doPop( Bool impendingPush ); ///< workhorse for pop action - - enum { MAX_SHELL_STACK = 16 }; ///< max simultaneous shell screens - WindowLayout *m_screenStack[ MAX_SHELL_STACK ]; ///< the screen layout stack - Int m_screenCount; ///< # of screens in screen stack - - WindowLayout *m_background; ///< The Background layout if the 3d shell isn't running - Bool m_clearBackground; ///< Flag if we're going to clear the background or not - - Bool m_pendingPush; ///< TRUE when a push is pending - Bool m_pendingPop; ///< TRUE when a pop is pending - AsciiString m_pendingPushName; ///< layout name to be pushed - Bool m_isShellActive; ///< TRUE when the shell is active - Bool m_shellMapOn; ///< TRUE when the shell map is on - AnimateWindowManager *m_animateWindowManager; ///< The animate Window Manager - ShellMenuSchemeManager *m_schemeManager; ///< The Shell Scheme Manager - - // - // we keep a pointer to this layout so that we can simply just hide/unhide this - // window layout. Why you ask? Well, as the result of pressing a button to start - // a save game load a super large set of operations will happen as the game - // loads. One of those operations is the destruction of the menu, which although - // it just destroys the windows and puts them on a destroyed list, that destroyed - // list is also processed before we are out of our own window procedure. - // This is a prime example why it's easier to just deal with windows by hiding and - // un-hiding them rather than actually creating and destroying them. - // - WindowLayout *m_saveLoadMenuLayout; ///< save/load menu layout - WindowLayout *m_popupReplayLayout; ///< replay save menu layout - WindowLayout *m_optionsLayout; ///< options menu layout - -}; - -// INLINING /////////////////////////////////////////////////////////////////////////////////////// - -// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// -extern Shell *TheShell; ///< the shell external interface diff --git a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h b/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h deleted file mode 100644 index d6fe0418607..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -// ShellHooks.h -// Author: Matthew D. Campbell, October 2002 - -#pragma once - -// -// This enumeration holds all the shell script hooks that we currently have, If you are going to -// add more, it's important to keep the enum lined up with the names in TheShellHookNames located -// in Scripts.cpp. -// -enum -{ - SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_SELECTED = 0, - SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGIN, - SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGOUT, - SHELL_SCRIPT_HOOK_GENERALS_ONLINE_ENTERED_FROM_GAME, - - SHELL_SCRIPT_HOOK_OPTIONS_OPENED, - SHELL_SCRIPT_HOOK_OPTIONS_CLOSED, - - SHELL_SCRIPT_HOOK_SKIRMISH_OPENED, - SHELL_SCRIPT_HOOK_SKIRMISH_CLOSED, - SHELL_SCRIPT_HOOK_SKIRMISH_ENTERED_FROM_GAME, - - SHELL_SCRIPT_HOOK_LAN_OPENED, - SHELL_SCRIPT_HOOK_LAN_CLOSED, - SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME, - - SHELL_SCRIPT_HOOK_TOTAL -}; - -extern const char *const TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. -void SignalUIInteraction(Int interaction); diff --git a/Generals/Code/GameEngine/Include/GameClient/ShellMenuScheme.h b/Generals/Code/GameEngine/Include/GameClient/ShellMenuScheme.h deleted file mode 100644 index b5d17347b46..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ShellMenuScheme.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ShellMenuScheme.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: ShellMenuScheme.h -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/Color.h" - -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class Image; - -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class ShellMenuSchemeLine -{ -public: - ShellMenuSchemeLine(); - ~ShellMenuSchemeLine(); - - ICoord2D m_startPos; - ICoord2D m_endPos; - Int m_width; - Color m_color; - -}; - -class ShellMenuSchemeImage -{ -public: - ShellMenuSchemeImage(); - ~ShellMenuSchemeImage(); - - AsciiString m_name; ///< Name of the image - ICoord2D m_position; ///< the position we'll draw it at - ICoord2D m_size; ///< the size of the image needed when we draw it - Image *m_image; ///< the actual pointer to the mapped image -}; - -class ShellMenuScheme -{ -public: - ShellMenuScheme(); - ~ShellMenuScheme(); - - void draw(); - void addImage( ShellMenuSchemeImage* schemeImage ); - void addLine( ShellMenuSchemeLine* schemeLine ); - - - AsciiString m_name; - - typedef std::list< ShellMenuSchemeImage* > ShellMenuSchemeImageList; - typedef ShellMenuSchemeImageList::iterator ShellMenuSchemeImageListIt; - ShellMenuSchemeImageList m_imageList; - - typedef std::list< ShellMenuSchemeLine* > ShellMenuSchemeLineList; - typedef ShellMenuSchemeLineList::iterator ShellMenuSchemeLineListIt; - ShellMenuSchemeLineList m_lineList; - - - - -}; - -class ShellMenuSchemeManager -{ -public: - ShellMenuSchemeManager(); - ~ShellMenuSchemeManager(); - - void init(); - void update(); - - void setShellMenuScheme( AsciiString name ); - - void draw(); - - // parse Functions for the INI file - const FieldParse *getFieldParse() const { return m_shellMenuSchemeFieldParseTable; } ///< returns the parsing fields - static const FieldParse m_shellMenuSchemeFieldParseTable[]; ///< the parse table - static void parseImagePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file - static void parseLinePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the line part of the INI file - - ShellMenuScheme *newShellMenuScheme(AsciiString name); - -private: - typedef std::list< ShellMenuScheme* > ShellMenuSchemeList; ///< list of Shell Menu schemes - typedef ShellMenuSchemeList::iterator ShellMenuSchemeListIt; - ShellMenuSchemeList m_schemeList; - ShellMenuScheme *m_currentScheme; - -}; - - -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp deleted file mode 100644 index 16a42b692a5..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ /dev/null @@ -1,898 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Shell.cpp //////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, September 2001 -// Description: Shell menu representations -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/RandomValue.h" -#include "GameClient/Shell.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GameWindowTransitions.h" -#include "GameClient/IMEManager.h" -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/ShellMenuScheme.h" -#include "GameLogic/GameLogic.h" -#include "GameNetwork/GameSpyOverlay.h" -#include "GameNetwork/GameSpy/PeerDefsImplementation.h" - -// PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -Shell *TheShell = nullptr; ///< the shell singleton definition - - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Shell::Shell() -{ - construct(); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Shell::~Shell() -{ - deconstruct(); - -} - -//------------------------------------------------------------------------------------------------- -void Shell::construct() -{ - Int i; - - m_screenCount = 0; - for( i = 0; i < MAX_SHELL_STACK; i++ ) - m_screenStack[ i ] = nullptr; - - m_pendingPush = FALSE; - m_pendingPop = FALSE; - m_pendingPushName.set( "" ); - m_isShellActive = TRUE; - m_shellMapOn = FALSE; - m_background = nullptr; - m_clearBackground = FALSE; - m_animateWindowManager = NEW AnimateWindowManager; - m_schemeManager = NEW ShellMenuSchemeManager; - m_saveLoadMenuLayout = nullptr; - m_popupReplayLayout = nullptr; - m_optionsLayout = nullptr; - m_screenCount = 0; -} - -//------------------------------------------------------------------------------------------------- -void Shell::deconstruct() -{ - WindowLayout *newTop = top(); - while(newTop) - { - popImmediate(); - newTop = top(); - } - - if(m_background) - { - m_background->destroyWindows(); - deleteInstance(m_background); - m_background = nullptr; - } - - delete m_animateWindowManager; - m_animateWindowManager = nullptr; - - delete m_schemeManager; - m_schemeManager = nullptr; - - // delete the save/load menu if present - if( m_saveLoadMenuLayout ) - { - - m_saveLoadMenuLayout->destroyWindows(); - deleteInstance(m_saveLoadMenuLayout); - m_saveLoadMenuLayout = nullptr; - - } - - // delete the replay save menu if present - if( m_popupReplayLayout ) - { - - m_popupReplayLayout->destroyWindows(); - deleteInstance(m_popupReplayLayout); - m_popupReplayLayout = nullptr; - - } - - // delete the options menu if present. - if (m_optionsLayout != nullptr) { - m_optionsLayout->destroyWindows(); - deleteInstance(m_optionsLayout); - m_optionsLayout = nullptr; - } -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the shell system */ -//------------------------------------------------------------------------------------------------- -void Shell::init() -{ - INI ini; - // Read from INI all the ShellMenuScheme - ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); - ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); - - if( m_schemeManager ) - m_schemeManager->init(); - -} - -//------------------------------------------------------------------------------------------------- -/** Reset the shell system to a clean state just as though init had - * just been called and ready to re-use */ -//------------------------------------------------------------------------------------------------- -void Shell::reset() -{ - - if (TheIMEManager) - TheIMEManager->detach(); - - // pop all screens - while( m_screenCount ) - popImmediate(); - - m_animateWindowManager->reset(); - -} - -//------------------------------------------------------------------------------------------------- -/** Update shell system cycle. All windows are updated that are on the stack, starting - * with the top layout and progressing to the bottom one */ -//------------------------------------------------------------------------------------------------- -void Shell::update() -{ - static Int lastUpdate = timeGetTime(); - static const Int shellUpdateDelay = 30; // try to update 30 frames a second - Int now = timeGetTime(); - - // - // we keep the shell updates fixed in time so that we can write consistent animation - // speeds during the screen update functions - // - if( now - lastUpdate >= ((1000.0f / shellUpdateDelay ) - 1) ) - { - - // run the updates for every window layout on the stack - for( Int i = m_screenCount - 1; i >= 0; i-- ) - { - - DEBUG_ASSERTCRASH( m_screenStack[ i ], ("Top of shell stack is null!") ); - m_screenStack[ i ]->runUpdate( nullptr ); - - } - if(TheGlobalData->m_shellMapOn && m_shellMapOn &&m_background) - { - - m_background->destroyWindows(); - deleteInstance(m_background); - m_background = nullptr; - - } - - m_schemeManager->update(); - - // mark last time we ran the updates - lastUpdate = now; - - } - - m_animateWindowManager->update(); - -} - -//------------------------------------------------------------------------------------------------- -namespace -{ - struct ScreenInfo - { - ScreenInfo() : isHidden(false) {} - AsciiString filename; - bool isHidden; - }; -} - -//------------------------------------------------------------------------------------------------- -void Shell::recreateWindowLayouts() -{ - // collect state of the current shell - const Int screenCount = getScreenCount(); - std::vector screenStackInfos; - - { - screenStackInfos.resize(screenCount); - Int screenIndex = 0; - for (; screenIndex < screenCount; ++screenIndex) - { - const WindowLayout* layout = getScreenLayout(screenIndex); - ScreenInfo& screenInfo = screenStackInfos[screenIndex]; - screenInfo.filename = layout->getFilename(); - screenInfo.isHidden = layout->isHidden(); - } - } - - // reconstruct the shell now - deconstruct(); - construct(); - init(); - - // restore the screen stack - Int screenIndex = 0; - for (; screenIndex < screenCount; ++screenIndex) - { - const ScreenInfo& screenInfo = screenStackInfos[screenIndex]; - push(screenInfo.filename); - - WindowLayout* layout = getScreenLayout(screenIndex); - layout->hide(screenInfo.isHidden); - } -} - -//------------------------------------------------------------------------------------------------- -/** Find a screen via the .wnd script filename loaded */ -//------------------------------------------------------------------------------------------------- -WindowLayout *Shell::findScreenByFilename( AsciiString filename ) -{ - - if (filename.isEmpty()) - return nullptr; - - // search screen list - WindowLayout *screen; - Int i; - for( i = 0; i < MAX_SHELL_STACK; i++ ) - { - - screen = m_screenStack[ i ]; - if( screen && filename.compareNoCase(screen->getFilename()) == 0 ) - return screen; - - } - - return nullptr; - -} - -//------------------------------------------------------------------------------------------------- -WindowLayout *Shell::getScreenLayout( Int index ) const -{ - if (index >= 0 && index < m_screenCount) - return m_screenStack[index]; - - return nullptr; -} - -//------------------------------------------------------------------------------------------------- -/** Hide or unhide all window layouts loaded */ -//------------------------------------------------------------------------------------------------- -void Shell::hide( Bool hide ) -{ - Int i; - - for( i = 0; i < MAX_SHELL_STACK; i++ ) - if( m_screenStack[ i ] ) - m_screenStack[ i ]->hide( hide ); - - if (TheIMEManager) - TheIMEManager->detach(); - -} - -//------------------------------------------------------------------------------------------------- -/** Push layout onto shell */ -//------------------------------------------------------------------------------------------------- -void Shell::push( AsciiString filename, Bool shutdownImmediate ) -{ - - // sanity - if( filename.isEmpty() ) - return; - if(TheGameSpyInfo) - GameSpyCloseAllOverlays(); - - -#ifdef DEBUG_LOGGING - DEBUG_LOG(("Shell:push(%s) - stack was", filename.str())); - for (Int i=0; igetFilename().str())); - } -#endif - - // make sure we have an available spot for another screen - if( m_screenCount >= MAX_SHELL_STACK ) - { - - DEBUG_LOG(( "Unable to load screen '%s', max '%d' reached", - filename.str(), MAX_SHELL_STACK )); - return; - - } - - // set a push as pending with the layout name passed in - m_pendingPush = TRUE; - m_pendingPushName = filename; - - // get the top of the current stack - WindowLayout *currentTop = top(); - - // - // if we have something on the top of the stack we won't do the push - // right now, we will instead shutdown the top, and when the top tells - // us it's done shutting down (via the shutdownComplete() method) we do - // the push then - // - if( currentTop && !currentTop->isHidden() ) - { - - // run the shutdown - currentTop->runShutdown( &shutdownImmediate ); - - } - else - { - - // just call shutdownComplete() which will immediately cause the push to happen - shutdownComplete( nullptr ); - - } - -// if (TheIMEManager) -// TheIMEManager->detach(); - -} - -//------------------------------------------------------------------------------------------------- -/** Pop top layout of the stack. Note that we don't actually do the pop right here, - * we instead run the layout shutdown. That shutdown() in turn notifies the - * shell when the shutdown is complete and at that point we do the actual pop */ -//------------------------------------------------------------------------------------------------- -void Shell::pop() -{ - WindowLayout *screen = top(); - if(TheGameSpyInfo) - GameSpyCloseAllOverlays(); - - - // sanity - if( screen == nullptr ) - return; - -#ifdef DEBUG_LOGGING - DEBUG_LOG(("Shell:pop() - stack was")); - for (Int i=0; igetFilename().str())); - } -#endif - - // set a pop as pending - m_pendingPop = TRUE; - - // - // run the shutdown function for the screen, when it's actually shutdown it - // will call Shell::shutdownComplete(), where the pending pop will be seen - // and the actual pop will occur - // - Bool immediatePop = FALSE; - screen->runShutdown( &immediatePop ); - - if (TheIMEManager) - TheIMEManager->detach(); - -} - -//------------------------------------------------------------------------------------------------- -/** When you need to immediately pop a screen off the stack use this method. It - * gives the screen the opportunity to shutdown and tells the shutdown - * method that an immediate pop is going to take place. When control returns - * from the shutdown() for the screen, it will be immediately popped off - * the stack */ -//------------------------------------------------------------------------------------------------- -void Shell::popImmediate() -{ - WindowLayout *screen = top(); - - // sanity - if( screen == nullptr ) - return; - -#ifdef DEBUG_LOGGING - DEBUG_LOG(("Shell:popImmediate() - stack was")); - for (Int i=0; igetFilename().str())); - } -#endif - - // do NOT set pending pop, we are going to force a pop after the shutdown is run - m_pendingPop = FALSE; - - // run the shutdown - Bool immediatePop = TRUE; - screen->runShutdown( &immediatePop ); - - // pop the screen of the stack - doPop( FALSE ); - - if (TheIMEManager) - TheIMEManager->detach(); - -} - -//------------------------------------------------------------------------------------------------- -/** Run the initialize function for the top of the stack just as though it was pushed - * on the stack. We want this behavior when we want to act like the top was just - * pushed on the stack, but it's already there (ie going from in game back to the - * pre-game shell menus */ -//------------------------------------------------------------------------------------------------- -void Shell::showShell( Bool runInit ) -{ - DEBUG_LOG(("Shell:showShell() - %s (%s)", TheGlobalData->m_initialFile.str(), (top())?top()->getFilename().str():"no top screen")); - - if(!TheGlobalData->m_initialFile.isEmpty() || !TheGlobalData->m_simulateReplays.empty()) - { - return; - } - - // runInit is used if we want show shell to run - if(runInit) - { - WindowLayout *layout = top(); - - if( layout ) - { - layout->runInit( nullptr ); - // layout->bringForward(); - } - } - // @todo remove this hack -// TheGlobalData->m_inGame = FALSE; - // add in the background stuff - -// if(TheGlobalData->m_shellMapOn) - // { - // if( top() ) - // top()->hide(TRUE); - // m_background = TheWindowManager->winCreateLayout("Menus/BlankWindow.wnd"); - // DEBUG_ASSERTCRASH(m_background,("We Couldn't Load Menus/BlankWindow.wnd")); - // m_background->hide(FALSE); - // m_background->bringForward(); - // if (TheGameLogic->isInGame()) - // TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA ); - // - // TheGlobalData->m_pendingFile = TheGlobalData->m_shellMapName; - // GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); - // msg->appendIntegerArgument(GAME_SHELL); - // } - // else - // { - // - // m_background = TheWindowManager->winCreateLayout("Menus/BlankWindow.wnd"); - // - // DEBUG_ASSERTCRASH(m_background,("We Couldn't Load Menus/BlankWindow.wnd")); - // m_background->hide(FALSE); - // if (top()) - // top()->bringForward(); - // - // } - - - if (!TheGlobalData->m_shellMapOn && m_screenCount == 0) - { -#ifdef RTS_PROFILE_LEGACY - Profile::StopRange("init"); -#endif - //else - push( "Menus/MainMenu.wnd" ); - } - m_isShellActive = TRUE; -} - -void Shell::showShellMap(Bool useShellMap ) -{ - // we don't want any of this to show if we're loading straight into a file - if (TheGlobalData->m_initialFile.isNotEmpty() || !TheGameLogic || !TheGlobalData->m_simulateReplays.empty()) - return; - if(useShellMap && TheGlobalData->m_shellMapOn) - { - // we're already in a shell game, return - if(TheGameLogic->isInGame() && TheGameLogic->getGameMode() == GAME_SHELL) - return; - // we're in some other kind of game, clear it out foo! - if(TheGameLogic->isInGame()) - TheGameLogic->exitGame(); - - TheWritableGlobalData->m_pendingFile = TheGlobalData->m_shellMapName; - InitRandom(0); - GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); - msg->appendIntegerArgument(GAME_SHELL); - m_shellMapOn = TRUE; - } - else - { - // we're in a shell game, stop it! - if(TheGameLogic->isInGame() && TheGameLogic->getGameMode() == GAME_SHELL) - TheGameLogic->exitGame(); - - // if the shell is active,we need a background - if(!m_isShellActive) - return; - if(!m_background) - m_background = TheWindowManager->winCreateLayout("Menus/BlankWindow.wnd"); - - DEBUG_ASSERTCRASH(m_background,("We Couldn't Load Menus/BlankWindow.wnd")); - m_background->getFirstWindow()->winSetStatus(WIN_STATUS_IMAGE); - m_background->hide(FALSE); - if (top()) - top()->bringForward(); - m_shellMapOn = FALSE; - m_clearBackground = FALSE; - } -} - -//------------------------------------------------------------------------------------------------- -/** Run the shutdown() function for the top of the stack just like we're going to pop - * it off but DO NOT pop it off the stack. We want this behavior when leaving the - * pre-game menus and entering the game and want the shell to still exist and contain - * the stack information but don't want it to go away */ -//------------------------------------------------------------------------------------------------- -void Shell::hideShell() -{ - // If we have the 3d background running, mark it to close - m_clearBackground = TRUE; - - DEBUG_LOG(("Shell:hideShell() - %s", (top())?top()->getFilename().str():"no top screen")); - - WindowLayout *layout = top(); - - if( layout ) - { - Bool immediatePop = TRUE; - - layout->runShutdown( &immediatePop ); - - } - - if (TheIMEManager) - TheIMEManager->detach(); - - // Mark that the shell is no longer up. - m_isShellActive = FALSE; - -} - -//------------------------------------------------------------------------------------------------- -/** Return the top layout on the stack */ -//------------------------------------------------------------------------------------------------- -WindowLayout *Shell::top() -{ - - // empty stack - if( m_screenCount == 0 ) - return nullptr; - - // top layout is at count index - return m_screenStack[ m_screenCount - 1 ]; - -} - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// -//------------------------------------------------------------------------------------------------- -/** Add screen to our list */ -//------------------------------------------------------------------------------------------------- -void Shell::linkScreen( WindowLayout *screen ) -{ - - // sanity - if( screen == nullptr ) - return; - - // check to see if at top already - if( m_screenCount == MAX_SHELL_STACK ) - { - - DEBUG_CRASH(( "No room in shell stack for screen" )); - return; - - } - - // add to array at top index - m_screenStack[ m_screenCount++ ] = screen; - -} - -//------------------------------------------------------------------------------------------------- -/** Remove screen from our list */ -//------------------------------------------------------------------------------------------------- -void Shell::unlinkScreen( WindowLayout *screen ) -{ - - // sanity - if( screen == nullptr ) - return; - - DEBUG_ASSERTCRASH( m_screenStack[ m_screenCount - 1 ] == screen, - ("Screen not on top of stack") ); - - // remove reference to screen and decrease count - if( m_screenStack[ m_screenCount - 1 ] == screen ) - m_screenStack[ --m_screenCount ] = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** Actually do the work for a push */ -//------------------------------------------------------------------------------------------------- -void Shell::doPush( AsciiString layoutFile ) -{ - if(TheGameSpyInfo) - GameSpyCloseAllOverlays(); - WindowLayout *newScreen; - - // create new layout and load from window manager - newScreen = TheWindowManager->winCreateLayout( layoutFile ); - DEBUG_ASSERTCRASH( newScreen != nullptr, ("Shell unable to load pending push layout") ); - - // link screen to the top - linkScreen( newScreen ); - - if (TheIMEManager) - TheIMEManager->detach(); - - // run the init function automatically - newScreen->runInit( nullptr ); - newScreen->bringForward(); - - -} - -//------------------------------------------------------------------------------------------------- -/** Actually do the work for a pop */ -//------------------------------------------------------------------------------------------------- -void Shell::doPop( Bool impendingPush ) -{ - WindowLayout *currentTop = top(); - - // there better be a top of the stack since we're popping - DEBUG_ASSERTCRASH( currentTop, ("Shell: No top of stack and we want to pop!") ); - - if (currentTop) - { - // remove this screen from our list - unlinkScreen(currentTop); - - // delete all the windows in the screen - currentTop->destroyWindows(); - - // release the screen object back to the memory pool - deleteInstance(currentTop); - } - - // run the init for the new top of the stack if present - WindowLayout *newTop = top(); - if( newTop && !impendingPush ) - { - newTop->runInit( nullptr ); - //newTop->bringForward(); - } - - if (TheIMEManager) - TheIMEManager->detach(); - -} - -//------------------------------------------------------------------------------------------------- -/** This is called when a layout has finished its shutdown process. Layouts are - * shutdown when a new screen is being pushed on the stack, or when we are - * popping the current screen off the top of the stack. It is here that we - * can look for any pending push or pop operations and actually do them - * - * NOTE: It is possible for the screen parameter to be nullptr when we are - * short circuiting the shutdown logic because there is no layout - * to actually shutdown (ie, the stack is empty and we push) */ -//------------------------------------------------------------------------------------------------- -void Shell::shutdownComplete( WindowLayout *screen, Bool impendingPush ) -{ - - // there should never be a pending push AND pop operation - DEBUG_ASSERTCRASH( m_pendingPush == FALSE || m_pendingPop == FALSE, - ("There is a pending push AND pop in the shell. Not allowed!") ); - - // Reset the AnimateWindowManager - m_animateWindowManager->reset(); - - // check for pending push or pop - if( m_pendingPush ) - { - - // do the push - doPush( m_pendingPushName ); - - // no more pending pushy for you! - m_pendingPush = FALSE; - m_pendingPushName.set( "" ); - - } - else if( m_pendingPop ) - { - - // do the pop - doPop( impendingPush ); - - // no more pending pop for you! - m_pendingPop = FALSE; - - } - - if(m_clearBackground) - { - if(m_background) - { - m_background->destroyWindows(); - deleteInstance(m_background); - m_background = nullptr; - m_clearBackground = FALSE; - } - - } - -} - - -void Shell::registerWithAnimateManager( GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt delayMS) -{ - if(!m_animateWindowManager) - { - DEBUG_CRASH(("We called registerWithAnimateManager and we don't have an Animate Manager created")); - return; - } - if (TheGlobalData->m_animateWindows) - m_animateWindowManager->registerGameWindow(win,animType,needsToFinish, 500,delayMS); -} - -Bool Shell::isAnimFinished() -{ - // check the new way also. - if (!TheTransitionHandler->isFinished()) - return FALSE; - - if(!m_animateWindowManager) - { - DEBUG_CRASH(("We called registerWithAnimateManager and we don't have an Animate Manager created")); - return TRUE; - } - if (TheGlobalData->m_animateWindows) - return m_animateWindowManager->isFinished(); - else - return TRUE; -} - -void Shell::reverseAnimatewindow() -{ - if(!m_animateWindowManager) - { - DEBUG_CRASH(("We called registerWithAnimateManager and we don't have an Animate Manager created")); - return; - } - if (TheGlobalData->m_animateWindows) - m_animateWindowManager->reverseAnimateWindow(); -} - -Bool Shell::isAnimReversed() -{ - if(!m_animateWindowManager) - { - DEBUG_CRASH(("We called registerWithAnimateManager and we don't have an Animate Manager created")); - return TRUE; - } - if (TheGlobalData->m_animateWindows) - return m_animateWindowManager->isReversed(); - else - return TRUE; -} - - -void Shell::loadScheme( AsciiString name ) -{ - if(!m_schemeManager) - return; - - m_schemeManager->setShellMenuScheme( name ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -WindowLayout *Shell::getSaveLoadMenuLayout() -{ - - // if layout has not been created, create it now - if( m_saveLoadMenuLayout == nullptr ) - m_saveLoadMenuLayout = TheWindowManager->winCreateLayout( "Menus/PopupSaveLoad.wnd" ); - - // sanity - DEBUG_ASSERTCRASH( m_saveLoadMenuLayout, ("Unable to create save/load menu layout") ); - - // return the layout - return m_saveLoadMenuLayout; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -WindowLayout *Shell::getPopupReplayLayout() -{ - - // if layout has not been created, create it now - if( m_popupReplayLayout == nullptr ) - m_popupReplayLayout = TheWindowManager->winCreateLayout( "Menus/PopupReplay.wnd" ); - - // sanity - DEBUG_ASSERTCRASH( m_popupReplayLayout, ("Unable to create replay save menu layout") ); - - // return the layout - return m_popupReplayLayout; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -WindowLayout *Shell::getOptionsLayout( Bool create ) -{ - // if layout has not been created, create it now - if ((m_optionsLayout == nullptr) && (create == TRUE)) - { - m_optionsLayout = TheWindowManager->winCreateLayout( "Menus/OptionsMenu.wnd" ); - - // sanity - DEBUG_ASSERTCRASH( m_optionsLayout, ("Unable to create options menu layout") ); - } - - // return the layout - return m_optionsLayout; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void Shell::destroyOptionsLayout() { - if (m_optionsLayout != nullptr) { - m_optionsLayout->destroyWindows(); - deleteInstance(m_optionsLayout); - m_optionsLayout = nullptr; - } -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp deleted file mode 100644 index 45dd45f9913..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ShellMenuScheme.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: ShellMenuScheme.cpp -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/INI.h" -#include "GameClient/ShellMenuScheme.h" -#include "GameClient/Shell.h" -#include "GameClient/Display.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -const FieldParse ShellMenuSchemeManager::m_shellMenuSchemeFieldParseTable[] = -{ - - { "ImagePart", ShellMenuSchemeManager::parseImagePart, nullptr, 0 }, - { "LinePart", ShellMenuSchemeManager::parseLinePart, nullptr, 0 }, - { nullptr, nullptr, nullptr, 0 } - -}; - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -void INI::parseShellMenuSchemeDefinition( INI *ini ) -{ - AsciiString name; - ShellMenuSchemeManager *SMSchemeManager; - ShellMenuScheme *SMScheme; - - // read the name - const char* c = ini->getNextToken(); - name.set( c ); - - // find existing item if present - SMSchemeManager = TheShell->getShellMenuSchemeManager(); - DEBUG_ASSERTCRASH( SMSchemeManager, ("parseShellMenuSchemeDefinition: Unable to Get SMSchemeManager") ); - if( !SMSchemeManager ) - return; - - // If we have a previously allocated control bar, this will return a cleared out pointer to it so we - // can overwrite it - SMScheme = SMSchemeManager->newShellMenuScheme( name ); - - // sanity - DEBUG_ASSERTCRASH( SMScheme, ("parseControlBarSchemeDefinition: Unable to allocate Scheme '%s'", name.str()) ); - - // parse the ini definition - ini->initFromINI( SMScheme, SMSchemeManager->getFieldParse() ); - -} - -ShellMenuSchemeLine::ShellMenuSchemeLine() -{ - m_startPos.x = m_startPos.y = 0; - m_endPos.x = m_endPos.y = 0; - m_color = GAME_COLOR_UNDEFINED; - m_width = 1; -} -ShellMenuSchemeLine::~ShellMenuSchemeLine() -{ -} - -ShellMenuSchemeImage::ShellMenuSchemeImage() -{ - m_name.clear(); - m_position.x = m_position.y = 0; - m_size.x = m_size.x = 0; - m_image = nullptr; -} - -ShellMenuSchemeImage::~ShellMenuSchemeImage() -{ - m_image = nullptr; -} - -ShellMenuScheme::ShellMenuScheme() -{ - -} - -ShellMenuScheme::~ShellMenuScheme() -{ - ShellMenuSchemeImageListIt it = m_imageList.begin(); - while(it != m_imageList.end()) - { - ShellMenuSchemeImage *image = *it; - it = m_imageList.erase( it ); - delete image; - } - - ShellMenuSchemeLineListIt lineIt = m_lineList.begin(); - while(lineIt != m_lineList.end()) - { - ShellMenuSchemeLine *line = *lineIt; - lineIt = m_lineList.erase( lineIt ); - delete line; - } - - -} - -void ShellMenuScheme::addLine( ShellMenuSchemeLine* schemeLine ) -{ - if(!schemeLine) - return; - - m_lineList.push_back( schemeLine ); -} - - -void ShellMenuScheme::addImage( ShellMenuSchemeImage* schemeImage ) -{ - if(!schemeImage) - return; - - m_imageList.push_back( schemeImage ); -} - -void ShellMenuScheme::draw() -{ - - ShellMenuSchemeImageListIt imageIt = m_imageList.begin(); - while(imageIt != m_imageList.end()) - { - ShellMenuSchemeImage *image = *imageIt; - if(image && image->m_image) - { - TheDisplay->drawImage(image->m_image, image->m_position.x, image->m_position.y, - image->m_position.x + image->m_size.x , image->m_position.y + image->m_size.y); - } - ++imageIt; - } - - ShellMenuSchemeLineListIt it = m_lineList.begin(); - while(it != m_lineList.end()) - { - ShellMenuSchemeLine *line = *it; - - if(line) - { - TheDisplay->drawLine(line->m_startPos.x, line->m_startPos.y, line->m_endPos.x, - line->m_endPos.y,line->m_width, line->m_color); - } - ++it; - } - - -} - -ShellMenuSchemeManager::ShellMenuSchemeManager() -{ - m_currentScheme = nullptr; -} - -ShellMenuSchemeManager::~ShellMenuSchemeManager() -{ - m_currentScheme = nullptr; - - - ShellMenuSchemeListIt it = m_schemeList.begin(); - while(it != m_schemeList.end()) - { - ShellMenuScheme *scheme = *it; - it = m_schemeList.erase( it ); - delete scheme; - } - -} - -void ShellMenuSchemeManager::parseImagePart(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) -{ - static const FieldParse myFieldParse[] = - { - { "Position", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, nullptr, offsetof( ShellMenuSchemeImage, m_image ) }, - { nullptr, nullptr, nullptr, 0 } - }; - - ShellMenuSchemeImage *schemeImage = NEW ShellMenuSchemeImage; - ini->initFromINI(schemeImage, myFieldParse); - ((ShellMenuScheme*)instance)->addImage(schemeImage); - -} - -void ShellMenuSchemeManager::parseLinePart(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) -{ - static const FieldParse myFieldParse[] = - { - { "StartPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_startPos ) }, - { "EndPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_endPos ) }, - { "Color", INI::parseColorInt, nullptr, offsetof( ShellMenuSchemeLine, m_color ) }, - { "Width", INI::parseInt, nullptr, offsetof( ShellMenuSchemeLine, m_width ) }, - - { nullptr, nullptr, nullptr, 0 } - }; - - ShellMenuSchemeLine *schemeLine = NEW ShellMenuSchemeLine; - ini->initFromINI(schemeLine, myFieldParse); - ((ShellMenuScheme*)instance)->addLine(schemeLine); - -} - -ShellMenuScheme *ShellMenuSchemeManager::newShellMenuScheme(AsciiString name) -{ - ShellMenuSchemeListIt it; - it = m_schemeList.begin(); - name.toLower(); - while(it != m_schemeList.end()) - { - ShellMenuScheme *scheme = *it; - if(scheme->m_name.compare(name) == 0) - { - m_schemeList.erase( it ); - delete scheme; - break; - } - else - ++it; - } - ShellMenuScheme *newScheme = NEW ShellMenuScheme; - newScheme->m_name.set(name); - m_schemeList.push_back(newScheme); - return newScheme; -} - -void ShellMenuSchemeManager::init() -{ - INI ini; - // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); - ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); - -} - -void ShellMenuSchemeManager::setShellMenuScheme( AsciiString name ) -{ - if(name.isEmpty()) - { - m_currentScheme = nullptr; - return; - } - - ShellMenuSchemeListIt it; - it = m_schemeList.begin(); - name.toLower(); - while(it != m_schemeList.end()) - { - ShellMenuScheme *scheme = *it; - if(scheme->m_name.compare(name) == 0) - { - m_currentScheme = scheme; - break; - } - ++it; - } -} - -void ShellMenuSchemeManager::draw() -{ - if(m_currentScheme) - m_currentScheme->draw(); -} - -void ShellMenuSchemeManager::update() -{ - -} -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/Main/CMakeLists.txt b/Generals/Code/Main/CMakeLists.txt index 1740b3c28e6..f40c7434bdf 100644 --- a/Generals/Code/Main/CMakeLists.txt +++ b/Generals/Code/Main/CMakeLists.txt @@ -10,8 +10,6 @@ endif() target_link_libraries(g_generals PRIVATE binkstub comctl32 - core_debug - core_profile_legacy d3d8 d3dx8 dinput8 diff --git a/Generals/Code/Tools/GUIEdit/CMakeLists.txt b/Generals/Code/Tools/GUIEdit/CMakeLists.txt index 901619e8d52..1fefa4bb91f 100644 --- a/Generals/Code/Tools/GUIEdit/CMakeLists.txt +++ b/Generals/Code/Tools/GUIEdit/CMakeLists.txt @@ -47,8 +47,6 @@ target_include_directories(g_guiedit PRIVATE target_link_libraries(g_guiedit PRIVATE comctl32 - core_debug - core_profile_legacy d3d8lib g_gameengine g_gameenginedevice diff --git a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt index 31024fea84a..1a65bb55d3d 100644 --- a/Generals/Code/Tools/WorldBuilder/CMakeLists.txt +++ b/Generals/Code/Tools/WorldBuilder/CMakeLists.txt @@ -211,8 +211,6 @@ target_precompile_headers(g_worldbuilder PRIVATE ) target_link_libraries(g_worldbuilder PRIVATE - core_debug - core_profile_legacy d3d8lib core_browserdispatch g_gameengine diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index e5b82e2db38..a636a00a345 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -212,9 +212,9 @@ set(GAMEENGINE_SRC # Include/GameClient/SelectionInfo.h # Include/GameClient/SelectionXlat.h Include/GameClient/Shadow.h - Include/GameClient/Shell.h - Include/GameClient/ShellHooks.h - Include/GameClient/ShellMenuScheme.h +# Include/GameClient/Shell.h +# Include/GameClient/ShellHooks.h +# Include/GameClient/ShellMenuScheme.h # Include/GameClient/Smudge.h # Include/GameClient/Snow.h # Include/GameClient/Statistics.h @@ -783,8 +783,8 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/IMEManager.cpp # Source/GameClient/GUI/LoadScreen.cpp # Source/GameClient/GUI/ProcessAnimateWindow.cpp - Source/GameClient/GUI/Shell/Shell.cpp - Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +# Source/GameClient/GUI/Shell/Shell.cpp +# Source/GameClient/GUI/Shell/ShellMenuScheme.cpp # Source/GameClient/GUI/WindowLayout.cpp # Source/GameClient/GUI/WindowVideoManager.cpp # Source/GameClient/GUI/WinInstanceData.cpp diff --git a/GeneralsMD/Code/Main/CMakeLists.txt b/GeneralsMD/Code/Main/CMakeLists.txt index 0aa9b6df91d..aabef06450f 100644 --- a/GeneralsMD/Code/Main/CMakeLists.txt +++ b/GeneralsMD/Code/Main/CMakeLists.txt @@ -10,8 +10,6 @@ endif() target_link_libraries(z_generals PRIVATE binkstub comctl32 - core_debug - core_profile_legacy d3d8 d3dx8 dinput8 diff --git a/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt b/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt index 94889705e34..7ddb0dd77c9 100644 --- a/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/GUIEdit/CMakeLists.txt @@ -47,8 +47,6 @@ target_include_directories(z_guiedit PRIVATE target_link_libraries(z_guiedit PRIVATE comctl32 - core_debug - core_profile_legacy d3d8lib imm32 stlport diff --git a/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt b/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt index c377a85c87c..e7ca1b259d1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/WorldBuilder/CMakeLists.txt @@ -216,8 +216,6 @@ target_precompile_headers(z_worldbuilder PRIVATE ) target_link_libraries(z_worldbuilder PRIVATE - core_debug - core_profile_legacy d3d8lib imm32 vfw32 diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 8c399c3d1d0..5ce7cf4aa63 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -689,6 +689,12 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngineDevice/Include/W3DDevice/Common/W3DConvert.h", Game.CORE, "GameEngineDevice/Include/W3DDevice/Common/W3DConvert.h") #unify_file(Game.ZEROHOUR, "GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp", Game.CORE, "GameEngineDevice/Source/W3DDevice/Common/W3DConvert.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/Shell.h", Game.CORE, "GameEngine/Include/GameClient/Shell.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Shell/Shell.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Shell/Shell.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/ShellHooks.h", Game.CORE, "GameEngine/Include/GameClient/ShellHooks.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/ShellMenuScheme.h", Game.CORE, "GameEngine/Include/GameClient/ShellMenuScheme.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp") + return