mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-17 23:44:22 +00:00
Merged Engine::go() and ::init() into a new run() method (currently implemented by calling the existing init&go methods; to be cleaned up by engine authors
svn-id: r39002
This commit is contained in:
parent
d0c2484502
commit
3fcbda829a
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
|
||||
virtual bool canLoadGameStateCurrently();
|
||||
virtual Common::Error loadGameState(int slot);
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
virtual Debugger *getDebugger() { return _debugger; }
|
||||
|
||||
public:
|
||||
bool hasFeature(EngineFeature f) const;
|
||||
|
||||
bool canLoadGameStateCurrently();
|
||||
Common::Error loadGameState(int slot);
|
||||
void syncSoundSettings();
|
||||
|
||||
Debugger *getDebugger() { return _debugger; }
|
||||
|
||||
void waitForInput();
|
||||
|
||||
Script _script;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user