Skip to content

Commit 6b7c19f

Browse files
committed
feat(movie): Implement ESC button mapping to skip Campaign, Challenge and Score videos (#1926)
1 parent c083e80 commit 6b7c19f

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#include "GameClient/GameWindowManager.h"
8080
#include "GameClient/Gadget.h"
8181
#include "GameClient/GameText.h"
82+
#include "GameClient/Keyboard.h"
8283
#include "GameClient/MapUtil.h"
8384
#include "GameClient/Shell.h"
8485
#include "GameClient/KeyDefs.h"
@@ -637,6 +638,18 @@ void PlayMovieAndBlock(AsciiString movieTitle)
637638
TheWritableGlobalData->m_loadScreenRender = TRUE;
638639
while (videoStream->frameIndex() < videoStream->frameCount() - 1)
639640
{
641+
// TheSuperHackers @feature User can now skip video by pressing ESC
642+
if (TheKeyboard)
643+
{
644+
TheKeyboard->UPDATE();
645+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
646+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
647+
{
648+
io->setUsed();
649+
break;
650+
}
651+
}
652+
640653
TheGameEngine->serviceWindowsOS();
641654

642655
if(!videoStream->isFrameReady())

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
#include "Common/AudioAffect.h"
6767

6868
#include "GameClient/LoadScreen.h"
69+
#include "GameClient/Keyboard.h"
6970
#include "GameClient/Shell.h"
7071
#include "GameClient/GameWindowManager.h"
7172
#include "GameClient/GadgetProgressBar.h"
@@ -487,6 +488,18 @@ void SinglePlayerLoadScreen::init( GameInfo *game )
487488
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
488489
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
489490
{
491+
// TheSuperHackers @feature User can now skip video by pressing ESC
492+
if (TheKeyboard)
493+
{
494+
TheKeyboard->UPDATE();
495+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
496+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
497+
{
498+
io->setUsed();
499+
break;
500+
}
501+
}
502+
490503
TheGameEngine->serviceWindowsOS();
491504

492505
if(!m_videoStream->isFrameReady())

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
#include "GameClient/GameWindowManager.h"
8383
#include "GameClient/Gadget.h"
8484
#include "GameClient/GameText.h"
85+
#include "GameClient/Keyboard.h"
8586
#include "GameClient/MapUtil.h"
8687
#include "GameClient/Shell.h"
8788
#include "GameClient/KeyDefs.h"
@@ -731,6 +732,18 @@ void PlayMovieAndBlock(AsciiString movieTitle)
731732
TheWritableGlobalData->m_loadScreenRender = TRUE;
732733
while (videoStream->frameIndex() < videoStream->frameCount() - 1)
733734
{
735+
// TheSuperHackers @feature User can now skip video by pressing ESC
736+
if (TheKeyboard)
737+
{
738+
TheKeyboard->UPDATE();
739+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
740+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
741+
{
742+
io->setUsed();
743+
break;
744+
}
745+
}
746+
734747
TheGameEngine->serviceWindowsOS();
735748

736749
if(!videoStream->isFrameReady())

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"
@@ -530,6 +531,18 @@ void SinglePlayerLoadScreen::init( GameInfo *game )
530531
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
531532
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
532533
{
534+
// TheSuperHackers @feature User can now skip video by pressing ESC
535+
if (TheKeyboard)
536+
{
537+
TheKeyboard->UPDATE();
538+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
539+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
540+
{
541+
io->setUsed();
542+
break;
543+
}
544+
}
545+
533546
TheGameEngine->serviceWindowsOS();
534547

535548
if(!m_videoStream->isFrameReady())
@@ -1050,6 +1063,18 @@ void ChallengeLoadScreen::init( GameInfo *game )
10501063
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
10511064
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
10521065
{
1066+
// TheSuperHackers @feature User can now skip video by pressing ESC
1067+
if (TheKeyboard)
1068+
{
1069+
TheKeyboard->UPDATE();
1070+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
1071+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
1072+
{
1073+
io->setUsed();
1074+
break;
1075+
}
1076+
}
1077+
10531078
TheGameEngine->serviceWindowsOS();
10541079

10551080
if(!m_videoStream->isFrameReady())

0 commit comments

Comments
 (0)