KYRA: (EOB) - allow returning to the main menu from character generation via ESC

This commit is contained in:
athrxx 2011-06-19 00:00:48 +02:00 committed by Johannes Schickel
parent 894df5a4ac
commit 69ad70afbb
9 changed files with 44 additions and 28 deletions

View File

@ -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() {

View File

@ -29,6 +29,7 @@ namespace Kyra {
EobEngine::EobEngine(OSystem *system, const GameFlags &flags) : EobCoreEngine(system, flags) {
_numSpells = 53;
_menuChoiceInit = 4;
}
EobEngine::~EobEngine() {

View File

@ -44,6 +44,7 @@ private:
// Main Menu
int mainMenu();
int mainMenuLoop();
int _menuChoiceInit;
// Main loop
void startupNew();

View File

@ -33,6 +33,7 @@ DarkMoonEngine::DarkMoonEngine(OSystem *system, const GameFlags &flags) : EobCor
_shapesIntro = _shapesFinale = 0;
_dscDoorType5Offs = 0;
_numSpells = 70;
_menuChoiceInit = 4;
}
DarkMoonEngine::~DarkMoonEngine() {

View File

@ -60,6 +60,7 @@ private:
// Main Menu
int mainMenu();
int mainMenuLoop();
int _menuChoiceInit;
// Main loop
void startupNew();

View File

@ -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();
}
for (bool repeatLoop = true; repeatLoop; repeatLoop ^= true) {
action = 0;
if (action == -1) {
// load game
_saveLoadMode = -1;
startupLoad();
} else if (action == -2) {
// new game
startCharacterGeneration();
startupNew();
} else if (action == -3) {
// transfer party
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) {

View File

@ -302,7 +302,7 @@ protected:
//int _runLoopUnk2;
// Create Party
void startCharacterGeneration();
bool startCharacterGeneration();
uint8 **_faceShapes;

View File

@ -34,7 +34,8 @@
namespace Kyra {
int EobEngine::mainMenu() {
int menuChoice = 4;
int menuChoice = _menuChoiceInit;
_menuChoiceInit = 0;
Screen::FontId of = _screen->_currentFont;

View File

@ -86,7 +86,8 @@ private:
};
int DarkMoonEngine::mainMenu() {
int menuChoice = 4;
int menuChoice = _menuChoiceInit;
_menuChoiceInit = 0;
_sound->loadSoundFile("INTRO");
Screen::FontId of = _screen->_currentFont;