[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.400,2.401 scumm.cpp,1.375,1.376 verbs.cpp,1.118,1.119

kirben kirben at users.sourceforge.net
Mon Mar 21 16:47:08 CET 2005


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

Modified Files:
	intern.h scumm.cpp verbs.cpp 
Log Message:

Cleanup


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.400
retrieving revision 2.401
diff -u -d -r2.400 -r2.401
--- intern.h	17 Mar 2005 11:06:42 -0000	2.400
+++ intern.h	22 Mar 2005 00:46:47 -0000	2.401
@@ -244,6 +244,7 @@
 	void setUserState(byte state);
 
 	void initV2MouseOver();
+	void initNESMouseOver();
 
 	/* Version 2 script opcodes */
 	void o2_actorFromPos();

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.375
retrieving revision 1.376
diff -u -d -r1.375 -r1.376
--- scumm.cpp	21 Mar 2005 23:51:48 -0000	1.375
+++ scumm.cpp	22 Mar 2005 00:46:47 -0000	1.376
@@ -1532,11 +1532,11 @@
 void ScummEngine_v2::scummInit() {
 	ScummEngine::scummInit();
 
-	initV2MouseOver();
-
 	if (_features & GF_NES) {
+		initNESMouseOver();
 		_switchRoomEffect2 = _switchRoomEffect = 6;
 	} else {
+		initV2MouseOver();
 		// Seems in V2 there was only a single room effect (iris),
 		// so we set that here.
 		_switchRoomEffect2 = 1;

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- verbs.cpp	21 Mar 2005 23:51:48 -0000	1.118
+++ verbs.cpp	22 Mar 2005 00:46:48 -0000	1.119
@@ -40,11 +40,7 @@
 	int i;
 	int arrow_color, color, hi_color;
 
-	if (_features & GF_NES) {
-		color = 0;
-		hi_color = 0;
-		arrow_color = 0;
-	} else if (_version == 1) {
+	if (_version == 1) {
 		color = 16;
 		hi_color = 7;
 		arrow_color = 6;
@@ -59,32 +55,18 @@
 	// Inventory items
 
 	for (i = 0; i < 2; i++) {
-		if (_features & GF_NES) {
-			v2_mouseover_boxes[2 * i].rect.left = 0;
-			v2_mouseover_boxes[2 * i].rect.right = 104;
-			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].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;
 
-		if (_features & GF_NES) {
-			v2_mouseover_boxes[2 * i + 1].rect.left = 120;
-			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].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;
@@ -92,43 +74,85 @@
 
 	// Inventory arrows
 
-	if (_features & GF_NES) {
-		v2_mouseover_boxes[kInventoryUpArrow].rect.left = 104;
-		v2_mouseover_boxes[kInventoryUpArrow].rect.right = 112;
-		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].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;
 
-	if (_features & GF_NES) {
-		v2_mouseover_boxes[kInventoryDownArrow].rect.left = 112;
-		v2_mouseover_boxes[kInventoryDownArrow].rect.right = 120;
-		v2_mouseover_boxes[kInventoryDownArrow].rect.top = 48;
-		v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 56;
-	} 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].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;
+
+	// Sentence line
+
+	v2_mouseover_boxes[kSentenceLine].rect.left = 0;
+	v2_mouseover_boxes[kSentenceLine].rect.right = 320;
+	v2_mouseover_boxes[kSentenceLine].rect.top = 0;
+	v2_mouseover_boxes[kSentenceLine].rect.bottom = 8;
+
+	v2_mouseover_boxes[kSentenceLine].color = color;
+	v2_mouseover_boxes[kSentenceLine].hicolor = hi_color;
+}
+
+void ScummEngine_v2::initNESMouseOver() {
+	int i;
+	int arrow_color, color, hi_color;
+
+	color = 0;
+	hi_color = 0;
+	arrow_color = 0;
+
+	v2_mouseover_box = -1;
+
+	// Inventory items
+
+	for (i = 0; i < 2; i++) {
+		v2_mouseover_boxes[2 * i].rect.left = 0;
+		v2_mouseover_boxes[2 * i].rect.right = 104;
+		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;
+
+		v2_mouseover_boxes[2 * i].color = color;
+		v2_mouseover_boxes[2 * i].hicolor = hi_color;
+
+		v2_mouseover_boxes[2 * i + 1].rect.left = 120;
+		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;
+
+		v2_mouseover_boxes[2 * i + 1].color = color;
+		v2_mouseover_boxes[2 * i + 1].hicolor = hi_color;
 	}
 
+	// Inventory arrows
+
+	v2_mouseover_boxes[kInventoryUpArrow].rect.left = 104;
+	v2_mouseover_boxes[kInventoryUpArrow].rect.right = 112;
+	v2_mouseover_boxes[kInventoryUpArrow].rect.top = 48;
+	v2_mouseover_boxes[kInventoryUpArrow].rect.bottom = 56;
+
+	v2_mouseover_boxes[kInventoryUpArrow].color = arrow_color;
+	v2_mouseover_boxes[kInventoryUpArrow].hicolor = hi_color;
+
+	v2_mouseover_boxes[kInventoryDownArrow].rect.left = 112;
+	v2_mouseover_boxes[kInventoryDownArrow].rect.right = 120;
+	v2_mouseover_boxes[kInventoryDownArrow].rect.top = 48;
+	v2_mouseover_boxes[kInventoryDownArrow].rect.bottom = 56;
+
 	v2_mouseover_boxes[kInventoryDownArrow].color = arrow_color;
 	v2_mouseover_boxes[kInventoryDownArrow].hicolor = hi_color;
 
 	// Sentence line
 
 	v2_mouseover_boxes[kSentenceLine].rect.left = 0;
-	if (_features & GF_NES)
-		v2_mouseover_boxes[kSentenceLine].rect.right = 224;
-	else
-		v2_mouseover_boxes[kSentenceLine].rect.right = 320;
+	v2_mouseover_boxes[kSentenceLine].rect.right = 224;
 	v2_mouseover_boxes[kSentenceLine].rect.top = 0;
 	v2_mouseover_boxes[kSentenceLine].rect.bottom = 8;
 
@@ -238,6 +262,7 @@
 	int max_inv;
 	Common::Rect inventoryBox;
 	int inventoryArea = (_features & GF_NES) ? 48: 32;
+	int maxChars = (_features & GF_NES) ? 13: 18;
 
 	v2_mouseover_box = -1;
 
@@ -269,25 +294,13 @@
 		const byte *tmp = getObjOrActorName(obj);
 		assert(tmp);
 
-		if (_features & GF_NES) {
-			// Prevent inventory entries from overflowing by truncating the text
-			// after 104/8 = 13 chars
-			byte msg[13 + 1];
-			msg[13] = 0;
-			strncpy((char *)msg, (const char *)tmp, 13);
-			
-			// Draw it
-			drawString(1, msg);
-		} else {
-			// Prevent inventory entries from overflowing by truncating the text
-			// after 144/8 = 18 chars
-			byte msg[18 + 1];
-			msg[18] = 0;
-			strncpy((char *)msg, (const char *)tmp, 18);
-			
-			// Draw it
-			drawString(1, msg);
-		}
+		// Prevent inventory entries from overflowing by truncating the text
+		byte msg[20];
+		msg[maxChars] = 0;
+		strncpy((char *)msg, (const char *)tmp, maxChars);
+
+		// Draw it
+		drawString(1, msg);
 	}
 
 





More information about the Scummvm-git-logs mailing list