Skip to content

Commit e6c28a4

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

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"
@@ -640,6 +641,18 @@ void PlayMovieAndBlock(AsciiString movieTitle)
640641
TheWritableGlobalData->m_loadScreenRender = TRUE;
641642
while (videoStream->frameIndex() < videoStream->frameCount() - 1)
642643
{
644+
// TheSuperHackers @feature User can now skip video by pressing ESC
645+
if (TheKeyboard)
646+
{
647+
TheKeyboard->UPDATE();
648+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
649+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
650+
{
651+
io->setUsed();
652+
break;
653+
}
654+
}
655+
643656
TheGameEngine->serviceWindowsOS();
644657

645658
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"
@@ -490,6 +491,18 @@ void SinglePlayerLoadScreen::init( GameInfo *game )
490491
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
491492
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
492493
{
494+
// TheSuperHackers @feature User can now skip video by pressing ESC
495+
if (TheKeyboard)
496+
{
497+
TheKeyboard->UPDATE();
498+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
499+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
500+
{
501+
io->setUsed();
502+
break;
503+
}
504+
}
505+
493506
TheGameEngine->serviceWindowsOS();
494507

495508
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"
@@ -734,6 +735,18 @@ void PlayMovieAndBlock(AsciiString movieTitle)
734735
TheWritableGlobalData->m_loadScreenRender = TRUE;
735736
while (videoStream->frameIndex() < videoStream->frameCount() - 1)
736737
{
738+
// TheSuperHackers @feature User can now skip video by pressing ESC
739+
if (TheKeyboard)
740+
{
741+
TheKeyboard->UPDATE();
742+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
743+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
744+
{
745+
io->setUsed();
746+
break;
747+
}
748+
}
749+
737750
TheGameEngine->serviceWindowsOS();
738751

739752
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"
@@ -533,6 +534,18 @@ void SinglePlayerLoadScreen::init( GameInfo *game )
533534
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
534535
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
535536
{
537+
// TheSuperHackers @feature User can now skip video by pressing ESC
538+
if (TheKeyboard)
539+
{
540+
TheKeyboard->UPDATE();
541+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
542+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
543+
{
544+
io->setUsed();
545+
break;
546+
}
547+
}
548+
536549
TheGameEngine->serviceWindowsOS();
537550

538551
if(!m_videoStream->isFrameReady())
@@ -1047,6 +1060,18 @@ void ChallengeLoadScreen::init( GameInfo *game )
10471060
Int shiftedPercent = -FRAME_FUDGE_ADD + 1;
10481061
while (m_videoStream->frameIndex() < m_videoStream->frameCount() - 1 )
10491062
{
1063+
// TheSuperHackers @feature User can now skip video by pressing ESC
1064+
if (TheKeyboard)
1065+
{
1066+
TheKeyboard->UPDATE();
1067+
KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED);
1068+
if (io && BitIsSet(io->state, KEY_STATE_DOWN))
1069+
{
1070+
io->setUsed();
1071+
break;
1072+
}
1073+
}
1074+
10501075
TheGameEngine->serviceWindowsOS();
10511076

10521077
if(!m_videoStream->isFrameReady())

0 commit comments

Comments
 (0)