[Scummvm-cvs-logs] SF.net SVN: scummvm: [21991] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Apr 17 15:48:02 CEST 2006


Revision: 21991
Author:   kirben
Date:     2006-04-17 15:47:12 -0700 (Mon, 17 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21991&view=rev

Log Message:
-----------
Split screenTextPObj script opcode into game specific versions

Modified Paths:
--------------
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-17 22:35:33 UTC (rev 21990)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-17 22:47:12 UTC (rev 21991)
@@ -255,7 +255,7 @@
 		// 175 - 179
 		&SimonEngine::o_lockZones,
 		&SimonEngine::o_unlockZones,
-		&SimonEngine::o_screenTextPObj,
+		NULL,
 		&SimonEngine::o_getPathPosn,
 		&SimonEngine::o_scnTxtLongText,
 		// 180 - 184
@@ -294,6 +294,7 @@
 		opcode_table[98] = &SimonEngine::o1_animate;
 		opcode_table[99] = &SimonEngine::o1_stopAnimate;
 		opcode_table[127] = &SimonEngine::o1_playTune;
+		opcode_table[177] = &SimonEngine::o1_screenTextPObj;
 		opcode_table[181] = &SimonEngine::o1_mouseOff;
 		opcode_table[182] = &SimonEngine::o1_loadBeard;
 		opcode_table[183] = &SimonEngine::o1_unloadBeard;
@@ -306,6 +307,7 @@
 		opcode_table[98] = &SimonEngine::o2_animate;
 		opcode_table[99] = &SimonEngine::o2_stopAnimate;
 		opcode_table[127] = &SimonEngine::o2_playTune;
+		opcode_table[177] = &SimonEngine::o2_screenTextPObj;
 		opcode_table[181] = &SimonEngine::o2_mouseOff;
 		opcode_table[188] = &SimonEngine::o2_isShortText;
 		opcode_table[189] = &SimonEngine::o2_clearMarks;
@@ -332,6 +334,7 @@
 		opcode_table[171] = &SimonEngine::o3_hyperLinkOn;
 		opcode_table[172] = &SimonEngine::o3_hyperLinkOff;
 		opcode_table[173] = &SimonEngine::o3_checkPaths;
+		opcode_table[177] = &SimonEngine::o3_screenTextPObj;
 		opcode_table[181] = &SimonEngine::o3_mouseOff;
 		opcode_table[182] = &SimonEngine::o3_loadVideo;
 		opcode_table[183] = &SimonEngine::o3_playVideo;
@@ -1391,7 +1394,7 @@
 	_vgaBufStart = _vgaFileBufOrg;
 }
 
-void SimonEngine::o_screenTextPObj() {
+void SimonEngine::o1_screenTextPObj() {
 	// 177: inventory descriptions
 	uint vgaSpriteId = getVarOrByte();
 	uint color = getVarOrByte();
@@ -1405,60 +1408,8 @@
 		tl = getTextLocation(vgaSpriteId);
 	}
 
-	if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE)) {
+	if (getFeatures() & GF_TALKIE) {
 		if (subObject != NULL && subObject->objectFlags & kOFVoice) {
-			uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];
-
-			if (subObject->objectFlags & kOFNumber) {
-				uint speechIdOffs = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
-
-				if (speechId == 116)
-					speechId = speechIdOffs + 115;
-				if (speechId == 92)
-					speechId = speechIdOffs + 98;
-				if (speechId == 99)
-					speechId = 9;
-				if (speechId == 97) {
-					switch (speechIdOffs) {
-					case 12:
-						speechId = 109;
-						break;
-					case 14:
-						speechId = 108;
-						break;
-					case 18:
-						speechId = 107;
-						break;
-					case 20:
-						speechId = 106;
-						break;
-					case 22:
-						speechId = 105;
-						break;
-					case 28:
-						speechId = 104;
-						break;
-					case 90:
-						speechId = 103;
-						break;
-					case 92:
-						speechId = 102;
-						break;
-					case 100:
-						speechId = 51;
-						break;
-					default:
-						error("o_177: invalid case %d", speechIdOffs);
-					}
-				}
-			}
-
-			if (_speech)
-				playSpeech(speechId, vgaSpriteId);
-		}
-
-	} else if (getFeatures() & GF_TALKIE) {
-		if (subObject != NULL && subObject->objectFlags & kOFVoice) {
 			uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
 			playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
 		} else if (subObject != NULL && subObject->objectFlags & kOFNumber) {
@@ -1728,6 +1679,84 @@
 		midi.startTrack(track);
 }
 
+void SimonEngine::o2_screenTextPObj() {
+	// 177: inventory descriptions
+	uint vgaSpriteId = getVarOrByte();
+	uint color = getVarOrByte();
+	const char *string_ptr = NULL;
+	TextLocation *tl = NULL;
+	char buf[256];
+
+	SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
+	if (subObject != NULL && subObject->objectFlags & kOFText) {
+		string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
+		tl = getTextLocation(vgaSpriteId);
+	}
+
+	if (getFeatures() & GF_TALKIE) {
+		if (subObject != NULL && subObject->objectFlags & kOFVoice) {
+			uint speechId = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFVoice)];
+
+			if (subObject->objectFlags & kOFNumber) {
+				uint speechIdOffs = subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)];
+
+				if (speechId == 116)
+					speechId = speechIdOffs + 115;
+				if (speechId == 92)
+					speechId = speechIdOffs + 98;
+				if (speechId == 99)
+					speechId = 9;
+				if (speechId == 97) {
+					switch (speechIdOffs) {
+					case 12:
+						speechId = 109;
+						break;
+					case 14:
+						speechId = 108;
+						break;
+					case 18:
+						speechId = 107;
+						break;
+					case 20:
+						speechId = 106;
+						break;
+					case 22:
+						speechId = 105;
+						break;
+					case 28:
+						speechId = 104;
+						break;
+					case 90:
+						speechId = 103;
+						break;
+					case 92:
+						speechId = 102;
+						break;
+					case 100:
+						speechId = 51;
+						break;
+					default:
+						error("o2_screenTextPObj: invalid case %d", speechIdOffs);
+					}
+				}
+			}
+
+			if (_speech)
+				playSpeech(speechId, vgaSpriteId);
+		}
+
+	}
+
+	if (subObject != NULL && (subObject->objectFlags & kOFText) && _subtitles) {
+		if (subObject->objectFlags & kOFNumber) {
+			sprintf(buf, "%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], string_ptr);
+			string_ptr = buf;
+		}
+		if (string_ptr != NULL)
+			printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
+	}
+}
+
 void SimonEngine::o2_mouseOff() {
 	// 181: force mouseOff
 	scriptMouseOff();
@@ -1948,6 +1977,35 @@
 	_variableArray2[57] = result;
 }
 
+void SimonEngine::o3_screenTextPObj() {
+	// 177: inventory descriptions
+	uint vgaSpriteId = getVarOrByte();
+	uint color = getVarOrByte();
+	const char *string_ptr = NULL;
+	TextLocation *tl = NULL;
+	char buf[256];
+
+	SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
+	if (subObject != NULL && subObject->objectFlags & kOFText) {
+		string_ptr = (const char *)getStringPtrByID(subObject->objectFlagValue[0]);
+		tl = getTextLocation(vgaSpriteId);
+	}
+
+	if (subObject != NULL && subObject->objectFlags & kOFVoice) {
+		uint offs = getOffsetOfChild2Param(subObject, kOFVoice);
+		playSpeech(subObject->objectFlagValue[offs], vgaSpriteId);
+	}
+
+	if (subObject != NULL && (subObject->objectFlags & kOFText) && _subtitles) {
+		if (subObject->objectFlags & kOFNumber) {
+			sprintf(buf, "%d%s", subObject->objectFlagValue[getOffsetOfChild2Param(subObject, kOFNumber)], string_ptr);
+			string_ptr = buf;
+		}
+		if (string_ptr != NULL)
+			printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
+	}
+}
+
 void SimonEngine::o3_mouseOff() {
 	// 181: force mouseOff
 	scriptMouseOff();

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-17 22:35:33 UTC (rev 21990)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-17 22:47:12 UTC (rev 21991)
@@ -932,7 +932,6 @@
 	void o_b2NotZero();
 	void o_lockZones();
 	void o_unlockZones();
-	void o_screenTextPObj();
 	void o_getPathPosn();
 	void o_scnTxtLongText();
 	void o_mouseOn();
@@ -945,6 +944,7 @@
 	void o1_animate();
 	void o1_stopAnimate();
 	void o1_playTune();
+	void o1_screenTextPObj();
 	void o1_mouseOff();
 	void o1_loadBeard();
 	void o1_unloadBeard();
@@ -957,6 +957,7 @@
 	void o2_animate();
 	void o2_stopAnimate();
 	void o2_playTune();
+	void o2_screenTextPObj();
 	void o2_mouseOff();
 	void o2_isShortText();
 	void o2_clearMarks();
@@ -980,6 +981,7 @@
 	void o3_hyperLinkOn();
 	void o3_hyperLinkOff();
 	void o3_checkPaths();
+	void o3_screenTextPObj();
 	void o3_mouseOff();
 	void o3_loadVideo();
 	void o3_playVideo();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list