diff options
-rw-r--r-- | common/gui_options.cpp | 1 | ||||
-rw-r--r-- | common/gui_options.h | 2 | ||||
-rw-r--r-- | engines/sci/detection.cpp | 11 | ||||
-rw-r--r-- | engines/sci/detection_tables.h | 18 | ||||
-rw-r--r-- | engines/sci/engine/guest_additions.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/guest_additions.h | 5 | ||||
-rw-r--r-- | engines/sci/engine/kfile.cpp | 3 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/vm.h | 1 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 4 | ||||
-rw-r--r-- | engines/sci/sci.h | 1 |
11 files changed, 58 insertions, 2 deletions
diff --git a/common/gui_options.cpp b/common/gui_options.cpp index 500830a303..18e02c1077 100644 --- a/common/gui_options.cpp +++ b/common/gui_options.cpp @@ -83,6 +83,7 @@ const struct GameOpt { // Option strings must not contain substrings of any other options, so // "gameOption10" would be invalid here because it contains "gameOption1" { GUIO_GAMEOPTIONS10, "gameOptionA" }, + { GUIO_GAMEOPTIONS11, "gameOptionB" }, { GUIO_NONE, 0 } }; diff --git a/common/gui_options.h b/common/gui_options.h index 6c1aa2fdcd..0813ff1216 100644 --- a/common/gui_options.h +++ b/common/gui_options.h @@ -75,6 +75,7 @@ #define GUIO_GAMEOPTIONS8 "\057" #define GUIO_GAMEOPTIONS9 "\060" #define GUIO_GAMEOPTIONS10 "\061" +#define GUIO_GAMEOPTIONS11 "\062" #define GUIO0() (GUIO_NONE) #define GUIO1(a) (a) @@ -85,6 +86,7 @@ #define GUIO6(a,b,c,d,e,f) (a b c d e f) #define GUIO7(a,b,c,d,e,f,g) (a b c d e f g) #define GUIO8(a,b,c,d,e,f,g,h) (a b c d e f g h) +#define GUIO9(a,b,c,d,e,f,g,h,i) (a b c d e f g h i) namespace Common { diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index 1707f13480..9ebdfa9e7c 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -499,6 +499,17 @@ static const ADExtraGuiOptionsMap optionsList[] = { } }, + // Phantasmagoria 2 - content censoring option + { + GAMEOPTION_ENABLE_CENSORING, + { + _s("Enable content censoring"), + _s("Enable the game's built-in optional content censoring"), + "enable_censoring", + false + } + }, + AD_EXTRA_GUI_OPTIONS_TERMINATOR }; diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index 6f539a9c45..1f387d5932 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -3143,14 +3143,25 @@ static const struct ADGameDescription SciGameDescriptions[] = { #undef GUIO_PHANTASMAGORIA #undef GUIO_PHANTASMAGORIA_MAC -#define GUIO_PHANTASMAGORIA2 GUIO8(GUIO_NOSUBTITLES, \ +#define GUIO_PHANTASMAGORIA2 GUIO9(GUIO_NOSUBTITLES, \ GUIO_LINKMUSICTOSFX, \ GUIO_LINKSPEECHTOSFX, \ GUIO_NOMIDI, \ GUIO_NOASPECT, \ GAMEOPTION_ORIGINAL_SAVELOAD, \ GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \ - GAMEOPTION_HQ_VIDEO) + GAMEOPTION_HQ_VIDEO, \ + GAMEOPTION_ENABLE_CENSORING) +// TODO: Learn which are the censored game editions and give them this GUIO +// instead +#define GUIO_PHANTASMAGORIA2_CENSORED GUIO8(GUIO_NOSUBTITLES, \ + GUIO_LINKMUSICTOSFX, \ + GUIO_LINKSPEECHTOSFX, \ + GUIO_NOMIDI, \ + GUIO_NOASPECT, \ + GAMEOPTION_ORIGINAL_SAVELOAD, \ + GAMEOPTION_ENABLE_BLACK_LINED_VIDEO, \ + GAMEOPTION_HQ_VIDEO) // Some versions of Phantasmagoria 2 were heavily censored. // Censored versions (data files are currently unknown to us): UK, Australia, first English release in Germany @@ -3249,6 +3260,9 @@ static const struct ADGameDescription SciGameDescriptions[] = { AD_LISTEND}, Common::JA_JPN, Common::kPlatformWindows, ADGF_CD | ADGF_TESTING, GUIO_PHANTASMAGORIA2 }, +#undef GUIO_PHANTASMAGORIA2 +#undef GUIO_PHANTASMAGORIA2_CENSORED + #endif // ENABLE_SCI32 // Pepper's Adventure In Time 1.000 English diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp index 792605c4b9..b184887d66 100644 --- a/engines/sci/engine/guest_additions.cpp +++ b/engines/sci/engine/guest_additions.cpp @@ -189,6 +189,12 @@ bool GuestAdditions::kDoSoundMasterVolumeHook(const int volume) const { } #ifdef ENABLE_SCI32 +void GuestAdditions::sciEngineInitGameHook() { + if (g_sci->getGameId() == GID_PHANTASMAGORIA2 && Common::checkGameGUIOption(GAMEOPTION_ENABLE_CENSORING, ConfMan.get("guioptions"))) { + _state->variables[VAR_GLOBAL][kGlobalVarPhant2CensorshipFlag] = make_reg(0, ConfMan.getBool("enable_censoring")); + } +} + void GuestAdditions::sendSelectorHook(const reg_t sendObj, Selector &selector, reg_t *argp) { if (_features->getMessageTypeSyncStrategy() == kMessageTypeSyncStrategyLSL6Hires) { syncMessageTypeToScummVMUsingLSL6HiresStrategy(sendObj, selector, argp); diff --git a/engines/sci/engine/guest_additions.h b/engines/sci/engine/guest_additions.h index 36264b946b..7c80c29aac 100644 --- a/engines/sci/engine/guest_additions.h +++ b/engines/sci/engine/guest_additions.h @@ -109,6 +109,11 @@ public: #ifdef ENABLE_SCI32 /** + * Guest additions hook for SciEngine::initGame. + */ + void sciEngineInitGameHook(); + + /** * Guest additions hook for send_selector. */ void sendSelectorHook(const reg_t sendObj, Selector &selector, reg_t *argp); diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index eb6cacbe19..79e1894532 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -446,6 +446,9 @@ reg_t kFileIOOpen(EngineState *s, int argc, reg_t *argv) { *it = '_'; } } + } else if (g_sci->getGameId() == GID_PHANTASMAGORIA2 && name == "RESDUK.PAT") { + // Ignore the censorship password file in lieu of our game option + return SIGNAL_REG; } // See kMakeSaveCatName diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 4ff27ba6d8..d6fab6229b 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -49,6 +49,7 @@ #include "sci/sound/music.h" #ifdef ENABLE_SCI32 +#include "common/gui_options.h" #include "sci/engine/guest_additions.h" #include "sci/graphics/cursor32.h" #include "sci/graphics/frameout.h" @@ -1282,6 +1283,13 @@ void gamestate_afterRestoreFixUp(EngineState *s, int savegameId) { // It gets disabled in the game's death screen. g_sci->_gfxMenu->kernelSetAttribute(2, 1, SCI_MENU_ATTRIBUTE_ENABLED, TRUE_REG); // Game -> Save Game break; +#ifdef ENABLE_SCI32 + case GID_PHANTASMAGORIA2: + if (Common::checkGameGUIOption(GAMEOPTION_ENABLE_CENSORING, ConfMan.get("guioptions"))) { + s->variables[VAR_GLOBAL][kGlobalVarPhant2CensorshipFlag] = make_reg(0, ConfMan.getBool("enable_censoring")); + } + break; +#endif default: break; } diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index a8ac7b180f..67729bfbf9 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -160,6 +160,7 @@ enum GlobalVar { kGlobalVarPhant1DACVolume = 188, // 0 to 127 kGlobalVarLSL6HiresMusicVolume = 194, // 0 to 13 kGlobalVarGK1DAC1 = 207, // 0 to 127 + kGlobalVarPhant2CensorshipFlag = 207, kGlobalVarGK1DAC2 = 208, // 0 to 127 kGlobalVarLSL6HiresRestoreTextWindow = 210, kGlobalVarGK1DAC3 = 211, // 0 to 127 diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index f5e327c619..6ed7411020 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -569,6 +569,10 @@ bool SciEngine::initGame() { // Load game language into printLang property of game object setSciLanguage(); +#ifdef ENABLE_SCI32 + _guestAdditions->sciEngineInitGameHook(); +#endif + return true; } diff --git a/engines/sci/sci.h b/engines/sci/sci.h index ff3b515dcc..faa153221a 100644 --- a/engines/sci/sci.h +++ b/engines/sci/sci.h @@ -57,6 +57,7 @@ namespace Sci { #define GAMEOPTION_HIGH_RESOLUTION_GRAPHICS GUIO_GAMEOPTIONS8 #define GAMEOPTION_ENABLE_BLACK_LINED_VIDEO GUIO_GAMEOPTIONS9 #define GAMEOPTION_HQ_VIDEO GUIO_GAMEOPTIONS10 +#define GAMEOPTION_ENABLE_CENSORING GUIO_GAMEOPTIONS11 struct EngineState; class Vocabulary; |