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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Apr 8 22:03:02 CEST 2006


Revision: 21712
Author:   kirben
Date:     2006-04-08 21:53:31 -0700 (Sat, 08 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21712&view=rev

Log Message:
-----------
Add centreScroll() for FF and hyperbox code differences in FF.

Modified Paths:
--------------
    scummvm/trunk/engines/simon/charset.cpp
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
    scummvm/trunk/engines/simon/string.cpp
    scummvm/trunk/engines/simon/verb.cpp
    scummvm/trunk/engines/simon/vga.cpp
Modified: scummvm/trunk/engines/simon/charset.cpp
===================================================================
--- scummvm/trunk/engines/simon/charset.cpp	2006-04-09 03:16:05 UTC (rev 21711)
+++ scummvm/trunk/engines/simon/charset.cpp	2006-04-09 04:53:31 UTC (rev 21712)
@@ -183,7 +183,7 @@
 	VgaPointersEntry *vpe = &_vgaBufferPointers[2];
 	byte *src, *dst, *p, *dst_org, chr;
 	const int textHeight = (getGameType() == GType_FF) ? 15: 10;
-	uint count;
+	uint count = 0;
 
 	if (vga_sprite_id >= 100) {
 		vga_sprite_id -= 100;
@@ -192,9 +192,14 @@
 
 	src = dst = vpe->vgaFile2;
 
-	count = 4000;
-	if (vga_sprite_id == 1)
-		count *= 2;
+	if (getGameType() == GType_FF) {
+		if (vga_sprite_id == 1)
+			count = 11025;
+	} else {
+		count = 4000;
+		if (vga_sprite_id == 1)
+			count *= 2;
+	}
 
 	p = dst + vga_sprite_id * 8;
 
@@ -207,7 +212,9 @@
 	}
 	dst += readUint32Wrapper(p);
 
-	memset(dst, 0, count);
+	if (count != 0)
+		memset(dst, 0, count);
+
 	if (_language == Common::HB_ISR)
 		dst += width - 1; // For Hebrew, start at the right edge, not the left.
 

Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-09 03:16:05 UTC (rev 21711)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-09 04:53:31 UTC (rev 21712)
@@ -1512,7 +1512,7 @@
 
 void SimonEngine::o3_centreScroll() {
 	// 187
-	warning("STUB: script opcode 187");
+	centreScroll();
 }
 
 void SimonEngine::o3_resetPVCount() {

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-09 03:16:05 UTC (rev 21711)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-09 04:53:31 UTC (rev 21712)
@@ -1554,6 +1554,7 @@
 
 void SimonEngine::setup_cond_c_helper() {
 	HitArea *last;
+	uint id;
 
 	_noRightClick = 1;
 
@@ -1644,7 +1645,14 @@
 			inventoryDown(_lastHitArea->window);
 		} else if (_lastHitArea->item_ptr != NULL) {
 			_hitAreaObjectItem = _lastHitArea->item_ptr;
-			_variableArray[60] = (_lastHitArea->flags & kBFTextBox) ? (_lastHitArea->flags / 256) : 0xFFFF;
+			id = 0xFFFF;
+			if (_lastHitArea->flags & kBFTextBox) {
+				if (getGameType() == GType_FF && (_lastHitArea->flags & kBFHyperBox))
+					id = _lastHitArea->data;
+				else
+					id = _lastHitArea->flags / 256;
+			}
+			_variableArray[60] = id;
 			break;
 		}
 	}
@@ -1950,8 +1958,12 @@
 			if_1:;
 				_hitAreaSubjectItem = ha->item_ptr;
 				id = 0xFFFF;
-				if (ha->flags & kBFTextBox)
-					id = ha->flags / 256;
+				if (ha->flags & kBFTextBox) {
+					if (getGameType() == GType_FF && (ha->flags & kBFHyperBox))
+						id = ha->data;
+					else
+						id = ha->flags / 256;
+				}
 				_variableArray[60] = id;
 				displayName(ha);
 				if (_verbHitArea != 0)

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-09 03:16:05 UTC (rev 21711)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-09 04:53:31 UTC (rev 21712)
@@ -67,6 +67,7 @@
 	uint16 width, height;
 	uint16 flags;
 	uint16 id;
+	uint16 data;
 	WindowBlock *window;
 	Item *item_ptr;
 	uint16 verb;
@@ -1015,6 +1016,7 @@
 	int getScale(int y, int x);
 	void checkScrollX(int x, int xpos);
 	void checkScrollY(int y, int ypos);
+	void centreScroll();
 
 	bool itemIsSiblingOf(uint16 val);
 	bool itemIsParentOf(uint16 a, uint16 b);

Modified: scummvm/trunk/engines/simon/string.cpp
===================================================================
--- scummvm/trunk/engines/simon/string.cpp	2006-04-09 03:16:05 UTC (rev 21711)
+++ scummvm/trunk/engines/simon/string.cpp	2006-04-09 04:53:31 UTC (rev 21712)
@@ -125,8 +125,6 @@
 }
 
 void SimonEngine::printInteractText(uint16 num, const char *string) {
-	printf("printInteractText: num %d, string %s\n", num, string);
-
 	char convertedString[320];
 	char *convertedString2 = convertedString;
 	const char *string2 = string;

Modified: scummvm/trunk/engines/simon/verb.cpp
===================================================================
--- scummvm/trunk/engines/simon/verb.cpp	2006-04-09 03:16:05 UTC (rev 21711)
+++ scummvm/trunk/engines/simon/verb.cpp	2006-04-09 04:53:31 UTC (rev 21712)
@@ -396,7 +396,7 @@
 	ha->item_ptr = item_ptr;
 
 	if (getGameType() == GType_FF && (ha->flags & kBFHyperBox)) {
-		// TODO
+		ha->data = _hyperLink;
 		ha->priority = 50;
 	}
 

Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp	2006-04-09 03:16:05 UTC (rev 21711)
+++ scummvm/trunk/engines/simon/vga.cpp	2006-04-09 04:53:31 UTC (rev 21712)
@@ -2424,8 +2424,8 @@
 	vsp->y = posy;
 
 	setBitFlag(85, false);
-	if (getBitFlag(74) == true) {
-		//centreScroll();
+	if (getBitFlag(74)) {
+		centreScroll();
 	}
 }
 
@@ -2569,4 +2569,40 @@
 	}
 }
 
+void SimonEngine::centreScroll() {
+	int16 x, y, tmp;
+
+	if (_scrollXMax != 0) {
+		_scrollCount = 0;
+		x = _variableArray[15] - _scrollX;
+		if (getBitFlag(85) || x >= 624) {
+			x -= 320;
+			tmp = _scrollXMax - _scrollX;
+			if (tmp < x)
+				x = tmp;
+			_scrollCount = x;
+		} else if (x < 17) {
+			x -= 320;
+			if (_scrollX < -x)
+				x = -_scrollX;
+			_scrollCount = x;
+		}
+	} else if (_scrollYMax != 0) {
+		_scrollCount = 0;
+		y = _variableArray[16] - _scrollY;
+		if (y >= 460) {
+			y -= 240;
+			tmp = _scrollYMax - _scrollY;
+			if (tmp < y)
+				y = tmp;
+			_scrollCount = y;
+		} else if (y < 30) {
+			y -= 240;
+			if (_scrollY < -y)
+				y = -_scrollY;
+			_scrollCount = y;
+		}
+	}
+}
+
 } // End of namespace Simon


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