diff options
author | Eugene Sandulenko | 2013-08-23 09:17:08 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:18 +0300 |
commit | cba0fb54f19fabbd71d4d20034dde2660fc3b673 (patch) | |
tree | cbc26efb9f832fe3345dda23e50ecf67e82796d1 /engines/fullpipe/inventory.cpp | |
parent | 54f4a8146128109edfaaacdbabbb4d945b4a9f62 (diff) | |
download | scummvm-rg350-cba0fb54f19fabbd71d4d20034dde2660fc3b673.tar.gz scummvm-rg350-cba0fb54f19fabbd71d4d20034dde2660fc3b673.tar.bz2 scummvm-rg350-cba0fb54f19fabbd71d4d20034dde2660fc3b673.zip |
FULLPIPE: Started CInventory2::rebuildItemRects() implementation
Diffstat (limited to 'engines/fullpipe/inventory.cpp')
-rw-r--r-- | engines/fullpipe/inventory.cpp | 115 |
1 files changed, 114 insertions, 1 deletions
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 36ee7129ab..35b516b587 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -104,7 +104,120 @@ void CInventory2::addItem(int itemId, int count) { void CInventory2::rebuildItemRects() { _scene = g_fullpipe->accessScene(_sceneId); - warning("STUB: CInventory2::rebuildItemRects()"); + if (!_scene) + return; + + _picture = _scene->getBigPicture(0, 0); + _picture->setAlpha(50); + + int itemX = 9; + int itemY = 0; + + for (uint i = 0; i < _scene->_picObjList.size(); i++) { + PictureObject *pic = (PictureObject *)_scene->_picObjList[i]; + + for (uint j = 0; j < _itemsPool.size(); j++) { + if (_itemsPool[j]->pictureObjectNormalId == pic->_id) { + if (pic->okeyCode) + _scene->deletePictureObject(pic); + else + pic->_flags &= 0xFFFB; + } + } + } + + for (uint i = 0; i < _inventoryItems.size(); i++) { + Common::Point point; + + idx = getInventoryPoolItemIndexById(_inventoryItems[i]->itemId); + + InventoryIcon *icn = new InventoryIcon(); + + icn->inventoryItemId = _itemsPool[idx]->id; + + PictureObject *pic = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectNormalId, 0); + + icn->pictureObjectNormal = pic; + + icn->icons = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectMouseInsideId, 0); + + icn->numIcons = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectId3, 0); // Weird + + pic->getDimensions(point); + + if (_itemsPool[idx]->flags & 0x10000) { + icn->x1 = 730; + icn->y1 = itemY; + icn->x2 = point.x + 730; + icn->y2 = point.y + itemY + 10; + } else { + icn->x1 = itemX; + icn->y1 = itemY; + icn->x2 = itemX + point.x; + itemX = icn->x2 + 1; + icn->y2 = point.y + itemY + 10; + } + v22 = _inventoryIcons->numIcons; + _inventoryIcons->numIcons++; + v38 = v23; + v24 = v23 + 1; + if (v24) { + v25 = _inventoryIcons->icons; + if (v25) { + v27 = _inventoryIcons->x1; + if (v24 > v27) { + v28 = _inventoryIcons->y1; + if (!v28) { + v28 = v22 / 8; + if (v22 / 8 >= 4) { + if (v28 > 1024) + v28 = 1024; + } else { + v28 = 4; + } + } + v29 = v27 + v28; + if (v24 >= v29) { + v34 = v24; + v29 = v24; + } else { + v34 = v29; + } + v30 = operator new(40 * v29); + memcpy(v30, _inventoryIcons->icons, 40 * _inventoryIcons->numIcons); + memset((char *)v30 + 40 * _inventoryIcons->numIcons, 0, 4 * ((unsigned int)(40 * (v24 - _inventoryIcons->numIcons)) >> 2)); + CObjectFree(_inventoryIcons->icons); + _inventoryIcons->icons = (InventoryIcon **)v30; + _inventoryIcons->numIcons = v24; + _inventoryIcons->x1 = v34; + } else if (v22 >= v24) { + _inventoryIcons->numIcons = v24; + } else { + memset(&v25[10 * v22], 0, 40 * (v24 - v22)); + _inventoryIcons->numIcons = v24; + } + } else { + v26 = (InventoryIcon **)operator new(40 * v24); + _inventoryIcons->icons = v26; + memset(v26, 0, 4 * ((unsigned int)(40 * v24) >> 2)); + _inventoryIcons->x1 = v24; + _inventoryIcons->numIcons = v24; + } + } else { + if (_inventoryIcons->icons) { + CObjectFree(_inventoryIcons->icons); + _inventoryIcons->icons = 0; + } + _inventoryIcons->x1 = 0; + _inventoryIcons->numIcons = 0; + } + v31 = icn->x1; + memcpy(&_inventoryIcons->icons[10 * v38], &inventoryIcon, 0x28u); + if (itemX >= 2 * (v31 - icn->x2) + 800) { + itemX = 9; + itemY = icn->y2 + 1; + } + } } void CInventory2::draw() { |