From 9b6d14faf4fb02a13eeca0a292c082aa1cd70063 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 20 Feb 2026 19:39:40 +0100 Subject: [PATCH 1/3] fix(loadscreen): Fix missing pointer initialization in constructors of MultiPlayerLoadScreen, GameSpyLoadScreen and remove superfluous code from destructors of LoadScreen classes (#2332) --- .../Source/GameClient/GUI/LoadScreen.cpp | 45 --------- .../Source/GameClient/GUI/LoadScreen.cpp | 93 ++----------------- 2 files changed, 6 insertions(+), 132 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index b59692c25ae..8a7292427e3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -132,11 +132,8 @@ LoadScreen::LoadScreen( void ) LoadScreen::~LoadScreen( void ) { - //if(m_loadScreen) - // delete (m_loadScreen); if(m_loadScreen) TheWindowManager->winDestroy( m_loadScreen ); - m_loadScreen = nullptr; } void LoadScreen::update( Int percent ) @@ -171,24 +168,14 @@ SinglePlayerLoadScreen::SinglePlayerLoadScreen( void ) SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void ) { - m_progressBar = nullptr; - m_percent = nullptr; - m_objectiveWin = nullptr; - for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) - m_objectiveLines[i] = nullptr; - delete m_videoBuffer; - m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = nullptr; } TheAudio->removeAudioEvent( m_ambientLoopHandle ); - m_ambientLoopHandle = 0; - } void SinglePlayerLoadScreen::moveWindows( Int frame ) @@ -622,8 +609,6 @@ ShellGameLoadScreen::ShellGameLoadScreen( void ) ShellGameLoadScreen::~ShellGameLoadScreen( void ) { - - m_progressBar = nullptr; } void ShellGameLoadScreen::init( GameInfo *game ) @@ -694,14 +679,6 @@ MultiPlayerLoadScreen::~MultiPlayerLoadScreen( void ) m_mapPreview->winSetUserData(nullptr); } - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressBars[i] = nullptr; - m_playerNames[i] = nullptr; - m_playerSide[i]= nullptr; - m_playerLookup[i] = -1; - } - TheAudio->removeAudioEvent( AHSV_StopTheMusicFade ); // TheAudio->stopAudio( AudioAffect_Music ); } @@ -918,18 +895,6 @@ GameSpyLoadScreen::~GameSpyLoadScreen( void ) { m_mapPreview->winSetUserData(nullptr); } - - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressBars[i] = nullptr; - m_playerNames[i] = nullptr; - m_playerSide[i]= nullptr; - m_playerLookup[i] = -1; - m_playerFavoriteFactions[i]= nullptr; - m_playerTotalDisconnects[i]= nullptr; - m_playerWin[i]= nullptr; - m_playerWinLosses[i]= nullptr; - } } extern Int GetAdditionalDisconnectsFromUserFile(Int playerID); @@ -1228,16 +1193,6 @@ MapTransferLoadScreen::MapTransferLoadScreen( void ) MapTransferLoadScreen::~MapTransferLoadScreen( void ) { - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressBars[i] = nullptr; - m_playerNames[i] = nullptr; - m_progressText[i]= nullptr; - m_playerLookup[i] = -1; - m_oldProgress[i] = -1; - } - m_fileNameText = nullptr; - m_timeoutText = nullptr; } void MapTransferLoadScreen::init( GameInfo *game ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index f0234729cb5..a607f140593 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -150,11 +150,8 @@ LoadScreen::LoadScreen( void ) LoadScreen::~LoadScreen( void ) { - //if(m_loadScreen) - // delete (m_loadScreen); if(m_loadScreen) TheWindowManager->winDestroy( m_loadScreen ); - m_loadScreen = nullptr; } void LoadScreen::update( Int percent ) @@ -192,24 +189,14 @@ SinglePlayerLoadScreen::SinglePlayerLoadScreen( void ) SinglePlayerLoadScreen::~SinglePlayerLoadScreen( void ) { - m_progressBar = nullptr; - m_percent = nullptr; - m_objectiveWin = nullptr; - for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) - m_objectiveLines[i] = nullptr; - delete m_videoBuffer; - m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = nullptr; } TheAudio->removeAudioEvent( m_ambientLoopHandle ); - m_ambientLoopHandle = 0; - } void SinglePlayerLoadScreen::moveWindows( Int frame ) @@ -687,54 +674,16 @@ ChallengeLoadScreen::ChallengeLoadScreen( void ) ChallengeLoadScreen::~ChallengeLoadScreen( void ) { - m_progressBar = nullptr; - delete m_videoBuffer; - m_videoBuffer = nullptr; if ( m_videoStream ) { m_videoStream->close(); - m_videoStream = nullptr; } - m_bioNameLeft = nullptr; - m_bioAgeLeft = nullptr; - m_bioBirthplaceLeft = nullptr; - m_bioStrategyLeft = nullptr; - m_bioBigNameEntryLeft = nullptr; - m_bioNameEntryLeft = nullptr; - m_bioAgeEntryLeft = nullptr; - m_bioBirthplaceEntryLeft = nullptr; - m_bioStrategyEntryLeft = nullptr; - m_bioBigNameEntryRight = nullptr; - m_bioNameRight = nullptr; - m_bioAgeRight = nullptr; - m_bioBirthplaceRight = nullptr; - m_bioStrategyRight = nullptr; - m_bioNameEntryRight = nullptr; - m_bioAgeEntryRight = nullptr; - m_bioBirthplaceEntryRight = nullptr; - m_bioStrategyEntryRight = nullptr; - - m_portraitLeft = nullptr; - m_portraitRight = nullptr; - m_portraitMovieLeft = nullptr; - m_portraitMovieRight = nullptr; - -// m_overlayReticleCrosshairs = nullptr; -// m_overlayReticleCircleLineOuter = nullptr; -// m_overlayReticleCircleLineInner = nullptr; - m_overlayReticleCircleAlphaOuter = nullptr; - m_overlayReticleCircleAlphaInner = nullptr; - m_overlayVsBackdrop = nullptr; - m_overlayVs = nullptr; - delete m_wndVideoManager; - m_wndVideoManager = nullptr; TheAudio->removeAudioEvent( m_ambientLoopHandle ); - m_ambientLoopHandle = 0; } // accepts the number of chars to advance, the window we're concerned with, the total text for final display, and the current position of the readout @@ -1184,8 +1133,6 @@ ShellGameLoadScreen::ShellGameLoadScreen( void ) ShellGameLoadScreen::~ShellGameLoadScreen( void ) { - - m_progressBar = nullptr; } void ShellGameLoadScreen::init( GameInfo *game ) @@ -1238,6 +1185,9 @@ void ShellGameLoadScreen::update( Int percent ) MultiPlayerLoadScreen::MultiPlayerLoadScreen( void ) { m_mapPreview = nullptr; + m_portraitLocalGeneral = nullptr; + m_featuresLocalGeneral = nullptr; + m_nameLocalGeneral = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { @@ -1256,18 +1206,6 @@ MultiPlayerLoadScreen::~MultiPlayerLoadScreen( void ) m_mapPreview->winSetUserData(nullptr); } - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressBars[i] = nullptr; - m_playerNames[i] = nullptr; - m_playerSide[i]= nullptr; - m_playerLookup[i] = -1; - } - - m_portraitLocalGeneral = nullptr; - m_featuresLocalGeneral = nullptr; - m_nameLocalGeneral = nullptr; - TheAudio->removeAudioEvent( AHSV_StopTheMusicFade ); // TheAudio->stopAudio( AudioAffect_Music ); } @@ -1498,6 +1436,9 @@ GameSpyLoadScreen::GameSpyLoadScreen( void ) { m_mapPreview = nullptr; + m_portraitLocalGeneral = nullptr; + m_featuresLocalGeneral = nullptr; + m_nameLocalGeneral = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { @@ -1523,18 +1464,6 @@ GameSpyLoadScreen::~GameSpyLoadScreen( void ) { m_mapPreview->winSetUserData(nullptr); } - - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressBars[i] = nullptr; - m_playerNames[i] = nullptr; - m_playerSide[i]= nullptr; - m_playerLookup[i] = -1; - m_playerFavoriteFactions[i]= nullptr; - m_playerTotalDisconnects[i]= nullptr; - m_playerWin[i]= nullptr; - m_playerWinLosses[i]= nullptr; - } } extern Int GetAdditionalDisconnectsFromUserFile(Int playerID); @@ -1873,16 +1802,6 @@ MapTransferLoadScreen::MapTransferLoadScreen( void ) MapTransferLoadScreen::~MapTransferLoadScreen( void ) { - for(Int i = 0; i < MAX_SLOTS; ++i) - { - m_progressBars[i] = nullptr; - m_playerNames[i] = nullptr; - m_progressText[i]= nullptr; - m_playerLookup[i] = -1; - m_oldProgress[i] = -1; - } - m_fileNameText = nullptr; - m_timeoutText = nullptr; } void MapTransferLoadScreen::init( GameInfo *game ) From 0124ac67a4eeed482be89ef6d3ca4c9fffddf0ad Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 20 Feb 2026 20:24:47 +0100 Subject: [PATCH 2/3] unify(loadscreen): Merge LoadScreen and related code (#2332) --- .../Include/GameClient/CampaignManager.h | 1 + .../Include/GameClient/GameWindow.h | 2 + .../Include/GameClient/LoadScreen.h | 83 ++ .../Source/GameClient/GUI/LoadScreen.cpp | 713 +++++++++++++++++- .../GameClient/System/CampaignManager.cpp | 2 +- .../Source/GameClient/GUI/LoadScreen.cpp | 90 ++- 6 files changed, 849 insertions(+), 42 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h b/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h index 77b4fe19875..da034d5ee98 100644 --- a/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h +++ b/Generals/Code/GameEngine/Include/GameClient/CampaignManager.h @@ -82,6 +82,7 @@ class Mission : public MemoryPoolObject AsciiString m_locationNameLabel; AsciiString m_unitNames[MAX_DISPLAYED_UNITS]; Int m_voiceLength; + AsciiString m_generalName; }; class Campaign : public MemoryPoolObject diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h index faed99452bf..f5e27b8a7b9 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h @@ -180,6 +180,8 @@ enum WIN_STATUS_NOT_READY = 0x00400000, // A disabled button that is available -- but not yet (power charge, fire delay). WIN_STATUS_FLASHING = 0x00800000, // Used for buttons that do cameo flashes. WIN_STATUS_ALWAYS_COLOR = 0x01000000, // Never render these buttons using greyscale renderer when button disabled. + WIN_STATUS_ON_MOUSE_DOWN = 0x02000000, // Pushbutton triggers on mouse down. + WIN_STATUS_SHORTCUT_BUTTON = 0x04000000, // Oh god... this is a total hack for shortcut buttons to handle rendering text top left corner... // when you edit this, remember to edit WindowStatusNames[] }; diff --git a/Generals/Code/GameEngine/Include/GameClient/LoadScreen.h b/Generals/Code/GameEngine/Include/GameClient/LoadScreen.h index f0f2ac53fe8..42ba8eca47b 100644 --- a/Generals/Code/GameEngine/Include/GameClient/LoadScreen.h +++ b/Generals/Code/GameEngine/Include/GameClient/LoadScreen.h @@ -37,11 +37,14 @@ #include "GameClient/GameWindow.h" #include "GameNetwork/GameInfo.h" #include "GameClient/CampaignManager.h" +#include "GameClient/ChallengeGenerals.h" + // FORWARD REFERENCES ///////////////////////////////////////////////////////// // TYPE DEFINES /////////////////////////////////////////////////////////////// class VideoBuffer; class VideoStreamInterface; +class WindowVideoManager; @@ -117,6 +120,79 @@ class SinglePlayerLoadScreen : public LoadScreen }; + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// class ChallengeLoadScreen is to be used only when we're loading a Generals' Challenge mission +/////////////////////////////////////////////////////////////////////////////////////////////////// +class ChallengeLoadScreen : public LoadScreen +{ +public: + ChallengeLoadScreen( void ); + virtual ~ChallengeLoadScreen( void ); + + virtual void init( GameInfo *game ); ///< Init the loadscreen + virtual void reset( void ); ///< Reset the system + virtual void update( void ) + { + DEBUG_CRASH(("Call update(Int) instead. This update isn't supported")); + }; + virtual void update(Int percent); ///< Update the state of the progress bar + virtual void processProgress(Int playerId, Int percentage) + { + DEBUG_CRASH(("We Got to a single player load screen throw the Network...")); + } + + virtual void setProgressRange( Int min, Int max ); + +private: + GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window + + VideoBuffer *m_videoBuffer; + VideoStreamInterface *m_videoStream; + + WindowVideoManager *m_wndVideoManager; + + AudioEventRTS m_ambientLoop; + AudioHandle m_ambientLoopHandle; + + GameWindow *m_bioNameLeft; + GameWindow *m_bioAgeLeft; + GameWindow *m_bioBirthplaceLeft; + GameWindow *m_bioStrategyLeft; + GameWindow *m_bioBigNameEntryLeft; + GameWindow *m_bioNameEntryLeft; + GameWindow *m_bioAgeEntryLeft; + GameWindow *m_bioBirthplaceEntryLeft; + GameWindow *m_bioStrategyEntryLeft; + GameWindow *m_bioNameRight; + GameWindow *m_bioAgeRight; + GameWindow *m_bioBirthplaceRight; + GameWindow *m_bioStrategyRight; + GameWindow *m_bioBigNameEntryRight; + GameWindow *m_bioNameEntryRight; + GameWindow *m_bioAgeEntryRight; + GameWindow *m_bioBirthplaceEntryRight; + GameWindow *m_bioStrategyEntryRight; + + GameWindow *m_portraitLeft; + GameWindow *m_portraitRight; + GameWindow *m_portraitMovieLeft; + GameWindow *m_portraitMovieRight; + +// GameWindow *m_overlayReticleCrosshairs; + GameWindow *m_overlayReticleCircleLineOuter; + GameWindow *m_overlayReticleCircleLineInner; + GameWindow *m_overlayReticleCircleAlphaOuter; + GameWindow *m_overlayReticleCircleAlphaInner; + GameWindow *m_overlayVsBackdrop; + GameWindow *m_overlayVs; + + void activatePieces( Int frame, const GeneralPersona *generalPlayer, const GeneralPersona *generalOpponent ); + void activatePiecesMinSpec(const GeneralPersona *generalPlayer, const GeneralPersona *generalOpponent); +}; + + + /////////////////////////////////////////////////////////////////////////////////////////////////// // class ShellGameLoadScreen is to be used for the Shell Game loadscreen //// /////////////////////////////////////////////////////////////////////////////////////////////// @@ -170,6 +246,9 @@ class MultiPlayerLoadScreen : public LoadScreen Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list) GameWindow *m_mapPreview; GameWindow *m_buttonMapStartPosition[MAX_SLOTS]; + GameWindow *m_portraitLocalGeneral; + GameWindow *m_featuresLocalGeneral; + GameWindow *m_nameLocalGeneral; }; @@ -205,6 +284,10 @@ class GameSpyLoadScreen : public LoadScreen GameWindow *m_buttonMapStartPosition[MAX_SLOTS]; Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list) + + GameWindow *m_portraitLocalGeneral; + GameWindow *m_featuresLocalGeneral; + GameWindow *m_nameLocalGeneral; }; /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index 8a7292427e3..9e7db996a54 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -53,38 +53,39 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- #include "Common/NameKeyGenerator.h" -#include "Common/MultiplayerSettings.h" +#include "Common/AudioAffect.h" +#include "Common/AudioEventRTS.h" +#include "Common/AudioHandleSpecialValues.h" +#include "Common/GameAudio.h" #include "Common/GameEngine.h" +#include "Common/GameLOD.h" #include "Common/GameState.h" -#include "Common/PlayerTemplate.h" -#include "Common/PlayerList.h" +#include "Common/MultiplayerSettings.h" #include "Common/Player.h" -#include "Common/GameLOD.h" -#include "Common/GameAudio.h" -#include "Common/AudioEventRTS.h" -#include "Common/AudioHandleSpecialValues.h" -#include "Common/AudioAffect.h" - -#include "GameClient/LoadScreen.h" -#include "GameClient/Keyboard.h" -#include "GameClient/Shell.h" -#include "GameClient/GameWindowManager.h" +#include "Common/PlayerList.h" +#include "Common/PlayerTemplate.h" +#include "GameClient/CampaignManager.h" +#include "GameClient/Display.h" #include "GameClient/GadgetProgressBar.h" #include "GameClient/GadgetStaticText.h" #include "GameClient/GameText.h" -#include "GameClient/Display.h" -#include "GameClient/WindowLayout.h" +#include "GameClient/GameWindowManager.h" +#include "GameClient/GameWindowTransitions.h" +#include "GameClient/Keyboard.h" +#include "GameClient/LoadScreen.h" +#include "GameClient/MapUtil.h" #include "GameClient/Mouse.h" +#include "GameClient/Shell.h" #include "GameClient/VideoPlayer.h" -#include "GameClient/MapUtil.h" +#include "GameClient/WindowLayout.h" +#include "GameClient/WindowVideoManager.h" +#include "GameClient/ChallengeGenerals.h" #include "GameLogic/FPUControl.h" #include "GameLogic/GameLogic.h" -#include "GameNetwork/NetworkInterface.h" #include "GameNetwork/GameSpy/PeerDefs.h" #include "GameNetwork/GameSpy/PersistentStorageThread.h" -#include "GameClient/CampaignManager.h" +#include "GameNetwork/NetworkInterface.h" #include "GameNetwork/RankPointValue.h" -#include "GameClient/GameWindowTransitions.h" //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// @@ -119,8 +120,25 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ void positionAdditionalImages( MapMetaData *mmd, GameWindow *mapWindow, Bool force); enum{ +FRAME_TITLES_START = 20, +FRAME_TELETYPE_START = 24, FRAME_FUDGE_ADD = 30, +FRAME_PORTRAITS_START = 35, +FRAME_OUTER_CIRCLE_LINE_SHOW = 50, +FRAME_INNER_CIRCLE_LINE_SHOW = 52, +FRAME_OUTER_CIRCLE_ALPHA_SHOW = 63, +FRAME_INNER_CIRCLE_ALPHA_SHOW = 74, +FRAME_OUTER_CIRCLE_LINE_HIDE = 75, +FRAME_INNER_BACKDROP_ALPHA_SHOW = 80, +FRAME_INNER_CIRCLE_LINE_HIDE = 81, +FRAME_VS_ANIM_START = 98, +FRAME_RIGHT_VOICE = 140, }; + +static const Int TELETYPE_UPDATE_FREQ = 2; // how many frames between teletype updates + + + //----------------------------------------------------------------------------- // LoadScreen Class //----------------------------------------------------------------------------- @@ -139,6 +157,9 @@ LoadScreen::~LoadScreen( void ) void LoadScreen::update( Int percent ) { TheGameEngine->serviceWindowsOS(); + if (TheGameEngine->getQuitting()) + return; //don't bother with any of this if the player is exiting game. + TheWindowManager->update(); TheDisplay->update(); // redraw all views, update the GUI @@ -469,6 +490,46 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) return; } + // format the progress bar: USA to blue, GLA to green, China to red + // and set the background image + AsciiString campaignName = TheCampaignManager->getCurrentCampaign()->m_name; + GameWindow *backgroundWin = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "SinglePlayerLoadScreen.wnd:ParentSinglePlayerLoadScreen" )); + if (campaignName.compareNoCase("USA") == 0) + { + if (const Image *image = TheMappedImageCollection->findImageByName("MissionLoad_USA")) + { + backgroundWin->winSetEnabledImage( 0, image); + } + if (const Image *image = TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter2")) + { + m_progressBar->winSetEnabledImage( 6, image ); + } + } + else if (campaignName.compareNoCase("GLA") == 0) + { + if (const Image *image = TheMappedImageCollection->findImageByName("MissionLoad_GLA")) + { + backgroundWin->winSetEnabledImage( 0, image ); + } + if (const Image *image = TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter3")) + { + m_progressBar->winSetEnabledImage( 6, image ); + } + } + else if (campaignName.compareNoCase("China") == 0) + { + if (const Image *image = TheMappedImageCollection->findImageByName("MissionLoad_China")) + { + backgroundWin->winSetEnabledImage( 0, image ); + } + if (const Image *image = TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter1")) + { + m_progressBar->winSetEnabledImage( 6, image ); + } + } + // else leave the default background screen + + if(TheGameLODManager && TheGameLODManager->didMemPass()) { // TheSuperHackers @bugfix Originally this movie render loop stopped rendering when the game window was inactive. @@ -500,7 +561,11 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) m_videoStream->frameDecompress(); m_videoStream->frameRender(m_videoBuffer); + +#if RTS_GENERALS moveWindows( m_videoStream->frameIndex()); +#endif + m_videoStream->frameNext(); if(m_videoBuffer) @@ -520,14 +585,21 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) } TheWindowManager->update(); - //TheShell->update(); - //TheDisplay->update(); // redraw all views, update the GUI TheDisplay->draw(); } + +#if !RTS_GENERALS + // let the background image show through + m_videoStream->close(); + m_videoStream = nullptr; + m_loadScreen->winGetInstanceData()->setVideoBuffer( nullptr ); + TheDisplay->draw(); +#endif } else { +#if RTS_GENERALS // if we're min speced m_videoStream->frameGoto(m_videoStream->frameCount()); // zero based while(!m_videoStream->isFrameReady()) @@ -549,6 +621,9 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) { GadgetStaticTextSetText(m_objectiveLines[i], m_unicodeObjectiveLines[i]); } +#else + // if we're min spec'ed don't play a movie +#endif Int delay = mission->m_voiceLength * 1000; Int begin = timeGetTime(); @@ -600,6 +675,500 @@ void SinglePlayerLoadScreen::setProgressRange( Int min, Int max ) } +// ChallengeLoadScreen Class /////////////////////////////////////////////// +//----------------------------------------------------------------------------- +ChallengeLoadScreen::ChallengeLoadScreen( void ) +{ + m_progressBar = nullptr; + m_videoStream = nullptr; + m_videoBuffer = nullptr; + + m_bioNameLeft = nullptr; + m_bioAgeLeft = nullptr; + m_bioBirthplaceLeft = nullptr; + m_bioStrategyLeft = nullptr; + m_bioBigNameEntryLeft = nullptr; + m_bioNameEntryLeft = nullptr; + m_bioAgeEntryLeft = nullptr; + m_bioBirthplaceEntryLeft = nullptr; + m_bioStrategyEntryLeft = nullptr; + m_bioBigNameEntryRight = nullptr; + m_bioNameRight = nullptr; + m_bioAgeRight = nullptr; + m_bioBirthplaceRight = nullptr; + m_bioStrategyRight = nullptr; + m_bioNameEntryRight = nullptr; + m_bioAgeEntryRight = nullptr; + m_bioBirthplaceEntryRight = nullptr; + m_bioStrategyEntryRight = nullptr; + + m_portraitLeft = nullptr; + m_portraitRight = nullptr; + m_portraitMovieLeft = nullptr; + m_portraitMovieRight = nullptr; + +// m_overlayReticleCrosshairs = nullptr; +// m_overlayReticleCircleLineOuter = nullptr; +// m_overlayReticleCircleLineInner = nullptr; + m_overlayReticleCircleAlphaOuter = nullptr; + m_overlayReticleCircleAlphaInner = nullptr; + m_overlayVsBackdrop = nullptr; + m_overlayVs = nullptr; + m_wndVideoManager = nullptr; +} + +ChallengeLoadScreen::~ChallengeLoadScreen( void ) +{ + delete m_videoBuffer; + + if ( m_videoStream ) + { + m_videoStream->close(); + } + + delete m_wndVideoManager; + + TheAudio->removeAudioEvent( m_ambientLoopHandle ); +} + +// accepts the number of chars to advance, the window we're concerned with, the total text for final display, and the current position of the readout +// returns the updated position of the readout +Int updateTeletypeText( Int num_chars, GameWindow* window, UnicodeString full_text, Int current_text_pos ) +{ + DEBUG_ASSERTCRASH(window, ("No window for teletype text update")); + UnicodeString currentText = GadgetStaticTextGetText(window); + WideChar wChar; + for (Int i = 0; i < num_chars; i++) + { + if (current_text_pos < full_text.getLength()) + { + wChar = full_text.getCharAt(current_text_pos); + currentText.concat(wChar); + current_text_pos++; + } + } + GadgetStaticTextSetText(window, currentText); + return current_text_pos; +} + +void ChallengeLoadScreen::activatePieces( Int frame, const GeneralPersona *generalPlayer, const GeneralPersona *generalOpponent ) +{ + static Int textPosBigNameRight = 0; + static Int textPosNameRight = 0; + static Int textPosAgeRight = 0; + static Int textPosBirthplaceRight = 0; + static Int textPosStrategyRight = 0; + static Int textPosBigNameLeft = 0; + static Int textPosNameLeft = 0; + static Int textPosAgeLeft = 0; + static Int textPosBirthplaceLeft = 0; + static Int textPosStrategyLeft = 0; + + AudioEventRTS eventLeftGeneral( generalPlayer->getNameSound() ); + AudioEventRTS eventVS("Taunts_GCAnnouncer12"); + AudioEventRTS eventRightGeneral( generalOpponent->getNameSound() ); + + switch (frame) + { + case FRAME_TITLES_START: + m_bioNameLeft->winHide(FALSE); +// m_bioAgeLeft->winHide(FALSE); + m_bioBirthplaceLeft->winHide(FALSE); + m_bioStrategyLeft->winHide(FALSE); + m_bioNameRight->winHide(FALSE); +// m_bioAgeRight->winHide(FALSE); + m_bioBirthplaceRight->winHide(FALSE); + m_bioStrategyRight->winHide(FALSE); + + break; + case FRAME_TELETYPE_START: + // reinit the statics for each new load screen + textPosBigNameRight = 0; + textPosNameRight = 0; + textPosAgeRight = 0; + textPosBirthplaceRight = 0; + textPosStrategyRight = 0; + textPosBigNameLeft = 0; + textPosNameLeft = 0; + textPosAgeLeft = 0; + textPosBirthplaceLeft = 0; + textPosStrategyLeft = 0; + + m_bioBigNameEntryLeft->winHide(FALSE); + m_bioNameEntryLeft->winHide(FALSE); +// m_bioAgeEntryLeft->winHide(FALSE); + m_bioBirthplaceEntryLeft->winHide(FALSE); + m_bioStrategyEntryLeft->winHide(FALSE); + GadgetStaticTextSetText( m_bioBigNameEntryLeft, UnicodeString::TheEmptyString ); + GadgetStaticTextSetText( m_bioNameEntryLeft, UnicodeString::TheEmptyString ); +// GadgetStaticTextSetText( m_bioAgeEntryLeft, UnicodeString::TheEmptyString ); + GadgetStaticTextSetText( m_bioBirthplaceEntryLeft, UnicodeString::TheEmptyString ); + GadgetStaticTextSetText( m_bioStrategyEntryLeft, UnicodeString::TheEmptyString ); + + m_bioBigNameEntryRight->winHide(FALSE); + m_bioNameEntryRight->winHide(FALSE); +// m_bioAgeEntryRight->winHide(FALSE); + m_bioBirthplaceEntryRight->winHide(FALSE); + m_bioStrategyEntryRight->winHide(FALSE); + GadgetStaticTextSetText( m_bioBigNameEntryRight, UnicodeString::TheEmptyString ); + GadgetStaticTextSetText( m_bioNameEntryRight, UnicodeString::TheEmptyString ); +// GadgetStaticTextSetText( m_bioAgeEntryRight, UnicodeString::TheEmptyString ); + GadgetStaticTextSetText( m_bioBirthplaceEntryRight, UnicodeString::TheEmptyString ); + GadgetStaticTextSetText( m_bioStrategyEntryRight, UnicodeString::TheEmptyString ); + break; + case FRAME_PORTRAITS_START: + + m_wndVideoManager->playMovie( m_portraitMovieLeft, generalPlayer->getPortraitMovieLeftName(), WINDOW_PLAY_MOVIE_SHOW_LAST_FRAME); + m_wndVideoManager->playMovie( m_portraitMovieRight, generalOpponent->getPortraitMovieRightName(), WINDOW_PLAY_MOVIE_SHOW_LAST_FRAME); + m_portraitMovieLeft->winHide(FALSE); + m_portraitMovieRight->winHide(FALSE); + + TheAudio->addAudioEvent( &eventLeftGeneral ); + + break; + case FRAME_OUTER_CIRCLE_LINE_SHOW: +// m_overlayReticleCircleLineOuter->winHide(FALSE); + break; + case FRAME_INNER_CIRCLE_LINE_SHOW: +// m_overlayReticleCircleLineInner->winHide(FALSE); + break; + case FRAME_OUTER_CIRCLE_ALPHA_SHOW: + m_overlayReticleCircleAlphaOuter->winHide(FALSE); + break; + case FRAME_INNER_CIRCLE_ALPHA_SHOW: + m_overlayReticleCircleAlphaInner->winHide(FALSE); + break; + case FRAME_OUTER_CIRCLE_LINE_HIDE: +// m_overlayReticleCircleLineOuter->winHide(TRUE); + break; + case FRAME_INNER_BACKDROP_ALPHA_SHOW: + m_overlayVsBackdrop->winHide(FALSE); + break; + case FRAME_INNER_CIRCLE_LINE_HIDE: +// m_overlayReticleCircleLineInner->winHide(TRUE); + break; + case FRAME_VS_ANIM_START: + // it's time to start the overlay movie +// m_overlayVsBackdrop->winSetEnabledImage( 0, TheMappedImageCollection->findImageByFilename(")) + m_overlayVsBackdrop->winHide(FALSE); + m_overlayVs->winHide(FALSE); + m_wndVideoManager->playMovie( m_overlayVs, "VSSmall", WINDOW_PLAY_MOVIE_SHOW_LAST_FRAME); + + // "Verses" + TheAudio->addAudioEvent( &eventVS ); + + break; + case FRAME_RIGHT_VOICE: + TheAudio->addAudioEvent( &eventRightGeneral ); + + break; + } + + // update the teletype readout + if (frame > FRAME_TELETYPE_START && (frame % TELETYPE_UPDATE_FREQ) == 0) + { + textPosNameLeft = updateTeletypeText( 1, m_bioNameEntryLeft, TheGameText->fetch(generalPlayer->getBioName()), textPosNameLeft); + textPosBigNameLeft = updateTeletypeText( 1, m_bioBigNameEntryLeft, TheGameText->fetch(generalPlayer->getBioName()), textPosBigNameLeft); +// textPosAgeLeft = updateTeletypeText( 1, m_bioAgeEntryLeft, TheGameText->fetch(generalPlayer->getBioDOB()), textPosAgeLeft); + textPosBirthplaceLeft = updateTeletypeText( 1, m_bioBirthplaceEntryLeft, TheGameText->fetch(generalPlayer->getBioRank()), textPosBirthplaceLeft); + textPosStrategyLeft = updateTeletypeText( 1, m_bioStrategyEntryLeft, TheGameText->fetch(generalPlayer->getBioStrategy()), textPosStrategyLeft); + + textPosNameRight = updateTeletypeText( 1, m_bioNameEntryRight, TheGameText->fetch(generalOpponent->getBioName()), textPosNameRight); + textPosBigNameRight = updateTeletypeText( 1, m_bioBigNameEntryRight, TheGameText->fetch(generalOpponent->getBioName()), textPosBigNameRight); +// textPosAgeRight = updateTeletypeText( 1, m_bioAgeEntryRight, TheGameText->fetch(generalOpponent->getBioDOB()), textPosAgeRight); + textPosBirthplaceRight = updateTeletypeText( 1, m_bioBirthplaceEntryRight, TheGameText->fetch(generalOpponent->getBioRank()), textPosBirthplaceRight); + textPosStrategyRight = updateTeletypeText( 1, m_bioStrategyEntryRight, TheGameText->fetch(generalOpponent->getBioStrategy()), textPosStrategyRight); + } +} + +void ChallengeLoadScreen::activatePiecesMinSpec(const GeneralPersona *generalPlayer, const GeneralPersona *generalOpponent) +{ + m_bioNameLeft->winHide(FALSE); +// m_bioAgeLeft->winHide(FALSE); + m_bioBirthplaceLeft->winHide(FALSE); + m_bioStrategyLeft->winHide(FALSE); + m_bioNameRight->winHide(FALSE); +// m_bioAgeRight->winHide(FALSE); + m_bioBirthplaceRight->winHide(FALSE); + m_bioStrategyRight->winHide(FALSE); + m_bioBigNameEntryLeft->winHide(FALSE); + m_bioNameEntryLeft->winHide(FALSE); +// m_bioAgeEntryLeft->winHide(FALSE); + m_bioBirthplaceEntryLeft->winHide(FALSE); + m_bioStrategyEntryLeft->winHide(FALSE); + GadgetStaticTextSetText( m_bioBigNameEntryLeft, TheGameText->fetch(generalPlayer->getBioName()) ); + GadgetStaticTextSetText( m_bioNameEntryLeft, TheGameText->fetch(generalPlayer->getBioName()) ); +// GadgetStaticTextSetText( m_bioAgeEntryLeft, TheGameText->fetch(generalPlayer->getBioDOB()) ); + GadgetStaticTextSetText( m_bioBirthplaceEntryLeft, TheGameText->fetch(generalPlayer->getBioRank()) ); + GadgetStaticTextSetText( m_bioStrategyEntryLeft, TheGameText->fetch(generalPlayer->getBioStrategy()) ); + m_bioBigNameEntryRight->winHide(FALSE); + m_bioNameEntryRight->winHide(FALSE); +// m_bioAgeEntryRight->winHide(FALSE); + m_bioBirthplaceEntryRight->winHide(FALSE); + m_bioStrategyEntryRight->winHide(FALSE); + GadgetStaticTextSetText( m_bioBigNameEntryRight, TheGameText->fetch(generalOpponent->getBioName()) ); + GadgetStaticTextSetText( m_bioNameEntryRight, TheGameText->fetch(generalOpponent->getBioName()) ); +// GadgetStaticTextSetText( m_bioAgeEntryRight, TheGameText->fetch(generalOpponent->getBioDOB()) ); + GadgetStaticTextSetText( m_bioBirthplaceEntryRight, TheGameText->fetch(generalOpponent->getBioRank()) ); + GadgetStaticTextSetText( m_bioStrategyEntryRight, TheGameText->fetch(generalOpponent->getBioStrategy()) ); + m_portraitLeft->winSetEnabledImage(0, generalPlayer->getBioPortraitLarge() ); + m_portraitRight->winSetEnabledImage(0, generalOpponent->getBioPortraitLarge() ); + m_portraitLeft->winHide(FALSE); + m_portraitRight->winHide(FALSE); + m_overlayReticleCircleAlphaOuter->winHide(FALSE); + m_overlayReticleCircleAlphaInner->winHide(FALSE); + m_overlayVsBackdrop->winHide(FALSE); + m_overlayVsBackdrop->winHide(FALSE); + m_overlayVs->winHide(FALSE); + m_wndVideoManager->playMovie( m_overlayVs, "VSSmall", WINDOW_PLAY_MOVIE_SHOW_LAST_FRAME); +} + + +void ChallengeLoadScreen::init( GameInfo *game ) +{ + const Campaign *campaign = TheCampaignManager->getCurrentCampaign(); + const Mission *mission = TheCampaignManager->getCurrentMission(); + + // the player general is tied to the campaign + const GeneralPersona* generalPlayer = TheChallengeGenerals->getPlayerGeneralByCampaignName( campaign->m_name ); + + // the opponent general is tied to the mission + DEBUG_ASSERTCRASH(mission->m_generalName.isNotEmpty(), ("No GeneralName associated with this mission, check Campaign.ini")); + const GeneralPersona* generalOpponent = TheChallengeGenerals->getGeneralByGeneralName( mission->m_generalName ); + + // create the layout of the load screen + m_loadScreen = TheWindowManager->winCreateFromScript( "Menus/ChallengeLoadScreen.wnd" ); + DEBUG_ASSERTCRASH(m_loadScreen, ("Can't initialize the single player loadscreen")); + m_loadScreen->winHide(FALSE); + m_loadScreen->winBringToTop(); + + // Store the pointer to the progress bar on the loadscreen + m_progressBar = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:ProgressLoad" )); + DEBUG_ASSERTCRASH(m_progressBar, ("Can't initialize the progressbar for the single player loadscreen")); + GadgetProgressBarSetProgress(m_progressBar, 0 ); + + m_ambientLoop.setEventName("LoadScreenAmbient"); + + // create the new background video stream + m_videoStream = TheVideoPlayer->open( TheCampaignManager->getCurrentMission()->m_movieLabel ); + + // Create the new buffer + m_videoBuffer = TheDisplay->createVideoBuffer(); + if (m_videoBuffer == nullptr || !m_videoBuffer->allocate( m_videoStream->width(), m_videoStream->height() )) + { + delete m_videoBuffer; + m_videoBuffer = nullptr; + + if ( m_videoStream ) + { + m_videoStream->close(); + m_videoStream = nullptr; + } + + return; + } + + // init overlays + NameKeyType namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:PortraitLeft"); + m_portraitLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:PortraitRight"); + m_portraitRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:PortraitMovieLeft"); + m_portraitMovieLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:PortraitMovieRight"); + m_portraitMovieRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + +// namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:ReticleCrosshairs"); +// m_overlayReticleCrosshairs = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); +/* + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:OuterCircleLine"); + m_overlayReticleCircleLineOuter = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:InnerCircleLine"); + m_overlayReticleCircleLineInner = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); +*/ + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:CircleAlphaOuter"); + m_overlayReticleCircleAlphaOuter = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:CircleAlphaInner"); + m_overlayReticleCircleAlphaInner = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:VersusBackdrop"); + m_overlayVsBackdrop = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:OverlayVs"); + m_overlayVs = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioNameLeft"); + m_bioNameLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); +// namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioDOBLeft"); +// m_bioAgeLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioBirthplaceLeft"); + m_bioBirthplaceLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioStrategyLeft"); + m_bioStrategyLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BigNameEntryLeft"); + m_bioBigNameEntryLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioNameEntryLeft"); + m_bioNameEntryLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); +// namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioDOBEntryLeft"); +// m_bioAgeEntryLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioBirthplaceEntryLeft"); + m_bioBirthplaceEntryLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioStrategyEntryLeft"); + m_bioStrategyEntryLeft = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioNameRight"); + m_bioNameRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); +// namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioDOBRight"); +// m_bioAgeRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioBirthplaceRight"); + m_bioBirthplaceRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioStrategyRight"); + m_bioStrategyRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BigNameEntryRight"); + m_bioBigNameEntryRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioNameEntryRight"); + m_bioNameEntryRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); +// namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioDOBEntryRight"); +// m_bioAgeEntryRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioBirthplaceEntryRight"); + m_bioBirthplaceEntryRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + namekey = TheNameKeyGenerator->nameToKey( "ChallengeLoadScreen.wnd:BioStrategyEntryRight"); + m_bioStrategyEntryRight = TheWindowManager->winGetWindowFromId( m_loadScreen, namekey ); + + + // make sure reticle stuff starts out hidden +// m_overlayReticleCircleLineOuter->winHide(TRUE); +// m_overlayReticleCircleLineInner->winHide(TRUE); + m_overlayReticleCircleAlphaOuter->winHide(TRUE); + m_overlayReticleCircleAlphaInner->winHide(TRUE); + m_overlayVsBackdrop->winHide(TRUE); + m_overlayVs->winHide(TRUE); + + m_wndVideoManager = NEW WindowVideoManager; + m_wndVideoManager->init(); + + if(TheGameLODManager && TheGameLODManager->didMemPass()) + { + // TheSuperHackers @bugfix Originally this movie render loop stopped rendering when the game window was inactive. + // This either skipped the movie or caused decompression artifacts. Now the video just keeps playing until it done. + + Int progressUpdateCount = m_videoStream->frameCount() / FRAME_FUDGE_ADD; + Int shiftedPercent = -FRAME_FUDGE_ADD + 1; + while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 ) + { + // TheSuperHackers @feature User can now skip video by pressing ESC + if (TheKeyboard) + { + TheKeyboard->UPDATE(); + KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED); + if (io && BitIsSet(io->state, KEY_STATE_DOWN)) + { + io->setUsed(); + break; + } + } + + TheGameEngine->serviceWindowsOS(); + + if(!m_videoStream->isFrameReady()) + { + Sleep(1); + continue; + } + + m_videoStream->frameDecompress(); + m_videoStream->frameRender(m_videoBuffer); + m_videoStream->frameNext(); + + if(m_videoBuffer) + m_loadScreen->winGetInstanceData()->setVideoBuffer(m_videoBuffer); + + Int frame = m_videoStream->frameIndex(); + if(frame % progressUpdateCount == 0) + { + shiftedPercent++; + if(shiftedPercent >0) + shiftedPercent = 0; + Int percent = (shiftedPercent + FRAME_FUDGE_ADD)/1.3; + UnicodeString per; + per.format(L"%d%%",percent); + TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); + GadgetProgressBarSetProgress(m_progressBar, percent); + } + TheWindowManager->update(); + + activatePieces(frame, generalPlayer, generalOpponent); + m_wndVideoManager->update(); + + // redraw all views, update the GUI + TheDisplay->draw(); + + TheAudio->update(); + } + } + else + { + // if we're min speced + m_videoStream->frameGoto(m_videoStream->frameCount()); // zero based + while(!m_videoStream->isFrameReady()) + Sleep(1); + m_videoStream->frameDecompress(); + m_videoStream->frameRender(m_videoBuffer); + if(m_videoBuffer) + m_loadScreen->winGetInstanceData()->setVideoBuffer(m_videoBuffer); + + activatePiecesMinSpec(generalPlayer, generalOpponent); + + Int delay = mission->m_voiceLength * 1000; + Int begin = timeGetTime(); + Int currTime = begin; + Int fudgeFactor = 0; + while(begin + delay > currTime ) + { + fudgeFactor = 30 * ((currTime - begin)/ INT_TO_REAL(delay )); + GadgetProgressBarSetProgress(m_progressBar, fudgeFactor); + + TheWindowManager->update(); + TheDisplay->draw(); + Sleep(100); + currTime = timeGetTime(); + } + + m_wndVideoManager->update(); + TheWindowManager->update(); + TheDisplay->draw(); + } + setFPMode(); + + + AudioEventRTS event( generalOpponent->getRandomTauntSound() ); + TheAudio->addAudioEvent( &event ); + + m_ambientLoopHandle = TheAudio->addAudioEvent(&m_ambientLoop); + TheAudio->update(); +} + +void ChallengeLoadScreen::reset( void ) +{ + setLoadScreen(nullptr); + m_progressBar = nullptr; +} + +void ChallengeLoadScreen::update( Int percent ) +{ + percent = (percent + FRAME_FUDGE_ADD)/1.3; + UnicodeString per; + per.format(L"%d%%",percent); + TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); + GadgetProgressBarSetProgress(m_progressBar, percent); + + // Do this last! + LoadScreen::update( percent ); +} + +void ChallengeLoadScreen::setProgressRange( Int min, Int max ) +{ + +} + // ShellGameLoadScreen Class ////////////////////////////////////////////////// //----------------------------------------------------------------------------- ShellGameLoadScreen::ShellGameLoadScreen( void ) @@ -661,6 +1230,9 @@ void ShellGameLoadScreen::update( Int percent ) MultiPlayerLoadScreen::MultiPlayerLoadScreen( void ) { m_mapPreview = nullptr; + m_portraitLocalGeneral = nullptr; + m_featuresLocalGeneral = nullptr; + m_nameLocalGeneral = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { @@ -697,8 +1269,44 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) pt = ThePlayerTemplateStore->getNthPlayerTemplate(lSlot->getPlayerTemplate()); else pt = ThePlayerTemplateStore->findPlayerTemplate( TheNameKeyGenerator->nameToKey("FactionObserver") ); + +#if RTS_GENERALS const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); + if(loadScreenImage) + m_loadScreen->winSetEnabledImage(0, loadScreenImage); +#else + // add portrait, features, and name for the local player's general + const GeneralPersona *localGeneral = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() ); + const Image *portrait = nullptr; + UnicodeString localName; + if (localGeneral) + { + portrait = localGeneral->getBioPortraitLarge(); + localName = TheGameText->fetch( localGeneral->getBioName() ); + } + else + { + // the main original factions don't have associated generals + AsciiString imageName; + if (pt->getName() == "FactionAmerica") + portrait = TheMappedImageCollection->findImageByName("SAFactionLogoLg_US"); + else if (pt->getName() == "FactionGLA") + portrait = TheMappedImageCollection->findImageByName("SUFactionLogoLg_GLA"); + else if (pt->getName() == "FactionChina") + portrait = TheMappedImageCollection->findImageByName("SNFactionLogoLg_China"); + else + DEBUG_CRASH(("Unexpected player template")); + localName = pt->getDisplayName(); + } + m_portraitLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MultiplayerLoadScreen.wnd:LocalGeneralPortrait")); + m_portraitLocalGeneral->winSetEnabledImage( 0, portrait); + m_featuresLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MultiplayerLoadScreen.wnd:LocalGeneralFeatures")); + AsciiString features = pt->getGeneralFeatures(); + GadgetStaticTextSetText( m_featuresLocalGeneral, TheGameText->fetch( features.isEmpty() ? "GUI:PlayerObserver" : pt->getGeneralFeatures() ) ); + m_nameLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MultiplayerLoadScreen.wnd:LocalGeneralName")); + GadgetStaticTextSetText( m_nameLocalGeneral, localName ); +#endif AsciiString musicName = pt->getLoadScreenMusic(); if ( ! musicName.isEmpty() ) @@ -712,9 +1320,6 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) } - - if(loadScreenImage) - m_loadScreen->winSetEnabledImage(0, loadScreenImage); //DEBUG_ASSERTCRASH(TheNetwork, ("Where the Heck is the Network!!!!")); //DEBUG_LOG(("NumPlayers %d", TheNetwork->getNumPlayers())); @@ -760,8 +1365,19 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) GameSlot *slot = game->getSlot(i); if (!slot || !slot->isOccupied()) continue; + Color houseColor = TheMultiplayerSettings->getColor(slot->getApparentColor())->getColor(); +#if RTS_GENERALS GadgetProgressBarSetEnabledBarColor(m_progressBars[netSlot],houseColor ); +#else + // format the progress bar to house colors + AsciiString imageName; + imageName.format("LoadingBar_ProgressCenter%d", slot->getApparentColor()); + const Image *houseImage = TheMappedImageCollection->findImageByName(imageName); + if (! houseImage) + houseImage = TheMappedImageCollection->findImageByName("LoadingBar_Progress"); + m_progressBars[netSlot]->winSetEnabledImage( 6, houseImage ); +#endif UnicodeString name = slot->getName(); GadgetStaticTextSetText(m_playerNames[netSlot], name ); @@ -870,6 +1486,9 @@ GameSpyLoadScreen::GameSpyLoadScreen( void ) { m_mapPreview = nullptr; + m_portraitLocalGeneral = nullptr; + m_featuresLocalGeneral = nullptr; + m_nameLocalGeneral = nullptr; for(Int i = 0; i < MAX_SLOTS; ++i) { @@ -915,9 +1534,44 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); pt = ThePlayerTemplateStore->getNthPlayerTemplate(lSlot->getPlayerTemplate()); else pt = ThePlayerTemplateStore->findPlayerTemplate( TheNameKeyGenerator->nameToKey("FactionObserver") ); + +#if RTS_GENERALS const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); if(loadScreenImage) m_loadScreen->winSetEnabledImage(0, loadScreenImage); +#else + // add portrait, features, and name for the local player's general + const GeneralPersona *localGeneral = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() ); + const Image *portrait = nullptr; + UnicodeString localName; + if (localGeneral) + { + portrait = localGeneral->getBioPortraitLarge(); + localName = TheGameText->fetch( localGeneral->getBioName() ); + } + else + { + // the main original factions don't have associated generals + AsciiString imageName; + if (pt->getName() == "FactionAmerica") + portrait = TheMappedImageCollection->findImageByName("SAFactionLogo144_US"); + else if (pt->getName() == "FactionGLA") + portrait = TheMappedImageCollection->findImageByName("SUFactionLogo144_GLA"); + else if (pt->getName() == "FactionChina") + portrait = TheMappedImageCollection->findImageByName("SNFactionLogo144_China"); + else + DEBUG_CRASH(("Unexpected player template")); + + localName = pt->getDisplayName(); + } + m_portraitLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "GameSpyLoadScreen.wnd:LocalGeneralPortrait")); + m_portraitLocalGeneral->winSetEnabledImage( 0, portrait); + m_featuresLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "GameSpyLoadScreen.wnd:LocalGeneralFeatures")); + AsciiString features = pt->getGeneralFeatures(); + GadgetStaticTextSetText( m_featuresLocalGeneral, TheGameText->fetch( features.isEmpty() ? "GUI:PlayerObserver" : pt->getGeneralFeatures() ) ); + m_nameLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "GameSpyLoadScreen.wnd:LocalGeneralName")); + GadgetStaticTextSetText( m_nameLocalGeneral, localName ); +#endif GameWindow *teamWin[MAX_SLOTS]; Int i = 0; @@ -991,8 +1645,19 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); GameSpyGameSlot *slot = (GameSpyGameSlot *)game->getSlot(i); if (!slot || !slot->isOccupied()) continue; + Color houseColor = TheMultiplayerSettings->getColor(slot->getApparentColor())->getColor(); +#if RTS_GENERALS GadgetProgressBarSetEnabledBarColor(m_progressBars[netSlot],houseColor ); +#else + // format the progress bar to house colors + AsciiString imageName; + imageName.format("LoadingBar_ProgressCenter%d", slot->getApparentColor()); + const Image *houseImage = TheMappedImageCollection->findImageByName(imageName); + if (! houseImage) + houseImage = TheMappedImageCollection->findImageByName("LoadingBar_Progress"); + m_progressBars[netSlot]->winSetEnabledImage( 6, houseImage ); +#endif UnicodeString name = slot->getName(); GadgetStaticTextSetText(m_playerNames[netSlot], name ); diff --git a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index 13a7f51a8d0..0f981f3e540 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -362,10 +362,10 @@ void CampaignManager::parseMissionPart( INI* ini, void *instance, void *store, c { "UnitNames0", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[0] ) }, { "UnitNames1", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[1] ) }, { "UnitNames2", INI::parseAsciiString, nullptr, offsetof( Mission, m_unitNames[2] ) }, + { "GeneralName", INI::parseAsciiString, nullptr, offsetof( Mission, m_generalName) }, { "LocationNameLabel",INI::parseAsciiString, nullptr, offsetof( Mission, m_locationNameLabel ) }, { "VoiceLength", INI::parseInt , nullptr, offsetof( Mission, m_voiceLength ) }, - { nullptr, nullptr, nullptr, 0 } }; AsciiString name; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index a607f140593..59154f13f45 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -496,18 +496,36 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) GameWindow *backgroundWin = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "SinglePlayerLoadScreen.wnd:ParentSinglePlayerLoadScreen" )); if (campaignName.compareNoCase("USA") == 0) { - backgroundWin->winSetEnabledImage( 0, TheMappedImageCollection->findImageByName("MissionLoad_USA") ); - m_progressBar->winSetEnabledImage( 6, TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter2") ); + if (const Image *image = TheMappedImageCollection->findImageByName("MissionLoad_USA")) + { + backgroundWin->winSetEnabledImage( 0, image); + } + if (const Image *image = TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter2")) + { + m_progressBar->winSetEnabledImage( 6, image ); + } } else if (campaignName.compareNoCase("GLA") == 0) { - backgroundWin->winSetEnabledImage( 0, TheMappedImageCollection->findImageByName("MissionLoad_GLA") ); - m_progressBar->winSetEnabledImage( 6, TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter3") ); + if (const Image *image = TheMappedImageCollection->findImageByName("MissionLoad_GLA")) + { + backgroundWin->winSetEnabledImage( 0, image ); + } + if (const Image *image = TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter3")) + { + m_progressBar->winSetEnabledImage( 6, image ); + } } else if (campaignName.compareNoCase("China") == 0) { - backgroundWin->winSetEnabledImage( 0, TheMappedImageCollection->findImageByName("MissionLoad_China") ); - m_progressBar->winSetEnabledImage( 6, TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter1") ); + if (const Image *image = TheMappedImageCollection->findImageByName("MissionLoad_China")) + { + backgroundWin->winSetEnabledImage( 0, image ); + } + if (const Image *image = TheMappedImageCollection->findImageByName("LoadingBar_ProgressCenter1")) + { + m_progressBar->winSetEnabledImage( 6, image ); + } } // else leave the default background screen @@ -544,8 +562,9 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) m_videoStream->frameDecompress(); m_videoStream->frameRender(m_videoBuffer); -// PULLED FROM THE MISSION DISK -// moveWindows( m_videoStream->frameIndex()); +#if RTS_GENERALS + moveWindows( m_videoStream->frameIndex()); +#endif m_videoStream->frameNext(); @@ -570,15 +589,41 @@ void SinglePlayerLoadScreen::init( GameInfo *game ) TheDisplay->draw(); } +#if !RTS_GENERALS // let the background image show through m_videoStream->close(); m_videoStream = nullptr; m_loadScreen->winGetInstanceData()->setVideoBuffer( nullptr ); TheDisplay->draw(); +#endif } else { +#if RTS_GENERALS + // if we're min speced + m_videoStream->frameGoto(m_videoStream->frameCount()); // zero based + while(!m_videoStream->isFrameReady()) + Sleep(1); + m_videoStream->frameDecompress(); + m_videoStream->frameRender(m_videoBuffer); + if(m_videoBuffer) + m_loadScreen->winGetInstanceData()->setVideoBuffer(m_videoBuffer); + + m_objectiveWin->winHide(FALSE); + for(i = 0; i < MAX_DISPLAYED_UNITS; ++i) + m_unitDesc[i]->winHide(FALSE); + m_location->winHide(FALSE); + + // Audio was choppy so, I chopped it out! + TheAudio->friend_forcePlayAudioEventRTS(&TheCampaignManager->getCurrentMission()->m_briefingVoice); + + for(Int i = 0; i < MAX_OBJECTIVE_LINES; ++i) + { + GadgetStaticTextSetText(m_objectiveLines[i], m_unicodeObjectiveLines[i]); + } +#else // if we're min spec'ed don't play a movie +#endif Int delay = mission->m_voiceLength * 1000; Int begin = timeGetTime(); @@ -1224,8 +1269,12 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) pt = ThePlayerTemplateStore->getNthPlayerTemplate(lSlot->getPlayerTemplate()); else pt = ThePlayerTemplateStore->findPlayerTemplate( TheNameKeyGenerator->nameToKey("FactionObserver") ); -// const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); +#if RTS_GENERALS + const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); + if(loadScreenImage) + m_loadScreen->winSetEnabledImage(0, loadScreenImage); +#else // add portrait, features, and name for the local player's general const GeneralPersona *localGeneral = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() ); const Image *portrait = nullptr; @@ -1257,6 +1306,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) GadgetStaticTextSetText( m_featuresLocalGeneral, TheGameText->fetch( features.isEmpty() ? "GUI:PlayerObserver" : pt->getGeneralFeatures() ) ); m_nameLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "MultiplayerLoadScreen.wnd:LocalGeneralName")); GadgetStaticTextSetText( m_nameLocalGeneral, localName ); +#endif AsciiString musicName = pt->getLoadScreenMusic(); if ( ! musicName.isEmpty() ) @@ -1270,9 +1320,6 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) } - -// if(loadScreenImage) -// m_loadScreen->winSetEnabledImage(0, loadScreenImage); //DEBUG_ASSERTCRASH(TheNetwork, ("Where the Heck is the Network!!!!")); //DEBUG_LOG(("NumPlayers %d", TheNetwork->getNumPlayers())); @@ -1320,7 +1367,9 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) continue; Color houseColor = TheMultiplayerSettings->getColor(slot->getApparentColor())->getColor(); - +#if RTS_GENERALS + GadgetProgressBarSetEnabledBarColor(m_progressBars[netSlot],houseColor ); +#else // format the progress bar to house colors AsciiString imageName; imageName.format("LoadingBar_ProgressCenter%d", slot->getApparentColor()); @@ -1328,6 +1377,7 @@ void MultiPlayerLoadScreen::init( GameInfo *game ) if (! houseImage) houseImage = TheMappedImageCollection->findImageByName("LoadingBar_Progress"); m_progressBars[netSlot]->winSetEnabledImage( 6, houseImage ); +#endif UnicodeString name = slot->getName(); GadgetStaticTextSetText(m_playerNames[netSlot], name ); @@ -1484,10 +1534,12 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); pt = ThePlayerTemplateStore->getNthPlayerTemplate(lSlot->getPlayerTemplate()); else pt = ThePlayerTemplateStore->findPlayerTemplate( TheNameKeyGenerator->nameToKey("FactionObserver") ); -// const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); -// if(loadScreenImage) -// m_loadScreen->winSetEnabledImage(0, loadScreenImage); +#if RTS_GENERALS + const Image *loadScreenImage = TheMappedImageCollection->findImageByName(pt->getLoadScreen()); + if(loadScreenImage) + m_loadScreen->winSetEnabledImage(0, loadScreenImage); +#else // add portrait, features, and name for the local player's general const GeneralPersona *localGeneral = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() ); const Image *portrait = nullptr; @@ -1519,6 +1571,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); GadgetStaticTextSetText( m_featuresLocalGeneral, TheGameText->fetch( features.isEmpty() ? "GUI:PlayerObserver" : pt->getGeneralFeatures() ) ); m_nameLocalGeneral = TheWindowManager->winGetWindowFromId( m_loadScreen,TheNameKeyGenerator->nameToKey( "GameSpyLoadScreen.wnd:LocalGeneralName")); GadgetStaticTextSetText( m_nameLocalGeneral, localName ); +#endif GameWindow *teamWin[MAX_SLOTS]; Int i = 0; @@ -1594,7 +1647,9 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); continue; Color houseColor = TheMultiplayerSettings->getColor(slot->getApparentColor())->getColor(); - +#if RTS_GENERALS + GadgetProgressBarSetEnabledBarColor(m_progressBars[netSlot],houseColor ); +#else // format the progress bar to house colors AsciiString imageName; imageName.format("LoadingBar_ProgressCenter%d", slot->getApparentColor()); @@ -1602,6 +1657,7 @@ GameSlot *lSlot = game->getSlot(game->getLocalSlotNum()); if (! houseImage) houseImage = TheMappedImageCollection->findImageByName("LoadingBar_Progress"); m_progressBars[netSlot]->winSetEnabledImage( 6, houseImage ); +#endif UnicodeString name = slot->getName(); GadgetStaticTextSetText(m_playerNames[netSlot], name ); From 9b5628fd5557dd3a0a1c5e139273135e8bd309bf Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Fri, 20 Feb 2026 20:37:34 +0100 Subject: [PATCH 3/3] unify(gui): Move several GUI related files to Core (#2332) --- Core/GameEngine/CMakeLists.txt | 40 +- .../GameEngine/Include/GameClient/GameFont.h | 0 .../Include/GameClient/GameWindow.h | 0 .../Include/GameClient/GameWindowGlobal.h | 0 .../GameClient/GameWindowTransitions.h | 0 .../Include/GameClient/HeaderTemplate.h | 0 .../Include/GameClient/IMEManager.h | 0 .../Include/GameClient/LoadScreen.h | 0 .../Include/GameClient/ProcessAnimateWindow.h | 0 .../Include/GameClient/WinInstanceData.h | 0 .../Include/GameClient/WindowLayout.h | 0 .../Source/GameClient/GUI/GameFont.cpp | 0 .../Source/GameClient/GUI/GameWindow.cpp | 0 .../GameClient/GUI/GameWindowGlobal.cpp | 0 .../GameClient/GUI/GameWindowTransitions.cpp | 0 .../Source/GameClient/GUI/HeaderTemplate.cpp | 0 .../Source/GameClient/GUI/IMEManager.cpp | 0 .../Source/GameClient/GUI/LoadScreen.cpp | 0 .../GameClient/GUI/ProcessAnimateWindow.cpp | 0 .../Source/GameClient/GUI/WinInstanceData.cpp | 0 .../Source/GameClient/GUI/WindowLayout.cpp | 0 Generals/Code/GameEngine/CMakeLists.txt | 40 +- .../GameEngine/Include/GameClient/GameFont.h | 105 - .../Include/GameClient/GameWindow.h | 503 ----- .../Include/GameClient/GameWindowGlobal.h | 63 - .../GameClient/GameWindowTransitions.h | 695 ------ .../Include/GameClient/HeaderTemplate.h | 115 - .../Include/GameClient/IMEManager.h | 113 - .../Include/GameClient/LoadScreen.h | 326 --- .../Include/GameClient/ProcessAnimateWindow.h | 264 --- .../Include/GameClient/WinInstanceData.h | 215 -- .../Include/GameClient/WindowLayout.h | 120 - .../Source/GameClient/GUI/GameFont.cpp | 235 -- .../Source/GameClient/GUI/GameWindow.cpp | 1837 --------------- .../GameClient/GUI/GameWindowGlobal.cpp | 240 -- .../GameClient/GUI/GameWindowTransitions.cpp | 583 ----- .../Source/GameClient/GUI/HeaderTemplate.cpp | 231 -- .../Source/GameClient/GUI/IMEManager.cpp | 1600 ------------- .../Source/GameClient/GUI/LoadScreen.cpp | 2011 ----------------- .../GameClient/GUI/ProcessAnimateWindow.cpp | 1544 ------------- .../Source/GameClient/GUI/WinInstanceData.cpp | 204 -- .../Source/GameClient/GUI/WindowLayout.cpp | 298 --- GeneralsMD/Code/GameEngine/CMakeLists.txt | 40 +- scripts/cpp/unify_move_files.py | 21 + 44 files changed, 81 insertions(+), 11362 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GameFont.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GameWindow.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GameWindowGlobal.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GameWindowTransitions.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/HeaderTemplate.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/IMEManager.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/LoadScreen.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/ProcessAnimateWindow.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/WinInstanceData.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/WindowLayout.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GameFont.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GameWindow.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/IMEManager.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/LoadScreen.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/WindowLayout.cpp (100%) delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GameFont.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GameWindow.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GameWindowGlobal.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GameWindowTransitions.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/HeaderTemplate.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/IMEManager.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/LoadScreen.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/ProcessAnimateWindow.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/WinInstanceData.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/WindowLayout.h delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index eaf88e5438a..e3179bbb93c 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -178,29 +178,29 @@ set(GAMEENGINE_SRC # Include/GameClient/GadgetTabControl.h # Include/GameClient/GadgetTextEntry.h # Include/GameClient/GameClient.h -# Include/GameClient/GameFont.h + Include/GameClient/GameFont.h # Include/GameClient/GameInfoWindow.h # Include/GameClient/GameText.h -# Include/GameClient/GameWindow.h -# Include/GameClient/GameWindowGlobal.h + Include/GameClient/GameWindow.h + Include/GameClient/GameWindowGlobal.h # Include/GameClient/GameWindowID.h # Include/GameClient/GameWindowManager.h -# Include/GameClient/GameWindowTransitions.h + Include/GameClient/GameWindowTransitions.h # Include/GameClient/GlobalLanguage.h # Include/GameClient/GraphDraw.h # Include/GameClient/GUICallbacks.h # Include/GameClient/GUICommandTranslator.h -# Include/GameClient/HeaderTemplate.h + Include/GameClient/HeaderTemplate.h # Include/GameClient/HintSpy.h # Include/GameClient/HotKey.h # Include/GameClient/Image.h -# Include/GameClient/IMEManager.h + Include/GameClient/IMEManager.h # Include/GameClient/InGameUI.h Include/GameClient/Keyboard.h # Include/GameClient/KeyDefs.h # Include/GameClient/LanguageFilter.h # Include/GameClient/Line2D.h -# Include/GameClient/LoadScreen.h + Include/GameClient/LoadScreen.h # Include/GameClient/LookAtXlat.h Include/GameClient/MapUtil.h # Include/GameClient/MessageBox.h @@ -212,7 +212,7 @@ set(GAMEENGINE_SRC Include/GameClient/ParabolicEase.h Include/GameClient/ParticleSys.h # Include/GameClient/PlaceEventTranslator.h -# Include/GameClient/ProcessAnimateWindow.h + Include/GameClient/ProcessAnimateWindow.h # Include/GameClient/RadiusDecal.h # Include/GameClient/RayEffect.h # Include/GameClient/SelectionInfo.h @@ -229,10 +229,10 @@ set(GAMEENGINE_SRC Include/GameClient/VideoPlayer.h Include/GameClient/View.h Include/GameClient/Water.h -# Include/GameClient/WindowLayout.h + Include/GameClient/WindowLayout.h Include/GameClient/WindowVideoManager.h # Include/GameClient/WindowXlat.h -# Include/GameClient/WinInstanceData.h + Include/GameClient/WinInstanceData.h # Include/GameLogic/AI.h # Include/GameLogic/AIDock.h # Include/GameLogic/AIGuard.h @@ -733,12 +733,12 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/Gadget/GadgetTabControl.cpp # Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp # Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp -# Source/GameClient/GUI/GameFont.cpp -# Source/GameClient/GUI/GameWindow.cpp -# Source/GameClient/GUI/GameWindowGlobal.cpp + Source/GameClient/GUI/GameFont.cpp + Source/GameClient/GUI/GameWindow.cpp + Source/GameClient/GUI/GameWindowGlobal.cpp # Source/GameClient/GUI/GameWindowManager.cpp # Source/GameClient/GUI/GameWindowManagerScript.cpp -# Source/GameClient/GUI/GameWindowTransitions.cpp + Source/GameClient/GUI/GameWindowTransitions.cpp # Source/GameClient/GUI/GameWindowTransitionsStyles.cpp # Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp # Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -791,15 +791,15 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp # Source/GameClient/GUI/GUICallbacks/MessageBox.cpp # Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp -# Source/GameClient/GUI/HeaderTemplate.cpp -# Source/GameClient/GUI/IMEManager.cpp -# Source/GameClient/GUI/LoadScreen.cpp -# Source/GameClient/GUI/ProcessAnimateWindow.cpp + Source/GameClient/GUI/HeaderTemplate.cpp + 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/WindowLayout.cpp + Source/GameClient/GUI/WindowLayout.cpp Source/GameClient/GUI/WindowVideoManager.cpp -# Source/GameClient/GUI/WinInstanceData.cpp + Source/GameClient/GUI/WinInstanceData.cpp # Source/GameClient/InGameUI.cpp Source/GameClient/Input/Keyboard.cpp Source/GameClient/Input/Mouse.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameFont.h b/Core/GameEngine/Include/GameClient/GameFont.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameFont.h rename to Core/GameEngine/Include/GameClient/GameFont.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h b/Core/GameEngine/Include/GameClient/GameWindow.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h rename to Core/GameEngine/Include/GameClient/GameWindow.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowGlobal.h b/Core/GameEngine/Include/GameClient/GameWindowGlobal.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowGlobal.h rename to Core/GameEngine/Include/GameClient/GameWindowGlobal.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h b/Core/GameEngine/Include/GameClient/GameWindowTransitions.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowTransitions.h rename to Core/GameEngine/Include/GameClient/GameWindowTransitions.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HeaderTemplate.h b/Core/GameEngine/Include/GameClient/HeaderTemplate.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/HeaderTemplate.h rename to Core/GameEngine/Include/GameClient/HeaderTemplate.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/IMEManager.h b/Core/GameEngine/Include/GameClient/IMEManager.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/IMEManager.h rename to Core/GameEngine/Include/GameClient/IMEManager.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/LoadScreen.h b/Core/GameEngine/Include/GameClient/LoadScreen.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/LoadScreen.h rename to Core/GameEngine/Include/GameClient/LoadScreen.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ProcessAnimateWindow.h b/Core/GameEngine/Include/GameClient/ProcessAnimateWindow.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ProcessAnimateWindow.h rename to Core/GameEngine/Include/GameClient/ProcessAnimateWindow.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/WinInstanceData.h b/Core/GameEngine/Include/GameClient/WinInstanceData.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/WinInstanceData.h rename to Core/GameEngine/Include/GameClient/WinInstanceData.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h b/Core/GameEngine/Include/GameClient/WindowLayout.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/WindowLayout.h rename to Core/GameEngine/Include/GameClient/WindowLayout.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp b/Core/GameEngine/Source/GameClient/GUI/GameFont.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameFont.cpp rename to Core/GameEngine/Source/GameClient/GUI/GameFont.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/Core/GameEngine/Source/GameClient/GUI/GameWindow.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp rename to Core/GameEngine/Source/GameClient/GUI/GameWindow.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp b/Core/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp rename to Core/GameEngine/Source/GameClient/GUI/GameWindowGlobal.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp b/Core/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp rename to Core/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp b/Core/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp rename to Core/GameEngine/Source/GameClient/GUI/HeaderTemplate.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp b/Core/GameEngine/Source/GameClient/GUI/IMEManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/IMEManager.cpp rename to Core/GameEngine/Source/GameClient/GUI/IMEManager.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Core/GameEngine/Source/GameClient/GUI/LoadScreen.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp rename to Core/GameEngine/Source/GameClient/GUI/LoadScreen.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp b/Core/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp rename to Core/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp b/Core/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp rename to Core/GameEngine/Source/GameClient/GUI/WinInstanceData.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp b/Core/GameEngine/Source/GameClient/GUI/WindowLayout.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/WindowLayout.cpp rename to Core/GameEngine/Source/GameClient/GUI/WindowLayout.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index addfdafc4f0..e6720304e31 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -167,29 +167,29 @@ set(GAMEENGINE_SRC Include/GameClient/GadgetTabControl.h Include/GameClient/GadgetTextEntry.h Include/GameClient/GameClient.h - Include/GameClient/GameFont.h +# Include/GameClient/GameFont.h Include/GameClient/GameInfoWindow.h Include/GameClient/GameText.h - Include/GameClient/GameWindow.h - Include/GameClient/GameWindowGlobal.h +# Include/GameClient/GameWindow.h +# Include/GameClient/GameWindowGlobal.h Include/GameClient/GameWindowID.h Include/GameClient/GameWindowManager.h - Include/GameClient/GameWindowTransitions.h +# Include/GameClient/GameWindowTransitions.h Include/GameClient/GlobalLanguage.h Include/GameClient/GraphDraw.h Include/GameClient/GUICallbacks.h Include/GameClient/GUICommandTranslator.h - Include/GameClient/HeaderTemplate.h +# Include/GameClient/HeaderTemplate.h Include/GameClient/HintSpy.h Include/GameClient/HotKey.h Include/GameClient/Image.h - Include/GameClient/IMEManager.h +# Include/GameClient/IMEManager.h Include/GameClient/InGameUI.h # Include/GameClient/Keyboard.h Include/GameClient/KeyDefs.h Include/GameClient/LanguageFilter.h Include/GameClient/Line2D.h - Include/GameClient/LoadScreen.h +# Include/GameClient/LoadScreen.h Include/GameClient/LookAtXlat.h # Include/GameClient/MapUtil.h Include/GameClient/MessageBox.h @@ -200,7 +200,7 @@ set(GAMEENGINE_SRC # Include/GameClient/Mouse.h # Include/GameClient/ParticleSys.h Include/GameClient/PlaceEventTranslator.h - Include/GameClient/ProcessAnimateWindow.h +# Include/GameClient/ProcessAnimateWindow.h Include/GameClient/RadiusDecal.h Include/GameClient/RayEffect.h Include/GameClient/SelectionInfo.h @@ -215,10 +215,10 @@ set(GAMEENGINE_SRC # Include/GameClient/VideoPlayer.h # Include/GameClient/View.h # Include/GameClient/Water.h - Include/GameClient/WindowLayout.h +# Include/GameClient/WindowLayout.h # Include/GameClient/WindowVideoManager.h Include/GameClient/WindowXlat.h - Include/GameClient/WinInstanceData.h +# Include/GameClient/WinInstanceData.h Include/GameLogic/AI.h Include/GameLogic/AIDock.h Include/GameLogic/AIGuard.h @@ -681,12 +681,12 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/Gadget/GadgetTabControl.cpp Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp - Source/GameClient/GUI/GameFont.cpp - Source/GameClient/GUI/GameWindow.cpp - Source/GameClient/GUI/GameWindowGlobal.cpp +# Source/GameClient/GUI/GameFont.cpp +# Source/GameClient/GUI/GameWindow.cpp +# Source/GameClient/GUI/GameWindowGlobal.cpp Source/GameClient/GUI/GameWindowManager.cpp Source/GameClient/GUI/GameWindowManagerScript.cpp - Source/GameClient/GUI/GameWindowTransitions.cpp +# Source/GameClient/GUI/GameWindowTransitions.cpp Source/GameClient/GUI/GameWindowTransitionsStyles.cpp Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp @@ -738,15 +738,15 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp Source/GameClient/GUI/GUICallbacks/MessageBox.cpp Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp - Source/GameClient/GUI/HeaderTemplate.cpp - Source/GameClient/GUI/IMEManager.cpp - Source/GameClient/GUI/LoadScreen.cpp - Source/GameClient/GUI/ProcessAnimateWindow.cpp +# Source/GameClient/GUI/HeaderTemplate.cpp +# 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/WindowLayout.cpp +# Source/GameClient/GUI/WindowLayout.cpp # Source/GameClient/GUI/WindowVideoManager.cpp - Source/GameClient/GUI/WinInstanceData.cpp +# Source/GameClient/GUI/WinInstanceData.cpp Source/GameClient/InGameUI.cpp # Source/GameClient/Input/Keyboard.cpp # Source/GameClient/Input/Mouse.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/GameFont.h b/Generals/Code/GameEngine/Include/GameClient/GameFont.h deleted file mode 100644 index 0119bcf2d8a..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GameFont.h +++ /dev/null @@ -1,105 +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: GameFont.h /////////////////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Desc: Game representations for fonts -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/SubsystemInterface.h" -#include "Lib/BaseType.h" -#include "Common/AsciiString.h" -#include "Common/GameMemory.h" - -//------------------------------------------------------------------------------------------------- -/** A font for use in the device independent game */ -//------------------------------------------------------------------------------------------------- -class GameFont : public MemoryPoolObject -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(GameFont, "GameFont") -public: - GameFont* next; ///< for library use - AsciiString nameString; - Int pointSize; ///< point size of font - Int height; ///< pixel height of font - void* fontData; ///< font data to be filled out for device specific font - Bool bold; ///< is this font bold -}; -EMPTY_DTOR(GameFont) - -//------------------------------------------------------------------------------------------------- -/** Interface to access fonts for the system */ -//------------------------------------------------------------------------------------------------- -class FontLibrary : public SubsystemInterface -{ - -public: - - -public: - - FontLibrary( void ); - virtual ~FontLibrary( void ); - - virtual void init( void ); - virtual void reset( void ); - virtual void update( void ) { } - - GameFont *getFont( AsciiString name, Int pointSize, Bool bold ); ///< get a font pointer - - GameFont *firstFont( void ); ///< return first font - GameFont *nextFont( GameFont *font ); ///< get next font in library - - Int getCount( void ); ///< return how many fonts are loaded in this lib - -protected: - - void deleteAllFonts( void ); ///< delete all fonts in this library - void linkFont( GameFont *font ); ///< add to font list - void unlinkFont( GameFont *font ); ///< remove font from list - - /// load the font data pointer based on everything else we already have set - virtual Bool loadFontData( GameFont *font ) = 0; - /// release the font data pointer - virtual void releaseFontData( GameFont *font ) { }; - - GameFont *m_fontList; ///< list of fonts we have loaded - Int m_count; ///< number of unique fonts loaded in this lib - -}; - -// INLINING /////////////////////////////////////////////////////////////////////////////////////// -inline Int FontLibrary::getCount( void ) { return m_count; } -inline GameFont *FontLibrary::firstFont( void ) { return m_fontList; } -inline GameFont *FontLibrary::nextFont( GameFont *font ) -{ - if( font ) - return font->next; - return nullptr; -} - -// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// -extern FontLibrary *TheFontLibrary; ///< font library external diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h b/Generals/Code/GameEngine/Include/GameClient/GameWindow.h deleted file mode 100644 index f5e27b8a7b9..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindow.h +++ /dev/null @@ -1,503 +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: GameWindow.h ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GameWindow.h -// -// Created: Colin Day, June 2001 -// -// Desc: Header for game windowing system for generic windows and GUI -// elements -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Lib/BaseType.h" -#include "Common/GameMemory.h" -#include "GameClient/Image.h" -#include "GameClient/DisplayString.h" -#include "GameClient/WinInstanceData.h" -#include "GameClient/Color.h" - -/////////////////////////////////////////////////////////////////////////////// -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -class GameWindow; -class WindowLayout; -class GameFont; -class TransitionWindow; -struct GameWindowEditData; - -/////////////////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -enum { WIN_COLOR_UNDEFINED = GAME_COLOR_UNDEFINED }; - -// WindowMsgData -------------------------------------------------------------- -//----------------------------------------------------------------------------- -typedef UnsignedInt WindowMsgData; - -//----------------------------------------------------------------------------- -enum WindowMsgHandledType CPP_11(: Int) { MSG_IGNORED, MSG_HANDLED }; - -// callback types ------------------------------------------------------------- -typedef void (*GameWinMsgBoxFunc)( void ); //used for the Message box callbacks. -typedef void (*GameWinDrawFunc)( GameWindow *, - WinInstanceData * ); -typedef void (*GameWinTooltipFunc)( GameWindow *, - WinInstanceData *, - UnsignedInt ); -typedef WindowMsgHandledType (*GameWinInputFunc)( GameWindow *, - UnsignedInt, - WindowMsgData, - WindowMsgData ); -typedef WindowMsgHandledType (*GameWinSystemFunc)( GameWindow *, - UnsignedInt, - WindowMsgData, - WindowMsgData ); - -enum -{ - - WIN_MAX_WINDOWS = 576, - CURSOR_MOVE_TOL_SQ = 4, - TOOLTIP_DELAY = 10, - WIN_TOOLTIP_LEN = 64, // max length of tooltip text - -}; - -// macros for easier conversion ----------------------------------------------- -#define SHORTTOLONG(a, b) ((UnsignedShort)(a) | ((UnsignedShort)(b) << 16)) -#define LOLONGTOSHORT(a) ((a) & 0x0000FFFF) -#define HILONGTOSHORT(b) (((b) & 0xFFFF0000) >> 16) - -// Game window messages ------------------------------------------------------- -//----------------------------------------------------------------------------- -enum GameWindowMessage CPP_11(: Int) -{ - - GWM_NONE = 0, - - GWM_CREATE, GWM_DESTROY, - GWM_ACTIVATE, GWM_ENABLE, - GWM_LEFT_DOWN, GWM_LEFT_UP, - GWM_LEFT_DOUBLE_CLICK, GWM_LEFT_DRAG, - GWM_MIDDLE_DOWN, GWM_MIDDLE_UP, - GWM_MIDDLE_DOUBLE_CLICK, GWM_MIDDLE_DRAG, - GWM_RIGHT_DOWN, GWM_RIGHT_UP, - GWM_RIGHT_DOUBLE_CLICK, GWM_RIGHT_DRAG, - GWM_MOUSE_ENTERING, GWM_MOUSE_LEAVING, - GWM_WHEEL_UP, GWM_WHEEL_DOWN, - GWM_CHAR, GWM_SCRIPT_CREATE, - // note that GWM_MOUSE_POS is only actually propagated to windows if the static - // sendMousePosMessages is set to true in the window manager file. See the - // comment on the static declaration for additional info - GWM_INPUT_FOCUS, GWM_MOUSE_POS, - GWM_IME_CHAR, GWM_IME_STRING - -}; - -// WinInputReturnCode ------------------------------------------------------ -/** These return codes are returned when after processing events through - * the window system */ -//----------------------------------------------------------------------------- -enum WinInputReturnCode CPP_11(: Int) -{ - WIN_INPUT_NOT_USED = 0, - WIN_INPUT_USED, -}; - - -#define GWM_USER 32768 - -// Window status flags -------------------------------------------------------- -//----------------------------------------------------------------------------- -enum -{ - - // when you edit this, remember to edit WindowStatusNames[] - WIN_STATUS_NONE = 0x00000000, // No status bits set at all - WIN_STATUS_ACTIVE = 0x00000001, // At the top of the window list - WIN_STATUS_TOGGLE = 0x00000002, // If set, click to toggle - WIN_STATUS_DRAGGABLE = 0x00000004, // Window can be dragged - WIN_STATUS_ENABLED = 0x00000008, // Window can receive input - WIN_STATUS_HIDDEN = 0x00000010, // Window is hidden, no input - WIN_STATUS_ABOVE = 0x00000020, // Window is always above others - WIN_STATUS_BELOW = 0x00000040, // Window is always below others - WIN_STATUS_IMAGE = 0x00000080, // Window is drawn with images - WIN_STATUS_TAB_STOP = 0x00000100, // Window is a tab stop - WIN_STATUS_NO_INPUT = 0x00000200, // Window does not take input - WIN_STATUS_NO_FOCUS = 0x00000400, // Window does not take focus - WIN_STATUS_DESTROYED = 0x00000800, // Window has been destroyed - WIN_STATUS_BORDER = 0x00001000, // Window will be drawn with Borders & Corners - WIN_STATUS_SMOOTH_TEXT = 0x00002000, // Window text will be drawn with smoothing - WIN_STATUS_ONE_LINE = 0x00004000, // Window text will be drawn on only one line - WIN_STATUS_NO_FLUSH = 0x00008000, // Window images will not be unloaded when window is hidden - WIN_STATUS_SEE_THRU = 0x00010000, // Will not draw, but it NOT hidden ... does not apply to children - WIN_STATUS_RIGHT_CLICK = 0x00020000, // Window pays attention to right clicks - WIN_STATUS_WRAP_CENTERED = 0x00040000, // Text will be centered on each word wrap or \n - WIN_STATUS_CHECK_LIKE = 0x00080000, // Make push buttons "check-like" with dual state - WIN_STATUS_HOTKEY_TEXT = 0x00100000, // Make push buttons "check-like" with dual state - WIN_STATUS_USE_OVERLAY_STATES = 0x00200000, // Push buttons will use the global automatic rendering overlay for disabled, hilited, and pushed. - WIN_STATUS_NOT_READY = 0x00400000, // A disabled button that is available -- but not yet (power charge, fire delay). - WIN_STATUS_FLASHING = 0x00800000, // Used for buttons that do cameo flashes. - WIN_STATUS_ALWAYS_COLOR = 0x01000000, // Never render these buttons using greyscale renderer when button disabled. - WIN_STATUS_ON_MOUSE_DOWN = 0x02000000, // Pushbutton triggers on mouse down. - WIN_STATUS_SHORTCUT_BUTTON = 0x04000000, // Oh god... this is a total hack for shortcut buttons to handle rendering text top left corner... - // when you edit this, remember to edit WindowStatusNames[] - -}; - - -// Message Box Button flags -------------------------------------------------------- -//----------------------------------------------------------------------------- -enum -{ - MSG_BOX_YES = 0x01, //Display the yes button - MSG_BOX_NO = 0x02, //Display the No button - MSG_BOX_OK = 0x08, //Display the Ok button - MSG_BOX_CANCEL = 0x04, //Display the Cancel button -}; - - -// WindowMessageBoxData --------------------------------------------------------- -/** Data attached to each Message box window */ -//----------------------------------------------------------------------------- -struct WindowMessageBoxData -{ - GameWinMsgBoxFunc yesCallback; ///