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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jul 9 21:19:57 CEST 2007


Revision: 27996
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27996&view=rev
Author:   peres001
Date:     2007-07-09 12:19:56 -0700 (Mon, 09 Jul 2007)

Log Message:
-----------
Moved mouse cursor tampering from inventory.cpp to Gfx class, and some cleanup.

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

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-07-09 19:19:41 UTC (rev 27995)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-07-09 19:19:56 UTC (rev 27996)
@@ -438,8 +438,8 @@
 
 	_mouseComposedArrow = _vm->_disk->loadPointer();
 
-	byte temp[16*16];
-	memcpy(temp, _mouseArrow, 16*16);
+	byte temp[MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT];
+	memcpy(temp, _mouseArrow, MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT);
 
 	uint16 k = 0;
 	for (uint16 i = 0; i < 4; i++) {
@@ -449,20 +449,40 @@
 	return;
 }
 
+//	NOTE: this routine will be moved into Gfx as soon as enough clarity
+//	is made regarding the field _id and _index of InventoryItem.
+//
+void extractInventoryGraphics(int16 pos, byte *dst) {
+//	printf("extractInventoryGraphics(%i)\n", pos);
+
+
+	return;
+}
+
+
 void Gfx::setMousePointer(int16 index) {
 
 	if (index == kCursorArrow) {		// standard mouse pointer
 
-		g_system->setMouseCursor(_mouseArrow, 16, 16, 0, 0, 0);
+		g_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
 		g_system->showMouse(true);
 
 	} else {
 		// inventory item pointer
 		byte *v8 = _mouseComposedArrow->_data0;
 
-		// FIXME: target offseting is not clear
-		extractInventoryGraphics(index, v8 + 7 + 32 * 7);
-		g_system->setMouseCursor(v8, 32, 32, 0, 0, 0);
+		// FIXME: destination offseting is not clear
+		byte* s = _vm->_char._objs->getFramePtr(getInventoryItemIndex(index));
+		byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
+
+		for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
+			memcpy(d, s, INVENTORYITEM_WIDTH);
+
+			s += INVENTORYITEM_PITCH;
+			d += MOUSECOMBO_WIDTH;
+		}
+
+		g_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
 	}
 
 	return;

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-07-09 19:19:41 UTC (rev 27995)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-07-09 19:19:56 UTC (rev 27996)
@@ -57,6 +57,12 @@
 #define BASE_PALETTE_SIZE		BASE_PALETTE_COLORS*3
 #define PALETTE_SIZE			PALETTE_COLORS*3
 
+#define MOUSEARROW_WIDTH		16
+#define MOUSEARROW_HEIGHT		16
+
+#define MOUSECOMBO_WIDTH		32	// sizes for cursor + selected inventory item
+#define MOUSECOMBO_HEIGHT		32
+
 #include "common/pack-start.h"	// START STRUCT PACKING
 
 struct PaletteFxRange {

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2007-07-09 19:19:41 UTC (rev 27995)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2007-07-09 19:19:56 UTC (rev 27996)
@@ -42,10 +42,6 @@
 #define INVENTORY_MAX_ITEMS 		30
 #define INVENTORY_FIRST_ITEM		4		// first four entries are used up by verbs
 
-#define INVENTORYITEM_PITCH 		32
-#define INVENTORYITEM_WIDTH 		24
-#define INVENTORYITEM_HEIGHT		24
-
 #define INVENTORY_ITEMS_PER_LINE	5
 #define INVENTORY_LINES 			6
 
@@ -89,7 +85,6 @@
 	{ 0,	0 }
 };
 
-void drawInventoryItem(uint16 pos, InventoryItem *item);
 
 int16 getNumUsedSlots() {
 	int16 num = 0;
@@ -224,31 +219,15 @@
 }
 
 
+int16 getInventoryItemIndex(int16 pos) {
+	// TODO: should assert against the number of items actually contained,
+	// not the theoretical limit.
+	assert(pos >= 0 && pos < INVENTORY_MAX_ITEMS);
+	return _inventory[pos]._index;
+}
 
 
-void extractInventoryGraphics(int16 pos, byte *dst) {
-//	printf("extractInventoryGraphics(%i)\n", pos);
 
-	// NOTE: this refresh is needed because we are reading graphics data from the
-	// inventory buffer instead than from the inventory icons storage.
-	refreshInventory();
-
-	int16 line = pos / INVENTORY_ITEMS_PER_LINE;
-	int16 col = pos % INVENTORY_ITEMS_PER_LINE;
-
-	// FIXME: this will end up in a general blit function
-	byte* d = dst;
-	byte* s = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._objs->_height * INVENTORY_WIDTH;
-	for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
-		memcpy(d, s, INVENTORYITEM_WIDTH);
-
-		s += INVENTORY_WIDTH;
-		d += INVENTORYITEM_PITCH;
-	}
-
-	return;
-}
-
 void jobShowInventory(void *parm, Job *j) {
 //	printf("job_showInventory()...");
 

Modified: scummvm/trunk/engines/parallaction/inventory.h
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.h	2007-07-09 19:19:41 UTC (rev 27995)
+++ scummvm/trunk/engines/parallaction/inventory.h	2007-07-09 19:19:56 UTC (rev 27996)
@@ -34,10 +34,14 @@
 struct Cnv;
 
 struct InventoryItem {
-	uint32		_id;            // lowest 16 bits are always zero
-	uint16		_index;
+	uint32		_id;            // object name (lowest 16 bits are always zero)
+	uint16		_index;			// index to frame in objs file
 };
 
+#define INVENTORYITEM_PITCH 		32
+#define INVENTORYITEM_WIDTH 		24
+#define INVENTORYITEM_HEIGHT		24
+
 #define MAKE_INVENTORY_ID(x) (((x) & 0xFFFF) << 16)
 
 
@@ -50,11 +54,10 @@
 void cleanInventory();
 void addInventoryItem(uint16 item);
 
+int16 getInventoryItemIndex(int16 pos);
 void highlightInventoryItem(int16 pos, byte color);
 
-void extractInventoryGraphics(int16 pos, byte *dst);
 
-
 } // namespace Parallaction
 
 #endif


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