CGE: Move the engine options into the MetaEngine subclass

This commit is contained in:
Cameron Cawley 2022-11-03 18:56:30 +00:00 committed by Eugene Sandulenko
parent 38596980b1
commit 9297e6fbfa
4 changed files with 67 additions and 34 deletions

View File

@ -1 +1,2 @@
engines/cge/detection.cpp
engines/cge/metaengine.cpp

View File

@ -27,6 +27,7 @@
#include "cge/fileio.h"
#include "cge/cge.h"
#include "cge/detection.h"
static const DebugChannelDef debugFlagList[] = {
{CGE::kCGEDebugBitmap, "bitmap", "CGE Bitmap debug channel"},
@ -37,9 +38,6 @@ static const DebugChannelDef debugFlagList[] = {
namespace CGE {
#define GAMEOPTION_COLOR_BLIND_DEFAULT_OFF GUIO_GAMEOPTIONS1
#define GAMEOPTION_TTS GUIO_GAMEOPTIONS2
static const PlainGameDescriptor CGEGames[] = {
{ "soltys", "So\305\202tys" },
{ nullptr, nullptr }
@ -106,39 +104,9 @@ static const ADGameDescription gameDescriptions[] = {
AD_TABLE_END_MARKER
};
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_COLOR_BLIND_DEFAULT_OFF,
{
_s("Color Blind Mode"),
_s("Enable Color Blind Mode by default"),
"enable_color_blind",
false,
0,
0
}
},
#ifdef USE_TTS
{
GAMEOPTION_TTS,
{
_s("Enable Text to Speech"),
_s("Use TTS to read text in the game (if TTS is available)"),
"tts_enabled",
false,
0,
0
}
},
#endif
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
class CGEMetaEngineDetection : public AdvancedMetaEngineDetection {
public:
CGEMetaEngineDetection() : AdvancedMetaEngineDetection(CGE::gameDescriptions, sizeof(ADGameDescription), CGEGames, optionsList) {
CGEMetaEngineDetection() : AdvancedMetaEngineDetection(CGE::gameDescriptions, sizeof(ADGameDescription), CGEGames) {
}
const char *getName() const override {

28
engines/cge/detection.h Normal file
View File

@ -0,0 +1,28 @@
/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CGE_DETECTION_H
#define CGE_DETECTION_H
#define GAMEOPTION_COLOR_BLIND_DEFAULT_OFF GUIO_GAMEOPTIONS1
#define GAMEOPTION_TTS GUIO_GAMEOPTIONS2
#endif

View File

@ -25,17 +25,53 @@
#include "common/savefile.h"
#include "common/system.h"
#include "common/translation.h"
#include "cge/cge.h"
#include "cge/detection.h"
namespace CGE {
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_COLOR_BLIND_DEFAULT_OFF,
{
_s("Color Blind Mode"),
_s("Enable Color Blind Mode by default"),
"enable_color_blind",
false,
0,
0
}
},
#ifdef USE_TTS
{
GAMEOPTION_TTS,
{
_s("Enable Text to Speech"),
_s("Use TTS to read text in the game (if TTS is available)"),
"tts_enabled",
false,
0,
0
}
},
#endif
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
class CGEMetaEngine : public AdvancedMetaEngine {
public:
const char *getName() const override {
return "cge";
}
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override {
return optionsList;
}
bool hasFeature(MetaEngineFeature f) const override;
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;