[Scummvm-cvs-logs] SF.net SVN: scummvm:[33226] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Jul 23 09:52:44 CEST 2008


Revision: 33226
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33226&view=rev
Author:   peres001
Date:     2008-07-23 07:52:43 +0000 (Wed, 23 Jul 2008)

Log Message:
-----------
Removed the historical waitUntilLeftClick function and adapted code to use the more general readInput and waitForButtonEvent.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/callables_ns.cpp
    scummvm/trunk/engines/parallaction/gui_ns.cpp
    scummvm/trunk/engines/parallaction/input.cpp
    scummvm/trunk/engines/parallaction/input.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp

Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-07-23 07:31:35 UTC (rev 33225)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp	2008-07-23 07:52:43 UTC (rev 33226)
@@ -340,7 +340,7 @@
 		g_system->delayMillis(20);
 	}
 
-	_input->waitUntilLeftClick();
+	_input->waitForButtonEvent(kMouseLeftUp);
 	_balloonMan->freeBalloons();
 
 	return;
@@ -396,8 +396,10 @@
 	_gfx->showLabel(id[1], CENTER_LABEL_HORIZONTAL, 100);
 	_gfx->showLabel(id[2], CENTER_LABEL_HORIZONTAL, 130);
 	_gfx->showLabel(id[3], CENTER_LABEL_HORIZONTAL, 160);
-	_input->waitUntilLeftClick();
 
+	_gfx->updateScreen();
+	_input->waitForButtonEvent(kMouseLeftUp);
+
 	_gfx->freeLabels();
 
 	if (allPartsComplete()) {
@@ -498,18 +500,15 @@
 
 		id[0] = _gfx->createLabel(_menuFont, "CLICK MOUSE BUTTON TO START", 1);
 		_gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 80);
-
-		_input->waitUntilLeftClick();
-
+		_gfx->updateScreen();
+		_input->waitForButtonEvent(kMouseLeftUp);
 		_gfx->freeLabels();
-
 		_engineFlags &= ~kEngineBlockInput;
 		selectStartLocation();
-
 		cleanupGame();
-
 	} else {
-		_input->waitUntilLeftClick();
+		_gfx->updateScreen();
+		_input->waitForButtonEvent(kMouseLeftUp);
 	}
 
 	return;

Modified: scummvm/trunk/engines/parallaction/gui_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_ns.cpp	2008-07-23 07:31:35 UTC (rev 33225)
+++ scummvm/trunk/engines/parallaction/gui_ns.cpp	2008-07-23 07:52:43 UTC (rev 33226)
@@ -271,15 +271,22 @@
 	Common::Point p;
 
 	int selection = -1;
+	int event;
 	while (selection == -1) {
-		_input->waitUntilLeftClick();
-		_input->getCursorPos(p);
-		for (uint16 i = 0; i < 4; i++) {
-			if (blocks[i].contains(p)) {
-				selection = i;
-				break;
+		_input->readInput();
+		event = _input->getLastButtonEvent();
+
+		if (event == kMouseLeftUp) {
+			_input->getCursorPos(p);
+			for (uint16 i = 0; i < 4; i++) {
+				if (blocks[i].contains(p)) {
+					selection = i;
+					break;
+				}
 			}
 		}
+
+		_gfx->updateScreen();
 	}
 
 	beep();
@@ -305,9 +312,7 @@
 
 	Common::Point p;
 
-	_input->readInput();
-	uint32 event = _input->getLastButtonEvent();
-
+	uint32 event = kMouseNone;
 	while (event != kMouseLeftUp) {
 
 		_input->readInput();
@@ -432,37 +437,41 @@
 		_gfx->showLabel(id[0], 60, 30);
 
 		_di = 0;
+		int event;
 		while (_di < PASSWORD_LEN) {
+			_input->readInput();
+			event = _input->getLastButtonEvent();
+			if (event == kMouseLeftUp) {
 
-			_input->waitUntilLeftClick();
-			_input->getCursorPos(p);
+				_input->getCursorPos(p);
 
-			int _si = guiGetSelectedBlock(p);
+				int _si = guiGetSelectedBlock(p);
 
-			if (_si != -1) {
-				_gfx->grabBackground(codeTrueBlocks[_si], block);
-				_gfx->patchBackground(block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, false);
+				if (_si != -1) {
+					_gfx->grabBackground(codeTrueBlocks[_si], block);
+					_gfx->patchBackground(block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, false);
 
-				if (keys[0][_di] == _si) {
-					points[0]++;
-				} else
-				if (keys[1][_di] == _si) {
-					points[1]++;
-				} else
-				if (keys[2][_di] == _si) {
-					points[2]++;
-				} else {
-					fail = true;
-				}
+					if (keys[0][_di] == _si) {
+						points[0]++;
+					} else
+					if (keys[1][_di] == _si) {
+						points[1]++;
+					} else
+					if (keys[2][_di] == _si) {
+						points[2]++;
+					} else {
+						fail = true;
+					}
 
-				// build user preference
-				points[0] += (keys[0][_di] == _si);
-				points[1] += (keys[1][_di] == _si);
-				points[2] += (keys[2][_di] == _si);
+					// build user preference
+					points[0] += (keys[0][_di] == _si);
+					points[1] += (keys[1][_di] == _si);
+					points[2] += (keys[2][_di] == _si);
 
-				_di++;
+					_di++;
+				}
 			}
-
+			_gfx->updateScreen();
 		}
 
 		if (!fail) {

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-07-23 07:31:35 UTC (rev 33225)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-07-23 07:52:43 UTC (rev 33226)
@@ -126,19 +126,7 @@
 
 }
 
-// FIXME: see comment for readInput()
-void Input::waitUntilLeftClick() {
 
-	do {
-		readInput();
-		_vm->_gfx->updateScreen();
-		_vm->_system->delayMillis(30);
-	} while (_mouseButtons != kMouseLeftUp);
-
-	return;
-}
-
-
 void Input::updateGameInput() {
 
 	readInput();

Modified: scummvm/trunk/engines/parallaction/input.h
===================================================================
--- scummvm/trunk/engines/parallaction/input.h	2008-07-23 07:31:35 UTC (rev 33225)
+++ scummvm/trunk/engines/parallaction/input.h	2008-07-23 07:52:43 UTC (rev 33226)
@@ -113,7 +113,6 @@
 	void	readInput();
 	InputData* 	updateInput();
 	void	trackMouse(ZonePtr z);
-	void 	waitUntilLeftClick();
 	void	waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1);
 	uint32	getLastButtonEvent() { return _mouseButtons; }
 	bool  	getLastKeyDown(uint16 &ascii);

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-23 07:31:35 UTC (rev 33225)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-23 07:52:43 UTC (rev 33226)
@@ -384,11 +384,10 @@
 
 	_programExec->runScripts(_location._programs.begin(), _location._programs.end());
 	drawAnimations();
-
+	showLocationComment(_location._comment, false);
 	_gfx->updateScreen();
 
-	showLocationComment(_location._comment, false);
-	_input->waitUntilLeftClick();
+	_input->waitForButtonEvent(kMouseLeftUp);
 	_balloonMan->freeBalloons();
 
 	// fades maximum intensity palette towards approximation of main palette

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-23 07:31:35 UTC (rev 33225)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-23 07:52:43 UTC (rev 33226)
@@ -323,7 +323,9 @@
 		showSlide(locname.slide());
 		uint id = _gfx->createLabel(_menuFont, _location._slideText[0], 1);
 		_gfx->showLabel(id, CENTER_LABEL_HORIZONTAL, 14);
-		_input->waitUntilLeftClick();
+		_gfx->updateScreen();
+
+		_input->waitForButtonEvent(kMouseLeftUp);
 		_gfx->freeLabels();
 		freeBackground();
 	}


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