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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Thu Apr 6 20:04:01 CEST 2006


Revision: 21659
Author:   kirben
Date:     2006-04-06 20:03:20 -0700 (Thu, 06 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21659&view=rev

Log Message:
-----------
Fix subtitle output in FF

Modified Paths:
--------------
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/string.cpp
    scummvm/trunk/engines/simon/verb.cpp
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-07 02:02:06 UTC (rev 21658)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-07 03:03:20 UTC (rev 21659)
@@ -317,7 +317,7 @@
 		opcode_table[171] = &SimonEngine::o3_hyperLinkOn;
 		opcode_table[172] = &SimonEngine::o3_hyperLinkOff;
 		opcode_table[173] = &SimonEngine::o3_checkPaths;
-		opcode_table[181] = &SimonEngine::o2_mouseOff;
+		opcode_table[181] = &SimonEngine::o3_mouseOff;
 		opcode_table[182] = &SimonEngine::o3_loadSmack;
 		opcode_table[183] = &SimonEngine::o3_playSmack;
 		opcode_table[185] = NULL;
@@ -1452,6 +1452,12 @@
 	warning("STUB: script opcode 173");
 }
 
+void SimonEngine::o3_mouseOff(bool &cond, int &ret) {
+	// 181: force mouseOff
+	o_mouseOff();
+	clearName();
+}
+
 void SimonEngine::o3_loadSmack(bool &cond, int &ret) {
 	// 182: load video file
 	debug(1,"Load video file: %s", getStringPtrByID(getNextStringID()));

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-07 02:02:06 UTC (rev 21658)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-07 03:03:20 UTC (rev 21659)
@@ -650,7 +650,6 @@
 	void printVerbOf(uint hitarea_id);
 	HitArea *findHitAreaByID(uint hitarea_id);
 
-	void printInteractText(uint16 num, const char *string);
 	void showActionString(const byte *string);
 	void videoPutchar(WindowBlock *window, byte c, byte b = 0);
 	void clearWindow(WindowBlock *window);
@@ -662,8 +661,6 @@
 
 	void setup_hitarea_from_pos(uint x, uint y, uint mode);
 	void displayName(HitArea * ha);
-	bool printTextOf(uint a, uint x, uint y);
-	bool printNameOf(Item *item, uint x, uint y);
 	void displayBoxStars();
 	void hitarea_stuff();
 
@@ -698,9 +695,13 @@
 	void loadSprite(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint palette);
 	void o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h);
 	void playSpeech(uint speech_id, uint vga_sprite_id);
-	void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
 	WindowBlock *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color);
 
+	bool printTextOf(uint a, uint x, uint y);
+	bool printNameOf(Item *item, uint x, uint y);
+	void printInteractText(uint16 num, const char *string);
+	void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
+
 	void renderStringAmiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
 	void renderString(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
 
@@ -969,6 +970,7 @@
 	void o3_hyperLinkOn(bool &cond, int &ret);
 	void o3_hyperLinkOff(bool &cond, int &ret);
 	void o3_checkPaths(bool &cond, int &ret);
+	void o3_mouseOff(bool &cond, int &ret);
 	void o3_loadSmack(bool &cond, int &ret);
 	void o3_playSmack(bool &cond, int &ret);
 	void o3_centreScroll(bool &cond, int &ret);

Modified: scummvm/trunk/engines/simon/string.cpp
===================================================================
--- scummvm/trunk/engines/simon/string.cpp	2006-04-07 02:02:06 UTC (rev 21658)
+++ scummvm/trunk/engines/simon/string.cpp	2006-04-07 03:03:20 UTC (rev 21659)
@@ -53,19 +53,23 @@
  	0, 0, 0, 0, 0, 7
 };
 
-static int getPixelLength(const char *string, int16 width) {
-	int pixels = 0;
+const char *getPixelLength(const char *string, uint16 maxWidth, uint16 &pixels) {
+	pixels = 0;
+
 	while (*string != 0) {
 		byte chr = *string;
-		if ((pixels + charWidth[chr]) > width)
+		if ((pixels + charWidth[chr]) > maxWidth)
 			break;	
 		pixels += charWidth[chr];
+		string++;
 	}
-	return pixels;
+
+	return string;
 }
 
 bool SimonEngine::printTextOf(uint a, uint x, uint y) {
 	const byte *stringPtr;
+	uint16 pixels, w;
 
 	if (getGameType() == GType_SIMON2) {
 		if (getBitFlag(79)) {
@@ -84,7 +88,8 @@
 
 	stringPtr = getStringPtrByID(_stringIdArray2[a]);
 	if (getGameType() == GType_FF) {
-		uint w = getPixelLength((const char *)stringPtr, 400) + 1;
+		getPixelLength((const char *)stringPtr, 400, pixels);
+		w = pixels + 1;
 		x -= w / 2;
 		printScreenText(6, 0, (const char *)stringPtr, x, y, w);
 	} else {
@@ -97,6 +102,7 @@
 bool SimonEngine::printNameOf(Item *item, uint x, uint y) {
 	SubObject *subObject;
 	const byte *stringPtr;
+	uint16 pixels, w;
 
 	if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
 		return false;
@@ -107,7 +113,8 @@
 
 	stringPtr = getStringPtrByID(subObject->objectName);
 	if (getGameType() == GType_FF) {
-		uint w = getPixelLength((const char *)stringPtr, 400) + 1;
+		getPixelLength((const char *)stringPtr, 400, pixels);
+		w = pixels + 1;
 		x -= w / 2;
 		printScreenText(6, 0, (const char *)stringPtr, x, y, w);
 	} else {
@@ -125,13 +132,10 @@
 	const char *string2 = string;
 	uint16 height = 15;
 	uint16 w = 620;
-	uint16 b;
-	uint16 x;
-	int pixels = 0;
+	uint16 b, pixels, x;
 
 	while (1) {
-		pixels = getPixelLength(string, 620);
-		string2 += pixels;
+		string2 = getPixelLength(string, 620, pixels);
 		if (*string2 == 0x00) {
 			if (w == 620)
 				w = pixels;
@@ -202,12 +206,11 @@
 	assert(stringLength > 0);
 
 	if (getGameType() == GType_FF) {
-		uint16 b, spaces;
-		uint16 len = width, pixels = 0;
+		uint16 b, pixels, spaces;
+		uint16 curWdth = width;
 
 		while (1) {
-			pixels = getPixelLength(string, len);
-			string2 += pixels;
+			string2 = getPixelLength(string, curWdth, pixels);
 			if (*string2 == 0) {
 				spaces = (width - pixels) / 12;
 				if (spaces != 0)
@@ -239,7 +242,7 @@
 			y -= textHeight;
 			if (y < 2)
 			    y = 2;
-			len = pixels;
+			curWdth = pixels;
 			string = string2;
 		}
 	} else {

Modified: scummvm/trunk/engines/simon/verb.cpp
===================================================================
--- scummvm/trunk/engines/simon/verb.cpp	2006-04-07 02:02:06 UTC (rev 21658)
+++ scummvm/trunk/engines/simon/verb.cpp	2006-04-07 03:03:20 UTC (rev 21659)
@@ -707,8 +707,8 @@
 		else
 			_animatePointer = 1;
 
-		if (!getBitFlag(99))
-			return;
+		//if (!getBitFlag(73))
+		//	return;
 
 		y = ha->y;
 		if (getBitFlag(99) && y > 288)


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