[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.18,1.19 script_v2.cpp,1.32,1.33 sound.cpp,1.35,1.36 sound.h,1.12,1.13

James Brown ender at users.sourceforge.net
Fri Oct 18 04:47:01 CEST 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv19070/scumm

Modified Files:
	actor.cpp script_v2.cpp sound.cpp sound.h 
Log Message:
Fix Wait:forActorDraw and the 'infinite mouth movement' problem in The Dig.

Code assumed that the actor always starts talking in the same room it finishes talking in - this doesn't apply for several cutscene 
sequences in The Dig. Also added the usual talkChannel fallback code in for The Dig.



Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- actor.cpp	17 Oct 2002 09:21:55 -0000	1.18
+++ actor.cpp	18 Oct 2002 11:45:57 -0000	1.19
@@ -782,7 +782,7 @@
 	act = _vars[VAR_TALK_ACTOR];
 	if (act && act < 0x80) {
 		Actor *a = derefActorSafe(act, "stopTalk");
-		if (a->isInCurrentRoom() && _useTalkAnims) {
+		if ((a->isInCurrentRoom() || (_features & GF_AFTER_V7)) && _useTalkAnims) {
 			a->startAnimActor(a->talkFrame2);
 			_useTalkAnims = false;
 		}

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- script_v2.cpp	18 Oct 2002 09:56:29 -0000	1.32
+++ script_v2.cpp	18 Oct 2002 11:45:57 -0000	1.33
@@ -2382,16 +2382,6 @@
 			Actor *a = derefActorSafe(actnum, "o6_wait:226");
 			int offs = (int16)fetchScriptWord();
 			
-			// FIXME: This wait command doesn't return at the 
-			// correct times, which causes several script freezes
-			// in The Dig. Eg, planetarium lightbridge,
-			// and taking the rod in the museum AFTER looking at
-			// all the displays. This is testing actor 3 (Ego),
-			// so I'm guessing it's something to do with the way
-			// ego doesn't always stop his mouth moving.
-			if (actnum == 3)
-				return;
-
 			if (a && a->isInCurrentRoom() && a->needRedraw) {
 				_scriptPointer += offs;
 				o6_breakHere();
@@ -2558,8 +2548,9 @@
 				pointer[j++] = _messagePtr[i];
 		}
 		pointer[j] = 0;
-		_sound->playBundleSound(pointer);
+		_sound->_talkChannel = _sound->playBundleSound(pointer);
 		_messagePtr = (byte*)&transText;
+		printf("Said %s, talkchannel is %d\n", transText, _sound->_talkChannel);
 		setStringVars(0);
 		actorTalk();
 	} else {
@@ -2585,7 +2576,8 @@
 				pointer[j++] = _messagePtr[i];
 		}
 		pointer[j] = 0;
-		_sound->playBundleSound(pointer);
+		_sound->_talkChannel = _sound->playBundleSound(pointer);
+		printf("Said %s, talkchannel is %d\n", transText, _sound->_talkChannel);
 		_messagePtr = (byte*)&transText;
 		setStringVars(0);
 		actorTalk();

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- sound.cpp	16 Oct 2002 09:11:08 -0000	1.35
+++ sound.cpp	18 Oct 2002 11:45:57 -0000	1.36
@@ -416,9 +416,9 @@
 		act = _scumm->_vars[_scumm->VAR_TALK_ACTOR];
 		if (_talkChannel < 0)
 			finished = false;
-		else if (_scumm->_mixer->_channels[_talkChannel] == NULL)
+		else if (_scumm->_mixer->_channels[_talkChannel] == NULL) {
 			finished = true;
-		else
+		} else
 			finished = false;
 		
 
@@ -1044,17 +1044,17 @@
 	}
 }
 
-void Sound::playBundleSound(char *sound) {
+int Sound::playBundleSound(char *sound) {
 	byte * ptr;
 
 	if (_scumm->_bundle->openVoiceFile("digvoice.bun", _scumm->getGameDataPath()) == false) {
-		return;
+		return -1;
 	}
 
 	ptr = (byte *)malloc(1000000);
 	if (_scumm->_bundle->decompressVoiceSampleByName(sound, ptr) == 0) {
 		delete ptr;
-		return;
+		return -1;
 	}
 
 	int rate = 22050;
@@ -1064,7 +1064,7 @@
 	if (tag != MKID_BE('iMUS')) {
 		warning("Decompression of bundle sound failed");
 		free(ptr);
-		return;
+		return -1;
 	}
 
 	ptr += 12;
@@ -1094,12 +1094,12 @@
 	if (size < 0) {
 		warning("Decompression sound failed (no size field)");
 		free(ptr);
-		return;
+		return -1;
 	}
 	
 	byte * final = (byte *)malloc(size);
 	memcpy(final, ptr, size);
-	_scumm->_mixer->playRaw(NULL, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+	return _scumm->_mixer->playRaw(NULL, final, size, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
 }
 
 int Sound::playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned) {

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- sound.h	15 Oct 2002 06:53:42 -0000	1.12
+++ sound.h	18 Oct 2002 11:45:57 -0000	1.13
@@ -56,7 +56,6 @@
 	bool _musicBundleToBeChanged;
 	bool _musicBundleToBeRemoved;
 
-	int _talkChannel;	/* Mixer channel actor is talking on */
 	File *_sfxFile;
 	uint32 _talk_sound_a1, _talk_sound_a2, _talk_sound_b1, _talk_sound_b2;
 	byte _talk_sound_mode;
@@ -92,6 +91,7 @@
 
 #endif
 
+	int _talkChannel;	/* Mixer channel actor is talking on */
 	int _cd_timer_value;
 	bool _soundsPaused;
 	int16 _sound_volume_master, _sound_volume_music, _sound_volume_sfx;
@@ -125,8 +125,8 @@
 	void pauseBundleMusic(bool state);
 	void bundleMusicHandler(Scumm * scumm);
 	void stopBundleMusic();
-	void playBundleSound(char *sound);
-	byte * readCreativeVocFile(byte * ptr, uint32 & size, uint32 & rate, uint32 & loops);
+	int playBundleSound(char *sound);
+	byte * readCreativeVocFile(byte * ptr, uint32 & size, uint32 & rate, uint32 & loops);
 	int playSfxSound(void *sound, uint32 size, uint rate, bool isUnsigned);
 	int playSfxSound_MP3(void *sound, uint32 size);
 





More information about the Scummvm-git-logs mailing list