[Scummvm-cvs-logs] SF.net SVN: scummvm:[55005] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Dec 22 14:58:29 CET 2010


Revision: 55005
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55005&view=rev
Author:   thebluegr
Date:     2010-12-22 13:58:28 +0000 (Wed, 22 Dec 2010)

Log Message:
-----------
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)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/sci.h

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-12-22 13:52:25 UTC (rev 55004)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-12-22 13:58:28 UTC (rev 55005)
@@ -286,6 +286,13 @@
 			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;
+		}
 	}
 }
 

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-12-22 13:52:25 UTC (rev 55004)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-12-22 13:58:28 UTC (rev 55005)
@@ -252,6 +252,7 @@
 	_soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, _features->detectDoSoundType());
 
 	syncSoundSettings();
+	syncIngameAudioOptions();
 
 	// Initialize all graphics related subsystems
 	initGraphics();
@@ -662,11 +663,15 @@
 	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 @@
 			patchGameSaveRestore(_gamestate->_segMan);
 			_gamestate->shrinkStackToBase();
 			_gamestate->abortScriptProcessing = kAbortNone;
+
+			syncSoundSettings();
+			syncIngameAudioOptions();
 		} else {
 			break;	// exit loop
 		}
@@ -807,4 +815,31 @@
 	}
 }
 
+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

Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h	2010-12-22 13:52:25 UTC (rev 55004)
+++ scummvm/trunk/engines/sci/sci.h	2010-12-22 13:58:28 UTC (rev 55005)
@@ -206,7 +206,6 @@
 	K_LANG_PORTUGUESE = 351
 };
 
-
 class SciEngine : public Engine {
 	friend class Console;
 public:
@@ -224,6 +223,7 @@
 	bool canLoadGameStateCurrently();
 	bool canSaveGameStateCurrently();
 	void syncSoundSettings();
+	void syncIngameAudioOptions();
 
 	const SciGameId &getGameId() const { return _gameId; }
 	const char *getGameIdStr() const;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list