aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-10 01:03:15 +0300
committerEugene Sandulenko2013-09-06 14:48:10 +0300
commit775065af1d23d9114594c96a77ecf04f1e722795 (patch)
tree2345653fb984c0d0c1eff9ba725e7b0fea88c6a2 /engines
parent54624966ce933e8a43fbf32dff0731b0db517e4a (diff)
downloadscummvm-rg350-775065af1d23d9114594c96a77ecf04f1e722795.tar.gz
scummvm-rg350-775065af1d23d9114594c96a77ecf04f1e722795.tar.bz2
scummvm-rg350-775065af1d23d9114594c96a77ecf04f1e722795.zip
FULLPIPE: Started CGameVar loading
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/objects.h61
-rw-r--r--engines/fullpipe/stateloader.cpp104
-rw-r--r--engines/fullpipe/utils.cpp21
-rw-r--r--engines/fullpipe/utils.h1
4 files changed, 145 insertions, 42 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 36f6996062..5f547902ee 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -31,7 +31,7 @@ class CObject {
virtual ~CObject() {}
};
-class CObList : Common::List<CObject>, public CObject {
+class CObList : public Common::List<CObject>, public CObject {
public:
virtual bool load(MfcArchive &file);
};
@@ -52,12 +52,9 @@ class MemoryObject {
int libHandle;
};
-class CObArray {
- //CObject obj;
- int m_pData;
- int m_nSize;
- int m_nMaxSize;
- int m_nGrowBy;
+class CObArray : public Common::Array<CObject>, public CObject {
+ public:
+ virtual bool load(MfcArchive &file);
};
struct CNode {
@@ -82,16 +79,13 @@ class SceneTag : public CObject {
virtual bool load(MfcArchive &file);
};
-typedef Common::List<SceneTag> SceneTagList_;
-
-class SceneTagList : public CObject {
- SceneTagList_ _list;
-
+class SceneTagList : public Common::List<SceneTag>, public CObject {
public:
virtual bool load(MfcArchive &file);
};
class GameProject : public CObject {
+ public:
int _field_4;
char *_headerFilename;
SceneTagList *_sceneTagList;
@@ -180,13 +174,13 @@ class CInputController {
};
class Sc2Array {
- CObArray objs;
+ CObArray _objs;
};
union VarValue {
- int floatValue;
+ float floatValue;
int intValue;
- int stringValue;
+ char *stringValue;
};
class Message {
@@ -222,16 +216,19 @@ class ExCommand : public CObject {
virtual bool load(MfcArchive &file);
};
-class CGameVar {
- //CObject obj;
- CGameVar *nextVarObj;
- CGameVar *prevVarObj;
- CGameVar *parentVarObj;
- CGameVar *subVars;
- int field_14;
- char *stringObj;
- VarValue value;
- int varType;
+ class CGameVar : public CObject {
+ CGameVar *_nextVarObj;
+ CGameVar *_prevVarObj;
+ CGameVar *_parentVarObj;
+ CGameVar *_subVars;
+ CGameVar *_field_14;
+ char *_stringObj;
+ VarValue _value;
+ int _varType;
+
+ public:
+ CGameVar();
+ virtual bool load(MfcArchive &file);
};
class InventoryPoolItem {
@@ -358,6 +355,18 @@ class CInventory2 : public CObject {
virtual bool load(MfcArchive &file);
};
+struct PreloadItem {
+ int preloadId1;
+ int preloadId2;
+ int sceneId;
+ int field_C;
+};
+
+class PreloadItems : public Common::Array<PreloadItem>, public CObject {
+ public:
+ virtual bool load(MfcArchive &file);
+};
+
class CGameLoader {
public:
CGameLoader();
@@ -387,7 +396,7 @@ class CGameLoader {
void *_readSavegameCallback;
int16 _field_F8;
int16 _field_FA;
- CObArray _preloadItems;
+ PreloadItems _preloadItems;
CGameVar *_gameVar;
char *_gameName;
ExCommand _exCommand;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index c2a244b40e..64604a29e9 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -102,10 +102,19 @@ bool CGameLoader::load(MfcArchive &file) {
_inventory.load(file);
- debug(0, "%x", file.pos());
-
_interactionController->load(file);
+ debug(0, "count: %d", _gameProject->_sceneTagList->size());
+
+ // TODO: Load Sc2
+
+ _preloadItems.load(file);
+
+ _field_FA = file.readUint16LE();
+ _field_F8 = file.readUint16LE();
+
+ _gameVar = (CGameVar *)file.readClass();
+
return true;
}
@@ -158,7 +167,7 @@ bool SceneTagList::load(MfcArchive &file) {
for (int i = 0; i < numEntries; i++) {
SceneTag *t = new SceneTag();
t->load(file);
- _list.push_back(*t);
+ push_back(*t);
}
return true;
@@ -247,8 +256,7 @@ bool CObList::load(MfcArchive &file) {
debug(0, "CObList::count: %d", count);
for (int i = 0; i < count; i++) {
- CObject *t = file.parseClass();
- t->load(file);
+ CObject *t = file.readClass();
push_back(*t);
}
@@ -290,11 +298,7 @@ bool CInteraction::load(MfcArchive &file) {
_flags = file.readUint32LE();
_stringObj = file.readPascalString();
- // messageQueue
- _messageQueue = (MessageQueue *)file.parseClass();
-
- if (_messageQueue)
- _messageQueue->load(file);
+ _messageQueue = (MessageQueue *)file.readClass();
return true;
}
@@ -317,8 +321,7 @@ bool MessageQueue::load(MfcArchive &file) {
debug(0, "MessageQueue::count = %d", count);
for (int i = 0; i < count; i++) {
- CObject *tmp = file.parseClass();
- tmp->load(file);
+ CObject *tmp = file.readClass();
_exCommands.push_back(tmp);
}
@@ -397,4 +400,81 @@ bool CObjstateCommand::load(MfcArchive &file) {
return true;
}
+bool CObArray::load(MfcArchive &file) {
+ int count = file.readCount();
+
+ debug(0, "CObArray::count: %d", count);
+
+ 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();
+
+ debug(0, "CObArray::count: %d", count);
+
+ resize(count);
+
+ for (int i = 0; i < count; i++) {
+ PreloadItem *t = new PreloadItem();
+ t->preloadId1 = file.readUint32LE();
+ t->preloadId2 = file.readUint32LE();
+ t->sceneId = file.readUint32LE();
+ t->field_C = file.readUint32LE();
+
+ push_back(*t);
+ }
+
+ return true;
+}
+
+CGameVar::CGameVar() {
+ _subVars = 0;
+ _parentVarObj = 0;
+ _nextVarObj = 0;
+ _prevVarObj = 0;
+ _field_14 = 0;
+ _varType = 0;
+ _value.floatValue = 0;
+}
+
+bool CGameVar::load(MfcArchive &file) {
+ _stringObj = file.readPascalString();
+ _varType = file.readUint32LE();
+ debug(0, "CGameVar: %d", _varType);
+
+ switch (_varType) {
+ case 0:
+ _value.intValue = file.readUint32LE();
+ debug(0, "--> %d", _value.intValue);
+ break;
+ case 1:
+ _value.intValue = file.readUint32LE(); // FIXME
+ debug(0, "--> %f", _value.floatValue);
+ break;
+ case 2:
+ _value.stringValue = file.readPascalString();
+ debug(0, "--> %s", _value.stringValue);
+ break;
+ default:
+ error("Unknown var type");
+ }
+
+ _parentVarObj = (CGameVar *)file.readClass();
+ _prevVarObj = (CGameVar *)file.readClass();
+ _nextVarObj = (CGameVar *)file.readClass();
+ _field_14 = (CGameVar *)file.readClass();
+ _subVars = (CGameVar *)file.readClass();
+
+ return true;
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 09f00b8042..aa4c270d54 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -60,7 +60,8 @@ enum {
kCInteraction = 1,
kMessageQueue = 2,
kExCommand = 3,
- kCObjstateCommand = 4
+ kCObjstateCommand = 4,
+ kCGameVar = 5
};
const struct {
@@ -71,6 +72,7 @@ const struct {
{ "MessageQueue", kMessageQueue },
{ "ExCommand", kExCommand },
{ "CObjstateCommand", kCObjstateCommand },
+ { "CGameVar", kCGameVar },
{ 0, 0 }
};
@@ -94,6 +96,15 @@ MfcArchive::MfcArchive() {
_objectMap.push_back(kNullObject);
}
+CObject *MfcArchive::readClass() {
+ CObject *res = parseClass();
+
+ if (res)
+ res->load(*this);
+
+ return res;
+}
+
CObject *MfcArchive::parseClass() {
char *name;
int objectId;
@@ -139,6 +150,9 @@ CObject *MfcArchive::parseClass() {
debug(0, "objectId: %d", objectId);
switch (objectId) {
+ case kNullObject:
+ warning("parseClass: NULL object at 0x%08x", pos() - 2);
+ return 0;
case kCInteraction:
return new CInteraction();
case kMessageQueue:
@@ -147,9 +161,8 @@ CObject *MfcArchive::parseClass() {
return new ExCommand();
case kCObjstateCommand:
return new CObjstateCommand();
- case kNullObject:
- warning("parseClass: NULL object at 0x%08x", pos() - 2);
- return 0;
+ case kCGameVar:
+ return new CGameVar();
default:
error("Unknown objectId: %d", objectId);
}
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index df56262421..a4e9413849 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -44,6 +44,7 @@ class MfcArchive : public Common::File {
char *readPascalString(bool twoByte = false);
int readCount();
CObject *parseClass();
+ CObject *readClass();
};
} // End of namespace Fullpipe