diff --git a/Core/GameEngine/Include/GameClient/Intro.h b/Core/GameEngine/Include/GameClient/Intro.h index 383ce8db12b..365399d89a4 100644 --- a/Core/GameEngine/Include/GameClient/Intro.h +++ b/Core/GameEngine/Include/GameClient/Intro.h @@ -61,6 +61,7 @@ class Intro void update(); void draw(); + Bool skipCurrentIntroStage(); Bool isDone() const { return m_currentState == IntroState_Done; } private: diff --git a/Core/GameEngine/Source/GameClient/Intro.cpp b/Core/GameEngine/Source/GameClient/Intro.cpp index a2af44a5b41..360dd8ac551 100644 --- a/Core/GameEngine/Source/GameClient/Intro.cpp +++ b/Core/GameEngine/Source/GameClient/Intro.cpp @@ -98,9 +98,32 @@ void Intro::draw() } } +Bool Intro::skipCurrentIntroStage() +{ + // Aborts waits, stops movies and skips waiting states + + Bool isSkipping = !isDone(); + + m_waitUntilMs = 0; + + switch (m_currentState) + { + case IntroState_EALogoMovie: + case IntroState_SizzleMovie: + TheDisplay->stopMovie(); + enterNextState(); + break; + + case IntroState_TheSuperHackers: + enterNextState(); + break; + } + + return isSkipping; +} + void Intro::doEALogoMovie() { - TheWritableGlobalData->m_allowExitOutOfMovies = FALSE; if (TheGameLODManager && TheGameLODManager->didMemPass()) TheDisplay->playMovie("EALogoMovie"); else @@ -221,7 +244,6 @@ void Intro::doTheSuperHackers() void Intro::doSizzleMovie() { - TheWritableGlobalData->m_allowExitOutOfMovies = TRUE; if (TheGameLODManager && TheGameLODManager->didMemPass()) TheDisplay->playMovie("Sizzle"); else @@ -231,7 +253,6 @@ void Intro::doSizzleMovie() void Intro::doPostIntro() { TheWritableGlobalData->m_breakTheMovie = TRUE; - TheWritableGlobalData->m_allowExitOutOfMovies = TRUE; } void Intro::doAsyncWait(UnsignedInt milliseconds) diff --git a/Core/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp b/Core/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp index 6833ce37c84..79553645b43 100644 --- a/Core/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp +++ b/Core/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp @@ -50,6 +50,7 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// #include "Common/MessageStream.h" +#include "GameClient/GameClient.h" #include "GameClient/GameWindowManager.h" #include "GameClient/WindowXlat.h" #include "GameClient/Shell.h" @@ -318,12 +319,17 @@ GameMessageDisposition WindowTranslator::translateGameMessage(const GameMessage // If we're in a movie, we want to be able to escape out of it if(returnCode != WIN_INPUT_USED && (key == KEY_ESC) - && (BitIsSet( state, KEY_STATE_UP )) - && TheDisplay->isMoviePlaying() - && TheGlobalData->m_allowExitOutOfMovies == TRUE ) + && (BitIsSet( state, KEY_STATE_UP )) ) { - TheDisplay->stopMovie(); - returnCode = WIN_INPUT_USED; + if (TheGameClient->skipCurrentIntroStage()) + { + returnCode = WIN_INPUT_USED; + } + else if (TheDisplay->isMoviePlaying()) + { + TheDisplay->stopMovie(); + returnCode = WIN_INPUT_USED; + } } // TheSuperHackers @bugfix If the input is disabled, then only allow the ESC button to get through. diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index deedd63006c..f4e60a9ddd4 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -365,7 +365,6 @@ class GlobalData : public SubsystemInterface Bool m_shellMapOn; ///< User can set the shell map not to load Bool m_playIntro; ///< Flag to say if we're to play the intro or not Bool m_playSizzle; ///< Flag to say whether we play the sizzle movie after the logo movie. - Bool m_allowExitOutOfMovies; ///< flag to allow exit out of movies only after the Intro has played Bool m_loadScreenRender; ///< flag to disallow rendering of almost everything during a loadscreen diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h index 91d809c7f02..c4e6b7a7492 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h @@ -155,6 +155,8 @@ class GameClient : public SubsystemInterface, void incrementRenderedObjectCount() { m_renderedObjectCount++; } virtual void notifyTerrainObjectMoved(Object *obj) = 0; + Bool skipCurrentIntroStage(); + static Bool isMovieAbortRequested(); protected: diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index 08e2d63a6ee..a26d255cf81 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -1014,7 +1014,6 @@ GlobalData::GlobalData() m_shellMapOn =TRUE; m_playIntro = TRUE; m_playSizzle = TRUE; - m_allowExitOutOfMovies = FALSE; m_loadScreenRender = FALSE; m_keyboardDefaultScrollFactor = m_keyboardScrollFactor = 0.5f; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 006c3ed9376..e396c3861b2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -748,6 +748,15 @@ void GameClient::step() TheDisplay->step(); } +Bool GameClient::skipCurrentIntroStage() +{ + if (m_intro != nullptr) + { + return m_intro->skipCurrentIntroStage(); + } + return false; +} + Bool GameClient::isMovieAbortRequested() { if (TheGameEngine) @@ -760,7 +769,7 @@ Bool GameClient::isMovieAbortRequested() { TheKeyboard->UPDATE(); KeyboardIO *io = TheKeyboard->findKey(KEY_ESC, KeyboardIO::STATUS_UNUSED); - if (io && BitIsSet(io->state, KEY_STATE_DOWN)) + if (io && BitIsSet(io->state, KEY_STATE_UP)) { io->setUsed(); return TRUE;