ADL: Clean up AdlMetaEngine
This commit is contained in:
parent
58e7c53909
commit
07d0997bef
6 changed files with 69 additions and 40 deletions
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include "adl/adl.h"
|
#include "adl/adl.h"
|
||||||
#include "adl/display.h"
|
#include "adl/display.h"
|
||||||
|
#include "adl/detection.h"
|
||||||
|
|
||||||
namespace Adl {
|
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
|
} // End of namespace Adl
|
||||||
|
|
|
@ -34,20 +34,11 @@ class SeekableReadStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Adl {
|
namespace Adl {
|
||||||
|
|
||||||
#define SAVEGAME_VERSION 0
|
|
||||||
#define SAVEGAME_NAME_LEN 32
|
|
||||||
|
|
||||||
class Display;
|
class Display;
|
||||||
class Parser;
|
class Parser;
|
||||||
class Console;
|
class Console;
|
||||||
struct AdlGameDescription;
|
struct AdlGameDescription;
|
||||||
|
|
||||||
enum GameType {
|
|
||||||
kGameTypeNone = 0,
|
|
||||||
kGameTypeHires1
|
|
||||||
};
|
|
||||||
|
|
||||||
struct StringOffset {
|
struct StringOffset {
|
||||||
int stringIdx;
|
int stringIdx;
|
||||||
uint offset;
|
uint offset;
|
||||||
|
@ -167,8 +158,6 @@ class AdlEngine : public Engine {
|
||||||
public:
|
public:
|
||||||
virtual ~AdlEngine();
|
virtual ~AdlEngine();
|
||||||
|
|
||||||
static AdlEngine *create(GameType type, OSystem *syst, const AdlGameDescription *gd);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AdlEngine(OSystem *syst, const AdlGameDescription *gd);
|
AdlEngine(OSystem *syst, const AdlGameDescription *gd);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "engines/advancedDetector.h"
|
#include "engines/advancedDetector.h"
|
||||||
|
|
||||||
#include "adl/adl.h"
|
#include "adl/detection.h"
|
||||||
|
|
||||||
namespace Adl {
|
namespace Adl {
|
||||||
|
|
||||||
|
@ -59,18 +59,12 @@ static const ADExtraGuiOptionsMap optionsList[] = {
|
||||||
AD_EXTRA_GUI_OPTIONS_TERMINATOR
|
AD_EXTRA_GUI_OPTIONS_TERMINATOR
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AdlGameDescription {
|
|
||||||
ADGameDescription desc;
|
|
||||||
GameType gameType;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const PlainGameDescriptor adlGames[] = {
|
static const PlainGameDescriptor adlGames[] = {
|
||||||
{"hires1", "Hi-Res Adventure #1: Mystery House"},
|
{"hires1", "Hi-Res Adventure #1: Mystery House"},
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const AdlGameDescription gameDescriptions[] = {
|
static const AdlGameDescription gameDescriptions[] = {
|
||||||
|
|
||||||
{ // MD5 by waltervn
|
{ // MD5 by waltervn
|
||||||
{
|
{
|
||||||
"hires1", 0,
|
"hires1", 0,
|
||||||
|
@ -85,9 +79,9 @@ static const AdlGameDescription gameDescriptions[] = {
|
||||||
ADGF_NO_FLAGS,
|
ADGF_NO_FLAGS,
|
||||||
GUIO2(GAMEOPTION_COLOR, GAMEOPTION_SCANLINES)
|
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 {
|
class AdlMetaEngine : public AdvancedMetaEngine {
|
||||||
|
@ -189,7 +183,7 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const {
|
||||||
const Common::String &fileName = files[i];
|
const Common::String &fileName = files[i];
|
||||||
Common::InSaveFile *inFile = saveFileMan->openForLoading(fileName);
|
Common::InSaveFile *inFile = saveFileMan->openForLoading(fileName);
|
||||||
if (!inFile) {
|
if (!inFile) {
|
||||||
warning("Cannot open save file %s", fileName.c_str());
|
warning("Cannot open save file '%s'", fileName.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +195,7 @@ SaveStateList AdlMetaEngine::listSaves(const char *target) const {
|
||||||
|
|
||||||
byte saveVersion = inFile->readByte();
|
byte saveVersion = inFile->readByte();
|
||||||
if (saveVersion != SAVEGAME_VERSION) {
|
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;
|
delete inFile;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -225,10 +219,23 @@ void AdlMetaEngine::removeSaveState(const char *target, int slot) const {
|
||||||
g_system->getSavefileManager()->removeSavefile(fileName);
|
g_system->getSavefileManager()->removeSavefile(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd);
|
||||||
|
|
||||||
bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
|
bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
|
||||||
if (gd)
|
if (!gd)
|
||||||
*engine = AdlEngine::create(((const AdlGameDescription *)gd)->gameType, syst, (const AdlGameDescription *)gd);
|
return false;
|
||||||
return gd != nullptr;
|
|
||||||
|
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
|
} // End of namespace Adl
|
||||||
|
|
45
engines/adl/detection.h
Normal file
45
engines/adl/detection.h
Normal file
|
@ -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
|
|
@ -98,10 +98,6 @@ static const StringOffset stringOffsets[] = {
|
||||||
#define IDI_HR1_OFS_VERBS 0x3800
|
#define IDI_HR1_OFS_VERBS 0x3800
|
||||||
#define IDI_HR1_OFS_NOUNS 0x0f00
|
#define IDI_HR1_OFS_NOUNS 0x0f00
|
||||||
|
|
||||||
HiRes1Engine::HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) :
|
|
||||||
AdlEngine(syst, gd) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void HiRes1Engine::runIntro() {
|
void HiRes1Engine::runIntro() {
|
||||||
Common::File file;
|
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);
|
return new HiRes1Engine(syst, gd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Adl {
|
||||||
|
|
||||||
class HiRes1Engine : public AdlEngine {
|
class HiRes1Engine : public AdlEngine {
|
||||||
public:
|
public:
|
||||||
HiRes1Engine(OSystem *syst, const AdlGameDescription *gd);
|
HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine(syst, gd) { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void restartGame();
|
void restartGame();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue