aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-08-24 16:27:09 +0300
committerEugene Sandulenko2013-09-06 14:51:18 +0300
commit2a59b516890375bf542f049c1dc302dc2c19c260 (patch)
treecf25bc50951e87e6e9ed659f6cb29d8cb0186557
parentcba0fb54f19fabbd71d4d20034dde2660fc3b673 (diff)
downloadscummvm-rg350-2a59b516890375bf542f049c1dc302dc2c19c260.tar.gz
scummvm-rg350-2a59b516890375bf542f049c1dc302dc2c19c260.tar.bz2
scummvm-rg350-2a59b516890375bf542f049c1dc302dc2c19c260.zip
FULLPIPE: Implemented CInventory2::rebuildItemRects()
-rw-r--r--engines/fullpipe/gfx.h2
-rw-r--r--engines/fullpipe/inventory.cpp79
-rw-r--r--engines/fullpipe/inventory.h6
-rw-r--r--engines/fullpipe/scene.cpp11
-rw-r--r--engines/fullpipe/scene.h1
5 files changed, 28 insertions, 71 deletions
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 18a48228e5..f7fd292a22 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -177,6 +177,8 @@ class Background : public CObject {
Background();
virtual bool load(MfcArchive &file);
void addPictureObject(PictureObject *pct);
+
+ BigPicture *getBigPicture(int x, int y) { return _bigPictureArray[x][y]; }
};
struct ShadowsItem {
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index 35b516b587..c6eebab183 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -39,7 +39,7 @@ bool CInventory::load(MfcArchive &file) {
t->id = file.readUint16LE();
t->pictureObjectNormalId = file.readUint16LE();
t->pictureObjectId1 = file.readUint16LE();
- t->pictureObjectMouseInsideId = file.readUint16LE();
+ t->pictureObjectMouseHover = file.readUint16LE();
t->pictureObjectId3 = file.readUint16LE();
t->flags = file.readUint32LE();
t->field_C = 0;
@@ -118,7 +118,7 @@ void CInventory2::rebuildItemRects() {
for (uint j = 0; j < _itemsPool.size(); j++) {
if (_itemsPool[j]->pictureObjectNormalId == pic->_id) {
- if (pic->okeyCode)
+ if (pic->_okeyCode)
_scene->deletePictureObject(pic);
else
pic->_flags &= 0xFFFB;
@@ -129,21 +129,17 @@ void CInventory2::rebuildItemRects() {
for (uint i = 0; i < _inventoryItems.size(); i++) {
Common::Point point;
- idx = getInventoryPoolItemIndexById(_inventoryItems[i]->itemId);
+ int idx = getInventoryPoolItemIndexById(_inventoryItems[i]->itemId);
InventoryIcon *icn = new InventoryIcon();
icn->inventoryItemId = _itemsPool[idx]->id;
- PictureObject *pic = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectNormalId, 0);
+ 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 = pic;
-
- icn->icons = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectMouseInsideId, 0);
-
- icn->numIcons = _scene->getPictureObjectById(_itemsPool[idx]->pictureObjectId3, 0); // Weird
-
- pic->getDimensions(point);
+ icn->pictureObjectNormal->getDimensions(&point);
if (_itemsPool[idx]->flags & 0x10000) {
icn->x1 = 730;
@@ -157,63 +153,10 @@ void CInventory2::rebuildItemRects() {
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) {
+
+ _inventoryIcons.push_back(icn);
+
+ if (itemX >= 2 * (icn->x1 - icn->x2) + 800) {
itemX = 9;
itemY = icn->y2 + 1;
}
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
index 6193c4a2bb..9244f9580a 100644
--- a/engines/fullpipe/inventory.h
+++ b/engines/fullpipe/inventory.h
@@ -32,7 +32,7 @@ struct InventoryPoolItem {
int16 id;
int16 pictureObjectNormalId;
int16 pictureObjectId1;
- int16 pictureObjectMouseInsideId;
+ int16 pictureObjectMouseHover;
int16 pictureObjectId3;
int16 field_A;
int field_C;
@@ -69,8 +69,8 @@ class PictureObject;
struct InventoryIcon {
PictureObject *pictureObjectNormal;
- InventoryIcon **icons;
- int numIcons;
+ PictureObject *pictureObjectHover;
+ PictureObject *pictureObjectId3;
int x1;
int y1;
int x2;
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index 8c53444b81..806145504f 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -334,6 +334,17 @@ PictureObject *Scene::getPictureObjectById(int objId, int flags) {
return 0;
}
+void Scene::deletePictureObject(PictureObject *obj) {
+ for (uint i = 0; i < _picObjList.size(); i++) {
+ if (((PictureObject *)_picObjList[i]) == obj) {
+ _picObjList.remove_at(i);
+ delete obj;
+
+ return;
+ }
+ }
+}
+
MessageQueue *Scene::getMessageQueueById(int messageId) {
for (uint i = 0; i < _messageQueueList.size(); i++)
if (((MessageQueue *)_messageQueueList[i])->_dataId == messageId)
diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h
index 1292bedf59..9c57bcbc10 100644
--- a/engines/fullpipe/scene.h
+++ b/engines/fullpipe/scene.h
@@ -67,6 +67,7 @@ class Scene : public Background {
void setPictureObjectsFlag4();
PictureObject *getPictureObjectById(int objId, int flags);
+ void deletePictureObject(PictureObject *obj);
void preloadMovements(CGameVar *var);
void initObjectCursors(const char *name);