diff options
| author | Eugene Sandulenko | 2013-08-24 17:57:58 +0300 |
|---|---|---|
| committer | Eugene Sandulenko | 2013-09-06 14:51:18 +0300 |
| commit | 87488185a82f123387176cb9f72e2c714d088c73 (patch) | |
| tree | 9b818d7339ba81e7561fe6ac3f93cccd53969f2d | |
| parent | 2a59b516890375bf542f049c1dc302dc2c19c260 (diff) | |
| download | scummvm-rg350-87488185a82f123387176cb9f72e2c714d088c73.tar.gz scummvm-rg350-87488185a82f123387176cb9f72e2c714d088c73.tar.bz2 scummvm-rg350-87488185a82f123387176cb9f72e2c714d088c73.zip | |
FULLPIPE: Implement CInventory2::draw()
| -rw-r--r-- | engines/fullpipe/gfx.cpp | 15 | ||||
| -rw-r--r-- | engines/fullpipe/gfx.h | 1 | ||||
| -rw-r--r-- | engines/fullpipe/inventory.cpp | 85 | ||||
| -rw-r--r-- | engines/fullpipe/inventory.h | 11 |
4 files changed, 98 insertions, 14 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 82014426c2..6c22c2a493 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -196,6 +196,21 @@ void PictureObject::draw() { _picture->draw(_ox, _oy, 0, 0); } +void PictureObject::drawAt(int x, int y) { + if (x == -1) + x = _ox; + if (y == -1) + y = _oy; + + _picture->_x = x; + _picture->_y = y; + + if (_flags & 1) + _picture->draw(x, y, 2, 0); + else + _picture->draw(x, y, 0, 0); +} + bool PictureObject::setPicAniInfo(PicAniInfo *picAniInfo) { if (!(picAniInfo->type & 2) || (picAniInfo->type & 1)) { error("Picture::setPicAniInfo(): Wrong type: %d", picAniInfo->type); diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index f7fd292a22..eec32848ec 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -155,6 +155,7 @@ class PictureObject : public GameObject { bool load(MfcArchive &file, bool bigPicture); Common::Point *getDimensions(Common::Point *p); void draw(); + void drawAt(int x, int y); bool setPicAniInfo(PicAniInfo *picAniInfo); bool isPointInside(int x, int y); diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index c6eebab183..002c9b9e6b 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -37,10 +37,10 @@ bool CInventory::load(MfcArchive &file) { for (int i = 0; i < numInvs; i++) { InventoryPoolItem *t = new InventoryPoolItem(); t->id = file.readUint16LE(); - t->pictureObjectNormalId = file.readUint16LE(); + t->pictureObjectNormal = file.readUint16LE(); t->pictureObjectId1 = file.readUint16LE(); - t->pictureObjectMouseHover = file.readUint16LE(); - t->pictureObjectId3 = file.readUint16LE(); + t->pictureObjectHover = file.readUint16LE(); + t->pictureObjectSelected = file.readUint16LE(); t->flags = file.readUint32LE(); t->field_C = 0; t->field_A = -536; @@ -117,7 +117,7 @@ void CInventory2::rebuildItemRects() { PictureObject *pic = (PictureObject *)_scene->_picObjList[i]; for (uint j = 0; j < _itemsPool.size(); j++) { - if (_itemsPool[j]->pictureObjectNormalId == pic->_id) { + if (_itemsPool[j]->pictureObjectNormal == pic->_id) { if (pic->_okeyCode) _scene->deletePictureObject(pic); else @@ -135,9 +135,9 @@ void CInventory2::rebuildItemRects() { icn->inventoryItemId = _itemsPool[idx]->id; - icn->pictureObjectNormal = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectNormalId, 0); - icn->pictureObjectHover = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectMouseHover, 0); - icn->pictureObjectId3 = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectId3, 0); + icn->pictureObjectNormal = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectNormal, 0); + icn->pictureObjectHover = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectHover, 0); + icn->pictureObjectSelected = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectSelected, 0); icn->pictureObjectNormal->getDimensions(&point); @@ -164,7 +164,76 @@ void CInventory2::rebuildItemRects() { } void CInventory2::draw() { - warning("STUB: CInventory2::draw()"); + if (!_scene) + return; + + int oldScLeft = g_fullpipe->_sceneRect.left; + int oldScTop = g_fullpipe->_sceneRect.top; + + g_fullpipe->_sceneRect.top = -_topOffset; + g_fullpipe->_sceneRect.left = 0; + + _picture->draw(-1, -1, 0, 0); + + for (uint i = 0; i < _inventoryIcons.size(); i++) { + InventoryIcon *icn = _inventoryIcons[i]; + + if (icn->isSelected) { + icn->pictureObjectSelected->drawAt(icn->x1, icn->y1 + 10); + } else { + if (icn->isMouseHover) + icn->pictureObjectHover->drawAt(icn->x1, icn->y1 + 10); + else + icn->pictureObjectNormal->drawAt(icn->x1, icn->y1 + 10); + } + } + + if (!_isInventoryOut) + goto LABEL_30; + + int v10, v11, v12; + + if (_topOffset != -10) { + if (_topOffset < -10) { + v10 = -10; + goto LABEL_13; + } + if (_topOffset + 10 >= 20) { + v11 = -20; +cont: + _topOffset += v11; + goto reset; + } + v12 = -10; + goto LABEL_25; + } + if (!_isInventoryOut) { +LABEL_30: + if (_topOffset != -65) { + if (_topOffset < -65) { + v10 = -65; +LABEL_13: + v11 = v10 - _topOffset; + if (v11 >= 20) + v11 = 20; + goto cont; + } + if (_topOffset + 65 >= 20) { + v11 = -20; + goto cont; + } + v12 = -65; +LABEL_25: + v11 = v12 - _topOffset; + goto cont; + } + } + +reset: + + g_fullpipe->_sceneRect.top = oldScTop; + g_fullpipe->_sceneRect.left = oldScLeft; + } void CInventory2::slideIn() { diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index 9244f9580a..902ecffeb6 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -30,10 +30,10 @@ class BigPicture; struct InventoryPoolItem { int16 id; - int16 pictureObjectNormalId; + int16 pictureObjectNormal; int16 pictureObjectId1; - int16 pictureObjectMouseHover; - int16 pictureObjectId3; + int16 pictureObjectHover; + int16 pictureObjectSelected; int16 field_A; int field_C; int obj; @@ -70,15 +70,14 @@ class PictureObject; struct InventoryIcon { PictureObject *pictureObjectNormal; PictureObject *pictureObjectHover; - PictureObject *pictureObjectId3; + PictureObject *pictureObjectSelected; int x1; int y1; int x2; int y2; int16 inventoryItemId; - int16 field_1E; int isSelected; - int isMouseInside; + int isMouseHover; }; typedef Common::Array<InventoryIcon *> InventoryIcons; |
