aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/inventory.cpp14
-rw-r--r--engines/parallaction/inventory.h5
-rw-r--r--engines/parallaction/parallaction_ns.cpp12
3 files changed, 16 insertions, 15 deletions
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 71c336bbab..42db5e50c1 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -38,6 +38,10 @@ namespace Parallaction {
// 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,6 +224,16 @@ void InventoryRenderer::getItemRect(ItemPosition pos, Common::Rect &r) {
}
+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) {
diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h
index 8c32c09219..eb96735c91 100644
--- a/engines/parallaction/inventory.h
+++ b/engines/parallaction/inventory.h
@@ -38,10 +38,6 @@ struct InventoryItem {
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 @@ public:
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; }
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index e8aa32dea7..5b5c9f6871 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -211,18 +211,8 @@ void Parallaction_ns::setInventoryCursor(int pos) {
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);
-
}