[Scummvm-cvs-logs] SF.net SVN: scummvm:[33337] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Jul 27 16:21:16 CEST 2008
Revision: 33337
http://scummvm.svn.sourceforge.net/scummvm/?rev=33337&view=rev
Author: peres001
Date: 2008-07-27 14:21:16 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
Moved inventory cursor drawing code to InventoryRenderer.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/inventory.cpp
scummvm/trunk/engines/parallaction/inventory.h
scummvm/trunk/engines/parallaction/parallaction_ns.cpp
Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp 2008-07-27 14:13:40 UTC (rev 33336)
+++ scummvm/trunk/engines/parallaction/inventory.cpp 2008-07-27 14:21:16 UTC (rev 33337)
@@ -38,6 +38,10 @@
// but only 24x24 pixels are actually copied to graphic memory
//
+#define INVENTORYITEM_PITCH 32
+#define INVENTORYITEM_WIDTH 24
+#define INVENTORYITEM_HEIGHT 24
+
#define INVENTORY_MAX_ITEMS 30
#define INVENTORY_FIRST_ITEM 4 // first four entries are used up by verbs
@@ -220,8 +224,18 @@
}
+void InventoryRenderer::drawItem(ItemName name, byte *buffer, uint pitch) {
+ byte* s = _vm->_char._objs->getData(name);
+ byte* d = buffer;
+ for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
+ memcpy(d, s, INVENTORYITEM_WIDTH);
+ s += INVENTORYITEM_PITCH;
+ d += pitch;
+ }
+}
+
Inventory::Inventory(uint16 maxItems) : _maxItems(maxItems), _numItems(0) {
_items = (InventoryItem*)calloc(_maxItems, sizeof(InventoryItem));
Modified: scummvm/trunk/engines/parallaction/inventory.h
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.h 2008-07-27 14:13:40 UTC (rev 33336)
+++ scummvm/trunk/engines/parallaction/inventory.h 2008-07-27 14:21:16 UTC (rev 33337)
@@ -38,10 +38,6 @@
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)
typedef int16 ItemPosition;
@@ -97,6 +93,7 @@
ItemPosition hitTest(const Common::Point &p) const;
void highlightItem(ItemPosition pos, byte color);
+ void drawItem(ItemName name, byte *buffer, uint pitch);
byte* getData() const { return (byte*)_surf.pixels; }
Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-07-27 14:13:40 UTC (rev 33336)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-07-27 14:21:16 UTC (rev 33337)
@@ -211,18 +211,8 @@
byte *v8 = _mouseComposedArrow->getData(0);
// FIXME: destination offseting is not clear
- byte* s = _char._objs->getData(item->_index);
- byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
-
- for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
- memcpy(d, s, INVENTORYITEM_WIDTH);
-
- s += INVENTORYITEM_PITCH;
- d += MOUSECOMBO_WIDTH;
- }
-
+ _inventoryRenderer->drawItem(item->_index, 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