[Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,2.91,2.92 scumm.h,1.205,1.206 scummvm.cpp,2.170,2.171 verbs.cpp,1.43,1.44

James Brown ender at users.sourceforge.net
Wed May 21 03:14:03 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv4933/scumm

Modified Files:
	script_v2.cpp scumm.h scummvm.cpp verbs.cpp 
Log Message:
Work on V2 inventory hack a little more


Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.91
retrieving revision 2.92
diff -u -d -r2.91 -r2.92
--- script_v2.cpp	21 May 2003 09:29:24 -0000	2.91
+++ script_v2.cpp	21 May 2003 10:13:05 -0000	2.92
@@ -875,21 +875,25 @@
 void Scumm_v2::o2_drawSentence() {
 	ScummVM::Rect sentenceline;
 	static char sentence[80];
+	byte *temp;
 	int slot = getVerbSlot(_scummVars[VAR_SENTENCE_VERB],0);
 
 	if (!(_userState & 32))
 		return;
 
 	strcpy(sentence, (char*)getResourceAddress(rtVerb, slot));
-
-	if (_scummVars[27] > 0) {
-		strcat(sentence, " ");
-		strcat(sentence, (char*)getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT1]));
+	if (_scummVars[VAR_SENTENCE_OBJECT1] > 0) {
+		if (temp = getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT1])) {
+			strcat(sentence, " ");
+			strcat(sentence, (char*)temp);
+		}
 	}
 
-	if (_scummVars[28] > 0) {
-		strcat(sentence, " ");
-		strcat(sentence, (char*)getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT2]));
+	if (_scummVars[VAR_SENTENCE_OBJECT2] > 0) {
+		if (temp = getObjOrActorName(_scummVars[VAR_SENTENCE_OBJECT2])) {
+			strcat(sentence, " with ");
+			strcat(sentence, (char*)temp);
+		}
 	}
 
 	_string[2].charset = 1;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- scumm.h	21 May 2003 09:29:24 -0000	1.205
+++ scumm.h	21 May 2003 10:13:06 -0000	1.206
@@ -713,6 +713,7 @@
 	void runObjectScript(int script, int entry, bool freezeResistant, bool recursive, int *vars);
 	void setVerbObject(uint room, uint object, uint verb);
 
+	void checkV2Inventory(int x, int y);
 	void redrawV2Inventory();
 
 public:

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.170
retrieving revision 2.171
diff -u -d -r2.170 -r2.171
--- scummvm.cpp	21 May 2003 07:22:43 -0000	2.170
+++ scummvm.cpp	21 May 2003 10:13:06 -0000	2.171
@@ -1868,9 +1868,12 @@
 
 			if (zone->number == 0)		// Clicked in scene
 				_scummVars[VAR_CLICK_AREA] = 2;
-			else if (zone->number == 2) 	// Clicked in verb/sentence
-				_scummVars[VAR_CLICK_AREA] = 1;
-
+			else if (zone->number == 2) {	// Clicked in verb/sentence
+				if (_mouse.y > zone->topline + 32)
+					_scummVars[VAR_CLICK_AREA] = 3; // Inventory
+				else
+					_scummVars[VAR_CLICK_AREA] = 1; // Verb
+			}
 		} else if (_lastKeyHit) 		// Key Input
 			_scummVars[VAR_CLICK_AREA] = 4;
 	}

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- verbs.cpp	21 May 2003 09:29:24 -0000	1.43
+++ verbs.cpp	21 May 2003 10:13:06 -0000	1.44
@@ -27,35 +27,53 @@
 #include "scumm.h"
 #include "verbs.h"
 
+void Scumm::checkV2Inventory(int x, int y) {
+	int object = 0;
+
+	if ((y < virtscr[2].topline + 34) || !(_mouseButStat & MBS_LEFT_CLICK)) 
+		return;
+
+	object = ((y - virtscr[2].topline - 34) / 8) * 2;
+	if (x > 150)
+		object++;
+
+	object = findInventory(_scummVars[VAR_EGO], object+1);
+	if (object > 0) {
+		_scummVars[35] = object;
+		runScript(4, 0, 0, 0);
+	}
+}
+
 void Scumm::redrawV2Inventory() {
 	int i, items = 0, curInventoryCount = 0;
 	bool alternate = false;
+	int max_inv = getInventoryCount(_scummVars[VAR_EGO]);
 
 	if (!(_userState & 64))
 		return;
 
-	if (curInventoryCount > _maxInventoryItems)
-		curInventoryCount = _maxInventoryItems;
+	if (curInventoryCount > max_inv)
+		curInventoryCount = max_inv;
 
-	for (i = curInventoryCount + 1; i <= _maxInventoryItems; i++) {
-		if (_inventory[i] != 0) {
-			_string[1].charset = 1;
-			_string[1].ypos = virtscr[2].topline + 34 + (8*(items / 2));
-			_string[1].color = 5;
-			_messagePtr = getObjOrActorName(_inventory[i]);
+	_string[1].charset = 1;
+	_string[1].color = 5;
 
-			if (alternate)
-				_string[1].xpos = 200;
-			else
-				_string[1].xpos = 0;
+	items = 0;
+	for (i = curInventoryCount + 1; i <= max_inv; i++) {
+		int obj = findInventory(_scummVars[VAR_EGO], i);
+		if ((obj == 0) || (items == 4)) break;
+		
+		_string[1].ypos = virtscr[2].topline + 34 + (8*(items / 2));
+		if (alternate)
+			_string[1].xpos = 200;
+		else
+			_string[1].xpos = 0;
 
-			drawString(1);
+		_messagePtr = getObjOrActorName(obj);
+		drawString(1);
+		items++;
 
-			items++;
-			alternate = !alternate;
-		}
-		if (items == 4)
-			break;
+		alternate = !alternate;
 	}
 
 	if (curInventoryCount > 0) { // Draw Up Arrow
@@ -72,6 +90,7 @@
 		drawString(1);
 	}
 }
+
 void Scumm::redrawVerbs() {
 	int i;
 	int verb = (_cursor.state > 0 ? checkMouseOver(_mouse.x, _mouse.y) : 0);
@@ -158,6 +177,10 @@
 
 		return i;
 	} while (--vs, --i);
+
+	if (_features & GF_AFTER_V2)
+		checkV2Inventory(x, y);
+
 	return 0;
 }
 





More information about the Scummvm-git-logs mailing list