mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 07:53:12 +00:00
Switched various Engine APIs to use Common::Error
svn-id: r34916
This commit is contained in:
parent
4c8f221fb8
commit
40136f2590
@ -126,13 +126,21 @@ static const EnginePlugin *detectPlugin() {
|
||||
}
|
||||
|
||||
// TODO: specify the possible return values here
|
||||
static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::String &edebuglevels) {
|
||||
// Query the game data path, for messages
|
||||
Common::String path = ConfMan.hasKey("path") ? ConfMan.get("path") : ".";
|
||||
|
||||
// Create the game engine
|
||||
static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const Common::String &edebuglevels) {
|
||||
// Determine the game data path, for validation and error messages
|
||||
Common::FSNode dir(ConfMan.get("path"));
|
||||
Common::Error err = Common::kNoError;
|
||||
Engine *engine = 0;
|
||||
Common::Error err = (*plugin)->createInstance(&system, &engine);
|
||||
|
||||
// Verify that the game path refers to an actual directory
|
||||
if (!(dir.exists() && dir.isDirectory()))
|
||||
err = Common::kInvalidPathError;
|
||||
|
||||
// Create the game engine
|
||||
if (err == Common::kNoError)
|
||||
err = (*plugin)->createInstance(&system, &engine);
|
||||
|
||||
// Check for errors
|
||||
if (!engine || err != Common::kNoError) {
|
||||
// TODO: Show an error dialog or so?
|
||||
// TODO: Also take 'err' into consideration...
|
||||
@ -154,9 +162,9 @@ static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::St
|
||||
plugin->getName(),
|
||||
errMsg,
|
||||
ConfMan.getActiveDomainName().c_str(),
|
||||
path.c_str()
|
||||
dir.getPath().c_str()
|
||||
);
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
// Set the window caption to the game name
|
||||
@ -172,20 +180,10 @@ static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::St
|
||||
}
|
||||
|
||||
//
|
||||
// Setup varios paths in the SearchManager
|
||||
// Setup various paths in the SearchManager
|
||||
//
|
||||
Common::FSNode dir;
|
||||
|
||||
// Add the game path to the directory search list
|
||||
//
|
||||
// FIXME: at this moment, game path handling is being discussed in the mailing list,
|
||||
// while Common::File is being reworked under the hood. After commit 34444, which
|
||||
// changed the implementation of Common::File (specifically removing usage of fopen
|
||||
// and fOpenNoCase, which implicitly supported backslashes in file names), some games
|
||||
// stopped working. Example of this are the HE games which use subdirectories: Kirben
|
||||
// found this issue on lost-win-demo at first. Thus, in commit 34450, searching the
|
||||
// game path was made recursive as a temporary fix/workaround.
|
||||
dir = Common::FSNode(path);
|
||||
SearchMan.addDirectory(dir.getPath(), dir, 0, 4);
|
||||
|
||||
// Add extrapath (if any) to the directory search list
|
||||
@ -209,10 +207,10 @@ static int runGame(const EnginePlugin *plugin, OSystem &system, const Common::St
|
||||
|
||||
// Init the engine (this might change the screen parameters)
|
||||
// TODO: We should specify what return values
|
||||
int result = engine->init();
|
||||
Common::Error result = engine->init();
|
||||
|
||||
// Run the game engine if the initialization was successful.
|
||||
if (result == 0) {
|
||||
if (result == Common::kNoError) {
|
||||
result = engine->go();
|
||||
} else {
|
||||
// TODO: Set an error flag, notify user about the problem
|
||||
@ -306,10 +304,10 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
|
||||
PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, plugin);
|
||||
|
||||
// Try to run the game
|
||||
int result = runGame(plugin, system, specialDebug);
|
||||
Common::Error result = runGame(plugin, system, specialDebug);
|
||||
|
||||
// Did an error occur ?
|
||||
if (result != 0) {
|
||||
if (result != Common::kNoError) {
|
||||
// TODO: Show an informative error dialog if starting the selected game failed.
|
||||
}
|
||||
|
||||
|
@ -779,7 +779,7 @@ AgiEngine::~AgiEngine() {
|
||||
free(_predictiveDictText);
|
||||
}
|
||||
|
||||
int AgiBase::init() {
|
||||
Common::Error AgiBase::init() {
|
||||
|
||||
// Initialize backend
|
||||
_system->beginGFXTransaction();
|
||||
@ -791,10 +791,10 @@ int AgiBase::init() {
|
||||
|
||||
_gfx->gfxSetPalette();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int AgiEngine::go() {
|
||||
Common::Error AgiEngine::go() {
|
||||
CursorMan.showMouse(true);
|
||||
|
||||
report(" \nAGI engine %s is ready.\n", gScummVMVersion);
|
||||
@ -808,7 +808,7 @@ int AgiEngine::go() {
|
||||
|
||||
runGame();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void AgiEngine::syncSoundSettings() {
|
||||
|
@ -696,7 +696,7 @@ struct StringData {
|
||||
class AgiBase : public ::Engine {
|
||||
protected:
|
||||
// Engine API
|
||||
virtual int init();
|
||||
virtual Common::Error init();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
|
||||
virtual void initialize() = 0;
|
||||
@ -745,7 +745,7 @@ class AgiEngine : public AgiBase {
|
||||
|
||||
protected:
|
||||
// Engine APIs
|
||||
virtual int go();
|
||||
virtual Common::Error go();
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
void initialize();
|
||||
|
@ -189,7 +189,7 @@ PreAgiEngine::~PreAgiEngine() {
|
||||
}
|
||||
|
||||
|
||||
int PreAgiEngine::go() {
|
||||
Common::Error PreAgiEngine::go() {
|
||||
setflag(fSoundOn, true); // enable sound
|
||||
|
||||
/*
|
||||
@ -227,7 +227,7 @@ FIXME (Fingolfin asks): Why are Mickey, Winnie and Troll standalone classes
|
||||
error("Unknown preagi engine");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
} // End of namespace Agi
|
||||
|
@ -37,7 +37,7 @@ class PreAgiEngine : public AgiBase {
|
||||
int _gameId;
|
||||
|
||||
protected:
|
||||
int go();
|
||||
Common::Error go();
|
||||
void initialize();
|
||||
|
||||
public:
|
||||
|
@ -528,7 +528,7 @@ AGOSEngine::AGOSEngine(OSystem *syst)
|
||||
syst->getEventManager()->registerRandomSource(_rnd, "agos");
|
||||
}
|
||||
|
||||
int AGOSEngine::init() {
|
||||
Common::Error AGOSEngine::init() {
|
||||
if (getGameId() == GID_DIMP) {
|
||||
_screenWidth = 496;
|
||||
_screenHeight = 400;
|
||||
@ -663,7 +663,7 @@ int AGOSEngine::init() {
|
||||
if (gDebugLevel == 5)
|
||||
_startVgaScript = true;
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
static const uint16 initialVideoWindows_Simon[20] = {
|
||||
@ -958,7 +958,7 @@ void AGOSEngine::pause() {
|
||||
}
|
||||
}
|
||||
|
||||
int AGOSEngine::go() {
|
||||
Common::Error AGOSEngine::go() {
|
||||
loadGamePcFile();
|
||||
|
||||
addTimeEvent(0, 1);
|
||||
@ -1023,7 +1023,7 @@ int AGOSEngine::go() {
|
||||
delay(100);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,8 +164,8 @@ class AGOSEngine : public Engine {
|
||||
friend class MoviePlayer;
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual GUI::Debugger *getDebugger();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void syncSoundSettings();
|
||||
|
@ -74,7 +74,7 @@ CineEngine::~CineEngine() {
|
||||
Common::clearAllSpecialDebugLevels();
|
||||
}
|
||||
|
||||
int CineEngine::init() {
|
||||
Common::Error CineEngine::init() {
|
||||
// Initialize backend
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
@ -91,10 +91,10 @@ int CineEngine::init() {
|
||||
|
||||
initialize();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int CineEngine::go() {
|
||||
Common::Error CineEngine::go() {
|
||||
CursorMan.showMouse(true);
|
||||
mainLoop(1);
|
||||
|
||||
@ -102,7 +102,7 @@ int CineEngine::go() {
|
||||
delete[] collisionPage;
|
||||
delete g_sound;
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int CineEngine::getTimerDelay() const {
|
||||
|
@ -71,8 +71,8 @@ class CineEngine : public Engine {
|
||||
|
||||
protected:
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
|
||||
void shutdown();
|
||||
|
@ -70,7 +70,7 @@ CruiseEngine::~CruiseEngine() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int CruiseEngine::init() {
|
||||
Common::Error CruiseEngine::init() {
|
||||
// Initialize backend
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
@ -79,16 +79,16 @@ int CruiseEngine::init() {
|
||||
|
||||
initialize();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int CruiseEngine::go() {
|
||||
Common::Error CruiseEngine::go() {
|
||||
Cruise::changeCursor(Cruise::CURSOR_NORMAL);
|
||||
CursorMan.showMouse(true);
|
||||
|
||||
Cruise::mainLoop();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void CruiseEngine::initialize() {
|
||||
|
@ -44,8 +44,10 @@ struct CRUISEGameDescription;
|
||||
class CruiseEngine:public Engine {
|
||||
|
||||
protected:
|
||||
int init();
|
||||
int go();
|
||||
// Engine APIs
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
|
||||
void shutdown();
|
||||
|
||||
bool initGame();
|
||||
|
@ -104,7 +104,7 @@ DrasculaEngine::~DrasculaEngine() {
|
||||
freeTexts(_textd1);
|
||||
}
|
||||
|
||||
int DrasculaEngine::init() {
|
||||
Common::Error DrasculaEngine::init() {
|
||||
// Initialize backend
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
@ -170,15 +170,15 @@ int DrasculaEngine::init() {
|
||||
*textName = 0;
|
||||
|
||||
if (!loadDrasculaDat())
|
||||
return 1;
|
||||
return Common::kUnknownError;
|
||||
|
||||
setupRoomsTable();
|
||||
loadArchives();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int DrasculaEngine::go() {
|
||||
Common::Error DrasculaEngine::go() {
|
||||
currentChapter = 1; // values from 1 to 6 will start each part of game
|
||||
loadedDifferentChapter = 0;
|
||||
|
||||
@ -274,7 +274,7 @@ int DrasculaEngine::go() {
|
||||
currentChapter++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void DrasculaEngine::endChapter() {
|
||||
|
@ -275,9 +275,9 @@ class DrasculaEngine : public ::Engine {
|
||||
Common::KeyState _keyPressed;
|
||||
|
||||
protected:
|
||||
int init();
|
||||
int go();
|
||||
// void shutdown();
|
||||
// Engine APIs
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
|
||||
public:
|
||||
DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gameDesc);
|
||||
|
@ -255,9 +255,9 @@ void Engine::syncSoundSettings() {
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
|
||||
}
|
||||
|
||||
int Engine::loadGameState(int slot) {
|
||||
Common::Error Engine::loadGameState(int slot) {
|
||||
// Do nothing by default
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool Engine::canLoadGameStateCurrently() {
|
||||
@ -265,9 +265,9 @@ bool Engine::canLoadGameStateCurrently() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Engine::saveGameState(int slot, const char *desc) {
|
||||
Common::Error Engine::saveGameState(int slot, const char *desc) {
|
||||
// Do nothing by default
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool Engine::canSaveGameStateCurrently() {
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define ENGINES_ENGINE_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/error.h"
|
||||
#include "common/fs.h"
|
||||
#include "common/str.h"
|
||||
|
||||
@ -127,17 +128,17 @@ public:
|
||||
|
||||
/**
|
||||
* Init the engine.
|
||||
* @return 0 for success, else an error code.
|
||||
* @return returns kNoError on success, else an error code.
|
||||
*/
|
||||
virtual int init() = 0;
|
||||
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 0 for success, else an error code.
|
||||
* @return returns kNoError on success, else an error code.
|
||||
*/
|
||||
virtual int go() = 0;
|
||||
virtual Common::Error go() = 0;
|
||||
|
||||
/**
|
||||
* Prepare an error string, which is printed by the error() function.
|
||||
@ -168,11 +169,9 @@ public:
|
||||
/**
|
||||
* Load a game state.
|
||||
* @param slot the slot from which a savestate should be loaded
|
||||
* @return returns 0 on success, anything else indicates failure
|
||||
*
|
||||
* @todo define proper error values
|
||||
* @return returns kNoError on success, else an error code.
|
||||
*/
|
||||
virtual int loadGameState(int slot);
|
||||
virtual Common::Error loadGameState(int slot);
|
||||
|
||||
/**
|
||||
* Indicates whether a game state can be loaded.
|
||||
@ -183,11 +182,9 @@ public:
|
||||
* Save a game state.
|
||||
* @param slot the slot into which the savestate should be stored
|
||||
* @param desc a description for the savestate, entered by the user
|
||||
* @return returns 0 on success, anything else indicates failure
|
||||
*
|
||||
* @todo define proper error values
|
||||
* @return returns kNoError on success, else an error code.
|
||||
*/
|
||||
virtual int saveGameState(int slot, const char *desc);
|
||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
||||
|
||||
/**
|
||||
* Indicates whether a game state can be saved.
|
||||
|
@ -110,10 +110,10 @@ GobEngine::~GobEngine() {
|
||||
delete[] _startTot0;
|
||||
}
|
||||
|
||||
int GobEngine::go() {
|
||||
Common::Error GobEngine::go() {
|
||||
_init->initGame(0);
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
const char *GobEngine::getLangDesc(int16 language) const {
|
||||
@ -177,10 +177,10 @@ bool GobEngine::hasAdlib() const {
|
||||
return (_features & kFeaturesAdlib) != 0;
|
||||
}
|
||||
|
||||
int GobEngine::init() {
|
||||
Common::Error GobEngine::init() {
|
||||
if (!initGameParts()) {
|
||||
GUIErrorMessage("GobEngine::init(): Unknown version of game engine");
|
||||
return -1;
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
_video->setSize(is640());
|
||||
@ -259,7 +259,7 @@ int GobEngine::init() {
|
||||
// 640x480.
|
||||
|
||||
g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void GobEngine::pauseEngineIntern(bool pause) {
|
||||
|
@ -191,8 +191,8 @@ private:
|
||||
uint32 _pauseStart;
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void pauseEngineIntern(bool pause);
|
||||
|
||||
|
@ -88,14 +88,14 @@ IgorEngine::~IgorEngine() {
|
||||
delete _midiPlayer;
|
||||
}
|
||||
|
||||
int IgorEngine::init() {
|
||||
Common::Error IgorEngine::init() {
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
_system->initSize(320, 200);
|
||||
_system->endGFXTransaction();
|
||||
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void IgorEngine::restart() {
|
||||
@ -169,7 +169,7 @@ void IgorEngine::restart() {
|
||||
_gameTicks = 0;
|
||||
}
|
||||
|
||||
int IgorEngine::go() {
|
||||
Common::Error IgorEngine::go() {
|
||||
restart();
|
||||
setupDefaultPalette();
|
||||
_currentPart = ConfMan.getInt("boot_param");
|
||||
@ -192,7 +192,7 @@ int IgorEngine::go() {
|
||||
PART_MAIN();
|
||||
_ovlFile.close();
|
||||
_sndFile.close();
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void IgorEngine::readTableFile() {
|
||||
|
@ -312,8 +312,8 @@ public:
|
||||
IgorEngine(OSystem *system, const DetectedGameVersion *dgv);
|
||||
virtual ~IgorEngine();
|
||||
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
|
||||
void handleOptionsMenu_paintSave();
|
||||
bool handleOptionsMenu_handleKeyDownSave(int key);
|
||||
@ -427,8 +427,8 @@ protected:
|
||||
void dialogueReplyToQuestion(int x, int y, int r, int g, int b, int reply = 0);
|
||||
|
||||
void saveOrLoadGameState(TypeSerializer &typeSerializer);
|
||||
int loadGameState(int slot);
|
||||
int saveGameState(int slot);
|
||||
Common::Error loadGameState(int slot);
|
||||
Common::Error saveGameState(int slot);
|
||||
void generateGameStateFileName(int num, char *dst, int len) const;
|
||||
|
||||
MidiPlayer *_midiPlayer;
|
||||
|
@ -156,7 +156,7 @@ void IgorEngine::saveOrLoadGameState(TypeSerializer &typeSerializer) {
|
||||
}
|
||||
}
|
||||
|
||||
int IgorEngine::loadGameState(int slot) {
|
||||
Common::Error IgorEngine::loadGameState(int slot) {
|
||||
char name[64];
|
||||
generateGameStateFileName(slot, name, 63);
|
||||
Common::InSaveFile *isf = _saveFileMan->openForLoading(name);
|
||||
@ -176,10 +176,10 @@ int IgorEngine::loadGameState(int slot) {
|
||||
debug(0, "Loaded state, current part %d", _currentPart);
|
||||
}
|
||||
|
||||
return 0; // TODO: return success/failure
|
||||
return Common::kNoError; // TODO: return success/failure
|
||||
}
|
||||
|
||||
int IgorEngine::saveGameState(int slot) {
|
||||
Common::Error IgorEngine::saveGameState(int slot) {
|
||||
char name[64];
|
||||
generateGameStateFileName(slot, name, 63);
|
||||
Common::OutSaveFile *osf = _saveFileMan->openForSaving(name);
|
||||
@ -190,7 +190,7 @@ int IgorEngine::saveGameState(int slot) {
|
||||
delete osf;
|
||||
}
|
||||
|
||||
return 0; // TODO: return success/failure
|
||||
return Common::kNoError; // TODO: return success/failure
|
||||
}
|
||||
|
||||
void IgorEngine::generateGameStateFileName(int num, char *dst, int len) const {
|
||||
|
@ -219,7 +219,7 @@ void KyraEngine_HoF::pauseEngineIntern(bool pause) {
|
||||
}
|
||||
}
|
||||
|
||||
int KyraEngine_HoF::init() {
|
||||
Common::Error KyraEngine_HoF::init() {
|
||||
_screen = new Screen_HoF(this, _system);
|
||||
assert(_screen);
|
||||
_screen->setResolution();
|
||||
@ -261,7 +261,7 @@ int KyraEngine_HoF::init() {
|
||||
|
||||
// No mouse display in demo
|
||||
if (_flags.isDemo && !_flags.isTalkie)
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
|
||||
_res->exists("PWGMOUSE.SHP", true);
|
||||
uint8 *shapes = _res->fileData("PWGMOUSE.SHP", 0);
|
||||
@ -273,10 +273,10 @@ int KyraEngine_HoF::init() {
|
||||
delete[] shapes;
|
||||
|
||||
_screen->setMouseCursor(0, 0, getShapePtr(0));
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int KyraEngine_HoF::go() {
|
||||
Common::Error KyraEngine_HoF::go() {
|
||||
if (_gameToLoad == -1) {
|
||||
if (_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98)
|
||||
seq_showStarcraftLogo();
|
||||
@ -326,7 +326,7 @@ int KyraEngine_HoF::go() {
|
||||
seq_playSequences(kSequenceFunters, kSequenceFrash);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void KyraEngine_HoF::startup() {
|
||||
|
@ -292,8 +292,8 @@ protected:
|
||||
void seq_init();
|
||||
void seq_uninit();
|
||||
|
||||
int init();
|
||||
int go();
|
||||
Common::Error init();
|
||||
Common::Error go();
|
||||
|
||||
Screen_HoF *_screen;
|
||||
TextDisplayer_HoF *_text;
|
||||
|
@ -155,7 +155,7 @@ KyraEngine_LoK::~KyraEngine_LoK() {
|
||||
delete[] _sceneAnimTable[i];
|
||||
}
|
||||
|
||||
int KyraEngine_LoK::init() {
|
||||
Common::Error KyraEngine_LoK::init() {
|
||||
_screen = new Screen_LoK(this, _system);
|
||||
assert(_screen);
|
||||
_screen->setResolution();
|
||||
@ -284,10 +284,10 @@ int KyraEngine_LoK::init() {
|
||||
|
||||
_lastMusicCommand = 0;
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int KyraEngine_LoK::go() {
|
||||
Common::Error KyraEngine_LoK::go() {
|
||||
if (_res->getFileSize("6.FNT"))
|
||||
_screen->loadFont(Screen::FID_6_FNT, "6.FNT");
|
||||
_screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
|
||||
@ -304,7 +304,7 @@ int KyraEngine_LoK::go() {
|
||||
setGameFlag(0xEF);
|
||||
seq_intro();
|
||||
if (shouldQuit())
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
if (_skipIntroFlag && _abortIntroFlag)
|
||||
resetGameFlag(0xEF);
|
||||
}
|
||||
@ -312,7 +312,7 @@ int KyraEngine_LoK::go() {
|
||||
resetGameFlag(0xEF);
|
||||
mainLoop();
|
||||
}
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -144,8 +144,8 @@ public:
|
||||
const uint8 * const*palTable2() { return &_specialPalettes[29]; }
|
||||
|
||||
protected:
|
||||
virtual int go();
|
||||
virtual int init();
|
||||
virtual Common::Error go();
|
||||
virtual Common::Error init();
|
||||
|
||||
public:
|
||||
// sequences
|
||||
|
@ -202,7 +202,7 @@ KyraEngine_MR::~KyraEngine_MR() {
|
||||
delete _album.rightPage.wsa;
|
||||
}
|
||||
|
||||
int KyraEngine_MR::init() {
|
||||
Common::Error KyraEngine_MR::init() {
|
||||
_screen = new Screen_MR(this, _system);
|
||||
assert(_screen);
|
||||
_screen->setResolution();
|
||||
@ -233,10 +233,10 @@ int KyraEngine_MR::init() {
|
||||
_res->loadFileToBuf("PALETTE.COL", _screen->getPalette(0), 768);
|
||||
_screen->setScreenPalette(_screen->getPalette(0));
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int KyraEngine_MR::go() {
|
||||
Common::Error KyraEngine_MR::go() {
|
||||
bool running = true;
|
||||
preinit();
|
||||
_screen->hideMouse();
|
||||
@ -324,7 +324,7 @@ int KyraEngine_MR::go() {
|
||||
if (_showOutro)
|
||||
playVQA("CREDITS");
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void KyraEngine_MR::initMainMenu() {
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
int language() const { return _lang; }
|
||||
bool heliumMode() const { return _configHelium; }
|
||||
|
||||
int go();
|
||||
Common::Error go();
|
||||
|
||||
void playVQA(const char *name);
|
||||
|
||||
@ -84,7 +84,7 @@ private:
|
||||
Screen_MR *_screen;
|
||||
SoundDigital *_soundDigital;
|
||||
|
||||
int init();
|
||||
Common::Error init();
|
||||
|
||||
void preinit();
|
||||
void startup();
|
||||
|
@ -92,7 +92,7 @@ void KyraEngine_v1::pauseEngineIntern(bool pause) {
|
||||
_timer->pause(pause);
|
||||
}
|
||||
|
||||
int KyraEngine_v1::init() {
|
||||
Common::Error KyraEngine_v1::init() {
|
||||
registerDefaultSettings();
|
||||
|
||||
// Setup mixer
|
||||
@ -186,7 +186,7 @@ int KyraEngine_v1::init() {
|
||||
// Prevent autosave on game startup
|
||||
_lastAutosave = _system->getMillis();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
KyraEngine_v1::~KyraEngine_v1() {
|
||||
|
@ -168,7 +168,7 @@ public:
|
||||
|
||||
protected:
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual Common::Error init();
|
||||
virtual ::GUI::Debugger *getDebugger();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void pauseEngineIntern(bool pause);
|
||||
@ -304,7 +304,7 @@ protected:
|
||||
|
||||
static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *file, bool loadThumbnail, SaveHeader &header);
|
||||
|
||||
int loadGameState(int slot);
|
||||
Common::Error loadGameState(int slot);
|
||||
virtual void loadGame(const char *fileName) = 0;
|
||||
virtual void saveGame(const char *fileName, const char *saveName, const Graphics::Surface *thumbnail) = 0;
|
||||
|
||||
|
@ -74,7 +74,7 @@ Screen *LoLEngine::screen() {
|
||||
return _screen;
|
||||
}
|
||||
|
||||
int LoLEngine::init() {
|
||||
Common::Error LoLEngine::init() {
|
||||
_screen = new Screen_LoL(this, _system);
|
||||
assert(_screen);
|
||||
_screen->setResolution();
|
||||
@ -90,10 +90,10 @@ int LoLEngine::init() {
|
||||
if (!_sound->init())
|
||||
error("Couldn't init sound");
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int LoLEngine::go() {
|
||||
Common::Error LoLEngine::go() {
|
||||
setupPrologueData(true);
|
||||
showIntro();
|
||||
_sound->playTrack(6);
|
||||
@ -102,7 +102,7 @@ int LoLEngine::go() {
|
||||
_screen->fadeToBlack();
|
||||
setupPrologueData(false);
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
#pragma mark - Input
|
||||
|
@ -47,8 +47,8 @@ private:
|
||||
Screen_LoL *_screen;
|
||||
TIMInterpreter *_tim;
|
||||
|
||||
int init();
|
||||
int go();
|
||||
Common::Error init();
|
||||
Common::Error go();
|
||||
|
||||
// input
|
||||
void updateInput();
|
||||
|
@ -244,14 +244,14 @@ bool KyraEngine_v1::saveFileLoadable(int slot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int KyraEngine_v1::loadGameState(int slot) {
|
||||
Common::Error KyraEngine_v1::loadGameState(int slot) {
|
||||
if (!_isSaveAllowed)
|
||||
return -1;
|
||||
return Common::kUnknownError; // FIXME
|
||||
|
||||
const char *filename = getSavegameFilename(slot);
|
||||
loadGame(filename);
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void KyraEngine_v1::checkAutosave() {
|
||||
|
@ -48,7 +48,7 @@ LureEngine::LureEngine(OSystem *system, const LureGameDescription *gameDesc): En
|
||||
Common::addSpecialDebugLevel(kLureDebugStrings, "strings", "Strings debugging");
|
||||
}
|
||||
|
||||
int LureEngine::init() {
|
||||
Common::Error LureEngine::init() {
|
||||
int_engine = this;
|
||||
_initialised = false;
|
||||
|
||||
@ -62,7 +62,7 @@ int LureEngine::init() {
|
||||
VersionStructure version;
|
||||
if (!f.open(SUPPORT_FILENAME)) {
|
||||
GUIError("Could not locate Lure support file");
|
||||
return 1;
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
f.seek(0xbf * 8);
|
||||
@ -71,12 +71,12 @@ int LureEngine::init() {
|
||||
|
||||
if (READ_LE_UINT16(&version.id) != 0xffff) {
|
||||
GUIError("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME);
|
||||
return 1;
|
||||
return Common::kUnknownError;
|
||||
} else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR)) {
|
||||
GUIError("Incorrect version of %s file - expected %d.%d but got %d.%d",
|
||||
SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR,
|
||||
version.vMajor, version.vMinor);
|
||||
return 1;
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
_disk = new Disk();
|
||||
@ -92,7 +92,7 @@ int LureEngine::init() {
|
||||
|
||||
_gameToLoad = -1;
|
||||
_initialised = true;
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
LureEngine::~LureEngine() {
|
||||
@ -119,7 +119,7 @@ LureEngine &LureEngine::getReference() {
|
||||
return *int_engine;
|
||||
}
|
||||
|
||||
int LureEngine::go() {
|
||||
Common::Error LureEngine::go() {
|
||||
Game *gameInstance = new Game();
|
||||
|
||||
// If requested, load a savegame instead of showing the intro
|
||||
@ -135,7 +135,7 @@ int LureEngine::go() {
|
||||
bool result = dialog->show();
|
||||
delete dialog;
|
||||
if (shouldQuit())
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
|
||||
if (!result)
|
||||
error("Sorry - copy protection failed");
|
||||
@ -158,7 +158,7 @@ int LureEngine::go() {
|
||||
}
|
||||
|
||||
delete gameInstance;
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void LureEngine::pauseEngineIntern(bool pause) {
|
||||
|
@ -70,8 +70,8 @@ public:
|
||||
static LureEngine &getReference();
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void syncSoundSettings();
|
||||
virtual void pauseEngineIntern(bool pause);
|
||||
|
@ -141,7 +141,7 @@ M4Engine::~M4Engine() {
|
||||
delete _resourceManager;
|
||||
}
|
||||
|
||||
int M4Engine::init() {
|
||||
Common::Error M4Engine::init() {
|
||||
// Initialize backend
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(isM4());
|
||||
@ -197,7 +197,7 @@ int M4Engine::init() {
|
||||
_random = new Common::RandomSource();
|
||||
g_system->getEventManager()->registerRandomSource(*_random, "m4");
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void M4Engine::eventHandler() {
|
||||
@ -272,14 +272,14 @@ void M4Engine::loadMenu(MenuType menuType, bool loadSaveFromHotkey, bool calledF
|
||||
_viewManager->moveToFront(view);
|
||||
}
|
||||
|
||||
int M4Engine::go() {
|
||||
Common::Error M4Engine::go() {
|
||||
if (isM4())
|
||||
return goM4();
|
||||
else
|
||||
return goMADS();
|
||||
}
|
||||
|
||||
int M4Engine::goMADS() {
|
||||
Common::Error M4Engine::goMADS() {
|
||||
_palette->setMadsSystemPalette();
|
||||
|
||||
_mouse->init("cursor.ss", NULL);
|
||||
@ -351,10 +351,10 @@ int M4Engine::goMADS() {
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int M4Engine::goM4() {
|
||||
Common::Error M4Engine::goM4() {
|
||||
|
||||
_script->open("m4.dat");
|
||||
|
||||
@ -375,7 +375,7 @@ int M4Engine::goM4() {
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
#endif
|
||||
|
||||
// Set up the inventory
|
||||
@ -520,7 +520,7 @@ int M4Engine::goM4() {
|
||||
g_system->delayMillis(10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void M4Engine::dumpFile(const char* filename, bool uncompress) {
|
||||
|
@ -107,12 +107,14 @@ FORCEINLINE long FixedDiv(long a, long b) { return (long)(((float)a / (float)b)
|
||||
|
||||
class M4Engine : public Engine {
|
||||
private:
|
||||
int goMADS();
|
||||
int goM4();
|
||||
Common::Error goMADS();
|
||||
Common::Error goM4();
|
||||
|
||||
protected:
|
||||
int init();
|
||||
int go();
|
||||
// Engine APIs
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
|
||||
void shutdown();
|
||||
|
||||
MidiPlayer *_midi;
|
||||
|
@ -138,14 +138,14 @@ MadeEngine::~MadeEngine() {
|
||||
delete _music;
|
||||
}
|
||||
|
||||
int MadeEngine::init() {
|
||||
Common::Error MadeEngine::init() {
|
||||
// Initialize backend
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
_system->initSize(320, 200);
|
||||
_system->endGFXTransaction();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int16 MadeEngine::getTicks() {
|
||||
@ -244,7 +244,7 @@ void MadeEngine::handleEvents() {
|
||||
|
||||
}
|
||||
|
||||
int MadeEngine::go() {
|
||||
Common::Error MadeEngine::go() {
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(_timers); i++)
|
||||
_timers[i] = -1;
|
||||
@ -297,7 +297,7 @@ int MadeEngine::go() {
|
||||
_script->runScript(_dat->getMainCodeObjectIndex());
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
} // End of namespace Made
|
||||
|
@ -78,8 +78,9 @@ class MadeEngine : public ::Engine {
|
||||
|
||||
protected:
|
||||
|
||||
int init();
|
||||
int go();
|
||||
// Engine APIs
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
|
||||
public:
|
||||
MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc);
|
||||
|
@ -109,7 +109,7 @@ Parallaction::~Parallaction() {
|
||||
}
|
||||
|
||||
|
||||
int Parallaction::init() {
|
||||
Common::Error Parallaction::init() {
|
||||
|
||||
_engineFlags = 0;
|
||||
_objectsNames = NULL;
|
||||
@ -145,7 +145,7 @@ int Parallaction::init() {
|
||||
|
||||
setupBalloonManager();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void Parallaction::updateView() {
|
||||
|
@ -228,7 +228,7 @@ public:
|
||||
~Parallaction();
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual Common::Error init();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
|
||||
// info
|
||||
@ -363,8 +363,8 @@ public:
|
||||
~Parallaction_ns();
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
|
||||
public:
|
||||
virtual void parseLocation(const char *filename);
|
||||
@ -451,8 +451,8 @@ public:
|
||||
Parallaction_br(OSystem* syst, const PARALLACTIONGameDescription *gameDesc) : Parallaction_ns(syst, gameDesc) { }
|
||||
~Parallaction_br();
|
||||
|
||||
int init();
|
||||
int go();
|
||||
Common::Error init();
|
||||
Common::Error go();
|
||||
|
||||
public:
|
||||
virtual void parseLocation(const char* name);
|
||||
|
@ -42,7 +42,7 @@ const char *Parallaction_br::_partNames[] = {
|
||||
"PART4"
|
||||
};
|
||||
|
||||
int Parallaction_br::init() {
|
||||
Common::Error Parallaction_br::init() {
|
||||
|
||||
_screenWidth = 640;
|
||||
_screenHeight = 400;
|
||||
@ -89,7 +89,7 @@ int Parallaction_br::init() {
|
||||
|
||||
Parallaction::init();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
Parallaction_br::~Parallaction_br() {
|
||||
@ -102,7 +102,7 @@ void Parallaction_br::callFunction(uint index, void* parm) {
|
||||
(this->*_callables[index])(parm);
|
||||
}
|
||||
|
||||
int Parallaction_br::go() {
|
||||
Common::Error Parallaction_br::go() {
|
||||
|
||||
bool splash = true;
|
||||
|
||||
@ -127,7 +127,7 @@ int Parallaction_br::go() {
|
||||
cleanupGame();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,7 +143,7 @@ void LocationName::bind(const char *s) {
|
||||
|
||||
|
||||
|
||||
int Parallaction_ns::init() {
|
||||
Common::Error Parallaction_ns::init() {
|
||||
|
||||
_screenWidth = 320;
|
||||
_screenHeight = 200;
|
||||
@ -193,7 +193,7 @@ int Parallaction_ns::init() {
|
||||
|
||||
Parallaction::init();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
Parallaction_ns::~Parallaction_ns() {
|
||||
@ -228,7 +228,7 @@ void Parallaction_ns::callFunction(uint index, void* parm) {
|
||||
}
|
||||
|
||||
|
||||
int Parallaction_ns::go() {
|
||||
Common::Error Parallaction_ns::go() {
|
||||
_saveLoad->renameOldSavefiles();
|
||||
|
||||
_globalFlagsNames = _disk->loadTable("global");
|
||||
@ -239,7 +239,7 @@ int Parallaction_ns::go() {
|
||||
runGame();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void Parallaction_ns::switchBackground(const char* background, const char* mask) {
|
||||
|
@ -312,9 +312,10 @@ bool QueenEngine::canLoadOrSave() const {
|
||||
return !_input->cutawayRunning() && !(_resource->isDemo() || _resource->isInterview());
|
||||
}
|
||||
|
||||
int QueenEngine::saveGameState(int slot, const char *desc) {
|
||||
Common::Error QueenEngine::saveGameState(int slot, const char *desc) {
|
||||
debug(3, "Saving game to slot %d", slot);
|
||||
char name[20];
|
||||
Common::Error err = Common::kNoError;
|
||||
makeGameStateName(slot, name);
|
||||
Common::OutSaveFile *file = _saveFileMan->openForSaving(name);
|
||||
if (file) {
|
||||
@ -345,18 +346,21 @@ int QueenEngine::saveGameState(int slot, const char *desc) {
|
||||
// check for errors
|
||||
if (file->ioFailed()) {
|
||||
warning("Can't write file '%s'. (Disk full?)", name);
|
||||
err = Common::kWritingFailed;
|
||||
}
|
||||
delete[] saveData;
|
||||
delete file;
|
||||
} else {
|
||||
warning("Can't create file '%s', game not saved", name);
|
||||
err = Common::kCreatingFileFailed;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
int QueenEngine::loadGameState(int slot) {
|
||||
Common::Error QueenEngine::loadGameState(int slot) {
|
||||
debug(3, "Loading game from slot %d", slot);
|
||||
Common::Error err = Common::kNoError;
|
||||
GameStateHeader header;
|
||||
Common::InSaveFile *file = readGameStateHeader(slot, &header);
|
||||
if (file && header.dataSize != 0) {
|
||||
@ -364,6 +368,7 @@ int QueenEngine::loadGameState(int slot) {
|
||||
byte *p = saveData;
|
||||
if (file->read(saveData, header.dataSize) != header.dataSize) {
|
||||
warning("Error reading savegame file");
|
||||
err = Common::kReadingFailed;
|
||||
} else {
|
||||
_bam->loadState(header.version, p);
|
||||
_grid->loadState(header.version, p);
|
||||
@ -371,15 +376,18 @@ int QueenEngine::loadGameState(int slot) {
|
||||
_sound->loadState(header.version, p);
|
||||
if (header.dataSize != (uint32)(p - saveData)) {
|
||||
warning("Corrupted savegame file");
|
||||
err = Common::kReadingFailed; // FIXME
|
||||
} else {
|
||||
_logic->setupRestoredGame();
|
||||
}
|
||||
}
|
||||
delete[] saveData;
|
||||
delete file;
|
||||
} else {
|
||||
err = Common::kReadingFailed;
|
||||
}
|
||||
|
||||
return 0; // TODO: return success/failure
|
||||
return err;
|
||||
}
|
||||
|
||||
Common::InSaveFile *QueenEngine::readGameStateHeader(int slot, GameStateHeader *gsh) {
|
||||
@ -436,7 +444,7 @@ GUI::Debugger *QueenEngine::getDebugger() {
|
||||
return _debugger;
|
||||
}
|
||||
|
||||
int QueenEngine::go() {
|
||||
Common::Error QueenEngine::go() {
|
||||
_logic->start();
|
||||
if (ConfMan.hasKey("save_slot") && canLoadOrSave()) {
|
||||
loadGameState(ConfMan.getInt("save_slot"));
|
||||
@ -461,10 +469,10 @@ int QueenEngine::go() {
|
||||
update(true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int QueenEngine::init() {
|
||||
Common::Error QueenEngine::init() {
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
_system->initSize(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
|
||||
@ -496,7 +504,7 @@ int QueenEngine::init() {
|
||||
registerDefaultSettings();
|
||||
readOptionSettings();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
} // End of namespace Queen
|
||||
|
@ -106,8 +106,8 @@ public:
|
||||
void update(bool checkPlayerInput = false);
|
||||
|
||||
bool canLoadOrSave() const;
|
||||
int saveGameState(int slot, const char *desc);
|
||||
int loadGameState(int slot);
|
||||
Common::Error saveGameState(int slot, const char *desc);
|
||||
Common::Error loadGameState(int slot);
|
||||
void makeGameStateName(int slot, char *buf) const;
|
||||
int getGameStateSlot(const char *filename) const;
|
||||
void findGameStateDescriptions(char descriptions[100][32]);
|
||||
@ -129,8 +129,8 @@ public:
|
||||
protected:
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual GUI::Debugger *getDebugger();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void syncSoundSettings();
|
||||
|
@ -245,7 +245,7 @@ int SagaEngine::getDisplayHeight() const {
|
||||
return di.logicalHeight;
|
||||
}
|
||||
|
||||
int SagaEngine::loadGameState(int slot) {
|
||||
Common::Error SagaEngine::loadGameState(int slot) {
|
||||
// Init the current chapter to 8 (character selection) for IHNM
|
||||
if (getGameType() == GType_IHNM)
|
||||
_scene->changeScene(-2, 0, kTransitionFade, 8);
|
||||
@ -262,7 +262,7 @@ int SagaEngine::loadGameState(int slot) {
|
||||
load(calcSaveFileName((uint)slot));
|
||||
syncSoundSettings();
|
||||
|
||||
return 0; // TODO: return success/failure
|
||||
return Common::kNoError; // TODO: return success/failure
|
||||
}
|
||||
|
||||
} // End of namespace Saga
|
||||
|
@ -140,7 +140,7 @@ SagaEngine::~SagaEngine() {
|
||||
delete _resource;
|
||||
}
|
||||
|
||||
int SagaEngine::init() {
|
||||
Common::Error SagaEngine::init() {
|
||||
_musicVolume = ConfMan.getInt("music_volume");
|
||||
_subtitlesEnabled = ConfMan.getBool("subtitles");
|
||||
_readingSpeed = getTalkspeed();
|
||||
@ -156,7 +156,7 @@ int SagaEngine::init() {
|
||||
// Detect game and open resource files
|
||||
if (!initGame()) {
|
||||
GUIErrorMessage("Error loading game resources.");
|
||||
return FAILURE;
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
// Initialize engine modules
|
||||
@ -197,7 +197,7 @@ int SagaEngine::init() {
|
||||
_music->setAdlib(adlib);
|
||||
_render = new Render(this, _system);
|
||||
if (!_render->initialized()) {
|
||||
return FAILURE;
|
||||
return Common::kUnknownError;
|
||||
}
|
||||
|
||||
// Initialize system specific sound
|
||||
@ -232,10 +232,10 @@ int SagaEngine::init() {
|
||||
if (getGameType() == GType_ITE)
|
||||
_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
|
||||
|
||||
return SUCCESS;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int SagaEngine::go() {
|
||||
Common::Error SagaEngine::go() {
|
||||
int msec = 0;
|
||||
|
||||
_previousTicks = _system->getMillis();
|
||||
@ -310,7 +310,7 @@ int SagaEngine::go() {
|
||||
_system->delayMillis(10);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPointer, size_t stringsLength) {
|
||||
|
@ -488,8 +488,8 @@ class SagaEngine : public Engine {
|
||||
|
||||
public:
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
@ -652,7 +652,7 @@ public:
|
||||
const Common::Rect &getDisplayClip() const { return _displayClip;}
|
||||
int getDisplayWidth() const;
|
||||
int getDisplayHeight() const;
|
||||
int loadGameState(int slot);
|
||||
Common::Error loadGameState(int slot);
|
||||
bool canLoadGameStateCurrently();
|
||||
bool canSaveGameStateCurrently();
|
||||
const GameDisplayInfo &getDisplayInfo();
|
||||
|
@ -794,18 +794,18 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
|
||||
// Fetch the list of files in the current directory
|
||||
Common::FSList fslist;
|
||||
Common::FSNode dir(ConfMan.get("path"));
|
||||
if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly)) {
|
||||
if (!dir.isDirectory())
|
||||
return Common::kInvalidPathError;
|
||||
}
|
||||
if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly))
|
||||
return Common::kNoGameDataFoundError;
|
||||
|
||||
// Invoke the detector, but fixed to the specified gameid.
|
||||
Common::List<DetectorResult> results;
|
||||
::detectGames(fslist, results, gameid);
|
||||
|
||||
// Unable to locate game data
|
||||
if (results.empty()) {
|
||||
if (results.empty())
|
||||
return Common::kNoGameDataFoundError;
|
||||
}
|
||||
|
||||
// No unique match found. If a platform override is present, try to
|
||||
// narrow down the list a bit more.
|
||||
@ -831,9 +831,8 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
|
||||
}
|
||||
|
||||
// Still no unique match found -> print a warning
|
||||
if (results.size() > 1) {
|
||||
if (results.size() > 1)
|
||||
warning("Engine_SCUMM_create: No unique game candidate found, using first one");
|
||||
}
|
||||
|
||||
// Simply use the first match
|
||||
DetectorResult res(*(results.begin()));
|
||||
|
@ -669,8 +669,8 @@ public:
|
||||
ScummEngine_vCUPhe(OSystem *syst, const DetectorResult &dr);
|
||||
~ScummEngine_vCUPhe();
|
||||
|
||||
int init();
|
||||
int go();
|
||||
Common::Error init();
|
||||
Common::Error go();
|
||||
|
||||
void parseEvents();
|
||||
|
||||
|
@ -75,9 +75,9 @@ struct SaveInfoSection {
|
||||
|
||||
#pragma mark -
|
||||
|
||||
int ScummEngine::loadGameState(int slot) {
|
||||
Common::Error ScummEngine::loadGameState(int slot) {
|
||||
requestLoad(slot);
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool ScummEngine::canLoadGameStateCurrently() {
|
||||
@ -85,9 +85,9 @@ bool ScummEngine::canLoadGameStateCurrently() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int ScummEngine::saveGameState(int slot, const char *desc) {
|
||||
Common::Error ScummEngine::saveGameState(int slot, const char *desc) {
|
||||
requestSave(slot, desc);
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool ScummEngine::canSaveGameStateCurrently() {
|
||||
|
@ -821,21 +821,21 @@ ScummEngine_vCUPhe::~ScummEngine_vCUPhe() {
|
||||
delete _cupPlayer;
|
||||
}
|
||||
|
||||
int ScummEngine_vCUPhe::init() {
|
||||
Common::Error ScummEngine_vCUPhe::init() {
|
||||
_system->beginGFXTransaction();
|
||||
_system->initSize(CUP_Player::kDefaultVideoWidth, CUP_Player::kDefaultVideoHeight);
|
||||
initCommonGFX(true);
|
||||
_system->endGFXTransaction();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int ScummEngine_vCUPhe::go() {
|
||||
Common::Error ScummEngine_vCUPhe::go() {
|
||||
if (_cupPlayer->open(_filenamePattern.pattern)) {
|
||||
_cupPlayer->play();
|
||||
_cupPlayer->close();
|
||||
}
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void ScummEngine_vCUPhe::parseEvents() {
|
||||
@ -907,7 +907,7 @@ ScummEngine_v8::~ScummEngine_v8() {
|
||||
#pragma mark --- Initialization ---
|
||||
#pragma mark -
|
||||
|
||||
int ScummEngine::init() {
|
||||
Common::Error ScummEngine::init() {
|
||||
|
||||
// Add default file directories.
|
||||
if (((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST)) && (_game.version <= 4)) {
|
||||
@ -1106,7 +1106,7 @@ int ScummEngine::init() {
|
||||
|
||||
syncSoundSettings();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void ScummEngine::setupScumm() {
|
||||
@ -1712,7 +1712,7 @@ int ScummEngine::getTalkDelay() {
|
||||
#pragma mark --- Main loop ---
|
||||
#pragma mark -
|
||||
|
||||
int ScummEngine::go() {
|
||||
Common::Error ScummEngine::go() {
|
||||
_engineStartTime = _system->getMillis() / 1000;
|
||||
|
||||
// If requested, load a save game instead of running the boot script
|
||||
@ -1763,7 +1763,7 @@ int ScummEngine::go() {
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void ScummEngine::waitForTimer(int msec_delay) {
|
||||
|
@ -443,16 +443,16 @@ public:
|
||||
virtual ~ScummEngine();
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual void errorString(const char *buf_input, char *buf_output);
|
||||
virtual GUI::Debugger *getDebugger();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
virtual int loadGameState(int slot);
|
||||
virtual Common::Error loadGameState(int slot);
|
||||
virtual bool canLoadGameStateCurrently();
|
||||
virtual int saveGameState(int slot, const char *desc);
|
||||
virtual Common::Error saveGameState(int slot, const char *desc);
|
||||
virtual bool canSaveGameStateCurrently();
|
||||
|
||||
virtual void pauseEngineIntern(bool pause);
|
||||
|
@ -349,7 +349,7 @@ void SkyEngine::handleKey(void) {
|
||||
_keyPressed.reset();
|
||||
}
|
||||
|
||||
int SkyEngine::go() {
|
||||
Common::Error SkyEngine::go() {
|
||||
|
||||
_keyPressed.reset();
|
||||
|
||||
@ -428,10 +428,10 @@ int SkyEngine::go() {
|
||||
_skyMusic->stopMusic();
|
||||
ConfMan.flushToDisk();
|
||||
delay(1500);
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int SkyEngine::init() {
|
||||
Common::Error SkyEngine::init() {
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
_system->initSize(320, 200);
|
||||
@ -549,7 +549,7 @@ int SkyEngine::init() {
|
||||
_skyMusic->setVolume(ConfMan.getInt("music_volume") >> 1);
|
||||
|
||||
_debugger = new Debugger(_skyLogic, _skyMouse, _skyScreen, _skyCompact);
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void SkyEngine::initItemList() {
|
||||
|
@ -89,8 +89,8 @@ public:
|
||||
|
||||
protected:
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual GUI::Debugger *getDebugger();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
|
||||
|
@ -309,7 +309,7 @@ SwordEngine::~SwordEngine() {
|
||||
delete _resMan;
|
||||
}
|
||||
|
||||
int SwordEngine::init() {
|
||||
Common::Error SwordEngine::init() {
|
||||
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(true);
|
||||
@ -377,7 +377,7 @@ int SwordEngine::init() {
|
||||
_mouse->initialize();
|
||||
_control = new Control(_saveFileMan, _resMan, _objectMan, _system, _mouse, _sound, _music);
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void SwordEngine::reinitialize(void) {
|
||||
@ -719,7 +719,7 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or
|
||||
#endif
|
||||
}
|
||||
|
||||
int SwordEngine::go() {
|
||||
Common::Error SwordEngine::go() {
|
||||
uint16 startPos = ConfMan.getInt("boot_param");
|
||||
if (startPos) {
|
||||
_logic->startPositions(startPos);
|
||||
@ -757,7 +757,7 @@ int SwordEngine::go() {
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void SwordEngine::checkCd(void) {
|
||||
|
@ -81,8 +81,8 @@ public:
|
||||
uint32 _features;
|
||||
protected:
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
|
@ -218,7 +218,7 @@ Common::Error Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) c
|
||||
Common::FSList fslist;
|
||||
Common::FSNode dir(ConfMan.get("path"));
|
||||
if (!dir.getChildren(fslist, Common::FSNode::kListAll)) {
|
||||
return Common::kInvalidPathError;
|
||||
return Common::kNoGameDataFoundError;
|
||||
}
|
||||
|
||||
// Invoke the detector
|
||||
@ -349,7 +349,7 @@ void Sword2Engine::setupPersistentResources() {
|
||||
_resman->openResource(CUR_PLAYER_ID);
|
||||
}
|
||||
|
||||
int Sword2Engine::init() {
|
||||
Common::Error Sword2Engine::init() {
|
||||
// Get some falling RAM and put it in your pocket, never let it slip
|
||||
// away
|
||||
|
||||
@ -378,7 +378,7 @@ int Sword2Engine::init() {
|
||||
_resman = new ResourceManager(this);
|
||||
|
||||
if (!_resman->init())
|
||||
return 1;
|
||||
return Common::kUnknownError;
|
||||
|
||||
_logic = new Logic(this);
|
||||
_fontRenderer = new FontRenderer(this);
|
||||
@ -426,7 +426,7 @@ int Sword2Engine::init() {
|
||||
// will either have killed the music, or done a crossfade.
|
||||
|
||||
if (shouldQuit())
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
|
||||
if (result)
|
||||
startGame();
|
||||
@ -435,10 +435,10 @@ int Sword2Engine::init() {
|
||||
|
||||
_screen->initialiseRenderCycle();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int Sword2Engine::go() {
|
||||
Common::Error Sword2Engine::go() {
|
||||
while (1) {
|
||||
if (_debugger->isAttached())
|
||||
_debugger->onFrame();
|
||||
@ -514,7 +514,7 @@ int Sword2Engine::go() {
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void Sword2Engine::restartGame() {
|
||||
|
@ -127,8 +127,8 @@ public:
|
||||
~Sword2Engine();
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual GUI::Debugger *getDebugger();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void pauseEngineIntern(bool pause);
|
||||
|
@ -658,7 +658,7 @@ TinselEngine::~TinselEngine() {
|
||||
delete _scheduler;
|
||||
}
|
||||
|
||||
int TinselEngine::init() {
|
||||
Common::Error TinselEngine::init() {
|
||||
// Initialize backend
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(false);
|
||||
@ -707,7 +707,7 @@ int TinselEngine::init() {
|
||||
// Actors, globals and inventory icons
|
||||
LoadBasicChunks();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
Common::String TinselEngine::getSavegameFilename(int16 saveNum) const {
|
||||
@ -718,7 +718,7 @@ Common::String TinselEngine::getSavegameFilename(int16 saveNum) const {
|
||||
|
||||
#define GAME_FRAME_DELAY (1000 / ONE_SECOND)
|
||||
|
||||
int TinselEngine::go() {
|
||||
Common::Error TinselEngine::go() {
|
||||
uint32 timerVal = 0;
|
||||
|
||||
// Continuous game processes
|
||||
@ -774,7 +774,7 @@ int TinselEngine::go() {
|
||||
// Write configuration
|
||||
WriteConfig();
|
||||
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,8 +91,9 @@ class TinselEngine : public Engine {
|
||||
|
||||
protected:
|
||||
|
||||
int init();
|
||||
int go();
|
||||
// Engine APIs
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
|
||||
public:
|
||||
TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc);
|
||||
|
@ -331,14 +331,14 @@ void ToucheEngine::handleMenuAction(void *menu, int actionId) {
|
||||
break;
|
||||
case kActionPerformSaveLoad:
|
||||
if (menuData->mode == kMenuLoadStateMode) {
|
||||
if (loadGameState(_saveLoadCurrentSlot) == 0) {
|
||||
if (loadGameState(_saveLoadCurrentSlot) == Common::kNoError) {
|
||||
menuData->quit = true;
|
||||
}
|
||||
} else if (menuData->mode == kMenuSaveStateMode) {
|
||||
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
|
||||
const char *description = menuData->saveLoadDescriptionsTable[_saveLoadCurrentSlot];
|
||||
if (strlen(description) > 0) {
|
||||
if (saveGameState(_saveLoadCurrentSlot, description)) {
|
||||
if (saveGameState(_saveLoadCurrentSlot, description) == Common::kNoError) {
|
||||
menuData->quit = true;
|
||||
}
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
|
||||
debug(0, "Loaded state, current episode %d", _currentEpisodeNum);
|
||||
}
|
||||
|
||||
int ToucheEngine::saveGameState(int num, const char *description) {
|
||||
Common::Error ToucheEngine::saveGameState(int num, const char *description) {
|
||||
bool saveOk = false;
|
||||
char gameStateFileName[64];
|
||||
generateGameStateFileName(num, gameStateFileName, 63);
|
||||
@ -337,10 +337,10 @@ int ToucheEngine::saveGameState(int num, const char *description) {
|
||||
}
|
||||
delete f;
|
||||
}
|
||||
return saveOk;
|
||||
return saveOk ? Common::kNoError : Common::kUnknownError;
|
||||
}
|
||||
|
||||
int ToucheEngine::loadGameState(int num) {
|
||||
Common::Error ToucheEngine::loadGameState(int num) {
|
||||
bool loadOk = false;
|
||||
char gameStateFileName[64];
|
||||
generateGameStateFileName(num, gameStateFileName, 63);
|
||||
@ -360,7 +360,7 @@ int ToucheEngine::loadGameState(int num) {
|
||||
}
|
||||
delete f;
|
||||
}
|
||||
return loadOk ? 0 : 1;
|
||||
return loadOk ? Common::kNoError : Common::kUnknownError;
|
||||
}
|
||||
|
||||
void ToucheEngine::readGameStateDescription(int num, char *description, int len) {
|
||||
|
@ -81,7 +81,7 @@ ToucheEngine::~ToucheEngine() {
|
||||
delete _midiPlayer;
|
||||
}
|
||||
|
||||
int ToucheEngine::init() {
|
||||
Common::Error ToucheEngine::init() {
|
||||
_system->beginGFXTransaction();
|
||||
initCommonGFX(true);
|
||||
_system->initSize(kScreenWidth, kScreenHeight);
|
||||
@ -96,10 +96,10 @@ int ToucheEngine::init() {
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
|
||||
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
int ToucheEngine::go() {
|
||||
Common::Error ToucheEngine::go() {
|
||||
res_openDataFile();
|
||||
res_allocateTables();
|
||||
res_loadSpriteImage(18, _menuKitData);
|
||||
@ -111,7 +111,7 @@ int ToucheEngine::go() {
|
||||
|
||||
res_deallocateTables();
|
||||
res_closeDataFile();
|
||||
return 0;
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
void ToucheEngine::restart() {
|
||||
|
@ -362,8 +362,8 @@ public:
|
||||
virtual ~ToucheEngine();
|
||||
|
||||
// Engine APIs
|
||||
virtual int init();
|
||||
virtual int go();
|
||||
virtual Common::Error init();
|
||||
virtual Common::Error go();
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
virtual void syncSoundSettings();
|
||||
|
||||
@ -497,8 +497,8 @@ protected:
|
||||
|
||||
void saveGameStateData(Common::WriteStream *stream);
|
||||
void loadGameStateData(Common::ReadStream *stream);
|
||||
int saveGameState(int num, const char *description);
|
||||
int loadGameState(int num);
|
||||
Common::Error saveGameState(int num, const char *description);
|
||||
Common::Error loadGameState(int num);
|
||||
void readGameStateDescription(int num, char *description, int len);
|
||||
void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const;
|
||||
int getGameStateFileSlot(const char *filename) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user