CGE2: Move the engine options into the MetaEngine subclass

This commit is contained in:
Cameron Cawley 2022-11-03 19:02:49 +00:00 committed by Eugene Sandulenko
parent 9297e6fbfa
commit 66b2483fd5
4 changed files with 81 additions and 48 deletions

1
engines/cge2/POTFILES Normal file
View File

@ -0,0 +1 @@
engines/cge2/metaengine.cpp

View File

@ -25,9 +25,9 @@
*/
#include "engines/advancedDetector.h"
#include "common/translation.h"
#include "cge2/fileio.h"
#include "cge2/cge2.h"
#include "cge2/detection.h"
static const DebugChannelDef debugFlagList[] = {
{CGE2::kCGE2DebugOpcode, "opcode", "CGE2 opcode debug channel"},
@ -36,10 +36,6 @@ static const DebugChannelDef debugFlagList[] = {
namespace CGE2 {
#define GAMEOPTION_COLOR_BLIND_DEFAULT_OFF GUIO_GAMEOPTIONS1
#define GAMEOPTION_TTS_OBJECTS GUIO_GAMEOPTIONS2
#define GAMEOPTION_TTS_SPEECH GUIO_GAMEOPTIONS3
static const PlainGameDescriptor CGE2Games[] = {
{ "sfinx", "Sfinx" },
{ nullptr, nullptr }
@ -98,51 +94,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_OBJECTS,
{
_s("Enable Text to Speech for Objects and Options"),
_s("Use TTS to read the descriptions (if TTS is available)"),
"tts_enabled_objects",
false,
0,
0
}
},
{
GAMEOPTION_TTS_SPEECH,
{
_s("Enable Text to Speech for Subtitles"),
_s("Use TTS to read the subtitles (if TTS is available)"),
"tts_enabled_speech",
false,
0,
0
}
},
#endif
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
class CGE2MetaEngineDetection : public AdvancedMetaEngineDetection {
public:
CGE2MetaEngineDetection() : AdvancedMetaEngineDetection(gameDescriptions, sizeof(ADGameDescription), CGE2Games, optionsList) {
CGE2MetaEngineDetection() : AdvancedMetaEngineDetection(gameDescriptions, sizeof(ADGameDescription), CGE2Games) {
}
const char *getName() const override {

29
engines/cge2/detection.h Normal file
View File

@ -0,0 +1,29 @@
/* 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 CGE2_DETECTION_H
#define CGE2_DETECTION_H
#define GAMEOPTION_COLOR_BLIND_DEFAULT_OFF GUIO_GAMEOPTIONS1
#define GAMEOPTION_TTS_OBJECTS GUIO_GAMEOPTIONS2
#define GAMEOPTION_TTS_SPEECH GUIO_GAMEOPTIONS3
#endif

View File

@ -26,18 +26,67 @@
#include "engines/advancedDetector.h"
#include "common/translation.h"
#include "graphics/surface.h"
#include "cge2/cge2.h"
#include "cge2/detection.h"
namespace CGE2 {
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_OBJECTS,
{
_s("Enable Text to Speech for Objects and Options"),
_s("Use TTS to read the descriptions (if TTS is available)"),
"tts_enabled_objects",
false,
0,
0
}
},
{
GAMEOPTION_TTS_SPEECH,
{
_s("Enable Text to Speech for Subtitles"),
_s("Use TTS to read the subtitles (if TTS is available)"),
"tts_enabled_speech",
false,
0,
0
}
},
#endif
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
class CGE2MetaEngine : public AdvancedMetaEngine {
public:
const char *getName() const override {
return "cge2";
}
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override {
return optionsList;
}
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
bool hasFeature(MetaEngineFeature f) const override;
int getMaximumSaveSlot() const override;