HOPKINS: Initialize censorship based on per-engine GUI option instead of optional text flag

This commit is contained in:
Strangerke 2014-02-02 16:20:17 +01:00
parent ea9fee35e8
commit 6bcc8dfee6
3 changed files with 45 additions and 25 deletions

View file

@ -29,6 +29,7 @@
#include "common/memstream.h"
#include "engines/advancedDetector.h"
#include "common/system.h"
#include "common/translation.h"
#include "graphics/colormasks.h"
#include "graphics/surface.h"
@ -69,6 +70,30 @@ static const PlainGameDescriptor hopkinsGames[] = {
#include "hopkins/detection_tables.h"
static const ADExtraGuiOptionsMap optionsList[] = {
{
GAMEOPTION_GORE_DEFAULT_OFF,
{
_s("Gore Mode"),
_s("Enable Gore Mode when available"),
"enable_gore",
false
}
},
{
GAMEOPTION_GORE_DEFAULT_ON,
{
_s("Gore Mode"),
_s("Enable Gore Mode when available"),
"enable_gore",
true
}
},
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
const static char *directoryGlobs[] = {
"voice",
"link",
@ -77,7 +102,7 @@ const static char *directoryGlobs[] = {
class HopkinsMetaEngine : public AdvancedMetaEngine {
public:
HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), hopkinsGames) {
HopkinsMetaEngine() : AdvancedMetaEngine(Hopkins::gameDescriptions, sizeof(Hopkins::HopkinsGameDescription), hopkinsGames, optionsList) {
_maxScanDepth = 3;
_directoryGlobs = directoryGlobs;
}

View file

@ -22,6 +22,9 @@
namespace Hopkins {
#define GAMEOPTION_GORE_DEFAULT_ON GUIO_GAMEOPTIONS1
#define GAMEOPTION_GORE_DEFAULT_OFF GUIO_GAMEOPTIONS2
static const HopkinsGameDescription gameDescriptions[] = {
{
// Hopkins FBI Linux Demo UK 1.00 and 1.02
@ -35,7 +38,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformLinux,
ADGF_DEMO,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -51,7 +54,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformOS2,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -66,7 +69,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformBeOS,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -81,7 +84,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -96,7 +99,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_OFF)
},
},
{
@ -111,7 +114,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -126,7 +129,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformLinux,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -141,7 +144,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformLinux,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -156,7 +159,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
@ -172,7 +175,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_OFF)
},
},
@ -189,7 +192,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_ON)
},
},
{
@ -204,7 +207,7 @@ static const HopkinsGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformWindows,
ADGF_DEMO,
GUIO1(GUIO_NONE)
GUIO1(GAMEOPTION_GORE_DEFAULT_OFF)
},
},
{ AD_TABLE_END_MARKER }

View file

@ -25,6 +25,7 @@
#include "hopkins/hopkins.h"
#include "hopkins/globals.h"
#include "common/config-manager.h"
#include "common/system.h"
#include "common/debug.h"
#include "common/file.h"
@ -68,20 +69,11 @@ int FileManager::readStream(Common::ReadStream &stream, void *buf, size_t nbytes
}
/**
* Initialize censorship based on blood.dat file
* The original censorship was based on blood.dat file.
* It's now using the config manager and a per-engine GUI option.
*/
void FileManager::initCensorship() {
_vm->_globals->_censorshipFl = false;
// If file doesn't exist, fallback to uncensored
if (fileExists("BLOOD.DAT")) {
char *data = (char *)loadFile("BLOOD.DAT");
if ((data[6] == 'u' && data[7] == 'k') || (data[6] == 'U' && data[7] == 'K'))
_vm->_globals->_censorshipFl = true;
_vm->_globals->freeMemory((byte *)data);
}
_vm->_globals->_censorshipFl = ConfMan.getBool("enable_gore");
}
/**