aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWalter van Niftrik2016-03-06 21:59:55 +0100
committerWalter van Niftrik2016-03-09 10:03:13 +0100
commit07d0997befe416c56e38b831031b81a30e63925a (patch)
tree2dfd398f068e616f562902e53e6887f2ad5ee65f /engines
parent58e7c539096f6b37c40dd0afa13c7ed500037be8 (diff)
downloadscummvm-rg350-07d0997befe416c56e38b831031b81a30e63925a.tar.gz
scummvm-rg350-07d0997befe416c56e38b831031b81a30e63925a.tar.bz2
scummvm-rg350-07d0997befe416c56e38b831031b81a30e63925a.zip
ADL: Clean up AdlMetaEngine
Diffstat (limited to 'engines')
-rw-r--r--engines/adl/adl.cpp10
-rw-r--r--engines/adl/adl.h11
-rw-r--r--engines/adl/detection.cpp35
-rw-r--r--engines/adl/detection.h45
-rw-r--r--engines/adl/hires1.cpp6
-rw-r--r--engines/adl/hires1.h2
6 files changed, 69 insertions, 40 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 442edb7b71..8884015d93 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -37,6 +37,7 @@
#include "adl/adl.h"
#include "adl/display.h"
+#include "adl/detection.h"
namespace Adl {
@@ -1071,13 +1072,4 @@ void AdlEngine::drawLineArt(const Common::Array<byte> &lineArt, const Common::Po
}
}
-AdlEngine *AdlEngine::create(GameType type, OSystem *syst, const AdlGameDescription *gd) {
- switch(type) {
- case kGameTypeHires1:
- return HiRes1Engine__create(syst, gd);
- default:
- error("Unknown GameType");
- }
-}
-
} // End of namespace Adl
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 6d5ab429ef..6f9b24d83f 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -34,20 +34,11 @@ class SeekableReadStream;
}
namespace Adl {
-
-#define SAVEGAME_VERSION 0
-#define SAVEGAME_NAME_LEN 32
-
class Display;
class Parser;
class Console;
struct AdlGameDescription;
-enum GameType {
- kGameTypeNone = 0,
- kGameTypeHires1
-};
-
struct StringOffset {
int stringIdx;
uint offset;
@@ -167,8 +158,6 @@ class AdlEngine : public Engine {
public:
virtual ~AdlEngine();
- static AdlEngine *create(GameType type, OSystem *syst, const AdlGameDescription *gd);
-
protected:
AdlEngine(OSystem *syst, const AdlGameDescription *gd);
diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp
index e556e1258a..d96d94c66f 100644
--- a/engines/adl/detection.cpp
+++ b/engines/adl/detection.cpp
@@ -28,7 +28,7 @@
#include "engines/advancedDetector.h"
-#include "adl/adl.h"
+#include "adl/detection.h"
namespace Adl {
@@ -59,18 +59,12 @@ static const ADExtraGuiOptionsMap optionsList[] = {
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
-struct AdlGameDescription {
- ADGameDescription desc;
- GameType gameType;
-};
-
static const PlainGameDescriptor adlGames[] = {
{"hires1", "Hi-Res Adventure #1: Mystery House"},
{0, 0}
};
static const AdlGameDescription gameDescriptions[] = {
-
{ // MD5 by waltervn
{
"hires1", 0,
@@ -85,9 +79,9 @@ static const AdlGameDescription gameDescriptions[] = {
ADGF_NO_FLAGS,
GUIO2(GAMEOPTION_COLOR, GAMEOPTION_SCANLINES)
},
- kGameTypeHires1
+ GAME_TYPE_HIRES1
},
- {AD_TABLE_END_MARKER, kGameTypeNone}
+ { AD_TABLE_END_MARKER, GAME_TYPE_NONE }
};
class AdlMetaEngine : public AdvancedMetaEngine {
@@ -189,7 +183,7 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const {
const Common::String &fileName = files[i];
Common::InSaveFile *inFile = saveFileMan->openForLoading(fileName);
if (!inFile) {
- warning("Cannot open save file %s", fileName.c_str());
+ warning("Cannot open save file '%s'", fileName.c_str());
continue;
}
@@ -201,7 +195,7 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const {
byte saveVersion = inFile->readByte();
if (saveVersion != SAVEGAME_VERSION) {
- warning("Save game version %i not supported in '%s'", saveVersion, fileName.c_str());
+ warning("Unsupported save game version %i found in '%s'", saveVersion, fileName.c_str());
delete inFile;
continue;
}
@@ -225,10 +219,23 @@ void AdlMetaEngine::removeSaveState(const char *target, int slot) const {
g_system->getSavefileManager()->removeSavefile(fileName);
}
+Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd);
+
bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
- if (gd)
- *engine = AdlEngine::create(((const AdlGameDescription *)gd)->gameType, syst, (const AdlGameDescription *)gd);
- return gd != nullptr;
+ if (!gd)
+ return false;
+
+ const AdlGameDescription *adlGd = (const AdlGameDescription *)gd;
+
+ switch (adlGd->gameType) {
+ case GAME_TYPE_HIRES1:
+ *engine = HiRes1Engine_create(syst, adlGd);
+ break;
+ default:
+ error("Unknown GameType");
+ }
+
+ return true;
}
} // End of namespace Adl
diff --git a/engines/adl/detection.h b/engines/adl/detection.h
new file mode 100644
index 0000000000..c646aeb5b9
--- /dev/null
+++ b/engines/adl/detection.h
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ADL_DETECTION_H
+#define ADL_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace Adl {
+
+#define SAVEGAME_VERSION 0
+#define SAVEGAME_NAME_LEN 32
+
+enum GameType {
+ GAME_TYPE_NONE,
+ GAME_TYPE_HIRES1
+};
+
+struct AdlGameDescription {
+ ADGameDescription desc;
+ GameType gameType;
+};
+
+} // End of namespace Adl
+
+#endif
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index 314434d850..ad023087d1 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -98,10 +98,6 @@ static const StringOffset stringOffsets[] = {
#define IDI_HR1_OFS_VERBS 0x3800
#define IDI_HR1_OFS_NOUNS 0x0f00
-HiRes1Engine::HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) :
- AdlEngine(syst, gd) {
-}
-
void HiRes1Engine::runIntro() {
Common::File file;
@@ -462,7 +458,7 @@ void HiRes1Engine::drawLine(const Common::Point &p1, const Common::Point &p2, by
}
}
-AdlEngine *HiRes1Engine__create(OSystem *syst, const AdlGameDescription *gd) {
+Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd) {
return new HiRes1Engine(syst, gd);
}
diff --git a/engines/adl/hires1.h b/engines/adl/hires1.h
index 7446e10394..540e613eb9 100644
--- a/engines/adl/hires1.h
+++ b/engines/adl/hires1.h
@@ -34,7 +34,7 @@ namespace Adl {
class HiRes1Engine : public AdlEngine {
public:
- HiRes1Engine(OSystem *syst, const AdlGameDescription *gd);
+ HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine(syst, gd) { }
private:
void restartGame();