[Scummvm-cvs-logs] SF.net SVN: scummvm: [23446] scummvm/branches/branch-0-9-0/engines/scumm/he

kirben at users.sourceforge.net kirben at users.sourceforge.net
Thu Jul 20 22:37:43 CEST 2006


Revision: 23446
          http://svn.sourceforge.net/scummvm/?rev=23446&view=rev
Author:   kirben
Date:     2006-07-08 22:47:14 -0700 (Sat, 08 Jul 2006)

Log Message:
-----------
HE80+ games ignore subtitle speed, due to sound code been used. Fixes glitches that can occur, when slow subtitle speed is set in HE80+ games.

Modified Paths:
--------------
    scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.cpp
    scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.h

Modified: scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.cpp	2006-07-09 01:36:35 UTC (rev 23445)
+++ scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.cpp	2006-07-09 05:47:14 UTC (rev 23446)
@@ -154,6 +154,7 @@
 		if (_heChannel[i].sound == sound) {
 			_heChannel[i].sound = 0;
 			_heChannel[i].priority = 0;
+			_heChannel[i].timer = 0;
 			_heChannel[i].sbngBlock = 0;
 			_heChannel[i].codeOffs = 0;
 			memset(_heChannel[i].soundVars, 0, sizeof(_heChannel[i].soundVars));
@@ -191,6 +192,7 @@
 
 	_heChannel[chan].sound = 0;
 	_heChannel[chan].priority = 0;
+	_heChannel[chan].timer = 0;
 	_heChannel[chan].sbngBlock = 0;
 	_heChannel[chan].codeOffs = 0;
 	memset(_heChannel[chan].soundVars, 0, sizeof(_heChannel[chan].soundVars));
@@ -386,6 +388,27 @@
 			_heChannel[chan].codeOffs += size;
 		}
 	}
+
+	for (chan = 0; chan < ARRAYSIZE(_heChannel); chan++) {
+		if (_heChannel[chan].sound == 0)
+			continue;
+
+		if (_heChannel[chan].timer == 0)
+			continue;
+
+		if (_vm->getHETimer(chan + 4) > _heChannel[chan].timer) {
+			if (_heChannel[chan].sound == 1) {
+				_vm->stopTalk();
+			}
+
+			_heChannel[chan].sound = 0;
+			_heChannel[chan].priority = 0;
+			_heChannel[chan].timer = 0;
+			_heChannel[chan].sbngBlock = 0;
+			_heChannel[chan].codeOffs = 0;
+			_heChannel[chan].soundVars[0] = 0;
+		}
+	}
 }
 
 void SoundHE::processSoundOpcodes(int sound, byte *codePtr, int *soundVars) {
@@ -602,20 +625,24 @@
 			_overrideFreq = 0;
 		}
 
+		_vm->setHETimer(heChannel + 4);
+		_heChannel[heChannel].sound = soundID;
+		_heChannel[heChannel].priority = priority;
+		_heChannel[heChannel].sbngBlock = (codeOffs != -1) ? 1 : 0;
+		_heChannel[heChannel].codeOffs = codeOffs;
+		memset(_heChannel[heChannel].soundVars, 0, sizeof(_heChannel[heChannel].soundVars));
+
 		// TODO: Extra sound flags
 		if (heFlags & 1) {
 			flags |= Audio::Mixer::FLAG_LOOP;
+			_heChannel[heChannel].timer = 0;
+		} else {
+			_heChannel[heChannel].timer = size * 1000 / rate;
 		}
 
 		_vm->_mixer->stopHandle(_heSoundChannels[heChannel]);
 		_vm->_mixer->playRaw(&_heSoundChannels[heChannel], ptr + heOffset + 8, size, rate, flags, soundID, 255, 0, 0,0, type);
 
-		_vm->setHETimer(heChannel + 4);
-		_heChannel[heChannel].sound = soundID;
-		_heChannel[heChannel].priority = priority;
-		_heChannel[heChannel].sbngBlock = (codeOffs != -1) ? 1 : 0;
-		_heChannel[heChannel].codeOffs = codeOffs;
-		memset(_heChannel[heChannel].soundVars, 0, sizeof(_heChannel[heChannel].soundVars));
 	}
 	// Support for PCM music in 3DO versions of Humongous Entertainment games
 	else if (READ_BE_UINT32(ptr) == MKID_BE('MRAW')) {

Modified: scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.h
===================================================================
--- scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.h	2006-07-09 01:36:35 UTC (rev 23445)
+++ scummvm/branches/branch-0-9-0/engines/scumm/he/sound_he.h	2006-07-09 05:47:14 UTC (rev 23446)
@@ -48,6 +48,7 @@
 		int sound;
 		int codeOffs;
 		int priority;
+		int timer;
 		int sbngBlock;
 		int soundVars[27];
 	} _heChannel[8];






More information about the Scummvm-git-logs mailing list