aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/main.cpp12
-rw-r--r--engines/agi/agi.h10
-rw-r--r--engines/agos/agos.h11
-rw-r--r--engines/cine/cine.h11
-rw-r--r--engines/cruise/cruise.h11
-rw-r--r--engines/drascula/drascula.h11
-rw-r--r--engines/engine.h12
-rw-r--r--engines/gob/gob.h11
-rw-r--r--engines/groovie/groovie.h23
-rw-r--r--engines/igor/igor.h11
-rw-r--r--engines/kyra/kyra_hof.cpp4
-rw-r--r--engines/kyra/kyra_v1.h8
-rw-r--r--engines/lure/lure.h11
-rw-r--r--engines/m4/m4.h11
-rw-r--r--engines/made/made.h11
-rw-r--r--engines/parallaction/parallaction.h13
-rw-r--r--engines/queen/queen.h11
-rw-r--r--engines/saga/saga.h7
-rw-r--r--engines/sci/sci.h11
-rw-r--r--engines/scumm/he/intern_he.h3
-rw-r--r--engines/scumm/scumm.cpp6
-rw-r--r--engines/scumm/scumm.h11
-rw-r--r--engines/sky/sky.h11
-rw-r--r--engines/sword1/sword1.h11
-rw-r--r--engines/sword2/sword2.h11
-rw-r--r--engines/tinsel/tinsel.h11
-rw-r--r--engines/touche/touche.h11
-rw-r--r--engines/tucker/tucker.h11
28 files changed, 221 insertions, 75 deletions
diff --git a/base/main.cpp b/base/main.cpp
index 336607d657..c2b141966d 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -188,16 +188,8 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
// Inform backend that the engine is about to be run
system.engineInit();
- // Init the engine (this might change the screen parameters)
- // TODO: We should specify what return values
- Common::Error result = engine->init();
-
- // Run the game engine if the initialization was successful.
- if (result == Common::kNoError) {
- result = engine->go();
- } else {
- // TODO: Set an error flag, notify user about the problem
- }
+ // Run the engine
+ Common::Error result = engine->run();
// Inform backend that the engine finished
system.engineDone();
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 4dfd444fb7..0e1c1fedf4 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -696,7 +696,15 @@ struct StringData {
class AgiBase : public ::Engine {
protected:
// Engine API
- virtual Common::Error init();
+ Common::Error init();
+ virtual Common::Error go() = 0;
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
virtual void initialize() = 0;
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 7f4cf71deb..29793b1ca2 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -166,8 +166,15 @@ class AGOSEngine : public Engine {
friend class MoviePlayerSMK;
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
diff --git a/engines/cine/cine.h b/engines/cine/cine.h
index 29d2f05b89..4800604791 100644
--- a/engines/cine/cine.h
+++ b/engines/cine/cine.h
@@ -71,8 +71,15 @@ class CineEngine : public Engine {
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
void shutdown();
diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h
index 8796ba13a0..1d43fb4139 100644
--- a/engines/cruise/cruise.h
+++ b/engines/cruise/cruise.h
@@ -61,8 +61,15 @@ private:
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
void shutdown();
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 63bafcea1b..1cc8a50e15 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -276,8 +276,15 @@ static const int interf_y[] ={ 51, 51, 51, 51, 83, 83, 83 };
class DrasculaEngine : public ::Engine {
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
public:
DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gameDesc);
diff --git a/engines/engine.h b/engines/engine.h
index bcf398a813..45477f408d 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -144,18 +144,10 @@ public:
virtual ~Engine();
/**
- * Init the engine.
+ * Init the engine and start its main loop.
* @return returns kNoError on success, else an error code.
*/
- virtual Common::Error init() = 0;
-
- /**
- * Start the main engine loop.
- * The return value is not yet used, but could indicate whether the user
- * wants to return to the launch or to fully quit ScummVM.
- * @return returns kNoError on success, else an error code.
- */
- virtual Common::Error go() = 0;
+ virtual Common::Error run() = 0;
/**
* Prepare an error string, which is printed by the error() function.
diff --git a/engines/gob/gob.h b/engines/gob/gob.h
index 69f4a20632..9a00e8b8fe 100644
--- a/engines/gob/gob.h
+++ b/engines/gob/gob.h
@@ -191,8 +191,15 @@ private:
uint32 _pauseStart;
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
virtual void pauseEngineIntern(bool pause);
diff --git a/engines/groovie/groovie.h b/engines/groovie/groovie.h
index 7a76248cf3..5407d0b174 100644
--- a/engines/groovie/groovie.h
+++ b/engines/groovie/groovie.h
@@ -74,20 +74,29 @@ public:
~GroovieEngine();
protected:
+
+ // Engine APIs
Common::Error init();
Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
- void errorString(const char *buf_input, char *buf_output, int buf_output_size);
+ virtual void errorString(const char *buf_input, char *buf_output, int buf_output_size);
-public:
- bool hasFeature(EngineFeature f) const;
+ virtual bool hasFeature(EngineFeature f) const;
- bool canLoadGameStateCurrently();
- Common::Error loadGameState(int slot);
- void syncSoundSettings();
+ virtual bool canLoadGameStateCurrently();
+ virtual Common::Error loadGameState(int slot);
+ virtual void syncSoundSettings();
- Debugger *getDebugger() { return _debugger; }
+ virtual Debugger *getDebugger() { return _debugger; }
+public:
void waitForInput();
Script _script;
diff --git a/engines/igor/igor.h b/engines/igor/igor.h
index 4ded9d1eb3..41123634fe 100644
--- a/engines/igor/igor.h
+++ b/engines/igor/igor.h
@@ -312,8 +312,15 @@ public:
IgorEngine(OSystem *system, const DetectedGameVersion *dgv);
virtual ~IgorEngine();
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
void handleOptionsMenu_paintSave();
bool handleOptionsMenu_handleKeyDownSave(int key);
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 00c630d3d4..83fa59a9d1 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -1550,7 +1550,7 @@ void KyraEngine_HoF::snd_playSoundEffect(int track, int volume) {
#pragma mark -
-void KyraEngine_HoF::loadInvWsa(const char *filename, int run, int delayTime, int page, int sfx, int sFrame, int flags) {
+void KyraEngine_HoF::loadInvWsa(const char *filename, int run_, int delayTime, int page, int sfx, int sFrame, int flags) {
int wsaFlags = 1;
if (flags)
wsaFlags |= 2;
@@ -1583,7 +1583,7 @@ void KyraEngine_HoF::loadInvWsa(const char *filename, int run, int delayTime, in
_invWsa.running = true;
_invWsa.timer = _system->getMillis();
- if (run) {
+ if (run_) {
while (_invWsa.running && !skipFlag() && !shouldQuit()) {
update();
_system->delayMillis(10);
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index af7e0385cc..527739f19f 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -176,6 +176,14 @@ public:
protected:
// Engine APIs
virtual Common::Error init();
+ virtual Common::Error go() = 0;
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual ::GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void pauseEngineIntern(bool pause);
diff --git a/engines/lure/lure.h b/engines/lure/lure.h
index 93b0d68c99..ecf8269fd3 100644
--- a/engines/lure/lure.h
+++ b/engines/lure/lure.h
@@ -71,8 +71,15 @@ public:
bool _saveLoadAllowed;
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
virtual void pauseEngineIntern(bool pause);
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 69887b0fa4..acf6b5a93b 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -112,8 +112,15 @@ private:
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
void shutdown();
diff --git a/engines/made/made.h b/engines/made/made.h
index 2b82f50a24..e8ea30e0c6 100644
--- a/engines/made/made.h
+++ b/engines/made/made.h
@@ -80,8 +80,15 @@ class MadeEngine : public ::Engine {
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
public:
MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc);
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 8a6546e9b9..05aa0bc3f4 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -242,6 +242,15 @@ public:
// Engine APIs
virtual Common::Error init();
+ virtual Common::Error go() = 0;
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
+
virtual bool hasFeature(EngineFeature f) const;
virtual void pauseEngineIntern(bool pause);
virtual GUI::Debugger *getDebugger();
@@ -469,8 +478,8 @@ public:
Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc);
~Parallaction_br();
- Common::Error init();
- Common::Error go();
+ virtual Common::Error init();
+ virtual Common::Error go();
public:
virtual void parseLocation(const char* name);
diff --git a/engines/queen/queen.h b/engines/queen/queen.h
index 3f7e40fc0f..4bde519ea8 100644
--- a/engines/queen/queen.h
+++ b/engines/queen/queen.h
@@ -129,8 +129,15 @@ public:
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 9f6b0d814b..1e3a17bacf 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -445,6 +445,13 @@ public:
// Engine APIs
Common::Error init();
Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
bool hasFeature(EngineFeature f) const;
void syncSoundSettings();
void pauseEngineIntern(bool pause);
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 1764d9dfab..0f10df0c16 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -76,8 +76,15 @@ public:
SciEngine(OSystem *syst, const SciGameDescription *desc);
~SciEngine();
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
GUI::Debugger *getDebugger() { return _console; }
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index a04cbc24a8..7abd6f924b 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -669,8 +669,7 @@ public:
ScummEngine_vCUPhe(OSystem *syst, const DetectorResult &dr);
~ScummEngine_vCUPhe();
- Common::Error init();
- Common::Error go();
+ virtual Common::Error run();
void parseEvents();
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index fd6d354d63..15fee4115c 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -824,13 +824,9 @@ ScummEngine_vCUPhe::~ScummEngine_vCUPhe() {
delete _cupPlayer;
}
-Common::Error ScummEngine_vCUPhe::init() {
+Common::Error ScummEngine_vCUPhe::run() {
initGraphics(CUP_Player::kDefaultVideoWidth, CUP_Player::kDefaultVideoHeight, true);
- return Common::kNoError;
-}
-
-Common::Error ScummEngine_vCUPhe::go() {
if (_cupPlayer->open(_filenamePattern.pattern)) {
_cupPlayer->play();
_cupPlayer->close();
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index f99f37d857..e08453eed8 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -447,8 +447,15 @@ public:
virtual ~ScummEngine();
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual void errorString(const char *buf_input, char *buf_output, int buf_output_size);
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
diff --git a/engines/sky/sky.h b/engines/sky/sky.h
index 4e92563401..71ac716113 100644
--- a/engines/sky/sky.h
+++ b/engines/sky/sky.h
@@ -91,8 +91,15 @@ public:
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index 775eb33749..c4cbbcf394 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -85,8 +85,15 @@ public:
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
// FIXME: Loading a game through the GMM crashes the game
diff --git a/engines/sword2/sword2.h b/engines/sword2/sword2.h
index 8cff53ffa1..946dc3df53 100644
--- a/engines/sword2/sword2.h
+++ b/engines/sword2/sword2.h
@@ -124,8 +124,15 @@ private:
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual GUI::Debugger *getDebugger();
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 41b02aef6f..571f068455 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -141,8 +141,15 @@ class TinselEngine : public Engine {
protected:
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
Common::Error loadGameState(int slot);
#if 0
diff --git a/engines/touche/touche.h b/engines/touche/touche.h
index 8b4ea9c036..eb42000872 100644
--- a/engines/touche/touche.h
+++ b/engines/touche/touche.h
@@ -370,8 +370,15 @@ public:
virtual ~ToucheEngine();
// Engine APIs
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index 65f1dfbb2d..b330b21532 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -240,8 +240,15 @@ public:
TuckerEngine(OSystem *system, Common::Language language, uint32 flags);
virtual ~TuckerEngine();
- virtual Common::Error init();
- virtual Common::Error go();
+ Common::Error init();
+ Common::Error go();
+ virtual Common::Error run() {
+ Common::Error err;
+ err = init();
+ if (err != Common::kNoError)
+ return err;
+ return go();
+ }
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();