diff options
author | Christopher Page | 2008-06-24 21:15:30 +0000 |
---|---|---|
committer | Christopher Page | 2008-06-24 21:15:30 +0000 |
commit | f878820bbee1e7e4659ca601872674082334fa63 (patch) | |
tree | d1b05985a2b1758e8648fe86a64a5ef2562f1765 /engines | |
parent | 65abece4c67c4fb574caac717fff24bfb5f31d69 (diff) | |
download | scummvm-rg350-f878820bbee1e7e4659ca601872674082334fa63.tar.gz scummvm-rg350-f878820bbee1e7e4659ca601872674082334fa63.tar.bz2 scummvm-rg350-f878820bbee1e7e4659ca601872674082334fa63.zip |
Created Global Main Menu Dialog. Made a uniform _quit flag for engines. So far agi, agos, and cine are now using the new _quit flag.
svn-id: r32770
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/agi.cpp | 4 | ||||
-rw-r--r-- | engines/agi/agi.h | 1 | ||||
-rw-r--r-- | engines/agi/cycle.cpp | 7 | ||||
-rw-r--r-- | engines/agi/op_cmd.cpp | 8 | ||||
-rw-r--r-- | engines/agi/op_test.cpp | 2 | ||||
-rw-r--r-- | engines/agi/saveload.cpp | 4 | ||||
-rw-r--r-- | engines/agos/agos.cpp | 31 | ||||
-rw-r--r-- | engines/agos/agos.h | 2 | ||||
-rw-r--r-- | engines/cine/anim.cpp | 2 | ||||
-rw-r--r-- | engines/cine/cine.cpp | 3 | ||||
-rw-r--r-- | engines/cine/main_loop.cpp | 11 | ||||
-rw-r--r-- | engines/cine/prc.cpp | 2 | ||||
-rw-r--r-- | engines/cine/various.cpp | 4 | ||||
-rw-r--r-- | engines/cine/various.h | 2 | ||||
-rw-r--r-- | engines/engine.cpp | 25 | ||||
-rw-r--r-- | engines/engine.h | 11 | ||||
-rw-r--r-- | engines/module.mk | 4 |
17 files changed, 91 insertions, 32 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 9d88dd73ef..3619b08c9d 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -62,7 +62,7 @@ void AgiEngine::processEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_QUIT: - _game.quitProgNow = true; + _quit = true; break; case Common::EVENT_PREDICTIVE_DIALOG: if (_predictiveDialogRunning) @@ -809,7 +809,7 @@ int AgiEngine::go() { runGame(); - return 0; + return _rtl; } } // End of namespace Agi diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 9240d562af..9f12ccd57c 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -530,7 +530,6 @@ struct AgiGame { /* internal flags */ int playerControl; /**< player is in control */ - int quitProgNow; /**< quit now */ int statusLine; /**< status line on/off */ int clockEnabled; /**< clock is on/off */ int exitAllLogics; /**< break cycle after new.room */ diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index e0babdf926..dc0e50cff2 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -116,7 +116,7 @@ void AgiEngine::interpretCycle() { oldSound = getflag(fSoundOn); _game.exitAllLogics = false; - while (runLogic(0) == 0 && !_game.quitProgNow) { + while (runLogic(0) == 0 && !_quit) { _game.vars[vWordNotFound] = 0; _game.vars[vBorderTouchObj] = 0; _game.vars[vBorderCode] = 0; @@ -314,7 +314,6 @@ int AgiEngine::playGame() { setvar(vTimeDelay, 2); /* "normal" speed */ _game.gfxMode = true; - _game.quitProgNow = false; _game.clockEnabled = true; _game.lineUserInput = 22; @@ -354,10 +353,10 @@ int AgiEngine::playGame() { _game.vars[vKey] = 0; } - if (_game.quitProgNow == 0xff) + if (_quit == 0xff) ec = errRestartGame; - } while (_game.quitProgNow == 0); + } while (_quit == 0); _sound->stopSound(); diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 7ecedfbc8c..e3629699ca 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -1213,11 +1213,11 @@ cmd(quit) { g_sound->stopSound(); if (p0) { - game.quitProgNow = true; + g_agi->_quit = true; } else { if (g_agi->selectionBox (" Quit the game, or continue? \n\n\n", buttons) == 0) { - game.quitProgNow = true; + g_agi->_quit = true; } } } @@ -1231,7 +1231,7 @@ cmd(restart_game) { g_agi->selectionBox(" Restart game, or continue? \n\n\n", buttons); if (sel == 0) { - game.quitProgNow = 0xff; + g_agi->_quit = 0xff; g_agi->setflag(fRestartGame, true); g_agi->_menu->enableAll(); } @@ -1739,7 +1739,7 @@ int AgiEngine::runLogic(int n) { curLogic->cIP = curLogic->sIP; timerHack = 0; - while (ip < _game.logics[n].size && !_game.quitProgNow) { + while (ip < _game.logics[n].size && !g_agi->_quit) { if (_debug.enabled) { if (_debug.steps > 0) { if (_debug.logic0 || n) { diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index 7ba3e625bf..098a7730a7 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -232,7 +232,7 @@ int AgiEngine::testIfCode(int lognum) { uint8 p[16] = { 0 }; bool end_test = false; - while (retval && !game.quitProgNow && !end_test) { + while (retval && !_quit && !end_test) { if (_debug.enabled && (_debug.logic0 || lognum)) debugConsole(lognum, lTEST_MODE, NULL); diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index db7bba13e4..5dc2523424 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -91,7 +91,7 @@ int AgiEngine::saveGame(const char *fileName, const char *description) { out->writeSint16BE((int16)_game.lognum); out->writeSint16BE((int16)_game.playerControl); - out->writeSint16BE((int16)_game.quitProgNow); + out->writeSint16BE((int16)_quit); out->writeSint16BE((int16)_game.statusLine); out->writeSint16BE((int16)_game.clockEnabled); out->writeSint16BE((int16)_game.exitAllLogics); @@ -281,7 +281,7 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) { _game.lognum = in->readSint16BE(); _game.playerControl = in->readSint16BE(); - _game.quitProgNow = in->readSint16BE(); + _quit = in->readSint16BE(); _game.statusLine = in->readSint16BE(); _game.clockEnabled = in->readSint16BE(); _game.exitAllLogics = in->readSint16BE(); diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 365f9fcde7..cd121b6300 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -30,6 +30,10 @@ #include "common/system.h" #include "common/events.h" +//#include "gui/message.h" +//#include "gui/newgui.h" + +//#include "agos/dialogs.h" #include "agos/debugger.h" #include "agos/intern.h" #include "agos/agos.h" @@ -97,7 +101,8 @@ AGOSEngine::AGOSEngine(OSystem *syst) _vc_get_out_of_code = 0; _gameOffsetsPtr = 0; - _quit = false; + //_quit = false; + //_rtl = false; _debugger = 0; @@ -195,6 +200,8 @@ AGOSEngine::AGOSEngine(OSystem *syst) _backFlag = 0; + //_mainMenuDialog = NULL; + _debugMode = 0; _startMainScript = false; _continousMainScript = false; @@ -1021,7 +1028,7 @@ int AGOSEngine::go() { delay(100); } - return 0; + return _rtl; } @@ -1080,5 +1087,25 @@ uint32 AGOSEngine::getTime() const { // FIXME: calling time() is not portable, use OSystem::getMillis instead return (uint32)time(NULL); } +/* +int AGOSEngine::runDialog(Dialog &dialog) { + + pauseEngine(true); + + int result = dialog.runModal(); + + pauseEngine(false); + return 0; +} +/* +void AGOSEngine::mainMenuDialog() { + if (!_mainMenuDialog) + _mainMenuDialog = new MainMenuDialog(this); + runDialog(*_mainMenuDialog); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _midi.setVolume(ConfMan.getInt("music_volume")); +} +*/ } // End of namespace AGOS diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 74a0b026e9..87a6d2298a 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -269,7 +269,7 @@ protected: uint16 _marks; - bool _quit; + // bool _quit; bool _scriptVar2; bool _runScriptReturn1; bool _runScriptCondition[40]; diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp index 055eb733c3..feafaa315b 100644 --- a/engines/cine/anim.cpp +++ b/engines/cine/anim.cpp @@ -731,7 +731,7 @@ void loadResource(const char *resourceName) { loadSeq(resourceName, -1); return; } else if (strstr(resourceName, "ECHEC")) { // Echec (French) means failure - exitEngine = 1; + g_cine->_quit = 1; return; } diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index f6778b6457..29dd47c1f6 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -102,7 +102,8 @@ int CineEngine::go() { delete renderer; delete[] page3Raw; delete g_sound; - return 0; + + return _rtl; } diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 0c5096c0d6..1e8ddb9418 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -62,7 +62,7 @@ static void processEvent(Common::Event &event) { case Common::EVENT_MOUSEMOVE: break; case Common::EVENT_QUIT: - exitEngine = 1; + g_cine->_quit = 1; break; case Common::EVENT_KEYDOWN: switch (event.kbd.keycode) { @@ -181,12 +181,11 @@ int getKeyData() { void CineEngine::mainLoop(int bootScriptIdx) { bool playerAction; - uint16 quitFlag; + //uint16 quitFlag; byte di; uint16 mouseButton; - quitFlag = 0; - exitEngine = 0; + //quitFlag = 0; if (_preLoad == false) { resetBgIncrustList(); @@ -296,7 +295,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { if ("quit"[menuCommandLen] == (char)di) { ++menuCommandLen; if (menuCommandLen == 4) { - quitFlag = 1; + g_cine->_quit = 1; } } else { menuCommandLen = 0; @@ -305,7 +304,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { manageEvents(); - } while (!exitEngine && !quitFlag && _danKeysPressed != 7); + } while (!g_cine->_quit && _danKeysPressed != 7); hideMouse(); g_sound->stopMusic(); diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp index 402c97b1a6..d636479b02 100644 --- a/engines/cine/prc.cpp +++ b/engines/cine/prc.cpp @@ -53,7 +53,7 @@ void loadPrc(const char *pPrcName) { // This is copy protection. Used to hang the machine if (!scumm_stricmp(pPrcName, "L201.ANI")) { - exitEngine = 1; + g_cine->_quit = 1; return; } diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 9b98ddb253..9f8edf854b 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -110,7 +110,7 @@ static const int16 canUseOnItemTable[] = { 1, 0, 0, 1, 1, 0, 0 }; CommandeType objectListCommand[20]; int16 objListTab[20]; -uint16 exitEngine; +//uint16 exitEngine; uint16 zoneData[NUM_MAX_ZONE]; @@ -757,7 +757,7 @@ void CineEngine::makeSystemMenu(void) { { getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY); if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) { - exitEngine = 1; + _quit = 1; } break; } diff --git a/engines/cine/various.h b/engines/cine/various.h index 91662c16ff..2252febfe1 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -117,7 +117,7 @@ void mainLoopSub6(void); void checkForPendingDataLoad(void); -extern uint16 exitEngine; +//extern uint16 exitEngine; void hideMouse(void); diff --git a/engines/engine.cpp b/engines/engine.cpp index 757a77f82b..29135d9323 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -36,7 +36,9 @@ #include "common/savefile.h" #include "common/system.h" #include "gui/message.h" +#include "gui/newgui.h" #include "sound/mixer.h" +#include "engines/dialogs.h" #ifdef _WIN32_WCE extern bool isSmartphone(void); @@ -54,7 +56,10 @@ Engine::Engine(OSystem *syst) _saveFileMan(_system->getSavefileManager()), _targetName(ConfMan.getActiveDomainName()), _gameDataPath(ConfMan.get("path")), - _pauseLevel(0) { + _pauseLevel(0), + _mainMenuDialog(NULL), + _quit(false), + _rtl(false) { g_engine = this; _autosavePeriod = ConfMan.getInt("autosave_period"); @@ -210,3 +215,21 @@ void Engine::pauseEngineIntern(bool pause) { // By default, just (un)pause all digital sounds _mixer->pauseAll(pause); } + +void Engine::mainMenuDialog() { + if (!_mainMenuDialog) + _mainMenuDialog = new MainMenuDialog(this); + runDialog(*_mainMenuDialog); +} + +int Engine::runDialog(Dialog &dialog) { + + pauseEngine(true); + + int result = dialog.runModal(); + + pauseEngine(false); + + return 0; +} + diff --git a/engines/engine.h b/engines/engine.h index 73d529cc62..a62b3d9adb 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -39,18 +39,27 @@ namespace Common { } namespace GUI { class Debugger; + class Dialog; } +using GUI::Dialog; + class Engine { public: OSystem *_system; Audio::Mixer *_mixer; Common::TimerManager * _timer; + bool _quit; + bool _rtl; + protected: Common::EventManager *_eventMan; Common::SaveFileManager *_saveFileMan; + + Dialog *_mainMenuDialog; + virtual int runDialog(Dialog &dialog); const Common::String _targetName; // target name for saves const Common::String _gameDataPath; @@ -113,6 +122,8 @@ public: */ bool isPaused() const { return _pauseLevel != 0; } + void mainMenuDialog(); + public: /** Setup the backend's graphics mode. */ diff --git a/engines/module.mk b/engines/module.mk index 6cfe9b36fa..f7dd71f403 100644 --- a/engines/module.mk +++ b/engines/module.mk @@ -1,7 +1,7 @@ MODULE := engines MODULE_OBJS := \ - engine.o - + engine.o \ + dialogs.o # Include common rules include $(srcdir)/rules.mk |