[Scummvm-cvs-logs] SF.net SVN: scummvm: [27975] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Jul 8 22:15:43 CEST 2007
Revision: 27975
http://scummvm.svn.sourceforge.net/scummvm/?rev=27975&view=rev
Author: peres001
Date: 2007-07-08 13:15:43 -0700 (Sun, 08 Jul 2007)
Log Message:
-----------
Changed inventory graphics update from synchronous to lazy.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/dialogue.cpp
scummvm/trunk/engines/parallaction/inventory.cpp
scummvm/trunk/engines/parallaction/inventory.h
scummvm/trunk/engines/parallaction/parallaction.cpp
scummvm/trunk/engines/parallaction/saveload.cpp
Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp 2007-07-08 19:56:12 UTC (rev 27974)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp 2007-07-08 20:15:43 UTC (rev 27975)
@@ -497,7 +497,6 @@
DialogueManager man(this, data);
man.run();
- refreshInventory();
showCursor(true);
return;
Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp 2007-07-08 19:56:12 UTC (rev 27974)
+++ scummvm/trunk/engines/parallaction/inventory.cpp 2007-07-08 20:15:43 UTC (rev 27975)
@@ -117,17 +117,30 @@
}
+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 @@
_inventory[slot]._id = MAKE_INVENTORY_ID(item);
_inventory[slot]._index = item;
- refreshInventoryItem(slot);
-
return 0;
}
@@ -160,8 +171,6 @@
memcpy(&_inventory[slot], &_inventory[slot+1], sizeof(InventoryItem));
}
- refreshInventory();
-
return;
}
@@ -177,28 +186,6 @@
}
-
-
-
-
-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 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 @@
_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;
}
Modified: scummvm/trunk/engines/parallaction/inventory.h
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.h 2007-07-08 19:56:12 UTC (rev 27974)
+++ scummvm/trunk/engines/parallaction/inventory.h 2007-07-08 20:15:43 UTC (rev 27975)
@@ -51,7 +51,6 @@
void addInventoryItem(uint16 item);
void highlightInventoryItem(int16 pos, byte color);
-void refreshInventory();
void extractInventoryGraphics(int16 pos, byte *dst);
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2007-07-08 19:56:12 UTC (rev 27974)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2007-07-08 20:15:43 UTC (rev 27975)
@@ -774,7 +774,6 @@
_vm->_char._talk = _disk->loadTalk(baseName);
_vm->_char._objs = _disk->loadObjects(baseName);
_objectsNames = _disk->loadTable(baseName);
- refreshInventory();
_soundMan->playCharacterMusic(name);
Modified: scummvm/trunk/engines/parallaction/saveload.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/saveload.cpp 2007-07-08 19:56:12 UTC (rev 27974)
+++ scummvm/trunk/engines/parallaction/saveload.cpp 2007-07-08 20:15:43 UTC (rev 27975)
@@ -166,8 +166,6 @@
// freeTable(_objectsNames);
// initTable(filename, _objectsNames);
-// refreshInventory(_vm->_characterName);
-
// parseLocation("common");
// force reload of character to solve inventory
@@ -238,11 +236,7 @@
delete f;
- refreshInventory();
-
return;
-
-
}
enum {
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