NEVERHOOD: Simplified detection tables

This commit is contained in:
Eugene Sandulenko 2020-08-24 23:24:10 +02:00
parent 4d0530117e
commit 1aa0367b8a
3 changed files with 81 additions and 107 deletions

View file

@ -28,33 +28,30 @@
#include "neverhood/neverhood.h"
enum NeverhoodGameFeatures {
GF_BIG_DEMO = (1 << 0)
};
namespace Neverhood {
struct NeverhoodGameDescription {
ADGameDescription desc;
uint32 features;
};
const char *NeverhoodEngine::getGameId() const {
return _gameDescription->desc.gameId;
return _gameDescription->gameId;
}
Common::Platform NeverhoodEngine::getPlatform() const {
return _gameDescription->desc.platform;
return _gameDescription->platform;
}
Common::Language NeverhoodEngine::getLanguage() const {
return _gameDescription->desc.language;
return _gameDescription->language;
}
bool NeverhoodEngine::isDemo() const {
return _gameDescription->desc.flags & ADGF_DEMO;
return _gameDescription->flags & ADGF_DEMO;
}
bool NeverhoodEngine::isBigDemo() const {
return _gameDescription->features & GF_BIG_DEMO;
return _gameDescription->flags & GF_BIG_DEMO;
}
bool NeverhoodEngine::applyResourceFixes() const {
@ -70,9 +67,8 @@ static const PlainGameDescriptor neverhoodGames[] = {
namespace Neverhood {
static const NeverhoodGameDescription gameDescriptions[] = {
static const ADGameDescription gameDescriptions[] = {
{
// Neverhood English version
{
"neverhood",
@ -83,10 +79,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
0
},
{
// Neverhood English big demo version
{
"neverhood",
@ -94,13 +87,10 @@ static const NeverhoodGameDescription gameDescriptions[] = {
AD_ENTRY1s("nevdemo.blb", "e637221d296f9a25ff22eaed96b07519", 117274189),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_DROPPLATFORM,
GF_BIG_DEMO | ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
GF_BIG_DEMO
},
{
// Neverhood English demo version
{
"neverhood",
@ -111,10 +101,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
0
},
{
// Neverhood earlier English demo version
{
"neverhood",
@ -125,10 +112,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DEMO | ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
0
},
{
// Neverhood Russian version. Dyadyushka Risech
{
"neverhood",
@ -139,10 +123,7 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
0
},
{
// Neverhood Russian version. Fargus
{
"neverhood",
@ -153,10 +134,8 @@ static const NeverhoodGameDescription gameDescriptions[] = {
ADGF_DROPPLATFORM,
GUIO1(GUIO_NONE)
},
0,
},
{ AD_TABLE_END_MARKER, 0 }
AD_TABLE_END_MARKER
};
} // End of namespace Neverhood
@ -185,7 +164,7 @@ static const ExtraGuiOption neverhoodExtraGuiOption3 = {
class NeverhoodMetaEngine : public AdvancedMetaEngine {
public:
NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(Neverhood::NeverhoodGameDescription), neverhoodGames) {
NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(ADGameDescription), neverhoodGames) {
_guiOptions = GUIO2(GUIO_NOSUBTITLES, GUIO_NOMIDI);
}
@ -231,11 +210,10 @@ bool Neverhood::NeverhoodEngine::hasFeature(EngineFeature f) const {
}
bool NeverhoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const Neverhood::NeverhoodGameDescription *gd = (const Neverhood::NeverhoodGameDescription *)desc;
if (gd) {
*engine = new Neverhood::NeverhoodEngine(syst, gd);
if (desc) {
*engine = new Neverhood::NeverhoodEngine(syst, desc);
}
return gd != 0;
return desc != 0;
}
const ExtraGuiOptions NeverhoodMetaEngine::getExtraGuiOptions(const Common::String &target) const {

View file

@ -47,7 +47,7 @@
namespace Neverhood {
NeverhoodEngine::NeverhoodEngine(OSystem *syst, const NeverhoodGameDescription *gameDesc) :
NeverhoodEngine::NeverhoodEngine(OSystem *syst, const ADGameDescription *gameDesc) :
Engine(syst), _gameDescription(gameDesc) {
// Setup mixer
if (!_mixer->isReady()) {

View file

@ -35,14 +35,10 @@
#include "neverhood/console.h"
#include "neverhood/messages.h"
struct ADGameDescription;
namespace Neverhood {
enum NeverhoodGameFeatures {
GF_BIG_DEMO = (1 << 0)
};
struct NeverhoodGameDescription;
class GameModule;
class GameVars;
class ResourceMan;
@ -64,11 +60,11 @@ protected:
void mainLoop();
public:
NeverhoodEngine(OSystem *syst, const NeverhoodGameDescription *gameDesc);
NeverhoodEngine(OSystem *syst, const ADGameDescription *gameDesc);
~NeverhoodEngine() override;
// Detection related functions
const NeverhoodGameDescription *_gameDescription;
const ADGameDescription *_gameDescription;
const char *getGameId() const;
Common::Platform getPlatform() const;
Common::Language getLanguage() const;