aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorColin Snover2017-09-07 00:35:25 -0500
committerColin Snover2017-09-08 16:03:24 -0500
commitf11b0a4ff53db917dd0d93969540952175923528 (patch)
tree7cae7cf9bb091898eb14f447dc2b15e9e1bebcb0 /engines/sci/engine
parent6571111efca8ade4e958b31318ebb5026d30c1f5 (diff)
downloadscummvm-rg350-f11b0a4ff53db917dd0d93969540952175923528.tar.gz
scummvm-rg350-f11b0a4ff53db917dd0d93969540952175923528.tar.bz2
scummvm-rg350-f11b0a4ff53db917dd0d93969540952175923528.zip
SCI32: Toggle Phant2 content censoring from game options
To enable the optional content censoring mode, Phant2 looks for a RESDUK.PAT file, which is normally placed by the game's installer if the user chose to enable censorship. If the file exists, the game reads an unlock password out of the file and asks the user to enter the password when starting a new game to create an uncensored game, or to click a "less intense" button to start the game with censoring. The censorship state of the game is then persisted in the save game file, and installations with the RESDUK.PAT file need to enter the password again in order to restore any of the uncensored saves. Since we do not have an installer that can enable this feature, add a game option toggle to enable/disable censoring (for the releases that have the optional censorship mode) instead so the censored content feature is available for anyone that wants to use it. This flag is restored from ScummVM whenever a save game is loaded, so it can be toggled on or off at any point without needing a separate save game, unlike in the original interpreter.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/guest_additions.cpp6
-rw-r--r--engines/sci/engine/guest_additions.h5
-rw-r--r--engines/sci/engine/kfile.cpp3
-rw-r--r--engines/sci/engine/savegame.cpp8
-rw-r--r--engines/sci/engine/vm.h1
5 files changed, 23 insertions, 0 deletions
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