[Scummvm-cvs-logs] SF.net SVN: scummvm: [27778] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jun 30 01:08:15 CEST 2007


Revision: 27778
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27778&view=rev
Author:   fingolfin
Date:     2007-06-29 16:08:15 -0700 (Fri, 29 Jun 2007)

Log Message:
-----------
Introduced ClickArea enum, some related cleanup in runInputScript and checkExecVerbs

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/input.cpp
    scummvm/trunk/engines/scumm/intern.h
    scummvm/trunk/engines/scumm/script.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/verbs.cpp
    scummvm/trunk/engines/scumm/verbs.h

Modified: scummvm/trunk/engines/scumm/input.cpp
===================================================================
--- scummvm/trunk/engines/scumm/input.cpp	2007-06-29 22:39:52 UTC (rev 27777)
+++ scummvm/trunk/engines/scumm/input.cpp	2007-06-29 23:08:15 UTC (rev 27778)
@@ -437,11 +437,6 @@
 	// Fall back to default behavior
 	ScummEngine::processKeyboard(lastKeyHit);
 
-	// Store the input type. So far we can't distinguish
-	// between 1, 3 and 5.
-	// 1) Verb	2) Scene	3) Inv.		4) Key
-	// 5) Sentence Bar
-
 	if (VAR_KEYPRESS != 0xFF && _mouseAndKeyboardStat) {		// Key Input
 		if (315 <= _mouseAndKeyboardStat && _mouseAndKeyboardStat <= 323) {
 			// Convert F-Keys for V1/V2 games (they start at 1)

Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h	2007-06-29 22:39:52 UTC (rev 27777)
+++ scummvm/trunk/engines/scumm/intern.h	2007-06-29 23:08:15 UTC (rev 27778)
@@ -313,7 +313,7 @@
 	virtual void readGlobalObjects();
 	virtual void loadCharset(int no);
 
-	virtual void runInputScript(int a, int cmd, int mode);
+	virtual void runInputScript(int clickArea, int val, int mode);
 	virtual void runInventoryScript(int i);
 
 	virtual int getVar();

Modified: scummvm/trunk/engines/scumm/script.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script.cpp	2007-06-29 22:39:52 UTC (rev 27777)
+++ scummvm/trunk/engines/scumm/script.cpp	2007-06-29 23:08:15 UTC (rev 27778)
@@ -1156,39 +1156,39 @@
 		runScript(sentenceScript, 0, 0, localParamList);
 }
 
-void ScummEngine_v2::runInputScript(int a, int cmd, int mode) {
+void ScummEngine_v2::runInputScript(int clickArea, int val, int mode) {
 	int args[24];
 	int verbScript;
 
 	verbScript = 4;
-	VAR(VAR_CLICK_AREA) = a;
-	switch (a) {
-	case 1:		// Verb clicked
-		VAR(VAR_CLICK_VERB) = cmd;
+	VAR(VAR_CLICK_AREA) = clickArea;
+	switch (clickArea) {
+	case kVerbClickArea:		// Verb clicked
+		VAR(VAR_CLICK_VERB) = val;
 		break;
-	case 3:		// Inventory clicked
-		VAR(VAR_CLICK_OBJECT) = cmd;
+	case kInventoryClickArea:		// Inventory clicked
+		VAR(VAR_CLICK_OBJECT) = val;
 		break;
 	}
 
 	memset(args, 0, sizeof(args));
-	args[0] = a;
-	args[1] = cmd;
+	args[0] = clickArea;
+	args[1] = val;
 	args[2] = mode;
 
 	if (verbScript)
 		runScript(verbScript, 0, 0, args);
 }
 
-void ScummEngine::runInputScript(int a, int cmd, int mode) {
+void ScummEngine::runInputScript(int clickArea, int val, int mode) {
 	int args[24];
 	int verbScript;
 
 	verbScript = VAR(VAR_VERB_SCRIPT);
 
 	memset(args, 0, sizeof(args));
-	args[0] = a;
-	args[1] = cmd;
+	args[0] = clickArea;
+	args[1] = val;
 	args[2] = mode;
 	// All HE 72+ games but only some HE 71 games.
 	if (_game.heversion >= 71) {
@@ -1198,18 +1198,18 @@
 
 	// Macintosh verison of indy3ega used different interface, so adjust values.
 	if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformMacintosh) {
-		if (a == 1 && (cmd >= 101 && cmd <= 108)) {
-			if (cmd == 107) {
+		if (clickArea == kVerbClickArea && (val >= 101 && val <= 108)) {
+			if (val == 107) {
 				VAR(67) -= 2;
 				inventoryScript();
 				return;
-			} else if (cmd == 108) {
+			} else if (val == 108) {
 				VAR(67) += 2;
 				inventoryScript();
 				return;
 			} else {
 				args[0] = 3;
-				args[1] = VAR(83 + (cmd - 101));
+				args[1] = VAR(83 + (val - 101));
 			}
 		}
 	}

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2007-06-29 22:39:52 UTC (rev 27777)
+++ scummvm/trunk/engines/scumm/scumm.h	2007-06-29 23:08:15 UTC (rev 27778)
@@ -863,7 +863,7 @@
 	void verbMouseOver(int verb);
 	int findVerbAtPos(int x, int y) const;
 	virtual void drawVerb(int verb, int mode);
-	virtual void runInputScript(int a, int cmd, int mode);
+	virtual void runInputScript(int clickArea, int val, int mode);
 	void restoreVerbBG(int verb);
 	void drawVerbBitmap(int verb, int x, int y);
 	int getVerbSlot(int id, int mode) const;

Modified: scummvm/trunk/engines/scumm/verbs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/verbs.cpp	2007-06-29 22:39:52 UTC (rev 27777)
+++ scummvm/trunk/engines/scumm/verbs.cpp	2007-06-29 23:08:15 UTC (rev 27778)
@@ -385,7 +385,7 @@
 					runObject(_activeInventory, _activeVerb);
 			}
 		} else {
-			runInputScript(3, object, 0);
+			runInputScript(kInventoryClickArea, object, 0);
 		}
 	}
 }
@@ -537,7 +537,7 @@
 				if (vs->verbid && vs->saveid == 0 && vs->curmode == 1) {
 					if (_mouseAndKeyboardStat == vs->key) {
 						// Trigger verb as if the user clicked it
-						runInputScript(1, vs->verbid, 1);
+						runInputScript(kVerbClickArea, vs->verbid, 1);
 						return;
 					}
 				}
@@ -580,14 +580,14 @@
 				// Check if person is available (see script 23 from ZAK_FM-TOWNS and script 4 from ZAK_PC).
 				// Zak: Var[144 Bit 15], Annie: Var[145 Bit 0], Melissa: Var[145 Bit 1], Leslie: Var[145 Bit 2]
 				if (!readVar(0x890E + fKey)) {
-					runInputScript(1, 36 + fKey, 0);
+					runInputScript(kVerbClickArea, 36 + fKey, 0);
 				}
 			}
 			return;
 		}
 
 		// Generic keyboard input
-		runInputScript(4, _mouseAndKeyboardStat, 1);
+		runInputScript(kKeyClickArea, _mouseAndKeyboardStat, 1);
 	} else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
 		VirtScreen *zone = findVirtScreen(_mouse.y);
 		byte code = _mouseAndKeyboardStat & MBS_LEFT_CLICK ? 1 : 2;
@@ -600,7 +600,7 @@
 
 		if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
 			// Click into V2 sentence line
-			runInputScript(5, 0, 0);
+			runInputScript(kSentenceClickArea, 0, 0);
 		} else if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + inventoryArea) {
 			// Click into V2 inventory
 			((ScummEngine_v2 *)this)->checkV2Inventory(_mouse.x, _mouse.y);
@@ -608,10 +608,10 @@
 			over = findVerbAtPos(_mouse.x, _mouse.y);
 			if (over != 0) {
 				// Verb was clicked
-				runInputScript(1, _verbs[over].verbid, code);
+				runInputScript(kVerbClickArea, _verbs[over].verbid, code);
 			} else {
 				// Scene was clicked
-				runInputScript((zone->number == kMainVirtScreen) ? 2 : 1, 0, code);
+				runInputScript((zone->number == kMainVirtScreen) ? kSceneClickArea : kVerbClickArea, 0, code);
 			}
 		}
 	}

Modified: scummvm/trunk/engines/scumm/verbs.h
===================================================================
--- scummvm/trunk/engines/scumm/verbs.h	2007-06-29 22:39:52 UTC (rev 27777)
+++ scummvm/trunk/engines/scumm/verbs.h	2007-06-29 23:08:15 UTC (rev 27778)
@@ -30,6 +30,18 @@
 
 namespace Scumm {
 
+/**
+ * The area in which some click (or key press) occured and which is passed
+ * to the input script.
+ */
+enum ClickArea {
+	kVerbClickArea = 1,
+	kSceneClickArea = 2,
+	kInventoryClickArea = 3,
+	kKeyClickArea = 4,
+	kSentenceClickArea = 5
+};
+
 enum {
 	kTextVerbType = 0,
 	kImageVerbType = 1


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