Skip to content

Commit bfe0bea

Browse files
committed
Add GameLogic::skipLoadScreen method to prevent direct LoadScreen access
1 parent 68143c6 commit bfe0bea

File tree

6 files changed

+32
-16
lines changed

6 files changed

+32
-16
lines changed

Generals/Code/GameEngine/Include/GameLogic/GameLogic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class GameLogic : public SubsystemInterface, public Snapshot
158158
void updateLoadProgress( Int progress );
159159
void deleteLoadScreen( void );
160160
LoadScreen *getLoadScreen( void ) const { return m_loadScreen; }
161+
Bool skipLoadScreen( void );
161162

162163
void setGameLoading( Bool loading );
163164
void setGameMode( GameMode mode );

Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include "GameClient/Shell.h"
5656
#include "GameClient/Display.h"
5757
#include "GameLogic/GameLogic.h"
58-
#include "GameClient/LoadScreen.h"
5958

6059

6160
// DEFINES ////////////////////////////////////////////////////////////////////
@@ -316,14 +315,9 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage
316315
&& (key == KEY_ESC)
317316
&& (BitIsSet( state, KEY_STATE_UP )) )
318317
{
319-
if( TheGameLogic )
318+
if( TheGameLogic && TheGameLogic->skipLoadScreen() )
320319
{
321-
LoadScreen *loadScreen = TheGameLogic->getLoadScreen();
322-
if( loadScreen && loadScreen->isVideoPlaying() )
323-
{
324-
loadScreen->skipVideo();
325-
returnCode = WIN_INPUT_USED;
326-
}
320+
returnCode = WIN_INPUT_USED;
327321
}
328322
}
329323

Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,19 @@ void GameLogic::deleteLoadScreen( void )
980980

981981
}
982982

983+
// ------------------------------------------------------------------------------------------------
984+
/** Skip the load screen video if one is playing */
985+
// ------------------------------------------------------------------------------------------------
986+
Bool GameLogic::skipLoadScreen( void )
987+
{
988+
if( m_loadScreen && m_loadScreen->isVideoPlaying() )
989+
{
990+
m_loadScreen->skipVideo();
991+
return TRUE;
992+
}
993+
return FALSE;
994+
}
995+
983996
void GameLogic::setGameLoading( Bool loading )
984997
{
985998
m_loadingScene = loading;

GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class GameLogic : public SubsystemInterface, public Snapshot
163163
void updateLoadProgress( Int progress );
164164
void deleteLoadScreen( void );
165165
LoadScreen *getLoadScreen( void ) const { return m_loadScreen; }
166+
Bool skipLoadScreen( void );
166167

167168
//Kris: Cut setGameLoading() and replaced with setLoadingMap() and setLoadingSave() -- reason: nomenclature
168169
//void setGameLoading( Bool loading ) { m_loadingScene = loading; }

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include "GameClient/Shell.h"
5656
#include "GameClient/Display.h"
5757
#include "GameLogic/GameLogic.h"
58-
#include "GameClient/LoadScreen.h"
5958

6059

6160
// DEFINES ////////////////////////////////////////////////////////////////////
@@ -333,14 +332,9 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage
333332
&& (key == KEY_ESC)
334333
&& (BitIsSet( state, KEY_STATE_UP )) )
335334
{
336-
if( TheGameLogic )
335+
if( TheGameLogic && TheGameLogic->skipLoadScreen() )
337336
{
338-
LoadScreen *loadScreen = TheGameLogic->getLoadScreen();
339-
if( loadScreen && loadScreen->isVideoPlaying() )
340-
{
341-
loadScreen->skipVideo();
342-
returnCode = WIN_INPUT_USED;
343-
}
337+
returnCode = WIN_INPUT_USED;
344338
}
345339
}
346340

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,19 @@ void GameLogic::deleteLoadScreen( void )
11221122

11231123
}
11241124

1125+
// ------------------------------------------------------------------------------------------------
1126+
/** Skip the load screen video if one is playing */
1127+
// ------------------------------------------------------------------------------------------------
1128+
Bool GameLogic::skipLoadScreen( void )
1129+
{
1130+
if( m_loadScreen && m_loadScreen->isVideoPlaying() )
1131+
{
1132+
m_loadScreen->skipVideo();
1133+
return TRUE;
1134+
}
1135+
return FALSE;
1136+
}
1137+
11251138
// ------------------------------------------------------------------------------------------------
11261139
// ------------------------------------------------------------------------------------------------
11271140
void GameLogic::updateDisplayBusyState()

0 commit comments

Comments
 (0)