Skip to content

Commit

Permalink
CGE2: Make the intro skippable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Bozsó committed Sep 6, 2014
1 parent a5528ec commit 5e099e9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions engines/cge2/cge2.cpp
Expand Up @@ -76,6 +76,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_vol[i] = nullptr;
_eventManager = nullptr;
_map = nullptr;
_skipIntro = false;
_quitFlag = false;
_bitmapPalette = nullptr;
_startupMode = 1;
Expand Down
1 change: 1 addition & 0 deletions engines/cge2/cge2.h
Expand Up @@ -280,6 +280,7 @@ class CGE2Engine : public Engine {

Common::RandomSource _randomSource;

bool _skipIntro;
bool _quitFlag;
Dac *_bitmapPalette;
int _startupMode;
Expand Down
8 changes: 4 additions & 4 deletions engines/cge2/cge2_main.cpp
Expand Up @@ -396,7 +396,7 @@ void CGE2Engine::movie(const char *ext) {
sceneUp(_now);
_keyboard->setClient(_sys);

while (!_commandHandler->idle() && !_quitFlag)
while (!_commandHandler->idle() && !_quitFlag && !_skipIntro)
mainLoop();

_keyboard->setClient(nullptr);
Expand Down Expand Up @@ -532,11 +532,11 @@ void CGE2Engine::mainLoop() {
// Handle a delay between game frames
handleFrame();

// Handle any pending events
_eventManager->poll();

// Check shouldQuit()
_quitFlag = shouldQuit();

// Handle any pending events
_eventManager->poll();
}

void CGE2Engine::checkSounds() {
Expand Down
2 changes: 2 additions & 0 deletions engines/cge2/events.cpp
Expand Up @@ -219,6 +219,8 @@ void EventManager::poll() {
switch (_event.type) {
case Common::EVENT_KEYDOWN:
case Common::EVENT_KEYUP:
if (_vm->_startupMode == 1)
_vm->_skipIntro = true; // So the player can interrupt the intro.
// Handle keyboard events
_vm->_keyboard->newKeyboard(_event);
handleEvents();
Expand Down

0 comments on commit 5e099e9

Please sign in to comment.