diff options
author | Nicola Mettifogo | 2007-07-08 20:15:43 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-07-08 20:15:43 +0000 |
commit | a641ee4fbe8b82333131bdde1b25a9b7593440cf (patch) | |
tree | 6a75c03b2662d16930f84d91c3de3fbee73c72ec | |
parent | d1b9002bb07bc671ab0e34e4c9c5b7f92d0a4843 (diff) | |
download | scummvm-rg350-a641ee4fbe8b82333131bdde1b25a9b7593440cf.tar.gz scummvm-rg350-a641ee4fbe8b82333131bdde1b25a9b7593440cf.tar.bz2 scummvm-rg350-a641ee4fbe8b82333131bdde1b25a9b7593440cf.zip |
Changed inventory graphics update from synchronous to lazy.
svn-id: r27975
-rw-r--r-- | engines/parallaction/dialogue.cpp | 1 | ||||
-rw-r--r-- | engines/parallaction/inventory.cpp | 55 | ||||
-rw-r--r-- | engines/parallaction/inventory.h | 1 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 1 | ||||
-rw-r--r-- | engines/parallaction/saveload.cpp | 6 |
5 files changed, 24 insertions, 40 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 786ff52721..d5000773de 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -497,7 +497,6 @@ void Parallaction::runDialogue(SpeakData *data) { DialogueManager man(this, data); man.run(); - refreshInventory(); showCursor(true); return; diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 44fdc2a1ba..d45b831a23 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -117,17 +117,30 @@ int16 Parallaction::getHoverInventoryItem(int16 x, int16 y) { } +void drawInventoryItem(uint16 pos, InventoryItem *item) { -void refreshInventory() { - for (uint16 i = 0; i < INVENTORY_MAX_ITEMS; i++) { - drawInventoryItem(i, &_inventory[i]); + uint16 line = pos / INVENTORY_ITEMS_PER_LINE; + uint16 col = pos % INVENTORY_ITEMS_PER_LINE; + + // FIXME: this will end up in a general blit function + byte* s = _vm->_char._objs->getFramePtr(item->_index); + byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._objs->_height * INVENTORY_WIDTH; + for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) { + memcpy(d, s, INVENTORYITEM_WIDTH); + + d += INVENTORY_WIDTH; + s += INVENTORYITEM_PITCH; } + return; } -void refreshInventoryItem(uint16 index) { - drawInventoryItem(index, &_inventory[index]); + +void refreshInventory() { + for (uint16 i = 0; i < INVENTORY_MAX_ITEMS; i++) + drawInventoryItem(i, &_inventory[i]); + return; } @@ -140,8 +153,6 @@ int Parallaction::addInventoryItem(uint16 item) { _inventory[slot]._id = MAKE_INVENTORY_ID(item); _inventory[slot]._index = item; - refreshInventoryItem(slot); - return 0; } @@ -160,8 +171,6 @@ void Parallaction::dropItem(uint16 v) { memcpy(&_inventory[slot], &_inventory[slot+1], sizeof(InventoryItem)); } - refreshInventory(); - return; } @@ -177,28 +186,6 @@ int16 Parallaction::isItemInInventory(int32 v) { } - - - - -void drawInventoryItem(uint16 pos, InventoryItem *item) { - - uint16 line = pos / INVENTORY_ITEMS_PER_LINE; - uint16 col = pos % INVENTORY_ITEMS_PER_LINE; - - // FIXME: this will end up in a general blit function - byte* s = _vm->_char._objs->getFramePtr(item->_index); - byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * _vm->_char._objs->_height * INVENTORY_WIDTH; - for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) { - memcpy(d, s, INVENTORYITEM_WIDTH); - - d += INVENTORY_WIDTH; - s += INVENTORYITEM_PITCH; - } - - return; -} - void drawBorder(const Common::Rect& r, byte *buffer, byte color) { byte *d = buffer + r.left + INVENTORY_WIDTH * r.top; @@ -242,6 +229,10 @@ void highlightInventoryItem(int16 pos, byte color) { 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; @@ -313,6 +304,8 @@ void openInventory() { _invPosition.x = CLIP(_vm->_mousePos.x - (INVENTORY_WIDTH / 2), 0, SCREEN_WIDTH - INVENTORY_WIDTH); _invPosition.y = CLIP(_vm->_mousePos.y - 2 - (lines * INVENTORYITEM_HEIGHT), 0, SCREEN_HEIGHT - lines * INVENTORYITEM_HEIGHT); + refreshInventory(); + return; } diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h index a88f835277..7b2e93efa7 100644 --- a/engines/parallaction/inventory.h +++ b/engines/parallaction/inventory.h @@ -51,7 +51,6 @@ void cleanInventory(); void addInventoryItem(uint16 item); void highlightInventoryItem(int16 pos, byte color); -void refreshInventory(); void extractInventoryGraphics(int16 pos, byte *dst); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index cf17d19058..15601eaedf 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -774,7 +774,6 @@ void Parallaction::changeCharacter(const char *name) { _vm->_char._talk = _disk->loadTalk(baseName); _vm->_char._objs = _disk->loadObjects(baseName); _objectsNames = _disk->loadTable(baseName); - refreshInventory(); _soundMan->playCharacterMusic(name); diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index feb37ec50d..279dbda1b9 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -166,8 +166,6 @@ void Parallaction::doLoadGame(uint16 slot) { // freeTable(_objectsNames); // initTable(filename, _objectsNames); -// refreshInventory(_vm->_characterName); - // parseLocation("common"); // force reload of character to solve inventory @@ -238,11 +236,7 @@ void Parallaction::doSaveGame(uint16 slot, const char* name) { delete f; - refreshInventory(); - return; - - } enum { |