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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed Mar 1 17:18:37 CET 2006


Revision: 21000
Author:   kirben
Date:     2006-03-01 17:17:41 -0800 (Wed, 01 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=21000&view=rev

Log Message:
-----------
Improve input in C64 maniac

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/intern.h
    scummvm/trunk/engines/scumm/script.cpp
    scummvm/trunk/engines/scumm/script_v2.cpp
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h
    scummvm/trunk/engines/scumm/verbs.cpp
Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h	2006-03-02 00:50:52 UTC (rev 20999)
+++ scummvm/trunk/engines/scumm/intern.h	2006-03-02 01:17:41 UTC (rev 21000)
@@ -278,6 +278,7 @@
 	virtual void readGlobalObjects();
 	virtual void loadCharset(int no);
 
+	virtual void runInputScript(int a, int cmd, int mode);
 	virtual void runInventoryScript(int i);
 
 	virtual int getVar();
@@ -377,6 +378,10 @@
 	byte VAR_SENTENCE_OBJECT2;
 	byte VAR_SENTENCE_PREPOSITION;
 	byte VAR_BACKUP_VERB;
+
+	byte VAR_CLICK_AREA;
+	byte VAR_CLICK_VERB;
+	byte VAR_CLICK_OBJECT;
 };
 
 /**
@@ -392,7 +397,7 @@
 
 	const OpcodeEntryC64 *_opcodesC64;
 
-	int _currentAction;
+	int _activeVerb;
 	int _currentMode;
 public:
 	ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst);

Modified: scummvm/trunk/engines/scumm/script.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script.cpp	2006-03-02 00:50:52 UTC (rev 20999)
+++ scummvm/trunk/engines/scumm/script.cpp	2006-03-02 01:17:41 UTC (rev 21000)
@@ -27,6 +27,7 @@
 #include "common/util.h"
 
 #include "scumm/actor.h"
+#include "scumm/intern.h"
 #include "scumm/object.h"
 #include "scumm/resource.h"
 #include "scumm/util.h"
@@ -1137,33 +1138,40 @@
 		runScript(sentenceScript, 0, 0, localParamList);
 }
 
-void ScummEngine::runInputScript(int a, int cmd, int mode) {
+void ScummEngine_v2::runInputScript(int a, int cmd, int mode) {
 	int args[24];
 	int verbScript;
 
-	if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
-		verbScript = 3;
-		//_scummVars[9] = cmd;
-
-	} else if (_game.version <= 2) {
-		verbScript = 4;
-		VAR(VAR_CLICK_AREA) = a;
-		switch (a) {
-		case 1:		// Verb clicked
-			VAR(VAR_CLICK_VERB) = cmd;
-			break;
-		case 3:		// Inventory clicked
-			VAR(VAR_CLICK_OBJECT) = cmd;
-			break;
-		}
-	} else {
-		verbScript = VAR(VAR_VERB_SCRIPT);
+	verbScript = 4;
+	VAR(VAR_CLICK_AREA) = a;
+	switch (a) {
+	case 1:		// Verb clicked
+		VAR(VAR_CLICK_VERB) = cmd;
+		break;
+	case 3:		// Inventory clicked
+		VAR(VAR_CLICK_OBJECT) = cmd;
+		break;
 	}
 
 	memset(args, 0, sizeof(args));
 	args[0] = a;
 	args[1] = cmd;
 	args[2] = mode;
+
+	if (verbScript)
+		runScript(verbScript, 0, 0, args);
+}
+
+void ScummEngine::runInputScript(int a, int cmd, int mode) {
+	int args[24];
+	int verbScript;
+
+	verbScript = VAR(VAR_VERB_SCRIPT);
+
+	memset(args, 0, sizeof(args));
+	args[0] = a;
+	args[1] = cmd;
+	args[2] = mode;
 	// All HE 72+ games but only some HE 71 games.
 	if (_game.heversion >= 71) {
 		args[3] = VAR(VAR_VIRT_MOUSE_X);

Modified: scummvm/trunk/engines/scumm/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/scumm/script_v2.cpp	2006-03-02 00:50:52 UTC (rev 20999)
+++ scummvm/trunk/engines/scumm/script_v2.cpp	2006-03-02 01:17:41 UTC (rev 21000)
@@ -1612,10 +1612,14 @@
 }
 
 void ScummEngine_v2::resetSentence() {
-	VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
-	VAR(VAR_SENTENCE_OBJECT1) = 0;
-	VAR(VAR_SENTENCE_OBJECT2) = 0;
-	VAR(VAR_SENTENCE_PREPOSITION) = 0;
+	if (_game.id == GID_MANIAC && _game.platform == Common::kPlatformC64) {
+		// TODO
+	} else {
+		VAR(VAR_SENTENCE_VERB) = VAR(VAR_BACKUP_VERB);
+		VAR(VAR_SENTENCE_OBJECT1) = 0;
+		VAR(VAR_SENTENCE_OBJECT2) = 0;
+		VAR(VAR_SENTENCE_PREPOSITION) = 0;
+	}
 }
 
 void ScummEngine_v2::runInventoryScript(int i) {

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-03-02 00:50:52 UTC (rev 20999)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-03-02 01:17:41 UTC (rev 21000)
@@ -785,9 +785,6 @@
 	VAR_ACTIVE_OBJECT1 = 0xFF;
 	VAR_ACTIVE_OBJECT2 = 0xFF;
 	VAR_VERB_ALLOWED = 0xFF;
-	VAR_CLICK_AREA = 0xFF;
-	VAR_CLICK_VERB = 0xFF;
-	VAR_CLICK_OBJECT = 0xFF;
 
 	VAR_BLAST_ABOVE_TEXT = 0xFF;
 	VAR_VOICE_MODE = 0xFF;
@@ -970,12 +967,22 @@
 
 ScummEngine_v2::ScummEngine_v2(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
 	: ScummEngine_v3old(detector, syst, gs, md5sum, subst) {
+
+	VAR_SENTENCE_VERB = 0xFF;
+	VAR_SENTENCE_OBJECT1 = 0xFF;
+	VAR_SENTENCE_OBJECT2 = 0xFF;
+	VAR_SENTENCE_PREPOSITION = 0xFF;
+	VAR_BACKUP_VERB = 0xFF;
+
+	VAR_CLICK_AREA = 0xFF;
+	VAR_CLICK_VERB = 0xFF;
+	VAR_CLICK_OBJECT = 0xFF;
 }
 
 ScummEngine_c64::ScummEngine_c64(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], SubstResFileNames subst)
 	: ScummEngine_v2(detector, syst, gs, md5sum, subst) {
 
-	_currentAction = 0;
+	_activeVerb = 0;
 	_currentMode = 0;
 }
 

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-03-02 00:50:52 UTC (rev 20999)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-03-02 01:17:41 UTC (rev 21000)
@@ -893,7 +893,7 @@
 	void verbMouseOver(int verb);
 	int findVerbAtPos(int x, int y) const;
 	virtual void drawVerb(int verb, int mode);
-	void runInputScript(int a, int cmd, int mode);
+	virtual void runInputScript(int a, int cmd, int mode);
 	void restoreVerbBG(int verb);
 	void drawVerbBitmap(int verb, int x, int y);
 	int getVerbSlot(int id, int mode) const;
@@ -1377,9 +1377,6 @@
 	byte VAR_ACTIVE_VERB;
 	byte VAR_ACTIVE_OBJECT1;
 	byte VAR_ACTIVE_OBJECT2;
-	byte VAR_CLICK_AREA;
-	byte VAR_CLICK_VERB;
-	byte VAR_CLICK_OBJECT;
 
 	// HE specific variables
 	byte VAR_REDRAW_ALL_ACTORS;		// Used in setActorRedrawFlags()

Modified: scummvm/trunk/engines/scumm/verbs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/verbs.cpp	2006-03-02 00:50:52 UTC (rev 20999)
+++ scummvm/trunk/engines/scumm/verbs.cpp	2006-03-02 01:17:41 UTC (rev 21000)
@@ -306,6 +306,11 @@
 
 	object = findInventory(_scummVars[VAR_EGO], object + 1 + _inventoryOffset);
 
+	if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
+		// TODO
+		return;
+	}
+
 	if (object > 0) {
 		runInputScript(3, object, 0);
 	}
@@ -500,38 +505,49 @@
 	if (_userPut <= 0 || _mouseAndKeyboardStat == 0)
 		return;
 
-	if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
+	if (_mouseAndKeyboardStat < MBS_MAX_KEY) {
+		/* Check keypresses */
 		// TODO
-	} else if (_game.version <= 2 && zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
-		// Click into V2 inventory
-		checkV2Inventory(_mouse.x, _mouse.y);
-	} else {
-		int over = findVerbAtPos(_mouse.x, _mouse.y);
-		if (over) {
-			_currentAction = _verbs[over].verbid;
-			return;
-		}
+	} else if (_mouseAndKeyboardStat & MBS_MOUSE_MASK) {
+		if (zone->number == kVerbVirtScreen && _mouse.y <= zone->topline + 8) {
+			// TODO
+		} else if (zone->number == kVerbVirtScreen && _mouse.y > zone->topline + 32) {
+			// Click into V2 inventory
+			checkV2Inventory(_mouse.x, _mouse.y);
+		} else {
+			int over = findVerbAtPos(_mouse.x, _mouse.y);
+			if (over) {
+				_activeVerb = _verbs[over].verbid;
+				return;
+			}
 
-		// HACK: Reset value
-		VAR(VAR_EGO) = 3;
+			// HACK: Reset value
+			VAR(VAR_EGO) = 3;
 
-		int object = findObject(_mouse.x, _mouse.y);
-		if (object) {
-			_activeObject = object;
-			if (_currentMode == 3) {
-				int x, y, dir;
-				a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
-				getObjectXYPos(object, x, y, dir);
-				a->startWalkActor(x, y, dir);
-			}
+			int object = findObject(_virtualMouse.x, _virtualMouse.y);
+			if (object) {
+				_activeObject = object;
+				if (_currentMode == 3 && _activeVerb == 13) {
+					int x, y, dir;
+					a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
+					getObjectXYPos(object, x, y, dir);
+					a->startWalkActor(x, y, dir);
+				}
 
-			int tmp = (_currentMode == 3) ? _currentAction : 15;
-			runObjectScript(object, tmp, false, false, NULL);
-		} else {
-			_activeObject = 0;
-			if (zone->number == kMainVirtScreen) {
-				a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
-				a->startWalkActor(_mouse.x, _mouse.y, -1);
+				int tmp = (_currentMode == 3) ? _activeVerb : 15;
+				if (getVerbEntrypoint(object, tmp) != 0) {
+					runObjectScript(object, tmp, false, false, NULL);
+				} else if (_activeVerb != 13 && _activeVerb != 15) {
+					VAR(9) = _activeVerb;
+					runScript(3, 0, 0, 0);
+				}
+			} else {
+				_activeObject = 0;
+				_activeVerb = 13;
+				if (zone->number == kMainVirtScreen) {
+					a = derefActor(VAR(VAR_EGO), "checkExecVerbs");
+					a->startWalkActor(_virtualMouse.x, _virtualMouse.y, -1);
+				}
 			}
 		}
 	}







More information about the Scummvm-git-logs mailing list