aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-12-22 13:58:28 +0000
committerFilippos Karapetis2010-12-22 13:58:28 +0000
commita5db8902600a217c5acfbea391a8a3c55dc47f93 (patch)
tree49ec71cc842018b5143ad9fdb4ccc1a64e4ed5db /engines/sci
parent166f3f2dfd1201a19c107ef9550ca43afbae034c (diff)
downloadscummvm-rg350-a5db8902600a217c5acfbea391a8a3c55dc47f93.tar.gz
scummvm-rg350-a5db8902600a217c5acfbea391a8a3c55dc47f93.tar.bz2
scummvm-rg350-a5db8902600a217c5acfbea391a8a3c55dc47f93.zip
SCI: Sync in-game speech/subtitle options with the ones from the ScummVM GUI.
- Obtain speech/subtitle options from the ScummVM GUI and set them in CD games. - Also, set simultaneous speech and subtitles in games that support them (currently SQ4 CD and Freddy Pharkas CD). There is no GUI option for setting simultaneous speech and subtitles in Freddy Pharkas CD, so this is the only current way of achieving this (unless the text speed slider inside the Freddy Pharkas options window is repurposed - but that will require extensive changes) svn-id: r55005
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/vm.cpp7
-rw-r--r--engines/sci/sci.cpp35
-rw-r--r--engines/sci/sci.h2
3 files changed, 43 insertions, 1 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 8398b7d8c2..958fcdf34f 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -286,6 +286,13 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i
value.segment = 0;
r[index] = value;
+
+ // If the game is trying to change its speech/subtitle settings, apply the ScummVM audio
+ // options first, if they haven't been applied yet
+ if (type == VAR_GLOBAL && index == 90 && !g_sci->getEngineState()->_syncedAudioOptions) {
+ g_sci->syncIngameAudioOptions();
+ g_sci->getEngineState()->_syncedAudioOptions = true;
+ }
}
}
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 43422b4ede..3e96ecc8f2 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -252,6 +252,7 @@ Common::Error SciEngine::run() {
_soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, _features->detectDoSoundType());
syncSoundSettings();
+ syncIngameAudioOptions();
// Initialize all graphics related subsystems
initGraphics();
@@ -662,11 +663,15 @@ void SciEngine::runGame() {
if (DebugMan.isDebugChannelEnabled(kDebugLevelOnStartup))
_console->attach();
+ g_sci->getEngineState()->_syncedAudioOptions = false;
+
do {
_gamestate->_executionStackPosChanged = false;
run_vm(_gamestate);
exitGame();
+ g_sci->getEngineState()->_syncedAudioOptions = true;
+
if (_gamestate->abortScriptProcessing == kAbortRestartGame) {
_gamestate->_segMan->resetSegMan();
initGame();
@@ -683,6 +688,9 @@ void SciEngine::runGame() {
patchGameSaveRestore(_gamestate->_segMan);
_gamestate->shrinkStackToBase();
_gamestate->abortScriptProcessing = kAbortNone;
+
+ syncSoundSettings();
+ syncIngameAudioOptions();
} else {
break; // exit loop
}
@@ -807,4 +815,31 @@ void SciEngine::syncSoundSettings() {
}
}
+void SciEngine::syncIngameAudioOptions() {
+ // Now, sync the in-game speech/subtitles settings for CD games
+ if (isCD()) {
+ bool subtitlesOn = ConfMan.getBool("subtitles");
+ bool speechOn = !ConfMan.getBool("speech_mute");
+
+ if (subtitlesOn && !speechOn) {
+ _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 1); // subtitles
+ } else if (!subtitlesOn && speechOn) {
+ _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech
+ } else if (subtitlesOn && speechOn) {
+ // Is it a game that supports simultaneous speech and subtitles?
+ if (getGameId() == GID_SQ4
+ || getGameId() == GID_FREDDYPHARKAS
+ // TODO: The following need script patches for simultaneous speech and subtitles
+ //|| getGameId() == GID_KQ6
+ //|| getGameId() == GID_LB2
+ ) {
+ _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 3); // speech + subtitles
+ } else {
+ // Game does not support speech and subtitles, set it to speech
+ _gamestate->variables[VAR_GLOBAL][90] = make_reg(0, 2); // speech
+ }
+ }
+ }
+}
+
} // End of namespace Sci
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 716419d103..91ab491945 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -206,7 +206,6 @@ enum kLanguage {
K_LANG_PORTUGUESE = 351
};
-
class SciEngine : public Engine {
friend class Console;
public:
@@ -224,6 +223,7 @@ public:
bool canLoadGameStateCurrently();
bool canSaveGameStateCurrently();
void syncSoundSettings();
+ void syncIngameAudioOptions();
const SciGameId &getGameId() const { return _gameId; }
const char *getGameIdStr() const;