aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-20 14:44:59 -0400
committerEugene Sandulenko2013-09-06 14:48:13 +0300
commit8de8a901cb7946f5506e990224b78bdfb4ca737e (patch)
tree1a1f0f15a2531329871087f7475dd5ce6f1dc961 /engines
parent3e948052f7a0775d3b4d04e1eaef533951f1a719 (diff)
downloadscummvm-rg350-8de8a901cb7946f5506e990224b78bdfb4ca737e.tar.gz
scummvm-rg350-8de8a901cb7946f5506e990224b78bdfb4ca737e.tar.bz2
scummvm-rg350-8de8a901cb7946f5506e990224b78bdfb4ca737e.zip
FULLPIPE: Put all inventory-related classes into separate file
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/fullpipe.cpp1
-rw-r--r--engines/fullpipe/inventory.cpp72
-rw-r--r--engines/fullpipe/inventory.h97
-rw-r--r--engines/fullpipe/module.mk1
-rw-r--r--engines/fullpipe/motion.cpp1
-rw-r--r--engines/fullpipe/objects.h114
-rw-r--r--engines/fullpipe/stateloader.cpp98
-rw-r--r--engines/fullpipe/utils.cpp55
-rw-r--r--engines/fullpipe/utils.h47
9 files changed, 274 insertions, 212 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index c5099f57cb..406a6fdc48 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -30,7 +30,6 @@
#include "fullpipe/fullpipe.h"
#include "fullpipe/ngiarchive.h"
#include "fullpipe/objectnames.h"
-#include "fullpipe/utils.h"
#include "fullpipe/objects.h"
namespace Fullpipe {
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
new file mode 100644
index 0000000000..03b7cbf8b7
--- /dev/null
+++ b/engines/fullpipe/inventory.cpp
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "fullpipe/fullpipe.h"
+
+#include "fullpipe/objects.h"
+
+namespace Fullpipe {
+
+bool CInventory::load(MfcArchive &file) {
+ _sceneId = file.readUint16LE();
+ int numInvs = file.readUint32LE();
+
+ 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::loadPartial(MfcArchive &file) { // CInventory2_SerializePartially
+ int numInvs = file.readUint32LE();
+
+ 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
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
new file mode 100644
index 0000000000..8b6271aa1b
--- /dev/null
+++ b/engines/fullpipe/inventory.h
@@ -0,0 +1,97 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef FULLPIPE_INVENTORY_H
+#define FULLPIPE_INVENTORY_H
+
+namespace Fullpipe {
+
+class Scene;
+class BigPicture;
+
+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 : public CObject {
+ int16 _sceneId;
+ int16 _field_6;
+ InventoryPoolItems _itemsPool;
+
+ public:
+ CInventory() { _sceneId = 0; }
+ virtual bool load(MfcArchive &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 CInventory2 : public CInventory {
+ InventoryItems _inventoryItems;
+ InventoryIcons _inventoryIcons;
+ int _selectedId;
+ int _field_48;
+ int _isInventoryOut;
+ int _isLocked;
+ int _topOffset;
+ Scene *_sceneObj;
+ BigPicture *_picture;
+
+ public:
+ CInventory2();
+ bool loadPartial(MfcArchive &file);
+};
+
+} // End of namespace Fullpipe
+
+#endif /* FULLPIPE_INVENTORY_H */
diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk
index a2402e0272..e5a79523b2 100644
--- a/engines/fullpipe/module.mk
+++ b/engines/fullpipe/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/fullpipe
MODULE_OBJS = \
detection.o \
fullpipe.o \
+ inventory.o \
motion.o \
ngiarchive.o \
stateloader.o \
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index ec6a8bdb36..3ff61816ef 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -26,7 +26,6 @@
#include "common/array.h"
#include "common/list.h"
-#include "fullpipe/utils.h"
#include "fullpipe/objects.h"
#include "fullpipe/motion.h"
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 49349f626c..9ef2dfe22d 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -23,54 +23,10 @@
#ifndef FULLPIPE_OBJECTS_H
#define FULLPIPE_OBJECTS_H
-namespace Fullpipe {
-
-class CObject {
- public:
- virtual bool load(MfcArchive &in) { return true; }
- virtual ~CObject() {}
-
- bool loadFile(const char *fname);
-};
-
-class CObList : public Common::List<CObject>, public CObject {
- public:
- virtual bool load(MfcArchive &file);
-};
-
-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 : public Common::Array<CObject>, public CObject {
- public:
- virtual bool load(MfcArchive &file);
-};
-
-class CDWordArray : public Common::Array<int32>, public CObject {
- public:
- virtual bool load(MfcArchive &file);
-};
-
-struct CNode {
- CNode *pNext;
- CNode *pPrev;
- void *data;
-};
+#include "fullpipe/utils.h"
+#include "fullpipe/inventory.h"
-typedef Common::Array<void *> CPtrList;
+namespace Fullpipe {
class SceneTag : public CObject {
public:
@@ -337,54 +293,6 @@ class CGameVar : public CObject {
};
-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 : public CObject {
- int16 _sceneId;
- int16 _field_6;
- InventoryPoolItems _itemsPool;
-
- public:
- CInventory() { _sceneId = 0; }
- virtual bool load(MfcArchive &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 Picture {
MemoryObject obj;
Common::Rect rect;
@@ -405,22 +313,6 @@ class BigPicture {
Picture pic;
};
-class CInventory2 : public CInventory {
- InventoryItems _inventoryItems;
- InventoryIcons _inventoryIcons;
- int _selectedId;
- int _field_48;
- int _isInventoryOut;
- int _isLocked;
- int _topOffset;
- Scene *_sceneObj;
- BigPicture *_picture;
-
- public:
- CInventory2();
- bool loadPartial(MfcArchive &file);
-};
-
struct PreloadItem {
int preloadId1;
int preloadId2;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 99f25d4e04..d02d6f6e75 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -26,7 +26,6 @@
#include "common/array.h"
#include "common/list.h"
-#include "fullpipe/utils.h"
#include "fullpipe/objects.h"
namespace Fullpipe {
@@ -76,15 +75,6 @@ CGameLoader::~CGameLoader() {
delete _gameProject;
}
-bool CObject::loadFile(const char *fname) {
- MfcArchive file;
-
- if (!file.open(fname))
- return false;
-
- return load(file);
-}
-
bool CGameLoader::load(MfcArchive &file) {
_gameName = file.readPascalString();
debug(6, "_gameName: %s", _gameName);
@@ -204,68 +194,10 @@ SceneTag::~SceneTag() {
free(_tag);
}
-bool CInventory::load(MfcArchive &file) {
- _sceneId = file.readUint16LE();
- int numInvs = file.readUint32LE();
-
- 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::loadPartial(MfcArchive &file) { // CInventory2_SerializePartially
- int numInvs = file.readUint32LE();
-
- 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;
-}
-
bool CInteractionController::load(MfcArchive &file) {
return _interactions.load(file);
}
-bool CObList::load(MfcArchive &file) {
- int count = file.readCount();
-
- debug(9, "CObList::count: %d:", count);
-
- for (int i = 0; i < count; i++) {
- debug(9, "CObList::[%d]", i);
- CObject *t = file.readClass();
-
- push_back(*t);
- }
-
- return true;
-}
-
CInputController::CInputController() {
// TODO
}
@@ -399,20 +331,6 @@ bool CObjstateCommand::load(MfcArchive &file) {
return true;
}
-bool CObArray::load(MfcArchive &file) {
- int count = file.readCount();
-
- resize(count);
-
- for (int i = 0; i < count; i++) {
- CObject *t = file.readClass();
-
- push_back(*t);
- }
-
- return true;
-}
-
bool PreloadItems::load(MfcArchive &file) {
int count = file.readCount();
@@ -627,22 +545,6 @@ bool Sc2::load(MfcArchive &file) {
return true;
}
-bool CDWordArray::load(MfcArchive &file) {
- int count = file.readCount();
-
- debug(9, "CDWordArray::count: %d", count);
-
- resize(count);
-
- for (int i = 0; i < count; i++) {
- int32 t = file.readUint32LE();
-
- push_back(t);
- }
-
- return true;
-}
-
bool PicAniInfo::load(MfcArchive &file) {
type = file.readUint32LE();
objectId = file.readUint16LE();
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 6a09174bc6..b3d035bf06 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -24,12 +24,65 @@
#include "common/file.h"
-#include "fullpipe/utils.h"
#include "fullpipe/objects.h"
#include "fullpipe/motion.h"
namespace Fullpipe {
+bool CObject::loadFile(const char *fname) {
+ MfcArchive file;
+
+ if (!file.open(fname))
+ return false;
+
+ return load(file);
+}
+
+bool CObList::load(MfcArchive &file) {
+ int count = file.readCount();
+
+ debug(9, "CObList::count: %d:", count);
+
+ for (int i = 0; i < count; i++) {
+ debug(9, "CObList::[%d]", i);
+ CObject *t = file.readClass();
+
+ push_back(*t);
+ }
+
+ return true;
+}
+
+bool CObArray::load(MfcArchive &file) {
+ int count = file.readCount();
+
+ resize(count);
+
+ for (int i = 0; i < count; i++) {
+ CObject *t = file.readClass();
+
+ push_back(*t);
+ }
+
+ return true;
+}
+
+bool CDWordArray::load(MfcArchive &file) {
+ int count = file.readCount();
+
+ debug(9, "CDWordArray::count: %d", count);
+
+ resize(count);
+
+ for (int i = 0; i < count; i++) {
+ int32 t = file.readUint32LE();
+
+ push_back(t);
+ }
+
+ return true;
+}
+
char *MfcArchive::readPascalString(bool twoByte) {
char *tmp;
int len;
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 9af7d14f67..88a06417cf 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -55,6 +55,53 @@ class MfcArchive : public Common::File {
int getLevel() { return _level; }
};
+class CObject {
+ public:
+ virtual bool load(MfcArchive &in) { return true; }
+ virtual ~CObject() {}
+
+ bool loadFile(const char *fname);
+};
+
+class CObList : public Common::List<CObject>, public CObject {
+ public:
+ virtual bool load(MfcArchive &file);
+};
+
+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 : public Common::Array<CObject>, public CObject {
+ public:
+ virtual bool load(MfcArchive &file);
+};
+
+class CDWordArray : public Common::Array<int32>, public CObject {
+ public:
+ virtual bool load(MfcArchive &file);
+};
+
+struct CNode {
+ CNode *pNext;
+ CNode *pPrev;
+ void *data;
+};
+
+typedef Common::Array<void *> CPtrList;
+
} // End of namespace Fullpipe
#endif /* FULLPIPE_UTILS_H */