[Scummvm-cvs-logs] CVS: scummvm/scumm costume.cpp,1.162,1.163 gfx.cpp,2.405,2.406 gfx.h,1.102,1.103 object.cpp,1.208,1.209 verbs.cpp,1.115,1.116

Eugene Sandulenko sev at users.sourceforge.net
Tue Mar 15 18:15:39 CET 2005


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

Modified Files:
	costume.cpp gfx.cpp gfx.h object.cpp verbs.cpp 
Log Message:
Patch from Quietust. Proper drawing of objects and fixes to inventory.


Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -d -r1.162 -r1.163
--- costume.cpp	15 Mar 2005 21:48:02 -0000	1.162
+++ costume.cpp	16 Mar 2005 02:14:31 -0000	1.163
@@ -842,7 +842,7 @@
 	if (_features & GF_NES) {
 		a->_cost.curpos[0] = 0;
 		a->_cost.start[0] = 0;
-		a->_cost.end[0] = getResourceAddress(rtCostume,a->_costume)[2+0*2+1];
+		a->_cost.end[0] = getResourceAddress(rtCostume, a->_costume)[2 + 8 * frame + 2 * newDirToOldDir(a->getFacing()) + 1];
 		a->_cost.frame[0] = frame;
 		return;
 	}

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.405
retrieving revision 2.406
diff -u -d -r2.405 -r2.406
--- gfx.cpp	15 Mar 2005 21:48:03 -0000	2.405
+++ gfx.cpp	16 Mar 2005 02:14:32 -0000	2.406
@@ -1371,7 +1371,7 @@
 
 		if (_vm->_version == 1) {
 			if (_vm->_features & GF_NES)
-				drawStripNES(dstPtr, vs->pitch, stripnr, height);
+				drawStripNES(dstPtr, vs->pitch, stripnr, y, height, _C64ObjectMode);
 			else if (_C64ObjectMode)
 				drawStripC64Object(dstPtr, vs->pitch, stripnr, width, height);
 			else
@@ -1872,22 +1872,40 @@
 	// there's another pointer at room + 0x0E, but I don't know what data it points at
 }
 
-void Gdi::drawStripNES(byte *dst, int dstPitch, int stripnr, int height) {
+void Gdi::decodeNESObject(const byte *ptr, int xpos, int ypos, int width, int height) {
+	int y;
+
+	_NESObj_x = xpos;
+	ypos /= 8;
+	height /= 8;
+
+	for (y = ypos; y < ypos + height; y++) {
+		int x = xpos;
+		while (x < xpos + width) {
+			byte len = *ptr++;
+			for (int i = 0; i < (len & 0x7F); i++)
+				_NESNametableObj[y][2 + x++] = (len & 0x80) ? (*ptr++) : (*ptr);
+			if (!(len & 0x80))
+				ptr++;
+		}
+	}
+}
+
+void Gdi::drawStripNES(byte *dst, int dstPitch, int stripnr, int top, int height, bool isObject) {
 //	printf("drawStripNES, pitch=%i, strip=%i, height=%i\n",dstPitch,stripnr,height);
+	top /= 8;
 	height /= 8;
 	int x = stripnr + 2;	// NES version has a 2 tile gap on each edge
 
-	if (height > 16) {
-//		debug(0,"NES room data %i (not 128) pixels high!\n",height);
-		height = 16;
-	}
+	if (isObject)
+		x += _NESObj_x; // for objects, need to start at the left edge of the object, not the screen
 	if (x > 63) {
 		debug(0,"NES tried to render invalid strip %i",stripnr);
 		return;
 	}
-	for (int y = 0; y < height; y++) {
+	for (int y = top; y < top + height; y++) {
 		int palette = (_NESAttributes[((y << 2) & 0x30) | ((x >> 2) & 0xF)] >> (((y & 2) << 1) | (x & 2))) & 0x3;
-		int tile = _NESNametable[y][x];
+		int tile = isObject ? _NESNametableObj[y][x] : _NESNametable[y][x];
 
 		for (int i = 0; i < 8; i++) {
 			byte c0 = _NESPatTable[tile * 16 + i];

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.h,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- gfx.h	13 Mar 2005 23:18:56 -0000	1.102
+++ gfx.h	16 Mar 2005 02:14:34 -0000	1.103
@@ -231,6 +231,8 @@
 
 	byte _NESPatTable[4096], _NESNametable[16][64], _NESAttributes[64], _NESPalette[16];
 	byte _NESBaseTiles;
+	byte _NESNametableObj[16][64];
+	int _NESObj_x;
 
 	/* Bitmap decompressors */
 	bool decompressBitmap(byte *dst, int dstPitch, const byte *src, int numLinesToProcess);
@@ -238,7 +240,7 @@
 	void drawStripEGA(byte *dst, int dstPitch, const byte *src, int height) const;
 	void drawStripC64Object(byte *dst, int dstPitch, int stripnr, int width, int height);
 	void drawStripC64Background(byte *dst, int dstPitch, int stripnr, int height);
-	void drawStripNES(byte *dst, int dstPitch, int stripnr, int height);
+	void drawStripNES(byte *dst, int dstPitch, int stripnr, int top, int height, bool isObject);
 
 	void drawStripComplex(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
 	void drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height, const bool transpCheck) const;
@@ -280,6 +282,7 @@
 	StripTable *generateStripTable(const byte *src, int width, int height, StripTable *table) const;
 	void decodeC64Gfx(const byte *src, byte *dst, int size) const;
 	void decodeNESGfx(const byte *room);
+	void decodeNESObject(const byte *ptr, int xpos, int ypos, int width, int height);
 
 	void drawBMAPBg(const byte *ptr, VirtScreen *vs, int startstrip);
 	void drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y, int w, int h);

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- object.cpp	13 Mar 2005 00:04:32 -0000	1.208
+++ object.cpp	16 Mar 2005 02:14:35 -0000	1.209
@@ -482,7 +482,11 @@
 
 		if (_version == 1) {
 			gdi._C64ObjectMode = true;
-			gdi.decodeC64Gfx(ptr, gdi._C64ObjectMap, width * (height / 8) * 3);
+			if (_features & GF_NES) {
+				gdi.decodeNESObject(ptr, xpos, ypos, width, height);
+			} else {
+				gdi.decodeC64Gfx(ptr, gdi._C64ObjectMap, width * (height / 8) * 3);
+			}
 		}
 		// Sam & Max needs this to fix object-layering problems with
 		// the inventory and conversation icons.

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- verbs.cpp	1 Jan 2005 16:09:16 -0000	1.115
+++ verbs.cpp	16 Mar 2005 02:14:35 -0000	1.116
@@ -55,19 +55,32 @@
 	// Inventory items
 
 	for (i = 0; i < 2; i++) {
-		v2_mouseover_boxes[2 * i].rect.left = 0;
-		v2_mouseover_boxes[2 * i].rect.right = 144;
-		v2_mouseover_boxes[2 * i].rect.top = 32 + 8 * i;
-		v2_mouseover_boxes[2 * i].rect.bottom = v2_mouseover_boxes[2 * i].rect.top + 8;
+		if (_features & GF_NES) {
+			v2_mouseover_boxes[2 * i].rect.left = 0;
+			v2_mouseover_boxes[2 * i].rect.right = 96;
+			v2_mouseover_boxes[2 * i].rect.top = 48 + 8 * i;
+			v2_mouseover_boxes[2 * i].rect.bottom = v2_mouseover_boxes[2 * i].rect.top + 8;
+		} else {
+			v2_mouseover_boxes[2 * i].rect.left = 0;
+			v2_mouseover_boxes[2 * i].rect.right = 144;
+			v2_mouseover_boxes[2 * i].rect.top = 32 + 8 * i;
+			v2_mouseover_boxes[2 * i].rect.bottom = v2_mouseover_boxes[2 * i].rect.top + 8;
+		}
 
 		v2_mouseover_boxes[2 * i].color = color;
 		v2_mouseover_boxes[2 * i].hicolor = hi_color;
 
-
-		v2_mouseover_boxes[2 * i + 1].rect.left = 176;
-		v2_mouseover_boxes[2 * i + 1].rect.right = 320;
-		v2_mouseover_boxes[2 * i + 1].rect.top = v2_mouseover_boxes[2 * i].rect.top;
-		v2_mouseover_boxes[2 * i + 1].rect.bottom = v2_mouseover_boxes[2 * i].rect.bottom;
+		if (_features & GF_NES) {
+			v2_mouseover_boxes[2 * i + 1].rect.left = 128;
+			v2_mouseover_boxes[2 * i + 1].rect.right = 224;
+			v2_mouseover_boxes[2 * i + 1].rect.top = v2_mouseover_boxes[2 * i].rect.top;
+			v2_mouseover_boxes[2 * i + 1].rect.bottom = v2_mouseover_boxes[2 * i].rect.bottom;
+		} else {
+			v2_mouseover_boxes[2 * i + 1].rect.left = 176;
+			v2_mouseover_boxes[2 * i + 1].rect.right = 320;
+			v2_mouseover_boxes[2 * i + 1].rect.top = v2_mouseover_boxes[2 * i].rect.top;
+			v2_mouseover_boxes[2 * i + 1].rect.bottom = v2_mouseover_boxes[2 * i].rect.bottom;
+		}
 
 		v2_mouseover_boxes[2 * i + 1].color = color;
 		v2_mouseover_boxes[2 * i + 1].hicolor = hi_color;
@@ -75,18 +88,32 @@
 
 	// Inventory arrows
 
-	v2_mouseover_boxes[kInventoryUpArrow].rect.left = 144;
-	v2_mouseover_boxes[kInventoryUpArrow].rect.right = 176;
-	v2_mouseover_boxes[kInventoryUpArrow].rect.top = 32;
-	v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 40;
+	if (_features & GF_NES) {
+		v2_mouseover_boxes[kInventoryUpArrow].rect.left = 96;
+		v2_mouseover_boxes[kInventoryUpArrow].rect.right = 128;
+		v2_mouseover_boxes[kInventoryUpArrow].rect.top = 48;
+		v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 56;
+	} else {
+		v2_mouseover_boxes[kInventoryUpArrow].rect.left = 144;
+		v2_mouseover_boxes[kInventoryUpArrow].rect.right = 176;
+		v2_mouseover_boxes[kInventoryUpArrow].rect.top = 32;
+		v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 40;
+	}
 
 	v2_mouseover_boxes[kInventoryUpArrow].color = arrow_color;
 	v2_mouseover_boxes[kInventoryUpArrow].hicolor = hi_color;
 
-	v2_mouseover_boxes[kInventoryDownArrow].rect.left = 144;
-	v2_mouseover_boxes[kInventoryDownArrow].rect.right = 176;
-	v2_mouseover_boxes[kInventoryDownArrow].rect.top = 40;
-	v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 48;
+	if (_features & GF_NES) {
+		v2_mouseover_boxes[kInventoryDownArrow].rect.left = 96;
+		v2_mouseover_boxes[kInventoryDownArrow].rect.right = 128;
+		v2_mouseover_boxes[kInventoryDownArrow].rect.top = 56;
+		v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 64;
+	} else {
+		v2_mouseover_boxes[kInventoryDownArrow].rect.left = 144;
+		v2_mouseover_boxes[kInventoryDownArrow].rect.right = 176;
+		v2_mouseover_boxes[kInventoryDownArrow].rect.top = 40;
+		v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 48;
+	}
 
 	v2_mouseover_boxes[kInventoryDownArrow].color = arrow_color;
 	v2_mouseover_boxes[kInventoryDownArrow].hicolor = hi_color;
@@ -94,7 +121,10 @@
 	// Sentence line
 
 	v2_mouseover_boxes[kSentenceLine].rect.left = 0;
-	v2_mouseover_boxes[kSentenceLine].rect.right = 320;
+	if (_features & GF_NES)
+		v2_mouseover_boxes[kSentenceLine].rect.right = 224;
+	else
+		v2_mouseover_boxes[kSentenceLine].rect.right = 320;
 	v2_mouseover_boxes[kSentenceLine].rect.top = 0;
 	v2_mouseover_boxes[kSentenceLine].rect.bottom = 8;
 





More information about the Scummvm-git-logs mailing list