diff options
author | Eugene Sandulenko | 2013-06-04 00:53:23 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:48:08 +0300 |
commit | ba26e179804e2cca229bcd1ae028ce03a410e436 (patch) | |
tree | 7362b1ae6d74bad5583f7722b7244df4b9197965 /engines | |
parent | 4eb91762744a1235129467200f16754e85e4d3c2 (diff) | |
download | scummvm-rg350-ba26e179804e2cca229bcd1ae028ce03a410e436.tar.gz scummvm-rg350-ba26e179804e2cca229bcd1ae028ce03a410e436.tar.bz2 scummvm-rg350-ba26e179804e2cca229bcd1ae028ce03a410e436.zip |
FULLPIPE: Load inventory from fullpipe.gam
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/objects.h | 184 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 58 |
2 files changed, 216 insertions, 26 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index 69b12d00ff..04fc42b279 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -39,6 +39,22 @@ class CObList { int m_nBlockSize; }; +class MemoryObject { + CObject obj; + int filename; + int field_8; + int field_C; + int field_10; + char field_14; + char field_15; + char field_16; + char field_17; + int data; + int dataSize; + int flags; + int libHandle; +}; + class CObArray { CObject obj; int m_pData; @@ -47,6 +63,22 @@ class CObArray { int m_nGrowBy; }; +struct CNode { + CNode *pNext; + CNode *pPrev; + void *data; +}; + +class CPtrList { + CObject obj; + CNode *m_pNodeHead; + int m_pNodeTail; + int m_nCount; + int m_pNodeFree; + int m_pBlocks; + int m_nBlockSize; +}; + class SceneTag { CObject _obj; int _field_4; @@ -63,7 +95,7 @@ class SceneTag { typedef Common::List<SceneTag> SceneTagList_; class SceneTagList { - SceneTagList_ list; + SceneTagList_ _list; public: SceneTagList(CFile &file); @@ -158,6 +190,131 @@ class CGameVar { int varType; }; +class InventoryPoolItem { + public: + int16 _id; + int16 _pictureObjectNormalId; + int16 _pictureObjectId1; + int16 _pictureObjectMouseInsideId; + int16 _pictureObjectId3; + int16 _field_A; + int _field_C; + int _obj; + int _flags; +}; + +typedef Common::Array<InventoryPoolItem> InventoryPoolItems; + +class CInventory { + CObject _obj; + int16 _sceneId; + int16 _field_6; + InventoryPoolItems _itemsPool; + + public: + CInventory() { _sceneId = 0; } + bool load(CFile &file); +}; + +struct InventoryItem { + int16 itemId; + int16 count; +}; + +typedef Common::Array<InventoryItem> InventoryItems; + +class InventoryIcon { + int pictureObjectNormal; + int pictureObjectMouseInside; + int pictureObject3; + int x1; + int y1; + int x2; + int y2; + int16 inventoryItemId; + int16 field_1E; + int isSelected; + int isMouseInside; +}; + +typedef Common::Array<InventoryIcon> InventoryIcons; + +class Background { + CPtrList list; + int stringObj; + int x; + int y; + int16 messageQueueId; + int colorMemoryObj; + int bigPictureArray1Count; + int bigPictureArray2Count; + int bigPictureArray; +}; + +class ShadowsItemArray { + CObArray objs; +}; + +class Shadows { + CObject obj; + int sceneId; + int staticAniObjectId; + int movementId; + ShadowsItemArray items; +}; + +class Scene { + Background bg; + CPtrList staticANIObjectList1; + CPtrList staticANIObjectList2; + CPtrList messageQueueList; + CPtrList faObjectList; + Shadows *shadows; + int soundList; + int16 sceneId; + int stringObj; + int field_BC; + int libHandle; +}; + +class Picture { + MemoryObject obj; + Common::Rect rect; + int convertedBitmap; + int x; + int y; + int field_44; + int width; + int height; + int bitmap; + int field_54; + int memoryObject2; + int alpha; + int paletteData; +}; + +class BigPicture { + Picture pic; +}; + +class CInventory2 { + CInventory _inventory; + InventoryItems _inventoryItems; + InventoryIcons _inventoryIcons; + int _selectedId; + int _field_48; + int _isInventoryOut; + int _isLocked; + int _topOffset; + Scene *_sceneObj; + BigPicture *_picture; + + public: + CInventory2(); + bool load(CFile &file); + bool read(CFile &file); +}; + class CGameLoader { public: bool loadFile(const char *fname); @@ -177,30 +334,7 @@ class CGameLoader { int _field_28; int _field_2C; CInputController _inputController; - int _inventory; - int _field_7C; - int _field_80; - int _field_84; - int _field_88; - int _field_8C; - int _field_90; - int _field_94; - int _field_98; - int _field_9C; - int _field_A0; - int _field_A4; - int _field_A8; - int _field_AC; - int _field_B0; - int _field_B4; - int _field_B8; - int _field_BC; - int _field_C0; - int _field_C4; - int _field_C8; - int _field_CC; - int _field_D0; - int _field_D4; + CInventory2 _inventory; Sc2Array _sc2array; void *_sceneSwitcher; void *_preloadCallback; diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index ffeb0b6391..5c571e0cbd 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -23,6 +23,7 @@ #include "fullpipe/fullpipe.h" #include "common/file.h" +#include "common/array.h" #include "common/list.h" #include "fullpipe/utils.h" @@ -59,6 +60,10 @@ bool CGameLoader::loadFile(const char *fname) { _gameName = file.readPascalString(); debug(0, "_gameName: %s", _gameName); + _inventory.load(file); + + debug(0, "%x", file.pos()); + return true; } @@ -105,7 +110,7 @@ SceneTagList::SceneTagList(CFile &file) { for (int i = 0; i < numEntries; i++) { SceneTag *t = new SceneTag(file); - list.push_back(*t); + _list.push_back(*t); } } @@ -124,4 +129,55 @@ SceneTag::~SceneTag() { free(_tag); } +bool CInventory::load(CFile &file) { + _sceneId = file.readUint16LE(); + int numInvs = file.readUint32LE(); + + debug(0, "numInvs: %d %x", numInvs, numInvs); + + for (int i = 0; i < numInvs; i++) { + InventoryPoolItem *t = new InventoryPoolItem(); + t->_id = file.readUint16LE(); + t->_pictureObjectNormalId = file.readUint16LE(); + t->_pictureObjectId1 = file.readUint16LE(); + t->_pictureObjectMouseInsideId = file.readUint16LE(); + t->_pictureObjectId3 = file.readUint16LE(); + t->_flags = file.readUint32LE(); + t->_field_C = 0; + t->_field_A = -536; + _itemsPool.push_back(*t); + } + + return true; +} + +CInventory2::CInventory2() { + _selectedId = -1; + _field_48 = -1; + _sceneObj = 0; + _picture = 0; + _isInventoryOut = 0; + _isLocked = 0; + _topOffset = -65; +} + +bool CInventory2::load(CFile &file) { + return _inventory.load(file); +} + +bool CInventory2::read(CFile &file) { // CInventory2_SerializePartially + int numInvs = file.readUint32LE(); + + debug(0, "numInvs: %d", numInvs); + + for (int i = 0; i < numInvs; i++) { + InventoryItem *t = new InventoryItem(); + t->itemId = file.readUint16LE(); + t->count = file.readUint16LE(); + _inventoryItems.push_back(*t); + } + + return true; +} + } // End of namespace Fullpipe |