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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Wed Jul 23 04:45:10 CEST 2008


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

Log Message:
-----------
More decoupling of inventory code.

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

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-23 02:41:28 UTC (rev 33223)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-07-23 02:45:09 UTC (rev 33224)
@@ -307,10 +307,14 @@
 }
 
 void Gfx::drawInventory() {
-
+/*
 	if ((_engineFlags & kEngineInventory) == 0) {
 		return;
 	}
+*/
+	if (_vm->_input->_inputMode != Input::kInputModeInventory) {
+		return;
+	}
 
 	Common::Rect r;
 	_vm->_inventoryRenderer->getRect(r);

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-07-23 02:41:28 UTC (rev 33223)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-07-23 02:45:09 UTC (rev 33224)
@@ -171,9 +171,7 @@
 	} else {
 		_inputData._mousePos = _mousePos;
 		_inputData._event = kEvNone;
-		if (!translateGameInput()) {
-			translateInventoryInput();
-		}
+		translateGameInput();
 	}
 
 }
@@ -192,6 +190,11 @@
 	case kInputModeGame:
 		updateGameInput();
 		break;
+
+	case kInputModeInventory:
+		readInput();
+		updateInventoryInput();
+		break;
 	}
 
 	return &_inputData;
@@ -234,7 +237,7 @@
 
 bool Input::translateGameInput() {
 
-	if ((_engineFlags & kEnginePauseJobs) || (_engineFlags & kEngineInventory)) {
+	if (_engineFlags & kEnginePauseJobs) {
 		return false;
 	}
 
@@ -310,6 +313,8 @@
 	_vm->openInventory();
 
 	_transCurrentHoverItem = -1;
+
+	_inputMode = kInputModeInventory;
 }
 
 void Input::exitInventoryMode() {
@@ -339,22 +344,17 @@
 		_vm->setInventoryCursor(item);
 	}
 	_vm->resumeJobs();
+
+	_inputMode = kInputModeGame;
 }
 
-bool Input::translateInventoryInput() {
-
-	if ((_engineFlags & kEngineInventory) == 0) {
-		return false;
-	}
-
-	// in inventory
-	int16 _si = _vm->getHoverInventoryItem(_mousePos.x, _mousePos.y);
-
+bool Input::updateInventoryInput() {
 	if (_mouseButtons == kMouseRightUp) {
 		exitInventoryMode();
 		return true;
 	}
 
+	int16 _si = _vm->getHoverInventoryItem(_mousePos.x, _mousePos.y);
 	if (_si != _transCurrentHoverItem) {
 		_transCurrentHoverItem = _si;
 		_vm->highlightInventoryItem(_si);						// enable

Modified: scummvm/trunk/engines/parallaction/input.h
===================================================================
--- scummvm/trunk/engines/parallaction/input.h	2008-07-23 02:41:28 UTC (rev 33223)
+++ scummvm/trunk/engines/parallaction/input.h	2008-07-23 02:45:09 UTC (rev 33224)
@@ -60,7 +60,7 @@
 
 	InputData	*translateInput();
 	bool		translateGameInput();
-	bool		translateInventoryInput();
+	bool		updateInventoryInput();
 	void 		takeAction(ZonePtr z);
 	void 		walkTo(const Common::Point &dest);
 
@@ -80,7 +80,8 @@
 	enum {
 		kInputModeGame = 0,
 		kInputModeComment = 1,
-		kInputModeDialogue = 2
+		kInputModeDialogue = 2,
+		kInputModeInventory = 3
 	};
 
 

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2008-07-23 02:41:28 UTC (rev 33223)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2008-07-23 02:45:09 UTC (rev 33224)
@@ -131,7 +131,7 @@
 	if (!_inv)
 		error("InventoryRenderer not bound to inventory");
 
-	_engineFlags |= kEngineInventory;
+//	_engineFlags |= kEngineInventory;
 
 	uint16 lines = getNumLines();
 
@@ -147,8 +147,6 @@
 void InventoryRenderer::hideInventory() {
 	if (!_inv)
 		error("InventoryRenderer not bound to inventory");
-
-	_engineFlags &= ~kEngineInventory;
 }
 
 void InventoryRenderer::getRect(Common::Rect& r) const {

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-23 02:41:28 UTC (rev 33223)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-23 02:45:09 UTC (rev 33224)
@@ -151,7 +151,7 @@
 
 void Parallaction::updateView() {
 
-	if ((_engineFlags & kEnginePauseJobs) && (_engineFlags & kEngineInventory) == 0) {
+	if ((_engineFlags & kEnginePauseJobs) && (_input->_inputMode != Input::kInputModeInventory)) {
 		return;
 	}
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-07-23 02:41:28 UTC (rev 33223)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-07-23 02:45:09 UTC (rev 33224)
@@ -101,7 +101,7 @@
 enum EngineFlags {
 	kEngineQuit			= (1 << 0),
 	kEnginePauseJobs	= (1 << 1),
-	kEngineInventory	= (1 << 2),
+//	kEngineInventory	= (1 << 2),
 	kEngineWalking		= (1 << 3),
 	kEngineChangeLocation	= (1 << 4),
 	kEngineBlockInput	= (1 << 5),


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