[Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.251,1.252 scumm.h,1.483,1.484 script_v5.cpp,1.261,1.262 script_v6.cpp,1.402,1.403 script_v6he.cpp,2.118,2.119 script_v72he.cpp,2.104,2.105 script_v8.cpp,2.271,2.272

Max Horn fingolfin at users.sourceforge.net
Sat Sep 18 13:51:01 CEST 2004


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

Modified Files:
	string.cpp scumm.h script_v5.cpp script_v6.cpp script_v6he.cpp 
	script_v72he.cpp script_v8.cpp 
Log Message:
Added ScummEngine::printString() convenience method; changed enqueueText to call addMessageToStack

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.251
retrieving revision 1.252
diff -u -d -r1.251 -r1.252
--- string.cpp	13 Sep 2004 04:16:22 -0000	1.251
+++ string.cpp	18 Sep 2004 20:50:14 -0000	1.252
@@ -34,6 +34,24 @@
 
 namespace Scumm {
 
+void ScummEngine::printString(int m, const byte *msg) {
+	switch (m) {
+	case 0:
+		actorTalk(msg);
+		break;
+	case 1:
+		drawString(1, msg);
+		break;
+	case 2:
+		unkMessage1(msg);
+		break;
+	case 3:
+		unkMessage2(msg);
+		break;
+	}
+}
+
+
 void ScummEngine::unkMessage1(const byte *msg) {
 	byte buffer[100];
 	addMessageToStack(msg, buffer, sizeof(buffer));
@@ -660,8 +678,8 @@
 void ScummEngine::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) {
 	BlastText &bt = _blastTextQueue[_blastTextQueuePos++];
 	assert(_blastTextQueuePos <= ARRAYSIZE(_blastTextQueue));
-	
-	strcpy((char *)bt.text, (const char *)text);
+
+	addMessageToStack(text, bt.text, sizeof(bt.text));
 	bt.xpos = x;
 	bt.ypos = y;
 	bt.color = color;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.483
retrieving revision 1.484
diff -u -d -r1.483 -r1.484
--- scumm.h	18 Sep 2004 20:29:13 -0000	1.483
+++ scumm.h	18 Sep 2004 20:50:14 -0000	1.484
@@ -1162,6 +1162,8 @@
 
 	void initCharset(int charset);
 
+	void printString(int m, const byte *msg);
+
 	void CHARSET_1();
 	void drawString(int a, const byte *msg);
 	void unkMessage1(const byte *msg);

Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.261
retrieving revision 1.262
diff -u -d -r1.261 -r1.262
--- script_v5.cpp	24 Aug 2004 06:36:12 -0000	1.261
+++ script_v5.cpp	18 Sep 2004 20:50:14 -0000	1.262
@@ -2608,7 +2608,6 @@
 
 void ScummEngine_v5::decodeParseString() {
 	int textSlot;
-	const byte *msg;
 
 	switch (_actorToPrintStrFor) {
 	case 252:
@@ -2691,23 +2690,9 @@
 			}
 			break;
 		case 15:	// SO_TEXTSTRING
-			msg = _scriptPointer;
+			printString(textSlot, _scriptPointer);
 			_scriptPointer += resStrLen(_scriptPointer) + 1;
 
-			switch (textSlot) {
-			case 0:
-				actorTalk(msg);
-				break;
-			case 1:
-				drawString(1, msg);
-				break;
-			case 2:
-				unkMessage1(msg);
-				break;
-			case 3:
-				unkMessage2(msg);
-				break;
-			}
 
  			// In SCUMM V1-V3, there were no 'default' values for the text slot
  			// values. Hence to achieve correct behaviour, we have to keep the

Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.402
retrieving revision 1.403
diff -u -d -r1.402 -r1.403
--- script_v6.cpp	16 Sep 2004 23:34:25 -0000	1.402
+++ script_v6.cpp	18 Sep 2004 20:50:14 -0000	1.403
@@ -2537,13 +2537,9 @@
 			_smushFrameRate = args[1];
 			break;
 		case 16:
-		case 17:{
-			byte buf_input[300];
-			const byte *message = getStringAddressVar(VAR_STRING2DRAW);
-
-			addMessageToStack(message, buf_input, sizeof(buf_input));
-			enqueueText(buf_input, args[3], args[4], args[2], args[1], true);
-			break;}
+		case 17:
+			enqueueText(getStringAddressVar(VAR_STRING2DRAW), args[3], args[4], args[2], args[1], true);
+			break;
 		case 20:
 			// it's used for turn on/off 'RadioChatter' effect for voice in the dig, but i's not needed
 			break;
@@ -3152,22 +3148,8 @@
 		_string[m].no_talk_anim = true;
 		break;
 	case 75:		// SO_TEXTSTRING
-		switch (m) {
-		case 0:
-			actorTalk(_scriptPointer);
-			break;
-		case 1:
-			drawString(1, _scriptPointer);
-			break;
-		case 2:
-			unkMessage1(_scriptPointer);
-			break;
-		case 3:
-			unkMessage2(_scriptPointer);
-			break;
-		}
+		printString(m, _scriptPointer);
 		_scriptPointer += resStrLen(_scriptPointer) + 1;
-
 		break;
 	case 0xFE:
 		_string[m].loadDefault();

Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.118
retrieving revision 2.119
diff -u -d -r2.118 -r2.119
--- script_v6he.cpp	16 Sep 2004 12:30:53 -0000	2.118
+++ script_v6he.cpp	18 Sep 2004 20:50:15 -0000	2.119
@@ -567,7 +567,7 @@
 	stopObjectScript(object1);
 	stopObjectScript(object2);
 
-	struct ObjectData tmpOd;
+	ObjectData tmpOd;
 
 	memcpy(&tmpOd, &_objs[idx1], sizeof(tmpOd));
 	memcpy(&_objs[idx1], &_objs[idx2], sizeof(tmpOd));
@@ -1150,6 +1150,8 @@
 		// See also o6_startSound().
 		_sound->setOverrideFreq(arg);
 		break;
+	default:
+		error("o6_soundOps: default case 0x%x", subOp);
 	}
 }
 
@@ -1171,19 +1173,7 @@
 	offset = pop();
 	slot = pop();
 
-	switch (mode) {
-	case 1:
-		seekFilePos(slot, offset, 0);
-		break;
-	case 2:
-		seekFilePos(slot, offset, 1);
-		break;
-	case 3:
-		seekFilePos(slot, offset, 2);
-		break;
-	default:
-		break;
-	}
+	seekFilePos(slot, offset, mode - 1);
 }
 
 void ScummEngine_v6he::seekFilePos(int slot, int offset, int mode) {
@@ -1200,6 +1190,8 @@
 	case 2:
 		_hFileTable[slot].seek(offset, SEEK_END);
 		break;
+	default:
+		error("seekFilePos: default case 0x%x", mode);
 	}
 }
 
@@ -1299,22 +1291,8 @@
 		_string[m].no_talk_anim = true;
 		break;
 	case 75:		// SO_TEXTSTRING
-		switch (m) {
-		case 0:
-			actorTalk(_scriptPointer);
-			break;
-		case 1:
-			drawString(1, _scriptPointer);
-			break;
-		case 2:
-			unkMessage1(_scriptPointer);
-			break;
-		case 3:
-			unkMessage2(_scriptPointer);
-			break;
-		}
+		printString(m, _scriptPointer);
 		_scriptPointer += resStrLen(_scriptPointer) + 1;
-
 		break;
 	case 0xF9:
 		color = pop();

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.104
retrieving revision 2.105
diff -u -d -r2.104 -r2.105
--- script_v72he.cpp	18 Sep 2004 04:12:14 -0000	2.104
+++ script_v72he.cpp	18 Sep 2004 20:50:15 -0000	2.105
@@ -2089,59 +2089,18 @@
 		_string[m].no_talk_anim = true;
 		break;
 	case 75:		// SO_TEXTSTRING
-		switch (m) {
-		case 0:
-			actorTalk(_scriptPointer);
-			break;
-		case 1:
-			drawString(1, _scriptPointer);
-			break;
-		case 2:
-			unkMessage1(_scriptPointer);
-			break;
-		case 3:
-			unkMessage2(_scriptPointer);
-			break;
-		}
+		printString(m, _scriptPointer);
 		_scriptPointer += resStrLen(_scriptPointer) + 1;
-
 		break;
 	case 194:
 		decodeScriptString(name, true);
-		switch (m) {
-		case 0:
-			actorTalk(name);
-			break;
-		case 1:
-			drawString(1, name);
-			break;
-		case 2:
-			unkMessage1(name);
-			break;
-		case 3:
-			unkMessage2(name);
-			break;
-		}
+		printString(m, name);
 		break;
 	case 0xE1:
 		ptr = getResourceAddress(rtTalkie, pop());
 		size = READ_BE_UINT32(ptr + 12);
 		memcpy(name, ptr + 16, size);
-
-		switch (m) {
-		case 0:
-			actorTalk(name);
-			break;
-		case 1:
-			drawString(1, name);
-			break;
-		case 2:
-			unkMessage1(name);
-			break;
-		case 3:
-			unkMessage2(name);
-			break;
-		}
+		printString(m, name);
 		break;
 	case 0xF9:
 		color = pop();

Index: script_v8.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v8.cpp,v
retrieving revision 2.271
retrieving revision 2.272
diff -u -d -r2.271 -r2.272
--- script_v8.cpp	3 Sep 2004 19:54:58 -0000	2.271
+++ script_v8.cpp	18 Sep 2004 20:50:15 -0000	2.272
@@ -499,26 +499,10 @@
 		_string[m].no_talk_anim = true;
 		break;
 	case 0xD1:		// SO_PRINT_STRING
-		switch (m) {
-		case 0:
-			actorTalk(_scriptPointer);
-			break;
-		case 1:
-			drawString(1, _scriptPointer);
-			break;
-		case 2:
-			unkMessage1(_scriptPointer);
-			break;
-		case 3:
-			unkMessage2(_scriptPointer);
-			break;
-		case 5:{
-			byte buffer[256];
-			addMessageToStack(_scriptPointer, buffer, sizeof(buffer));
-			enqueueText(buffer, _string[m].xpos, _string[m].ypos, _string[m].color, _string[m].charset, _string[m].center);
-			}
-			break;
-		}
+		if (m == 5)
+			enqueueText(_scriptPointer, _string[m].xpos, _string[m].ypos, _string[m].color, _string[m].charset, _string[m].center);
+		else
+			printString(m, _scriptPointer);
 		_scriptPointer += resStrLen(_scriptPointer) + 1;
 
 		break;





More information about the Scummvm-git-logs mailing list