diff --git a/Core/GameEngineDevice/CMakeLists.txt b/Core/GameEngineDevice/CMakeLists.txt index 6added5403b..16794e4c043 100644 --- a/Core/GameEngineDevice/CMakeLists.txt +++ b/Core/GameEngineDevice/CMakeLists.txt @@ -85,7 +85,7 @@ set(GAMEENGINEDEVICE_SRC # Include/W3DDevice/GameLogic/W3DTerrainLogic.h Include/Win32Device/Common/Win32BIGFile.h Include/Win32Device/Common/Win32BIGFileSystem.h -# Include/Win32Device/Common/Win32GameEngine.h + Include/Win32Device/Common/Win32GameEngine.h Include/Win32Device/Common/Win32LocalFile.h Include/Win32Device/Common/Win32LocalFileSystem.h Include/Win32Device/GameClient/Win32DIKeyboard.h @@ -188,10 +188,10 @@ set(GAMEENGINEDEVICE_SRC # Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp Source/Win32Device/Common/Win32BIGFile.cpp Source/Win32Device/Common/Win32BIGFileSystem.cpp -# Source/Win32Device/Common/Win32GameEngine.cpp + Source/Win32Device/Common/Win32GameEngine.cpp Source/Win32Device/Common/Win32LocalFile.cpp Source/Win32Device/Common/Win32LocalFileSystem.cpp -# Source/Win32Device/Common/Win32OSDisplay.cpp + Source/Win32Device/Common/Win32OSDisplay.cpp Source/Win32Device/GameClient/Win32DIKeyboard.cpp #Source/Win32Device/GameClient/Win32DIMouse.cpp Source/Win32Device/GameClient/Win32Mouse.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h b/Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h rename to Core/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp rename to Core/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp rename to Core/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp diff --git a/Generals/Code/GameEngineDevice/CMakeLists.txt b/Generals/Code/GameEngineDevice/CMakeLists.txt index dea3ff6c9ae..a0c6091420c 100644 --- a/Generals/Code/GameEngineDevice/CMakeLists.txt +++ b/Generals/Code/GameEngineDevice/CMakeLists.txt @@ -72,7 +72,7 @@ set(GAMEENGINEDEVICE_SRC Include/W3DDevice/GameLogic/W3DTerrainLogic.h # Include/Win32Device/Common/Win32BIGFile.h # Include/Win32Device/Common/Win32BIGFileSystem.h - Include/Win32Device/Common/Win32GameEngine.h +# Include/Win32Device/Common/Win32GameEngine.h # Include/Win32Device/Common/Win32LocalFile.h # Include/Win32Device/Common/Win32LocalFileSystem.h # Include/Win32Device/GameClient/Win32DIKeyboard.h @@ -170,10 +170,10 @@ set(GAMEENGINEDEVICE_SRC Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp # Source/Win32Device/Common/Win32BIGFile.cpp # Source/Win32Device/Common/Win32BIGFileSystem.cpp - Source/Win32Device/Common/Win32GameEngine.cpp +# Source/Win32Device/Common/Win32GameEngine.cpp # Source/Win32Device/Common/Win32LocalFile.cpp # Source/Win32Device/Common/Win32LocalFileSystem.cpp - Source/Win32Device/Common/Win32OSDisplay.cpp +# Source/Win32Device/Common/Win32OSDisplay.cpp # Source/Win32Device/GameClient/Win32DIKeyboard.cpp # Source/Win32Device/GameClient/Win32Mouse.cpp ) diff --git a/Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h b/Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h deleted file mode 100644 index b17369dc844..00000000000 --- a/Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h +++ /dev/null @@ -1,117 +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: Win32GameEngine.h //////////////////////////////////////////////////////////////////////// -// Author: Colin Day, April 2001 -// Description: -// Device implementation of the game engine ... this is, of course, the -// highest level of the game that creates the necessary interfaces to the -// devices we need -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/GameEngine.h" -#include "GameClient/ParticleSys.h" -#include "GameLogic/GameLogic.h" -#include "GameNetwork/NetworkInterface.h" -#include "MilesAudioDevice/MilesAudioManager.h" -#include "Win32Device/Common/Win32BIGFileSystem.h" -#include "Win32Device/Common/Win32LocalFileSystem.h" -#include "W3DDevice/Common/W3DModuleFactory.h" -#include "W3DDevice/GameLogic/W3DGameLogic.h" -#include "W3DDevice/GameClient/W3DGameClient.h" -#include "W3DDevice/GameClient/W3DWebBrowser.h" -#include "W3DDevice/Common/W3DFunctionLexicon.h" -#include "W3DDevice/Common/W3DRadar.h" -#include "W3DDevice/Common/W3DThingFactory.h" - - - - -//------------------------------------------------------------------------------------------------- -/** Class declaration for the Win32 game engine */ -//------------------------------------------------------------------------------------------------- -class Win32GameEngine : public GameEngine -{ - -public: - - Win32GameEngine(); - virtual ~Win32GameEngine() override; - - virtual void init() override; ///< initialization - virtual void reset() override; ///< reset engine - virtual void update() override; ///< update the game engine - virtual void serviceWindowsOS() override; ///< allow windows maintenance in background - -protected: - - virtual GameLogic *createGameLogic() override; ///< factory for game logic - virtual GameClient *createGameClient() override; ///< factory for game client - virtual ModuleFactory *createModuleFactory() override; ///< factory for creating modules - virtual ThingFactory *createThingFactory() override; ///< factory for the thing factory - virtual FunctionLexicon *createFunctionLexicon() override; ///< factory for function lexicon - virtual LocalFileSystem *createLocalFileSystem() override; ///< factory for local file system - virtual ArchiveFileSystem *createArchiveFileSystem() override; ///< factory for archive file system - virtual NetworkInterface *createNetwork(); ///< Factory for the network - virtual Radar *createRadar(Bool dummy) override; ///< Factory for radar - virtual WebBrowser *createWebBrowser() override; ///< Factory for embedded browser - virtual AudioManager *createAudioManager(Bool dummy) override; ///< Factory for audio device - virtual ParticleSystemManager* createParticleSystemManager(Bool dummy) override; - - -protected: - UINT m_previousErrorMode; -}; - -// INLINE ----------------------------------------------------------------------------------------- -inline GameLogic *Win32GameEngine::createGameLogic() { return NEW W3DGameLogic; } -inline GameClient *Win32GameEngine::createGameClient() { return NEW W3DGameClient; } -inline ModuleFactory *Win32GameEngine::createModuleFactory() { return NEW W3DModuleFactory; } -inline ThingFactory *Win32GameEngine::createThingFactory() { return NEW W3DThingFactory; } -inline FunctionLexicon *Win32GameEngine::createFunctionLexicon() { return NEW W3DFunctionLexicon; } -inline LocalFileSystem *Win32GameEngine::createLocalFileSystem() { return NEW Win32LocalFileSystem; } -inline ArchiveFileSystem *Win32GameEngine::createArchiveFileSystem() { return NEW Win32BIGFileSystem; } -inline ParticleSystemManager* Win32GameEngine::createParticleSystemManager(Bool dummy) -{ - if (dummy) - return NEW ParticleSystemManagerDummy; - return NEW W3DParticleSystemManager; -} - -inline NetworkInterface *Win32GameEngine::createNetwork() { return NetworkInterface::createNetwork(); } -inline Radar *Win32GameEngine::createRadar(Bool dummy) -{ - if (dummy) - return NEW RadarDummy; - return NEW W3DRadar; -} -inline WebBrowser *Win32GameEngine::createWebBrowser() { return NEW CComObject; } -inline AudioManager *Win32GameEngine::createAudioManager(Bool dummy) -{ - if (dummy) - return NEW MilesAudioManagerDummy; - return NEW MilesAudioManager; -} diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp deleted file mode 100644 index 9c1850bc2a9..00000000000 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ /dev/null @@ -1,164 +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: W3DGameEngine.cpp //////////////////////////////////////////////////////////////////////// -// Author: Colin Day, April 2001 -// Description: -// Implementation of the Win32 game engine, this is the highest level of -// the game application, it creates all the devices we will use for the game -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include - -#include "Win32Device/Common/Win32GameEngine.h" -#include "Common/PerfTimer.h" - -#include "GameNetwork/LANAPICallbacks.h" - -extern DWORD TheMessageTime; - -//------------------------------------------------------------------------------------------------- -/** Constructor for Win32GameEngine */ -//------------------------------------------------------------------------------------------------- -Win32GameEngine::Win32GameEngine() -{ - // Stop blue screen - m_previousErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS ); -} - -//------------------------------------------------------------------------------------------------- -/** Destructor for Win32GameEngine */ -//------------------------------------------------------------------------------------------------- -Win32GameEngine::~Win32GameEngine() -{ - // restore it (this isn't really necessary, but feels good.) - SetErrorMode( m_previousErrorMode ); -} - - -//------------------------------------------------------------------------------------------------- -/** Initialize the game engine */ -//------------------------------------------------------------------------------------------------- -void Win32GameEngine::init() -{ - - // extending functionality - GameEngine::init(); - -} - -//------------------------------------------------------------------------------------------------- -/** Reset the system */ -//------------------------------------------------------------------------------------------------- -void Win32GameEngine::reset() -{ - - // extending functionality - GameEngine::reset(); - -} - -//------------------------------------------------------------------------------------------------- -/** Update the game engine by updating the GameClient and - * GameLogic singletons. */ -//------------------------------------------------------------------------------------------------- -void Win32GameEngine::update() -{ - - - // call the engine normal update - GameEngine::update(); - - extern HWND ApplicationHWnd; - if (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { - while (ApplicationHWnd && ::IsIconic(ApplicationHWnd)) { - // We are alt-tabbed out here. Sleep a bit, & process windows - // so that we can become un-alt-tabbed out. - Sleep(5); - serviceWindowsOS(); - - if (TheLAN != nullptr) { - // BGC - need to update TheLAN so we can process and respond to other - // people's messages who may not be alt-tabbed out like we are. - TheLAN->setIsActive(isActive()); - TheLAN->update(); - } - - // If we are running a multiplayer game, keep running the logic. - // There is code in the client to skip client redraw if we are - // iconic. jba. - if (TheGameEngine->getQuitting() || TheGameLogic->isInInternetGame() || TheGameLogic->isInLanGame()) { - break; // keep running. - } - } - } - - // allow windows to perform regular windows maintenance stuff like msgs - serviceWindowsOS(); - -} - -//------------------------------------------------------------------------------------------------- -/** This function may be called from within this application to let - * Microsoft Windows do its message processing and dispatching. Presumeably - * we would call this at least once each time around the game loop to keep - * Windows services from backing up */ -//------------------------------------------------------------------------------------------------- -void Win32GameEngine::serviceWindowsOS() -{ - MSG msg; - Int returnValue; - - // - // see if we have any messages to process, a nullptr window handle tells the - // OS to look at the main window associated with the calling thread, us! - // - while( PeekMessage( &msg, nullptr, 0, 0, PM_NOREMOVE ) ) - { - - // get the message - returnValue = GetMessage( &msg, nullptr, 0, 0 ); - - // this is one possible way to check for quitting conditions as a message - // of WM_QUIT will cause GetMessage() to return 0 -/* - if( returnValue == 0 ) - { - - setQuitting( true ); - break; - - } -*/ - - TheMessageTime = msg.time; - // translate and dispatch the message - TranslateMessage( &msg ); - DispatchMessage( &msg ); - TheMessageTime = 0; - - } - -} - diff --git a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp b/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp deleted file mode 100644 index dbe3d3f18e4..00000000000 --- a/Generals/Code/GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp +++ /dev/null @@ -1,118 +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. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// Win32OSDisplay.cpp ////////////////////////////////////// -// John McDonald, December 2002 -//////////////////////////////////////////////////////////// - -#define WIN32_LEAN_AND_MEAN -#include -#include "Common/OSDisplay.h" - -#include "Common/SubsystemInterface.h" -#include "Common/STLTypedefs.h" -#include "Common/AsciiString.h" -#include "Common/UnicodeString.h" -#include "GameClient/GameText.h" - - - -extern HWND ApplicationHWnd; - -//------------------------------------------------------------------------------------------------- -static void RTSFlagsToOSFlags(UnsignedInt buttonFlags, UnsignedInt otherFlags, UnsignedInt& outWindowsFlags) -{ - outWindowsFlags = 0; - - if (BitIsSet(buttonFlags, OSDBT_OK)) { - outWindowsFlags |= MB_OK; - } - - if (BitIsSet(buttonFlags, OSDBT_CANCEL)) { - outWindowsFlags |= MB_OKCANCEL; - } - - //----------------------------------------------------------------------------------------------- - if (BitIsSet(otherFlags, OSDOF_SYSTEMMODAL)) { - outWindowsFlags |= MB_SYSTEMMODAL; - } - - if (BitIsSet(otherFlags, OSDOF_APPLICATIONMODAL)) { - outWindowsFlags |= MB_APPLMODAL; - } - - if (BitIsSet(otherFlags, OSDOF_TASKMODAL)) { - outWindowsFlags |= MB_TASKMODAL; - } - - if (BitIsSet(otherFlags, OSDOF_EXCLAMATIONICON)) { - outWindowsFlags |= MB_ICONEXCLAMATION; - } - - if (BitIsSet(otherFlags, OSDOF_INFORMATIONICON)) { - outWindowsFlags |= MB_ICONINFORMATION; - } - - if (BitIsSet(otherFlags, OSDOF_ERRORICON)) { - outWindowsFlags |= MB_ICONERROR; - } - - if (BitIsSet(otherFlags, OSDOF_STOPICON)) { - outWindowsFlags |= MB_ICONSTOP; - } - -} - -//------------------------------------------------------------------------------------------------- -OSDisplayButtonType OSDisplayWarningBox(AsciiString p, AsciiString m, UnsignedInt buttonFlags, UnsignedInt otherFlags) -{ - if (!TheGameText) { - return OSDBT_ERROR; - } - - UnicodeString promptStr = TheGameText->fetch(p); - UnicodeString mesgStr = TheGameText->fetch(m); - - UnsignedInt windowsOptionsFlags = 0; - RTSFlagsToOSFlags(buttonFlags, otherFlags, windowsOptionsFlags); - - // @todo Make this return more than just ok/cancel - jkmcd - // (we need a function to translate back the other way.) - const Int returnResult = ::MessageBoxW(nullptr, mesgStr.str(), promptStr.str(), windowsOptionsFlags); - if (returnResult == IDOK) { - return OSDBT_OK; - } - - return OSDBT_CANCEL; -} - -//------------------------------------------------------------------------------------------------- -void OSDisplaySetBusyState(Bool busyDisplay, Bool busySystem) -{ - EXECUTION_STATE state = ES_CONTINUOUS; - state |= busyDisplay ? ES_DISPLAY_REQUIRED : 0; - state |= busySystem ? ES_SYSTEM_REQUIRED : 0; - - ::SetThreadExecutionState(state); -} diff --git a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt index 56408e821bd..0d50b778371 100644 --- a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt @@ -83,7 +83,7 @@ set(GAMEENGINEDEVICE_SRC Include/W3DDevice/GameLogic/W3DTerrainLogic.h # Include/Win32Device/Common/Win32BIGFile.h # Include/Win32Device/Common/Win32BIGFileSystem.h - Include/Win32Device/Common/Win32GameEngine.h +# Include/Win32Device/Common/Win32GameEngine.h # Include/Win32Device/Common/Win32LocalFile.h # Include/Win32Device/Common/Win32LocalFileSystem.h # Include/Win32Device/GameClient/Win32DIKeyboard.h @@ -183,10 +183,10 @@ set(GAMEENGINEDEVICE_SRC Source/W3DDevice/GameLogic/W3DTerrainLogic.cpp # Source/Win32Device/Common/Win32BIGFile.cpp # Source/Win32Device/Common/Win32BIGFileSystem.cpp - Source/Win32Device/Common/Win32GameEngine.cpp +# Source/Win32Device/Common/Win32GameEngine.cpp # Source/Win32Device/Common/Win32LocalFile.cpp # Source/Win32Device/Common/Win32LocalFileSystem.cpp - Source/Win32Device/Common/Win32OSDisplay.cpp +# Source/Win32Device/Common/Win32OSDisplay.cpp # Source/Win32Device/GameClient/Win32DIKeyboard.cpp # #Source/Win32Device/GameClient/Win32DIMouse.cpp # Source/Win32Device/GameClient/Win32Mouse.cpp diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 29d16c2b2bb..852c529d31a 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -412,6 +412,10 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp", Game.CORE, "GameEngineDevice/Source/Win32Device/GameClient/Win32DIMouse.cpp") #unify_file(Game.ZEROHOUR, "GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp", Game.CORE, "GameEngineDevice/Source/Win32Device/GameClient/Win32Mouse.cpp") + #unify_file(Game.ZEROHOUR, "GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h", Game.CORE, "GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h") + #unify_file(Game.ZEROHOUR, "GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp", Game.CORE, "GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp") + #unify_file(Game.ZEROHOUR, "GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp", Game.CORE, "GameEngineDevice/Source/Win32Device/Common/Win32OSDisplay.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GameFont.h", Game.CORE, "GameEngine/Include/GameClient/GameFont.h") #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GameWindow.h", Game.CORE, "GameEngine/Include/GameClient/GameWindow.h") #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GameWindowGlobal.h", Game.CORE, "GameEngine/Include/GameClient/GameWindowGlobal.h")