[Scummvm-cvs-logs] SF.net SVN: scummvm:[49393] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed Jun 2 17:26:35 CEST 2010


Revision: 49393
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49393&view=rev
Author:   mthreepwood
Date:     2010-06-02 15:26:35 +0000 (Wed, 02 Jun 2010)

Log Message:
-----------
In Riven, if we get a change card opcode on a mouse down event, ignore the next mouse up event so we don't misinterpret that as an event in the next card; minor cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/riven.cpp
    scummvm/trunk/engines/mohawk/riven.h
    scummvm/trunk/engines/mohawk/riven_external.cpp
    scummvm/trunk/engines/mohawk/riven_scripts.cpp

Modified: scummvm/trunk/engines/mohawk/riven.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven.cpp	2010-06-02 13:56:04 UTC (rev 49392)
+++ scummvm/trunk/engines/mohawk/riven.cpp	2010-06-02 15:26:35 UTC (rev 49393)
@@ -47,6 +47,7 @@
 	_cardData.hasData = false;
 	_gameOver = false;
 	_activatedSLST = false;
+	_ignoreNextMouseUp = false;
 	_extrasFile = NULL;
 
 	// Attempt to let game run from the CDs
@@ -147,10 +148,15 @@
 					runHotspotScript(_curHotspot, kMouseDownScript);
 				break;
 			case Common::EVENT_LBUTTONUP:
-				if (_curHotspot >= 0)
-					runHotspotScript(_curHotspot, kMouseUpScript);
-				else
-					checkInventoryClick();
+				// See RivenScript::switchCard() for more information on why we sometimes
+				// disable the next up event.
+				if (!_ignoreNextMouseUp) {
+					if (_curHotspot >= 0)
+						runHotspotScript(_curHotspot, kMouseUpScript);
+					else
+						checkInventoryClick();
+				}
+				_ignoreNextMouseUp = false;
 				break;
 			case Common::EVENT_KEYDOWN:
 				switch (event.kbd.keycode) {

Modified: scummvm/trunk/engines/mohawk/riven.h
===================================================================
--- scummvm/trunk/engines/mohawk/riven.h	2010-06-02 13:56:04 UTC (rev 49392)
+++ scummvm/trunk/engines/mohawk/riven.h	2010-06-02 15:26:35 UTC (rev 49393)
@@ -113,7 +113,6 @@
 	Common::RandomSource *_rnd;
 
 	Card _cardData;
-	bool _gameOver;
 
 	GUI::Debugger *getDebugger();
 
@@ -147,6 +146,10 @@
 	uint32 *_vars;
 	uint32 _varCount;
 
+	// Miscellaneous
+	bool _gameOver;
+	bool _ignoreNextMouseUp;
+
 public:
 	Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id);
 	bool _activatedSLST;
@@ -180,6 +183,9 @@
 	uint32 *getLocalVar(uint32 index);
 	uint32 *matchVarToString(Common::String varName);
 	uint32 *matchVarToString(const char *varName);
+
+	void setGameOver() { _gameOver = true; }
+	void ignoreNextMouseUp() { _ignoreNextMouseUp = true; }
 };
 
 } // End of namespace Mohawk

Modified: scummvm/trunk/engines/mohawk/riven_external.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven_external.cpp	2010-06-02 13:56:04 UTC (rev 49392)
+++ scummvm/trunk/engines/mohawk/riven_external.cpp	2010-06-02 15:26:35 UTC (rev 49393)
@@ -210,7 +210,7 @@
 	_vm->_video->playMovieBlocking(video);
 
 	// TODO: Play until the last frame and then run the credits
-	_vm->_gameOver = true;
+	_vm->setGameOver();
 }
 
 void RivenExternal::runDomeButtonMovie() {

Modified: scummvm/trunk/engines/mohawk/riven_scripts.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven_scripts.cpp	2010-06-02 13:56:04 UTC (rev 49392)
+++ scummvm/trunk/engines/mohawk/riven_scripts.cpp	2010-06-02 15:26:35 UTC (rev 49393)
@@ -298,13 +298,10 @@
 
 // Command 1: draw tBMP resource (tbmp_id, left, top, right, bottom, u0, u1, u2, u3)
 void RivenScript::drawBitmap(uint16 op, uint16 argc, uint16 *argv) {
-	if (argc < 5) {
-		// Copy the image to the whole screen, ignoring the rest of the parameters
+	if (argc < 5) // Copy the image to the whole screen, ignoring the rest of the parameters
 		_vm->_gfx->copyImageToScreen(argv[0], 0, 0, 608, 392);
-	} else {
-		// Copy the image to a certain part of the screen
+	else // Copy the image to a certain part of the screen
 		_vm->_gfx->copyImageToScreen(argv[0], argv[1], argv[2], argv[3], argv[4]);
-	}
 
 	// Now, update the screen
 	_vm->_gfx->updateScreen();
@@ -313,6 +310,12 @@
 // Command 2: go to card (card id)
 void RivenScript::switchCard(uint16 op, uint16 argc, uint16 *argv) {
 	_vm->changeToCard(argv[0]);
+
+	// WORKAROUND: If we changed card on a mouse down event,
+	// we want to ignore the next mouse up event so we don't
+	// change card when lifting the mouse on the next card.
+	if (_scriptType == kMouseDownScript)
+		_vm->ignoreNextMouseUp();
 }
 
 // Command 3: play an SLST from the script


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