mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
FULLPIPE: Put all inventory-related classes into separate file
This commit is contained in:
parent
3e948052f7
commit
8de8a901cb
@ -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 {
|
||||
|
72
engines/fullpipe/inventory.cpp
Normal file
72
engines/fullpipe/inventory.cpp
Normal file
@ -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
|
97
engines/fullpipe/inventory.h
Normal file
97
engines/fullpipe/inventory.h
Normal file
@ -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 */
|
@ -3,6 +3,7 @@ MODULE := engines/fullpipe
|
||||
MODULE_OBJS = \
|
||||
detection.o \
|
||||
fullpipe.o \
|
||||
inventory.o \
|
||||
motion.o \
|
||||
ngiarchive.o \
|
||||
stateloader.o \
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "common/array.h"
|
||||
#include "common/list.h"
|
||||
|
||||
#include "fullpipe/utils.h"
|
||||
#include "fullpipe/objects.h"
|
||||
#include "fullpipe/motion.h"
|
||||
|
||||
|
@ -23,55 +23,11 @@
|
||||
#ifndef FULLPIPE_OBJECTS_H
|
||||
#define FULLPIPE_OBJECTS_H
|
||||
|
||||
#include "fullpipe/utils.h"
|
||||
#include "fullpipe/inventory.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;
|
||||
};
|
||||
|
||||
typedef Common::Array<void *> CPtrList;
|
||||
|
||||
class SceneTag : public CObject {
|
||||
public:
|
||||
int _field_4;
|
||||
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user