SWORD2: Move the engine options into the MetaEngine subclass

This commit is contained in:
Cameron Cawley 2022-11-03 21:48:00 +00:00 committed by Eugene Sandulenko
parent 32c49c29be
commit b272c96668
5 changed files with 28 additions and 25 deletions

View file

@ -1,3 +1,3 @@
engines/sword2/animation.cpp engines/sword2/animation.cpp
engines/sword2/detection.cpp engines/sword2/metaengine.cpp
engines/sword2/sword2.cpp engines/sword2/sword2.cpp

View file

@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "common/translation.h"
#include "engines/advancedDetector.h" #include "engines/advancedDetector.h"
#include "engines/obsolete.h" #include "engines/obsolete.h"
@ -43,28 +41,9 @@ static const char *const directoryGlobs[] = {
nullptr nullptr
}; };
namespace Sword2 {
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_OBJECT_LABELS,
{
_s("Show object labels"),
_s("Show labels for objects on mouse hover"),
"object_labels",
false,
0,
0
}
},
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
} // End of namespace Sword2
class Sword2MetaEngineDetection : public AdvancedMetaEngineDetection { class Sword2MetaEngineDetection : public AdvancedMetaEngineDetection {
public: public:
Sword2MetaEngineDetection() : AdvancedMetaEngineDetection(Sword2::gameDescriptions, sizeof(Sword2::Sword2GameDescription), sword2Games, Sword2::optionsList) { Sword2MetaEngineDetection() : AdvancedMetaEngineDetection(Sword2::gameDescriptions, sizeof(Sword2::Sword2GameDescription), sword2Games) {
_guiOptions = GUIO3(GUIO_NOMIDI, GUIO_NOASPECT, GAMEOPTION_OBJECT_LABELS); _guiOptions = GUIO3(GUIO_NOMIDI, GUIO_NOASPECT, GAMEOPTION_OBJECT_LABELS);
_maxScanDepth = 2; _maxScanDepth = 2;
_directoryGlobs = directoryGlobs; _directoryGlobs = directoryGlobs;

View file

@ -39,6 +39,8 @@ struct Sword2GameDescription {
uint32 features; uint32 features;
}; };
#define GAMEOPTION_OBJECT_LABELS GUIO_GAMEOPTIONS1
} // End of namespace Sword2 } // End of namespace Sword2
#endif // SWORD2_DETECTION_H #endif // SWORD2_DETECTION_H

View file

@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define GAMEOPTION_OBJECT_LABELS GUIO_GAMEOPTIONS1
namespace Sword2 { namespace Sword2 {
static const Sword2GameDescription gameDescriptions[] = { static const Sword2GameDescription gameDescriptions[] = {

View file

@ -31,17 +31,41 @@
#include "common/gui_options.h" #include "common/gui_options.h"
#include "common/savefile.h" #include "common/savefile.h"
#include "common/system.h" #include "common/system.h"
#include "common/translation.h"
#include "sword2/sword2.h" #include "sword2/sword2.h"
#include "sword2/saveload.h" #include "sword2/saveload.h"
#include "sword2/obsolete.h" #include "sword2/obsolete.h"
namespace Sword2 {
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_OBJECT_LABELS,
{
_s("Show object labels"),
_s("Show labels for objects on mouse hover"),
"object_labels",
false,
0,
0
}
},
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
} // End of namespace Sword2
class Sword2MetaEngine : public AdvancedMetaEngine { class Sword2MetaEngine : public AdvancedMetaEngine {
public: public:
const char *getName() const override { const char *getName() const override {
return "sword2"; return "sword2";
} }
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override {
return Sword2::optionsList;
}
bool hasFeature(MetaEngineFeature f) const override; bool hasFeature(MetaEngineFeature f) const override;
SaveStateList listSaves(const char *target) const override; SaveStateList listSaves(const char *target) const override;