From 32c49c29bebad21e5221cb292457c1be22520946 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Thu, 3 Nov 2022 21:45:33 +0000 Subject: [PATCH] SUPERNOVA: Move the engine options into the MetaEngine subclass --- engines/supernova/POTFILES | 2 +- engines/supernova/detection.cpp | 35 ++------------------------------ engines/supernova/detection.h | 28 +++++++++++++++++++++++++ engines/supernova/metaengine.cpp | 34 +++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 34 deletions(-) create mode 100644 engines/supernova/detection.h diff --git a/engines/supernova/POTFILES b/engines/supernova/POTFILES index 1cd0707b6ca..3d0b7fcc6de 100644 --- a/engines/supernova/POTFILES +++ b/engines/supernova/POTFILES @@ -1,3 +1,3 @@ engines/supernova/supernova.cpp -engines/supernova/detection.cpp +engines/supernova/metaengine.cpp diff --git a/engines/supernova/detection.cpp b/engines/supernova/detection.cpp index 3c449808dc6..dbb5c2c55b9 100644 --- a/engines/supernova/detection.cpp +++ b/engines/supernova/detection.cpp @@ -22,46 +22,15 @@ #include "base/plugins.h" #include "common/file.h" #include "common/gui_options.h" -#include "common/translation.h" #include "engines/advancedDetector.h" #include "supernova/supernova.h" - -#define GAMEOPTION_IMPROVED GUIO_GAMEOPTIONS1 -#define GAMEOPTION_TTS GUIO_GAMEOPTIONS2 +#include "supernova/detection.h" static const DebugChannelDef debugFlagList[] = { {Supernova::kDebugGeneral, "general", "Supernova general debug channel"}, DEBUG_CHANNEL_END }; -static const ADExtraGuiOptionsMap optionsList[] = { - { - GAMEOPTION_IMPROVED, - { - _s("Improved mode"), - _s("Removes some repetitive actions, adds possibility to change verbs by keyboard"), - "improved", - true, - 0, - 0 - } - }, - - { - GAMEOPTION_TTS, - { - _s("Enable Text to Speech"), - _s("Use TTS to read the descriptions (if TTS is available)"), - "tts_enabled", - false, - 0, - 0 - } - }, - - AD_EXTRA_GUI_OPTIONS_TERMINATOR -}; - static const PlainGameDescriptor supernovaGames[] = { {"msn1", "Mission Supernova 1"}, {"msn2", "Mission Supernova 2"}, @@ -123,7 +92,7 @@ static const ADGameDescription gameDescriptions[] = { class SupernovaMetaEngineDetection: public AdvancedMetaEngineDetection { public: - SupernovaMetaEngineDetection() : AdvancedMetaEngineDetection(Supernova::gameDescriptions, sizeof(ADGameDescription), supernovaGames, optionsList) { + SupernovaMetaEngineDetection() : AdvancedMetaEngineDetection(Supernova::gameDescriptions, sizeof(ADGameDescription), supernovaGames) { } const char *getName() const override { diff --git a/engines/supernova/detection.h b/engines/supernova/detection.h new file mode 100644 index 00000000000..36be015fdf0 --- /dev/null +++ b/engines/supernova/detection.h @@ -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 . + * + */ + +#ifndef SUPERNOVA_DETECTION_H +#define SUPERNOVA_DETECTION_H + +#define GAMEOPTION_IMPROVED GUIO_GAMEOPTIONS1 +#define GAMEOPTION_TTS GUIO_GAMEOPTIONS2 + +#endif diff --git a/engines/supernova/metaengine.cpp b/engines/supernova/metaengine.cpp index cee930a2b6c..316fba84d67 100644 --- a/engines/supernova/metaengine.cpp +++ b/engines/supernova/metaengine.cpp @@ -24,10 +24,40 @@ #include "common/gui_options.h" #include "common/savefile.h" #include "common/system.h" +#include "common/translation.h" #include "graphics/thumbnail.h" #include "engines/advancedDetector.h" #include "supernova/supernova.h" +#include "supernova/detection.h" + +static const ADExtraGuiOptionsMap optionsList[] = { + { + GAMEOPTION_IMPROVED, + { + _s("Improved mode"), + _s("Removes some repetitive actions, adds possibility to change verbs by keyboard"), + "improved", + true, + 0, + 0 + } + }, + + { + GAMEOPTION_TTS, + { + _s("Enable Text to Speech"), + _s("Use TTS to read the descriptions (if TTS is available)"), + "tts_enabled", + false, + 0, + 0 + } + }, + + AD_EXTRA_GUI_OPTIONS_TERMINATOR +}; class SupernovaMetaEngine : public AdvancedMetaEngine { public: @@ -35,6 +65,10 @@ public: return "supernova"; } + 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;