diff options
author | athrxx | 2011-06-19 00:00:48 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-12-26 16:18:11 +0100 |
commit | 69ad70afbb16f25f62432fb497e39c9d5633c10a (patch) | |
tree | e7324b3150247eee531addbb80ad75f8b31d2b27 | |
parent | 894df5a4ac97bc67cfe7fd9a7df17e541c505365 (diff) | |
download | scummvm-rg350-69ad70afbb16f25f62432fb497e39c9d5633c10a.tar.gz scummvm-rg350-69ad70afbb16f25f62432fb497e39c9d5633c10a.tar.bz2 scummvm-rg350-69ad70afbb16f25f62432fb497e39c9d5633c10a.zip |
KYRA: (EOB) - allow returning to the main menu from character generation via ESC
-rw-r--r-- | engines/kyra/chargen.cpp | 20 | ||||
-rw-r--r-- | engines/kyra/eob1.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/eob1.h | 1 | ||||
-rw-r--r-- | engines/kyra/eob2.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/eob2.h | 1 | ||||
-rw-r--r-- | engines/kyra/eobcommon.cpp | 42 | ||||
-rw-r--r-- | engines/kyra/eobcommon.h | 2 | ||||
-rw-r--r-- | engines/kyra/sequences_eob1.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/sequences_eob2.cpp | 3 |
9 files changed, 45 insertions, 29 deletions
diff --git a/engines/kyra/chargen.cpp b/engines/kyra/chargen.cpp index 17ee920127..fc3e874de3 100644 --- a/engines/kyra/chargen.cpp +++ b/engines/kyra/chargen.cpp @@ -33,7 +33,7 @@ public: CharacterGenerator(EobCoreEngine *vm, Screen_Eob *screen); ~CharacterGenerator(); - void start(EobCharacter *characters, uint8 ***faceShapes); + bool start(EobCharacter *characters, uint8 ***faceShapes); private: void init(); @@ -113,8 +113,8 @@ private: Screen_Eob *_screen; }; -void EobCoreEngine::startCharacterGeneration() { - CharacterGenerator(this, _screen).start(_characters, &_faceShapes); +bool EobCoreEngine::startCharacterGeneration() { + return CharacterGenerator(this, _screen).start(_characters, &_faceShapes); } CharacterGenerator::CharacterGenerator(EobCoreEngine *vm, Screen_Eob *screen) : _vm(vm), _screen(screen), @@ -156,9 +156,9 @@ CharacterGenerator::~CharacterGenerator() { } } -void CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) { +bool CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) { if (!characters && !faceShapes) - return; + return true; _characters = characters; _faceShapes = *faceShapes; @@ -184,10 +184,15 @@ void CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) { _vm->removeInputTop(); if (inputFlag) { - if (inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) + if (inputFlag == _vm->_keyMap[Common::KEYCODE_LEFT] || inputFlag == _vm->_keyMap[Common::KEYCODE_RIGHT]) { _activeBox ^= 1; - else if (inputFlag == _vm->_keyMap[Common::KEYCODE_UP] || inputFlag == _vm->_keyMap[Common::KEYCODE_DOWN]) + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_UP] || inputFlag == _vm->_keyMap[Common::KEYCODE_DOWN]) { _activeBox ^= 2; + } else if (inputFlag == _vm->_keyMap[Common::KEYCODE_ESCAPE]) { + // Unlike the original we allow returning to the main menu + _vm->sound()->haltTrack(); + return false; + } highlightBoxFrame(-1); } @@ -233,6 +238,7 @@ void CharacterGenerator::start(EobCharacter *characters, uint8 ***faceShapes) { _vm->sound()->playTrack(15); *faceShapes = _faceShapes; + return true; } void CharacterGenerator::init() { diff --git a/engines/kyra/eob1.cpp b/engines/kyra/eob1.cpp index 3a6bd28342..cdccd65414 100644 --- a/engines/kyra/eob1.cpp +++ b/engines/kyra/eob1.cpp @@ -29,6 +29,7 @@ namespace Kyra { EobEngine::EobEngine(OSystem *system, const GameFlags &flags) : EobCoreEngine(system, flags) { _numSpells = 53; + _menuChoiceInit = 4; } EobEngine::~EobEngine() { diff --git a/engines/kyra/eob1.h b/engines/kyra/eob1.h index 27a060f65c..8a959e9fa4 100644 --- a/engines/kyra/eob1.h +++ b/engines/kyra/eob1.h @@ -44,6 +44,7 @@ private: // Main Menu int mainMenu(); int mainMenuLoop(); + int _menuChoiceInit; // Main loop void startupNew(); diff --git a/engines/kyra/eob2.cpp b/engines/kyra/eob2.cpp index 06e85a8cc7..de8e90c80f 100644 --- a/engines/kyra/eob2.cpp +++ b/engines/kyra/eob2.cpp @@ -33,6 +33,7 @@ DarkMoonEngine::DarkMoonEngine(OSystem *system, const GameFlags &flags) : EobCor _shapesIntro = _shapesFinale = 0; _dscDoorType5Offs = 0; _numSpells = 70; + _menuChoiceInit = 4; } DarkMoonEngine::~DarkMoonEngine() { diff --git a/engines/kyra/eob2.h b/engines/kyra/eob2.h index a36ec0e466..3fabe44bf0 100644 --- a/engines/kyra/eob2.h +++ b/engines/kyra/eob2.h @@ -60,6 +60,7 @@ private: // Main Menu int mainMenu(); int mainMenuLoop(); + int _menuChoiceInit; // Main loop void startupNew(); diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index e0fb584e16..3f9782a343 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -350,27 +350,31 @@ Common::Error EobCoreEngine::go() { //initPlayBuffers loadItemDefs(); - int action = 0; - if (_gameToLoad != -1) { - if (loadGameState(_gameToLoad).getCode() != Common::kNoError) - error("Couldn't load game slot %d on startup", _gameToLoad); - _gameToLoad = -1; - } else { - action = mainMenu(); - } - - if (action == -1) { - // load game - _saveLoadMode = -1; - startupLoad(); - } else if (action == -2) { - // new game - startCharacterGeneration(); - startupNew(); - } else if (action == -3) { - // transfer party + for (bool repeatLoop = true; repeatLoop; repeatLoop ^= true) { + action = 0; + + if (_gameToLoad != -1) { + if (loadGameState(_gameToLoad).getCode() != Common::kNoError) + error("Couldn't load game slot %d on startup", _gameToLoad); + _gameToLoad = -1; + } else { + action = mainMenu(); + } + + if (action == -1) { + // load game + _saveLoadMode = -1; + startupLoad(); + } else if (action == -2) { + // new game + repeatLoop = startCharacterGeneration(); + if (repeatLoop) + startupNew(); + } else if (action == -3) { + // transfer party + } } if (!shouldQuit() && action > -3) { diff --git a/engines/kyra/eobcommon.h b/engines/kyra/eobcommon.h index 6632ae3cba..4ad4ebfe99 100644 --- a/engines/kyra/eobcommon.h +++ b/engines/kyra/eobcommon.h @@ -302,7 +302,7 @@ protected: //int _runLoopUnk2; // Create Party - void startCharacterGeneration(); + bool startCharacterGeneration(); uint8 **_faceShapes; diff --git a/engines/kyra/sequences_eob1.cpp b/engines/kyra/sequences_eob1.cpp index 7e15a7aac7..e835c12f0f 100644 --- a/engines/kyra/sequences_eob1.cpp +++ b/engines/kyra/sequences_eob1.cpp @@ -34,7 +34,8 @@ namespace Kyra { int EobEngine::mainMenu() { - int menuChoice = 4; + int menuChoice = _menuChoiceInit; + _menuChoiceInit = 0; Screen::FontId of = _screen->_currentFont; diff --git a/engines/kyra/sequences_eob2.cpp b/engines/kyra/sequences_eob2.cpp index 07dd5237b8..c926eb6934 100644 --- a/engines/kyra/sequences_eob2.cpp +++ b/engines/kyra/sequences_eob2.cpp @@ -86,7 +86,8 @@ private: }; int DarkMoonEngine::mainMenu() { - int menuChoice = 4; + int menuChoice = _menuChoiceInit; + _menuChoiceInit = 0; _sound->loadSoundFile("INTRO"); Screen::FontId of = _screen->_currentFont; |