[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.98,1.99 imuse_digi.cpp,1.94,1.95 imuse_digi.h,1.25,1.26 script.cpp,1.139,1.140 script_v6.cpp,1.225,1.226 script_v8.cpp,2.210,2.211 scumm.h,1.339,1.340 scummvm.cpp,2.520,2.521 sound.cpp,1.301,1.302 string.cpp,1.175,1.176

Max Horn fingolfin at users.sourceforge.net
Sat Dec 27 07:24:00 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv2939

Modified Files:
	dialogs.cpp imuse_digi.cpp imuse_digi.h script.cpp 
	script_v6.cpp script_v8.cpp scumm.h scummvm.cpp sound.cpp 
	string.cpp 
Log Message:
get rid of _noSubtitles, use ConfigManager directly instead; clean up some IMuseDigital oddities

Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- dialogs.cpp	27 Dec 2003 14:27:30 -0000	1.98
+++ dialogs.cpp	27 Dec 2003 15:22:59 -0000	1.99
@@ -458,7 +458,7 @@
 	GUI_OptionsDialog::open();
 
 	// update checkboxes, too
-	subtitlesCheckbox->setState(_scumm->_noSubtitles == false);
+	subtitlesCheckbox->setState(ConfMan.getBool("subtitles"));
 }
 
 void ConfigDialog::close() {
@@ -484,9 +484,6 @@
 
 	_scumm->_mixer->setVolume(soundVolumeSfx * soundVolumeMaster / 255);
 	_scumm->_mixer->setMusicVolume(soundVolumeMusic);
-	
-	// Subtitles?
-	_scumm->_noSubtitles = !ConfMan.getBool("subtitles");
 }
 
 

Index: imuse_digi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- imuse_digi.cpp	27 Dec 2003 14:10:45 -0000	1.94
+++ imuse_digi.cpp	27 Dec 2003 15:22:59 -0000	1.95
@@ -674,12 +674,6 @@
 	: _scumm(scumm) {
 	_pause = false;
 	
-	_voiceVocData = NULL;
-	_voiceVocSize = 0;
-	_voiceVocRate = 0;
-
-	_voiceBundleData = NULL;
-
 	_nameBundleMusic = "";
 	_musicBundleBufFinal = NULL;
 	_musicBundleBufOutput = NULL;
@@ -766,23 +760,15 @@
 	}
 }
 
-void IMuseDigital::setVocVoice(byte *src, int32 size, int rate) {
-	_voiceVocData = src;
-	_voiceVocSize = size;
-	_voiceVocRate = rate;
-}
-
-void IMuseDigital::setBundleVoice(byte *src) {
-	_voiceBundleData = src;
-}
-
-void IMuseDigital::startSound(int sound) {
+void IMuseDigital::startSound(int sound, byte *voc_src, int voc_size, int voc_rate) {
 	debug(5, "IMuseDigital::startSound(%d)", sound);
 	int l, r;
 
 	for (l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
 		if (!_channel[l].used && !_channel[l].handle.isActive()) {
 			byte *ptr, *s_ptr;
+			byte *_voiceVocData = (voc_src && voc_size > 0) ? voc_src : 0;
+			byte *_voiceBundleData = (voc_src && voc_size <= 0) ? voc_src : 0;
 			if ((sound == kTalkSoundID) && (_voiceBundleData)) {
 				s_ptr = ptr = _voiceBundleData;
 			} else if ((sound == kTalkSoundID) && (_voiceVocData)) {
@@ -819,37 +805,26 @@
 			int32 size = 0;
 			int t;
 
-			if ((sound == kTalkSoundID) && (_voiceVocData)) {
-				_channel[l].mixerSize = _voiceVocRate * 2;
-				_channel[l].freq = _voiceVocRate;
-				_channel[l].size = _voiceVocSize * 2;
-				_channel[l].bits = 8;
-				_channel[l].channels = 2;
-				_channel[l].mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED;
-				_channel[l].data = (byte *)malloc(_channel[l].size);
-
-				for (t = 0; t < _channel[l].size / 2; t++) {
-					*(_channel[l].data + t * 2 + 0) = *(_voiceVocData + t);
-					*(_channel[l].data + t * 2 + 1) = *(_voiceVocData + t);
+			if ((sound == kTalkSoundID) && (_voiceVocData) || (READ_UINT32(ptr) == MKID('Crea'))) {
+				if (READ_UINT32(ptr) == MKID('Crea')) {
+					int loops = 0;
+					voc_src = readVOCFromMemory(ptr, voc_size, voc_rate, loops);
 				}
-
-				_voiceVocData = NULL;
-			} else if (READ_UINT32(ptr) == MKID('Crea')) {
-				int32 loops = 0;
-				byte *t_ptr= readVOCFromMemory(ptr, size, _channel[l].freq, loops);
-				_channel[l].mixerSize = _channel[l].freq * 2;
-				_channel[l].size = size * 2;
+				_channel[l].mixerSize = voc_rate * 2;
+				_channel[l].freq = voc_rate;
+				_channel[l].size = voc_size * 2;
 				_channel[l].bits = 8;
 				_channel[l].channels = 2;
 				_channel[l].mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO | SoundMixer::FLAG_UNSIGNED;
 				_channel[l].data = (byte *)malloc(_channel[l].size);
 
+				// Widen data to two channels
 				for (t = 0; t < _channel[l].size / 2; t++) {
-					*(_channel[l].data + t * 2 + 0) = *(t_ptr + t);
-					*(_channel[l].data + t * 2 + 1) = *(t_ptr + t);
+					*(_channel[l].data + t * 2 + 0) = *(voc_src + t);
+					*(_channel[l].data + t * 2 + 1) = *(voc_src + t);
 				}
 
-				free(t_ptr);
+				free(voc_src);
 			} else if (READ_UINT32(ptr) == MKID('iMUS')) {
 				ptr += 16;
 				for (;;) {
@@ -964,11 +939,10 @@
 						size *= 2;
 						_channel[l].channels = 2;
 						_channel[l].data = (byte *)malloc(size);
+						// Widen data to two channels
 						for (t = 0; t < size / 4; t++) {
-							*(_channel[l].data + t * 4 + 0) = *(ptr + t * 2 + 0);
-							*(_channel[l].data + t * 4 + 1) = *(ptr + t * 2 + 1);
-							*(_channel[l].data + t * 4 + 2) = *(ptr + t * 2 + 0);
-							*(_channel[l].data + t * 4 + 3) = *(ptr + t * 2 + 1);
+							*(uint16 *)(_channel[l].data + t * 4 + 0) = *(uint16 *)(ptr + t * 2);
+							*(uint16 *)(_channel[l].data + t * 4 + 2) = *(uint16 *)(ptr + t * 2);
 						}
 					}
 					_channel[l].size = size;
@@ -978,6 +952,7 @@
 						size *= 2;
 						_channel[l].channels = 2;
 						_channel[l].data = (byte *)malloc(size);
+						// Widen data to two channels
 						for (t = 0; t < size / 2; t++) {
 							*(_channel[l].data + t * 2 + 0) = *(ptr + t);
 							*(_channel[l].data + t * 2 + 1) = *(ptr + t);
@@ -1478,8 +1453,7 @@
 
 	if (ptr) {
 		stopSound(kTalkSoundID);
-		setBundleVoice(ptr);
-		startSound(kTalkSoundID);
+		startSound(kTalkSoundID, ptr);
 		free(ptr);
 	}
 }

Index: imuse_digi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_digi.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- imuse_digi.h	26 Dec 2003 21:40:30 -0000	1.25
+++ imuse_digi.h	27 Dec 2003 15:22:59 -0000	1.26
@@ -130,17 +130,12 @@
 public:
 	int32 _bundleSongPosInMs;
 	Bundle *_bundle;	// FIXME: should be protected but is used by ScummEngine::askForDisk
-	byte *_voiceVocData;
-	int32 _voiceVocSize;
-	int _voiceVocRate;
-
-	byte *_voiceBundleData;
 
 	void pauseBundleMusic(bool state);
 	void stopBundleMusic();
 	void playBundleSound(const char *sound);
-	void setVocVoice(byte *src, int32 size, int rate);
-	void setBundleVoice(byte *src);
+
+	void startSound(int sound, byte *src, int size = 0, int rate = 0);
 
 public:
 	IMuseDigital(ScummEngine *scumm);
@@ -148,7 +143,7 @@
 
 	void setMasterVolume(int vol) {}
 
-	void startSound(int sound);
+	void startSound(int sound) { startSound(sound, 0, 0, 0); }
 	void stopSound(int sound);
 	void stopAllSounds();
 	void pause(bool pause);

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- script.cpp	26 Dec 2003 23:11:34 -0000	1.139
+++ script.cpp	27 Dec 2003 15:22:59 -0000	1.140
@@ -22,6 +22,7 @@
 
 #include "stdafx.h"
 
+#include "common/config-manager.h"
 #include "common/util.h"
 
 #include "scumm/actor.h"
@@ -476,7 +477,7 @@
 		}
 
 		if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES) {
-			return _noSubtitles;	
+			return !ConfMan.getBool("subtitles");	
 		}
 		
 		checkRange(_numVariables - 1, 0, var, "Variable %d out of range(r)");
@@ -542,8 +543,10 @@
 			_scummVars[var] = value;
 
 		// stay in sync with loom cd subtitle var
-		if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES && (value == 0 || value == 1)) 
-			_noSubtitles = (value != 0);
+		if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES) {
+			assert(value == 0 || value == 1);
+			ConfMan.set("subtitles", (value == 0));
+		}
 
 		if ((_varwatch == (int)var) || (_varwatch == 0)) {
 			if (vm.slot[_currentScript].number < 100)

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -d -r1.225 -r1.226
--- script_v6.cpp	26 Dec 2003 23:49:46 -0000	1.225
+++ script_v6.cpp	27 Dec 2003 15:22:59 -0000	1.226
@@ -23,6 +23,8 @@
 
 #include "stdafx.h"
 
+#include "common/config-manager.h"
+
 #include "scumm/actor.h"
 #include "scumm/charset.h"
 #include "scumm/imuse.h"
@@ -2413,7 +2415,7 @@
 
 				debug(1, "INSANE Arg: %d %d", args[1], args[2]);
 
-				SmushPlayer *sp = new SmushPlayer(this, speed, !_noSubtitles);
+				SmushPlayer *sp = new SmushPlayer(this, speed);
 
 				// INSANE mode 0: SMUSH movie playback
 				if (args[1] == 0) {
@@ -2422,7 +2424,7 @@
 #ifdef INSANE
 					const int insaneVarNum = (_features & GF_DEMO) ? 232 : 233;
 
-					_insane->setSmushParams(speed, !_noSubtitles);
+					_insane->setSmushParams(speed);
 					_insane->runScene(insaneVarNum);
 				    
 #else
@@ -2559,10 +2561,7 @@
 			_saveSound = args[1];
 			break;
 		case 215:
-			if (args[1])
-				_noSubtitles = false;
-			else
-				_noSubtitles = true;
+			ConfMan.set("subtitles", args[1] != 0);
 			break;
 		default:
 			error("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num);

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.210
retrieving revision 2.211
diff -u -d -r2.210 -r2.211
--- script_v8.cpp	26 Dec 2003 23:11:35 -0000	2.210
+++ script_v8.cpp	27 Dec 2003 15:22:59 -0000	2.211
@@ -1244,7 +1244,7 @@
 
 	debug(4, "o8_startVideo(%s/%s)", getGameDataPath(), (const char*)_scriptPointer);
 
-	SmushPlayer *sp = new SmushPlayer(this, 83333, !_noSubtitles);
+	SmushPlayer *sp = new SmushPlayer(this, 83333);
 	sp->play((const char*)_scriptPointer, getGameDataPath());
 	delete sp;
 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.339
retrieving revision 1.340
diff -u -d -r1.339 -r1.340
--- scumm.h	27 Dec 2003 00:10:20 -0000	1.339
+++ scumm.h	27 Dec 2003 15:22:59 -0000	1.340
@@ -1013,8 +1013,6 @@
 	int _charsetBufPos;
 	byte _charsetBuffer[512];
 
-public:
-	bool _noSubtitles;	// Whether to skip all subtitles
 protected:
 
 	void initCharset(int charset);

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.520
retrieving revision 2.521
diff -u -d -r2.520 -r2.521
--- scummvm.cpp	26 Dec 2003 23:11:35 -0000	2.520
+++ scummvm.cpp	27 Dec 2003 15:22:59 -0000	2.521
@@ -471,7 +471,6 @@
 	memset(_charsetBuffer, 0, sizeof(_charsetBuffer));
 	_copyProtection = false;
 	_demoMode = false;
-	_noSubtitles = false;
 	_confirmExit = false;
 	_numInMsgStack = 0;
 	_msgPtrToAdd = NULL;
@@ -659,11 +658,10 @@
 
 	_copyProtection = ConfMan.getBool("copy_protection");
 	_demoMode = ConfMan.getBool("demo_mode");
-	_noSubtitles = ConfMan.getBool("subtitles");
-	_noSubtitles ^=1;
 	if (ConfMan.hasKey("nosubtitles")) {
 		warning("Configuration key 'nosubtitles' is deprecated. Use 'subtitles' instead");
-		_noSubtitles = ConfMan.getBool("nosubtitles");
+		if (!ConfMan.hasKey("subtitles"))
+			ConfMan.set("subtitles", !ConfMan.getBool("nosubtitles"));
 	}
 	_confirmExit = ConfMan.getBool("confirm_exit");
 	_defaultTalkDelay = ConfMan.getInt("talkspeed");

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.301
retrieving revision 1.302
diff -u -d -r1.301 -r1.302
--- sound.cpp	27 Dec 2003 14:10:45 -0000	1.301
+++ sound.cpp	27 Dec 2003 15:22:59 -0000	1.302
@@ -559,7 +559,8 @@
 		_mouthSyncMode = true;
 	}
 
-	startSfxSound(_sfxFile, size, handle, id);
+	if (!_soundsPaused && _scumm->_mixer->isReady())
+		startSfxSound(_sfxFile, size, handle, id);
 }
 
 void Sound::stopTalkSound() {
@@ -794,9 +795,6 @@
 
 void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
 
-	if (_soundsPaused || !_scumm->_mixer->isReady())
-		return;
-
 	if (file_size > 0) {
 		if (_vorbis_mode) {
 #ifdef USE_VORBIS
@@ -815,9 +813,7 @@
 	byte *data = loadVOCFile(_sfxFile, size, rate);
 
 	if (_scumm->_imuseDigital) {
-		_scumm->_imuseDigital->setVocVoice(data, size, rate);
-		_scumm->_imuseDigital->startSound(kTalkSoundID);
-		free(data);
+		_scumm->_imuseDigital->startSound(kTalkSoundID, data, size, rate);
 	} else {
 		_scumm->_mixer->playRaw(handle, data, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, id);
 	}
@@ -832,7 +828,8 @@
 	 * same directory */
 	offset_table = NULL;
 
-	// for now until better streaming will be, ft voice can't not be compressed
+	// FIXME / TODO / HACK: for FT voice can only be loaded from original .sou
+	// files, not .so3 or .sog. This will be so until IMuseDigital gets fixed.
 	if (_scumm->_imuseDigital) {
 		sprintf(buf, "%s.sou", _scumm->getGameName());
 		if (!file->open(buf, _scumm->getGameDataPath())) {

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- string.cpp	26 Dec 2003 23:11:35 -0000	1.175
+++ string.cpp	27 Dec 2003 15:22:59 -0000	1.176
@@ -21,6 +21,9 @@
  */
 
 #include "stdafx.h"
+
+#include "common/config-manager.h"
+
 #include "scumm/scumm.h"
 #include "scumm/actor.h"
 #include "scumm/charset.h"
@@ -316,9 +319,9 @@
 			if (_version <= 3) {
 				_charset->printChar(c);
 			} else {
-				if ((_gameId == GID_LOOM256) && _noSubtitles && (_sound->pollCD())) {
+				if ((_gameId == GID_LOOM256) && !ConfMan.getBool("subtitles") && (_sound->pollCD())) {
 					// Special case for loomcd, since it only uses CD audio.for sound
-				} else if (_noSubtitles && (_haveMsg == 0xFE || _sound->_talkChannelHandle.isActive())) {
+				} else if (!ConfMan.getBool("subtitles") && (_haveMsg == 0xFE || _sound->_talkChannelHandle.isActive())) {
 					// Subtitles are turned off, and there is a voice version
 					// of this message -> don't print it. 
 				} else





More information about the Scummvm-git-logs mailing list