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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jul 28 13:50:37 CEST 2008


Revision: 33371
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33371&view=rev
Author:   peres001
Date:     2008-07-28 11:50:36 +0000 (Mon, 28 Jul 2008)

Log Message:
-----------
Pick up/drop/open/close actions are now available in game.

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

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-07-28 11:48:04 UTC (rev 33370)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-07-28 11:50:36 UTC (rev 33371)
@@ -301,13 +301,13 @@
 void Input::exitInventoryMode() {
 	// right up hides inventory
 
-	int item = _vm->getHoverInventoryItem(_mousePos.x, _mousePos.y);
+	int pos = _vm->getHoverInventoryItem(_mousePos.x, _mousePos.y);
 	_vm->highlightInventoryItem(-1);			// disable
 
 	if ((_engineFlags & kEngineDragging)) {
 
 		_engineFlags &= ~kEngineDragging;
-		ZonePtr z = _vm->hitZone(kZoneMerge, _activeItem._index, _vm->getInventoryItemIndex(item));
+		ZonePtr z = _vm->hitZone(kZoneMerge, _activeItem._index, _vm->getInventoryItemIndex(pos));
 
 		if (z) {
 			_vm->dropItem(z->u.merge->_obj1);
@@ -319,10 +319,14 @@
 	}
 
 	_vm->closeInventory();
-	if (item == -1) {
+	if (pos == -1) {
 		_vm->setArrowCursor();
 	} else {
-		_vm->setInventoryCursor(item);
+		const InventoryItem *item = _vm->getInventoryItem(pos);
+		if (item->_index != 0) {
+			_activeItem._id = item->_id;
+			_vm->setInventoryCursor(item->_index);
+		}
 	}
 	_vm->resumeJobs();
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-28 11:48:04 UTC (rev 33370)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-07-28 11:50:36 UTC (rev 33371)
@@ -100,6 +100,8 @@
 
 	cleanupGui();
 
+	delete _comboArrow;
+
 	delete _localFlagNames;
 	delete _gfx;
 	delete _soundMan;

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-07-28 11:48:04 UTC (rev 33370)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-07-28 11:50:36 UTC (rev 33371)
@@ -325,6 +325,7 @@
 	Common::RandomSource _rnd;
 
 	Debugger	*_debugger;
+	Frames	*_comboArrow;
 
 
 protected:		// data
@@ -365,7 +366,7 @@
 	virtual	void callFunction(uint index, void* parm) { }
 
 	virtual void setArrowCursor() = 0;
-	virtual void setInventoryCursor(int pos) = 0;
+	virtual void setInventoryCursor(ItemName name) = 0;
 
 	virtual void parseLocation(const char* name) = 0;
 
@@ -481,7 +482,6 @@
 	typedef void (Parallaction_ns::*Callable)(void*);
 
 	virtual	void callFunction(uint index, void* parm);
-	void setMousePointer(uint32 value);
 
 	bool loadGame();
 	bool saveGame();
@@ -512,7 +512,7 @@
 	void changeCharacter(const char *name);
 	void runPendingZones();
 
-	void setInventoryCursor(int pos);
+	void setInventoryCursor(ItemName name);
 
 
 	void doLoadGame(uint16 slot);
@@ -525,7 +525,6 @@
 
 	static byte _resMouseArrow[256];
 	byte	*_mouseArrow;
-	Frames	*_mouseComposedArrow;
 
 	static const Callable _dosCallables[25];
 	static const Callable _amigaCallables[25];
@@ -644,7 +643,7 @@
 	void		initFonts();
 	void		freeFonts();
 
-	void setInventoryCursor(int pos);
+	void setInventoryCursor(ItemName name);
 
 	void		changeLocation(char *location);
 	void 		runPendingZones();
@@ -652,7 +651,6 @@
 	void		initPart();
 	void		freePart();
 
-	void setMousePointer(int16 index);
 	void initCursors();
 
 	Frames	*_dinoCursor;

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-28 11:48:04 UTC (rev 33370)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-28 11:50:36 UTC (rev 33371)
@@ -32,6 +32,27 @@
 
 namespace Parallaction {
 
+struct MouseComboProperties {
+	int	_xOffset;
+	int	_yOffset;
+	int	_width;
+	int	_height;
+};
+/*
+// TODO: improve NS's handling of normal cursor before merging cursor code.
+MouseComboProperties	_mouseComboProps_NS = {
+	7,	// combo x offset (the icon from the inventory will be rendered from here)
+	7,	// combo y offset (ditto)
+	32,	// combo (arrow + icon) width
+	32	// combo (arrow + icon) height
+};
+*/
+MouseComboProperties	_mouseComboProps_BR = {
+	8,	// combo x offset (the icon from the inventory will be rendered from here)
+	8,	// combo y offset (ditto)
+	68,	// combo (arrow + icon) width
+	68	// combo (arrow + icon) height
+};
 
 const char *Parallaction_br::_partNames[] = {
 	"PART0",
@@ -103,6 +124,7 @@
 	delete _dougCursor;
 	delete _donnaCursor;
 
+	delete _mouseArrow;
 }
 
 void Parallaction_br::callFunction(uint index, void* parm) {
@@ -154,6 +176,12 @@
 		_dougCursor = _disk->loadPointer("pointer2");
 		_donnaCursor = _disk->loadPointer("pointer3");
 
+		Graphics::Surface *surf = new Graphics::Surface;
+		surf->create(_mouseComboProps_BR._width, _mouseComboProps_BR._height, 1);
+		_comboArrow = new SurfaceToFrames(surf);
+
+		// TODO: choose the pointer depending on the active character
+		// For now, we pick Donna's
 		_mouseArrow = _donnaCursor;
 	} else {
 		// TODO: Where are the Amiga cursors?
@@ -161,19 +189,6 @@
 
 }
 
-void Parallaction_br::setMousePointer(int16 index) {
-	// FIXME: Where are the Amiga cursors?
-	if (getPlatform() == Common::kPlatformAmiga)
-		return;
-
-	Common::Rect r;
-	_mouseArrow->getRect(0, r);
-
-	_system->setMouseCursor(_mouseArrow->getData(0), r.width(), r.height(), 0, 0, 0);
-	_system->showMouse(true);
-
-}
-
 void Parallaction_br::initPart() {
 
 	memset(_counters, 0, ARRAYSIZE(_counters));
@@ -340,15 +355,29 @@
 
 
 void Parallaction_br::setArrowCursor() {
-	// TODO: choose the pointer depending on the active character
-	// For now, defaults to 0, that corresponds to the default in the original
-	setMousePointer(0);
+	// FIXME: Where are the Amiga cursors?
+	if (getPlatform() == Common::kPlatformAmiga)
+		return;
+
+	Common::Rect r;
+	_mouseArrow->getRect(0, r);
+
+	_system->setMouseCursor(_mouseArrow->getData(0), r.width(), r.height(), 0, 0, 0);
+	_system->showMouse(true);
+
+	_input->_activeItem._id = 0;
 }
 
-void Parallaction_br::setInventoryCursor(int pos) {
+void Parallaction_br::setInventoryCursor(ItemName name) {
+	assert(name > 0);
 
+	byte *src = _mouseArrow->getData(0);
+	byte *dst = _comboArrow->getData(0);
+	memcpy(dst, src, _comboArrow->getSize(0));
 
-
+	// FIXME: destination offseting is not clear
+	_inventoryRenderer->drawItem(name, dst + _mouseComboProps_BR._yOffset * _mouseComboProps_BR._width + _mouseComboProps_BR._xOffset, _mouseComboProps_BR._width);
+	_system->setMouseCursor(dst, _mouseComboProps_BR._width, _mouseComboProps_BR._height, 0, 0, 0);
 }
 
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-28 11:48:04 UTC (rev 33370)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-07-28 11:50:36 UTC (rev 33371)
@@ -34,6 +34,7 @@
 
 namespace Parallaction {
 
+
 #define MOUSEARROW_WIDTH		16
 #define MOUSEARROW_HEIGHT		16
 
@@ -165,7 +166,6 @@
 
 	delete _locationParser;
 	delete _programParser;
-	delete _mouseComposedArrow;
 
 	_location._animations.remove(_char._ani);
 
@@ -182,7 +182,7 @@
 }
 
 void Parallaction_ns::initCursors() {
-	_mouseComposedArrow = _disk->loadPointer("pointer");
+	_comboArrow = _disk->loadPointer("pointer");
 	_mouseArrow = _resMouseArrow;
 }
 
@@ -197,21 +197,13 @@
 	_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
 }
 
-void Parallaction_ns::setInventoryCursor(int pos) {
+void Parallaction_ns::setInventoryCursor(ItemName name) {
+	assert(name > 0);
 
-	if (pos == -1)
-		return;
+	byte *v8 = _comboArrow->getData(0);
 
-	const InventoryItem *item = getInventoryItem(pos);
-	if (item->_index == 0)
-		return;
-
-	_input->_activeItem._id = item->_id;
-
-	byte *v8 = _mouseComposedArrow->getData(0);
-
 	// FIXME: destination offseting is not clear
-	_inventoryRenderer->drawItem(item->_index, v8 + 7 * MOUSECOMBO_WIDTH + 7, MOUSECOMBO_WIDTH);
+	_inventoryRenderer->drawItem(name, v8 + 7 * MOUSECOMBO_WIDTH + 7, MOUSECOMBO_WIDTH);
 	_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
 }
 


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