diff options
author | Nicola Mettifogo | 2008-07-27 14:21:16 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-07-27 14:21:16 +0000 |
commit | 387134a16a144df3c9512e8c61901e7b7142e540 (patch) | |
tree | 1a737f750fb76171fc37dbf8f033154b3a335b1e | |
parent | d223e90002d5e95c1dccd14aa81c7090138abbd1 (diff) | |
download | scummvm-rg350-387134a16a144df3c9512e8c61901e7b7142e540.tar.gz scummvm-rg350-387134a16a144df3c9512e8c61901e7b7142e540.tar.bz2 scummvm-rg350-387134a16a144df3c9512e8c61901e7b7142e540.zip |
Moved inventory cursor drawing code to InventoryRenderer.
svn-id: r33337
-rw-r--r-- | engines/parallaction/inventory.cpp | 14 | ||||
-rw-r--r-- | engines/parallaction/inventory.h | 5 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 12 |
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); - } |