[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.255,1.256 actor.h,1.54,1.55 sound.cpp,1.350,1.351 string.cpp,1.222,1.223

Travis Howell kirben at users.sourceforge.net
Thu Jul 15 05:28:53 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22396/scumm

Modified Files:
	actor.cpp actor.h sound.cpp string.cpp 
Log Message:

Actually use actor talkScript when required.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.255
retrieving revision 1.256
diff -u -d -r1.255 -r1.256
--- actor.cpp	11 Jul 2004 11:59:18 -0000	1.255
+++ actor.cpp	15 Jul 2004 12:26:10 -0000	1.256
@@ -1192,7 +1192,7 @@
 				stopTalk();
 			setTalkingActor(a->number);
 			if (!_string[0].no_talk_anim) {
-				a->startAnimActor(a->talkStartFrame);
+				a->runActorTalkScript(a->talkStartFrame);
 				_useTalkAnims = true;
 			}
 			oldact = getTalkingActor();
@@ -1216,6 +1216,19 @@
 	CHARSET_1();
 }
 
+void Actor::runActorTalkScript(int f) {
+	if (talkScript) {
+		int script = talkScript;
+		int args[16];
+		memset(args, 0, sizeof(args));
+		args[1] = f;
+		args[0] = number;
+
+		_vm->runScript(script, 1, 0, args);
+	} else
+		startAnimActor(f);
+}
+
 void ScummEngine::stopTalk() {
 	int act;
 
@@ -1228,7 +1241,7 @@
 	if (act && act < 0x80) {
 		Actor *a = derefActor(act, "stopTalk");
 		if ((a->isInCurrentRoom() && _useTalkAnims) || (_features & GF_NEW_COSTUMES)) {
-			a->startAnimActor(a->talkStopFrame);
+			a->runActorTalkScript(a->talkStopFrame);
 			_useTalkAnims = false;
 		}
 		if (!(_features & GF_HUMONGOUS))

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- actor.h	29 Jun 2004 11:02:15 -0000	1.54
+++ actor.h	15 Jul 2004 12:26:10 -0000	1.55
@@ -166,6 +166,7 @@
 protected:
 	void startWalkAnim(int cmd, int angle);
 public:
+	void runActorTalkScript(int f);
 	void startAnimActor(int frame);
 
 	void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.350
retrieving revision 1.351
diff -u -d -r1.350 -r1.351
--- sound.cpp	15 Jul 2004 05:44:57 -0000	1.350
+++ sound.cpp	15 Jul 2004 12:26:10 -0000	1.351
@@ -522,10 +522,10 @@
 				if (_mouthSyncMode != b) {
 					_mouthSyncMode = b;
 					if (_talk_sound_frame != -1) {
-						a->startAnimActor(_talk_sound_frame);
+						a->runActorTalkScript(_talk_sound_frame);
 						_talk_sound_frame = -1;
 					} else
-						a->startAnimActor(b ? a->talkStopFrame : a->talkStartFrame);
+						a->runActorTalkScript(b ? a->talkStopFrame : a->talkStartFrame);
 				}
 			}
 		}

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -d -r1.222 -r1.223
--- string.cpp	10 Jul 2004 11:42:31 -0000	1.222
+++ string.cpp	15 Jul 2004 12:26:10 -0000	1.223
@@ -80,8 +80,6 @@
 	int frme = -1;
 	Actor *a;
 	byte *buffer;
-	bool has_talk_sound = false;
-	bool has_anim = false;
 
 	if (!_haveMsg)
 		return;
@@ -152,7 +150,7 @@
 	}
 
 	if (a && !_string[0].no_talk_anim) {
-		has_anim = true;
+		a->runActorTalkScript(a->talkStartFrame);
 		_useTalkAnims = true;
 	}
 
@@ -230,14 +228,15 @@
 			case 9:
 				frme = *buffer++;
 				frme |= *buffer++ << 8;
-				has_anim = true;
+				a->startAnimActor(frme != -1 ? frme : a->talkStartFrame);
 				break;
 			case 10:
 				talk_sound_a = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24);
 				talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24);
-				has_talk_sound = true;
 				buffer += 14;
 	
+				_sound->talkSound(talk_sound_a, talk_sound_b, 2, frme);
+
 				// Set flag that speech variant exist of this msg.
 				// TODO: This does not work for the speech system in V7+ games
 				// since they encode the voice information differently, and it
@@ -303,16 +302,6 @@
 		}
 	} while (c != 2 && c != 3);
 
-	// Even if talkSound() is called, we may still have to call
-	// startAnimActor() since actorTalk() may already have caused the
-	// wrong animation frame to be drawn, and the talkSound() won't be
-	// processed until after the next screen update. Bleah.
-
-	if (has_talk_sound)
-		_sound->talkSound(talk_sound_a, talk_sound_b, 2, frme);
-	if (a && has_anim)
-		a->startAnimActor(frme != -1 ? frme : a->talkStartFrame);
-
 	_charsetBufPos = buffer - _charsetBuffer;
 
 	// FIXME: Remove this and the next two lines eventually!





More information about the Scummvm-git-logs mailing list