Skip to content

Commit fb97d6e

Browse files
committed
feat(movie): Implement ESC button mapping to skip Compaign and Challenge intro videos
1 parent fe4a589 commit fb97d6e

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

GeneralsMD/Code/GameEngine/Include/GameClient/LoadScreen.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ class LoadScreen
6363
virtual void update( Int percent ); ///< Update the state of the slider bars
6464
virtual void processProgress(Int playerId, Int percentage) = 0;
6565
virtual void setProgressRange( Int min, Int max ) = 0;
66+
6667
protected:
6768
void setLoadScreen( GameWindow *g ) { m_loadScreen = g; }
68-
GameWindow *m_loadScreen; ///< The GameWindow that is our loadscreen
69-
70-
private:
69+
static Bool canSkipVideo();
7170

71+
GameWindow *m_loadScreen; ///< The GameWindow that is our loadscreen
7272
};
7373

7474
///////////////////////////////////////////////////////////////////////////////////////////////////

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#include "GameClient/GameText.h"
7272
#include "GameClient/GameWindowManager.h"
7373
#include "GameClient/GameWindowTransitions.h"
74+
#include "GameClient/Keyboard.h"
7475
#include "GameClient/LoadScreen.h"
7576
#include "GameClient/MapUtil.h"
7677
#include "GameClient/Mouse.h"
@@ -170,6 +171,22 @@ void LoadScreen::update( Int percent )
170171
setFPMode();
171172
}
172173

174+
Bool LoadScreen::canSkipVideo()
175+
{
176+
if (TheKeyboard != NULL)
177+
{
178+
TheKeyboard->UPDATE();
179+
for (KeyboardIO *key = TheKeyboard->getFirstKey(); key->key != KEY_NONE; ++key)
180+
{
181+
if (key->key == KEY_ESC && BitIsSet(key->state, KEY_STATE_UP))
182+
{
183+
return true;
184+
}
185+
}
186+
}
187+
return false;
188+
}
189+
173190

174191
// SinglePlayerLoadScreen Class ///////////////////////////////////////////////
175192
//-----------------------------------------------------------------------------
@@ -533,6 +550,10 @@ void SinglePlayerLoadScreen::init( GameInfo *game )
533550
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
534551
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
535552
{
553+
// TheSuperHackers @feature User can now skip video by pressing ESC
554+
if (canSkipVideo())
555+
break;
556+
536557
TheGameEngine->serviceWindowsOS();
537558

538559
if(!m_videoStream->isFrameReady())
@@ -1053,6 +1074,10 @@ void ChallengeLoadScreen::init( GameInfo *game )
10531074
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
10541075
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
10551076
{
1077+
// TheSuperHackers @feature User can now skip video by pressing ESC
1078+
if (canSkipVideo())
1079+
break;
1080+
10561081
TheGameEngine->serviceWindowsOS();
10571082

10581083
if(!m_videoStream->isFrameReady())

0 commit comments

Comments
 (0)