[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.220,1.221 debugger.cpp,1.117,1.118 script_v5.cpp,1.224,1.225 script_v6.cpp,1.272,1.273 scumm.h,1.360,1.361 scummvm.cpp,2.550,2.551 sound.cpp,1.313,1.314 string.cpp,1.187,1.188

James Brown ender at users.sourceforge.net
Fri Jan 16 02:46:03 CET 2004


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

Modified Files:
	actor.cpp debugger.cpp script_v5.cpp script_v6.cpp scumm.h 
	scummvm.cpp sound.cpp string.cpp 
Log Message:
Fix for bug #862263 - Maniac actors never stop talking. I know this could probably be neater :)



Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.220
retrieving revision 1.221
diff -u -d -r1.220 -r1.221
--- actor.cpp	16 Jan 2004 09:05:57 -0000	1.220
+++ actor.cpp	16 Jan 2004 10:45:55 -0000	1.221
@@ -561,7 +561,7 @@
 }
 
 void Actor::putActor(int dstX, int dstY, byte newRoom) {
-	if (visible && _vm->_currentRoom != newRoom && _vm->VAR(_vm->VAR_TALK_ACTOR) == number) {
+	if (visible && _vm->_currentRoom != newRoom && _vm->talkingActor() == number) {
 		_vm->clearMsgQueue();
 	}
 
@@ -781,6 +781,22 @@
 	needRedraw = true;
 }
 
+// Maniac doesn't have a ScummVar for VAR_TALK_ACTOR, and just uses
+// an internal variable. Emulate this to prevent overwriting script vars...
+int ScummEngine::talkingActor() {
+	if (_gameId == GID_MANIAC)
+		return _V1_talkingActor;
+	else
+		return VAR(VAR_TALK_ACTOR);
+};
+
+void ScummEngine::talkingActor(int value) {
+	if (_gameId == GID_MANIAC)
+		_V1_talkingActor = value;
+	else
+		VAR(VAR_TALK_ACTOR) = value;
+};
+
 void ScummEngine::showActors() {
 	int i;
 
@@ -1138,7 +1154,7 @@
 	if (_actorToPrintStrFor == 0xFF) {
 		if (!_keepText)
 			stopTalk();
-		VAR(VAR_TALK_ACTOR) = 0xFF;
+		talkingActor(0xFF);
 	} else {
 		int oldact;
 		
@@ -1154,21 +1170,21 @@
 		} else {
 			if (!_keepText)
 				stopTalk();
-			VAR(VAR_TALK_ACTOR) = a->number;
+			talkingActor(a->number);
 			if (!_string[0].no_talk_anim) {
 				a->startAnimActor(a->talkStartFrame);
 				_useTalkAnims = true;
 			}
-			oldact = VAR(VAR_TALK_ACTOR);
+			oldact = talkingActor();
 		}
 		if (oldact >= 0x80)
 			return;
 	}
 
-	if (((_gameId == GID_MANIAC) && (_version == 1)) || VAR(VAR_TALK_ACTOR) > 0x7F) {
+	if (((_gameId == GID_MANIAC) && (_version == 1)) || talkingActor() > 0x7F) {
 		_charsetColor = (byte)_string[0].color;
 	} else {
-		a = derefActor(VAR(VAR_TALK_ACTOR), "actorTalk(2)");
+		a = derefActor(talkingActor(), "actorTalk(2)");
 		_charsetColor = a->talkColor;
 	}
 	_charsetBufPos = 0;
@@ -1188,14 +1204,14 @@
 	_haveMsg = 0;
 	_talkDelay = 0;
 
-	act = VAR(VAR_TALK_ACTOR);
+	act = talkingActor();
 	if (act && act < 0x80) {
 		Actor *a = derefActor(act, "stopTalk");
 		if ((a->isInCurrentRoom() && _useTalkAnims) || (_features & GF_NEW_COSTUMES)) {
 			a->startAnimActor(a->talkStopFrame);
 			_useTalkAnims = false;
 		}
-		VAR(VAR_TALK_ACTOR) = 0xFF;
+		talkingActor(0xFF);
 	}
 	_keepText = false;
 	_charset->restoreCharsetBg();

Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- debugger.cpp	14 Jan 2004 10:02:33 -0000	1.117
+++ debugger.cpp	16 Jan 2004 10:45:55 -0000	1.118
@@ -56,7 +56,7 @@
 	vsprintf(buf, s, va);
 	va_end(va);
 
-	debug(g_debugLevel, buf);
+	debug(buf);
 };
 	
 ScummDebugger::ScummDebugger(ScummEngine *s)

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -d -r1.224 -r1.225
--- script_v5.cpp	15 Jan 2004 19:25:17 -0000	1.224
+++ script_v5.cpp	16 Jan 2004 10:45:55 -0000	1.225
@@ -1648,7 +1648,7 @@
 
 	a = derefActor(act, "o5_putActorInRoom");
 	
-	if (a->visible && _currentRoom != room && VAR(VAR_TALK_ACTOR) == a->number) {
+	if (a->visible && _currentRoom != room && talkingActor() == a->number) {
 		clearMsgQueue();
 	}
 	a->room = room;

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.272
retrieving revision 1.273
diff -u -d -r1.272 -r1.273
--- script_v6.cpp	16 Jan 2004 06:16:38 -0000	1.272
+++ script_v6.cpp	16 Jan 2004 10:45:56 -0000	1.273
@@ -1069,7 +1069,7 @@
 	if (room == 0xFF || room == 0x7FFFFFFF) {
 		room = a->room;
 	} else {
-		if (a->visible && _currentRoom != room && VAR(VAR_TALK_ACTOR) == a->number) {
+		if (a->visible && _currentRoom != room && talkingActor() == a->number) {
 			clearMsgQueue();
 		}
 		if (room != 0)

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.360
retrieving revision 1.361
diff -u -d -r1.360 -r1.361
--- scumm.h	14 Jan 2004 01:41:44 -0000	1.360
+++ scumm.h	16 Jan 2004 10:45:56 -0000	1.361
@@ -771,14 +771,16 @@
 
 public:
 	/* Actor talking stuff */
-	byte _actorToPrintStrFor;
+	byte _actorToPrintStrFor, _V1_talkingActor;
 	int _sentenceNum;
 	SentenceTab _sentence[NUM_SENTENCE];
 	StringTab _string[6];
 	int16 _talkDelay;
 	void actorTalk();
 	void stopTalk();
-	
+	int talkingActor();		// Wrapper around VAR_TALK_ACTOR for V1/V2 purposes
+	void talkingActor(int variable);
+
 	// Costume class
 	void cost_decodeData(Actor *a, int frame, uint usemask);
 	int cost_frameToAnim(Actor *a, int frame);

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.550
retrieving revision 2.551
diff -u -d -r2.550 -r2.551
--- scummvm.cpp	16 Jan 2004 07:58:55 -0000	2.550
+++ scummvm.cpp	16 Jan 2004 10:45:56 -0000	2.551
@@ -1237,7 +1237,7 @@
 	}
 	
 	VAR(VAR_CHARINC) = 4;
-	VAR(VAR_TALK_ACTOR) = 0;
+	talkingActor(0);
 }
 
 #pragma mark -

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.313
retrieving revision 1.314
diff -u -d -r1.313 -r1.314
--- sound.cpp	15 Jan 2004 20:39:24 -0000	1.313
+++ sound.cpp	16 Jan 2004 10:45:56 -0000	1.314
@@ -414,7 +414,7 @@
 		_talk_sound_mode = 0;
 	}
 
-	const int act = _vm->VAR(_vm->VAR_TALK_ACTOR);
+	const int act = _vm->talkingActor();
 	if ((_sfxMode & 2) && act != 0) {
 		Actor *a;
 		bool b, finished;

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- string.cpp	16 Jan 2004 08:34:42 -0000	1.187
+++ string.cpp	16 Jan 2004 10:45:56 -0000	1.188
@@ -103,14 +103,14 @@
 	if (!_haveMsg)
 		return;
 
-	if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK256 && VAR(VAR_TALK_ACTOR) == 0xff)) {
+	if (!(_features & GF_NEW_CAMERA) && !(_gameId == GID_ZAK256 && talkingActor() == 0xFF)) {
 		if ((camera._dest.x / 8) != (camera._cur.x / 8) || camera._cur.x != camera._last.x)
 			return;
 	}
 
 	a = NULL;
-	if (VAR(VAR_TALK_ACTOR) != 0xFF)
-		a = derefActorSafe(VAR(VAR_TALK_ACTOR), "CHARSET_1");
+	if (talkingActor() != 0xFF)
+		a = derefActorSafe(talkingActor(), "CHARSET_1");
 
 	if (a && _string[0].overhead != 0) {
 		if (_version <= 5) {





More information about the Scummvm-git-logs mailing list