aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/fullpipe/objects.h124
-rw-r--r--engines/fullpipe/stateloader.cpp93
-rw-r--r--engines/fullpipe/utils.cpp23
3 files changed, 174 insertions, 66 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 4551d29a19..6b615ffcba 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -66,15 +66,7 @@ struct CNode {
void *data;
};
-class CPtrList {
- //CObject obj;
- CNode *m_pNodeHead;
- int m_pNodeTail;
- int m_nCount;
- int m_pNodeFree;
- int m_pBlocks;
- int m_nBlockSize;
-};
+typedef Common::Array<void *> CPtrList;
class SceneTag : public CObject {
int _field_4;
@@ -112,36 +104,40 @@ class GameProject : public CObject {
};
class MessageQueue : public CObject {
- int _id;
- int _flags;
- char *_stringObj;
- int16 _dataId;
- int16 _field_12;
- int _field_14;
- CPtrList _exCommands;
- int _counter;
- int _field_38;
- int _isFinished;
- int _parId;
- int _flag1;
+ int _id;
+ int _flags;
+ char *_stringObj;
+ int16 _dataId;
+ int16 _field_12;
+ int _field_14;
+ CPtrList _exCommands;
+ int _counter;
+ int _field_38;
+ int _isFinished;
+ int _parId;
+ int _flag1;
+
+ public:
+ MessageQueue();
+ virtual bool load(MfcArchive &file);
};
class CInteraction : public CObject {
- int16 _objectId1;
- int16 _objectId2;
- int16 _objectId3;
- int16 _staticsId1;
- int16 _staticsId2;
- int16 _field_E;
- int _objectState1;
- int _objectState2;
- int _xOffs;
- int _yOffs;
- MessageQueue *_messageQueue;
- int _sceneId;
- int _field_28;
- int _flags;
- char *_stringObj;
+ int16 _objectId1;
+ int16 _objectId2;
+ int16 _objectId3;
+ int16 _staticsId1;
+ int16 _staticsId2;
+ int16 _field_E;
+ int _objectState1;
+ int _objectState2;
+ int _xOffs;
+ int _yOffs;
+ MessageQueue *_messageQueue;
+ int _sceneId;
+ int _field_28;
+ int _flags;
+ char *_stringObj;
public:
CInteraction();
@@ -188,35 +184,42 @@ class Sc2Array {
};
union VarValue {
- int floatValue;
- int intValue;
- int stringValue;
+ int floatValue;
+ int intValue;
+ int stringValue;
};
class Message {
- //CObject obj;
- int messageKind;
- int16 parentId;
- char gap_A[2];
- int x;
- int y;
- int field_14;
- int sceneClickX;
- int sceneClickY;
- int field_20;
- int field_24;
- int param28;
- int field_2C;
- int field_30;
- int field_34;
+ public:
+ int _messageKind;
+ int16 _parentId;
+ int _x;
+ int _y;
+ int _field_14;
+ int _sceneClickX;
+ int _sceneClickY;
+ int _field_20;
+ int _field_24;
+ int _param28;
+ int _field_2C;
+ int _field_30;
+ int _field_34;
+
+ public:
+ Message();
};
-class ExCommand {
- Message msg;
- int messageNum;
- int field_3C;
- int flags;
- int parId;
+class ExCommand : public CObject {
+ Message _msg;
+ int _messageNum;
+ int _field_3C;
+ int _flags;
+ int _parId;
+
+ public:
+ ExCommand();
+
+ virtual bool load(MfcArchive &file);
};
class CGameVar {
@@ -396,4 +399,3 @@ class CGameLoader {
} // End of namespace Fullpipe
#endif /* FULLPIPE_OBJECTS_H */
-
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 82ba4562bd..4e54aa3d5d 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -116,6 +116,10 @@ GameProject::GameProject() {
}
bool GameProject::load(MfcArchive &file) {
+ _field_4 = 0;
+ _headerFilename = 0;
+ _field_10 = 12;
+
g_gameProjectVersion = file.readUint32LE();
g_gameProjectValue = file.readUint16LE();
g_scrollSpeed = file.readUint32LE();
@@ -166,6 +170,9 @@ SceneTag::SceneTag() {
}
bool SceneTag::load(MfcArchive &file) {
+ _field_4 = 0;
+ _scene = 0;
+
_sceneId = file.readUint16LE();
_tag = file.readPascalString();
@@ -287,8 +294,94 @@ bool CInteraction::load(MfcArchive &file) {
// messageQueue
_messageQueue = (MessageQueue *)file.parseClass();
+ _messageQueue->load(file);
+
+ return true;
+}
+
+MessageQueue::MessageQueue() {
+ _field_14 = 0;
+ _parId = 0;
+ _dataId = 0;
+ _id = 0;
+ _isFinished = 0;
+ _flags = 0;
+}
+
+bool MessageQueue::load(MfcArchive &file) {
+ _dataId = file.readUint16LE();
+
+ int count = file.readUint16LE();
+
+ _stringObj = file.readPascalString();
+ debug(0, "MessageQueue::count = %d", count);
+ debug(0, "MessageQueue::_stringObj = %s", _stringObj);
+
+ for (int i = 0; i < count; i++) {
+ CObject *tmp = file.parseClass();
+ tmp->load(file);
+
+ _exCommands.push_back(tmp);
+ }
+
+ _id = -1;
+ _field_14 = 0;
+ _parId = 0;
+ _isFinished = 0;
+
+ return true;
+}
+
+ExCommand::ExCommand() {
+ _field_3C = 1;
+ _messageNum = 0;
+ _flags = 0;
+ _parId = 0;
+}
+
+bool ExCommand::load(MfcArchive &file) {
+ debug(0, "ExCommand::load");
+
+ _msg._parentId = file.readUint16LE();
+ _msg._messageKind = file.readUint32LE();
+ _msg._x = file.readUint32LE();
+ _msg._y = file.readUint32LE();
+ _msg._field_14 = file.readUint32LE();
+ _msg._sceneClickX = file.readUint32LE();
+ _msg._sceneClickY = file.readUint32LE();
+ _msg._field_20 = file.readUint32LE();
+ _msg._field_24 = file.readUint32LE();
+ _msg._param28 = file.readUint32LE();
+ _msg._field_2C = file.readUint32LE();
+ _msg._field_30 = file.readUint32LE();
+ _msg._field_34 = file.readUint32LE();
+
+ _messageNum = file.readUint32LE();
+
+ _field_3C = 0;
+
+ if (g_gameProjectVersion >= 12) {
+ _flags = file.readUint32LE();
+ _parId = file.readUint32LE();
+ }
+
return true;
}
+Message::Message() {
+ _messageKind = 0;
+ _parentId = 0;
+ _x = 0;
+ _y = 0;
+ _field_14 = 0;
+ _sceneClickX = 0;
+ _sceneClickY = 0;
+ _field_20 = 0;
+ _field_24 = 0;
+ _param28 = 0;
+ _field_2C = 0;
+ _field_30 = 0;
+ _field_34 = 0;
+}
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index b39ae423ea..954af848af 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -54,14 +54,18 @@ int MfcArchive::readCount() {
}
enum {
- kCInteraction = 0
+ kCInteraction = 0,
+ kMessageQueue = 1,
+ kExCommand = 2
};
const struct {
const char *name;
int id;
} classMap[] = {
- { "CInteraction", kCInteraction },
+ { "CInteraction", kCInteraction },
+ { "MessageQueue", kMessageQueue },
+ { "ExCommand", kExCommand },
{ 0, 0 }
};
@@ -79,7 +83,7 @@ CObject *MfcArchive::parseClass() {
uint obTag = readUint16LE();
- debug(0, "parseClass::obTag = %d", obTag);
+ debug(0, "parseClass::obTag = %d (%04x)", obTag, obTag);
if (obTag == 0xffff) {
int schema = readUint16LE();
@@ -87,6 +91,7 @@ CObject *MfcArchive::parseClass() {
debug(0, "parseClass::schema = %d", schema);
name = readPascalString(true);
+ debug(0, "parseClass::class <%s>", name);
if (!_classMap.contains(name)) {
error("Unknown class in MfcArchive: <%s>", name);
@@ -94,14 +99,18 @@ CObject *MfcArchive::parseClass() {
objectId = _classMap[name];
_objectMap.push_back(objectId);
+
+ debug(0, "tag: %d", _objectMap.size());
} else {
obTag &= ~0x8000;
+ debug(0, "parseClass::obTag <%d>", obTag);
+
if (_objectMap.size() < obTag) {
- error("Object index too big: %d", obTag);
+ error("Object index too big: %d at 0x%08x", obTag, pos() - 2);
}
- objectId = _objectMap[obTag];
+ objectId = _objectMap[obTag - 1];
}
debug(0, "objectId: %d", objectId);
@@ -109,6 +118,10 @@ CObject *MfcArchive::parseClass() {
switch (objectId) {
case kCInteraction:
return new CInteraction();
+ case kMessageQueue:
+ return new MessageQueue();
+ case kExCommand:
+ return new ExCommand();
default:
error("Unknown objectId: %d", objectId);
}