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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Jul 23 03:07:40 CEST 2008


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

Log Message:
-----------
More merging of input code.

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

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-07-22 20:13:57 UTC (rev 33218)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-07-23 01:07:39 UTC (rev 33219)
@@ -219,17 +219,30 @@
 	_vm->_gfx->hideFloatingLabel();
 }
 
+void Input::takeAction(ZonePtr z) {
+	stopHovering();
+	_vm->pauseJobs();
+	_vm->runZone(z);
+	_vm->resumeJobs();
+}
 
+void Input::walkTo(const Common::Point &dest) {
+	stopHovering();
+	_vm->setArrowCursor();
+	_vm->_char.scheduleWalk(dest.x, dest.y);
+}
+
 bool Input::translateGameInput() {
 
 	if ((_engineFlags & kEnginePauseJobs) || (_engineFlags & kEngineInventory)) {
 		return false;
 	}
 
-	if (_actionAfterWalk) {
+	if (_hasDelayedAction) {
 		// if walking is over, then take programmed action
-		_inputData._event = kEvAction;
-		_actionAfterWalk = false;
+		takeAction(_delayedActionZone);
+		_hasDelayedAction = false;
+		_delayedActionZone = nullZonePtr;
 		return true;
 	}
 
@@ -241,9 +254,10 @@
 
 	// test if mouse is hovering on an interactive zone for the currently selected inventory item
 	ZonePtr z = _vm->hitZone(_activeItem._id, _mousePos.x, _mousePos.y);
+	Common::Point dest(_mousePos);
 
 	if (((_mouseButtons == kMouseLeftUp) && (_activeItem._id == 0) && ((_engineFlags & kEngineWalking) == 0)) && ((!z) || ((z->_type & 0xFFFF) != kZoneCommand))) {
-		_inputData._event = kEvWalk;
+		walkTo(dest);
 		return true;
 	}
 
@@ -257,16 +271,17 @@
 		_inputData._zone = z;
 		if (z->_flags & kFlagsNoWalk) {
 			// character doesn't need to walk to take specified action
-			_inputData._event = kEvAction;
-
+			takeAction(z);
 		} else {
 			// action delayed: if Zone defined a moveto position the character is programmed to move there,
 			// else it will move to the mouse position
-			_inputData._event = kEvWalk;
-			_actionAfterWalk = true;
+			_delayedActionZone = z;
+			_hasDelayedAction = true;
 			if (z->_moveTo.y != 0) {
-				_inputData._mousePos = z->_moveTo;
+				dest = z->_moveTo;
 			}
+
+			walkTo(dest);
 		}
 
 		_vm->beep();

Modified: scummvm/trunk/engines/parallaction/input.h
===================================================================
--- scummvm/trunk/engines/parallaction/input.h	2008-07-22 20:13:57 UTC (rev 33218)
+++ scummvm/trunk/engines/parallaction/input.h	2008-07-23 01:07:39 UTC (rev 33219)
@@ -52,14 +52,17 @@
 
 	// input-only
 	InputData	_inputData;
-	bool		_actionAfterWalk;  // actived when the character needs to move before taking an action
-	// these two could/should be merged as they carry on the same duty in two member functions,
-	// respectively processInput and translateInput
+
+	bool		_hasDelayedAction;  // actived when the character needs to move before taking an action
+	ZonePtr		_delayedActionZone;
+
 	int16		_transCurrentHoverItem;
 
 	InputData	*translateInput();
 	bool		translateGameInput();
 	bool		translateInventoryInput();
+	void 		takeAction(ZonePtr z);
+	void 		walkTo(const Common::Point &dest);
 
 	Parallaction	*_vm;
 
@@ -83,11 +86,12 @@
 
 	Input(Parallaction *vm) : _vm(vm) {
 		_transCurrentHoverItem = 0;
-		_actionAfterWalk = false;  // actived when the character needs to move before taking an action
+		_hasDelayedAction = false;  // actived when the character needs to move before taking an action
 		_mouseHidden = false;
 		_activeItem._index = 0;
 		_activeItem._id = 0;
 		_mouseButtons = 0;
+		_delayedActionZone = nullZonePtr;
 	}
 
 	virtual ~Input() { }

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-22 20:13:57 UTC (rev 33218)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-23 01:07:39 UTC (rev 33219)
@@ -299,25 +299,6 @@
 void Parallaction::processInput(InputData *data) {
 
 	switch (data->_event) {
-	case kEvAction:
-		debugC(2, kDebugInput, "processInput: kEvAction");
-		_input->stopHovering();
-		pauseJobs();
-		runZone(data->_zone);
-		resumeJobs();
-		break;
-
-	case kEvWalk:
-		debugC(2, kDebugInput, "processInput: kEvWalk");
-		_input->stopHovering();
-		setArrowCursor();
-		_char.scheduleWalk(data->_mousePos.x, data->_mousePos.y);
-		break;
-
-	case kEvQuitGame:
-		_engineFlags |= kEngineQuit;
-		break;
-
 	case kEvSaveGame:
 		_input->stopHovering();
 		saveGame();


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