aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-07 23:56:40 +0300
committerEugene Sandulenko2013-09-06 14:48:09 +0300
commit0c03278937d0b7e85da3b60f1edf8bf7764aecbc (patch)
tree7679f7bcdd61e843f5ee7e1964d33383f532c821
parentbd565771d0bb54eedaa1b51f1d0f1ab123d48249 (diff)
downloadscummvm-rg350-0c03278937d0b7e85da3b60f1edf8bf7764aecbc.tar.gz
scummvm-rg350-0c03278937d0b7e85da3b60f1edf8bf7764aecbc.tar.bz2
scummvm-rg350-0c03278937d0b7e85da3b60f1edf8bf7764aecbc.zip
FULLPIPE: Start of reading CInteraction
-rw-r--r--engines/fullpipe/objects.h37
-rw-r--r--engines/fullpipe/stateloader.cpp36
-rw-r--r--engines/fullpipe/utils.cpp55
-rw-r--r--engines/fullpipe/utils.h20
4 files changed, 124 insertions, 24 deletions
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 40ca2023e4..5b15aa04f2 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -111,23 +111,26 @@ class GameProject : public CObject {
virtual bool load(MfcArchive &file);
};
-class CInteraction {
- //CObject obj;
- int16 objectId1;
- int16 objectId2;
- int16 objectId3;
- int16 staticsId1;
- int16 staticsId2;
- int16 field_E;
- int objectState1;
- int objectState2;
- int xOffs;
- int yOffs;
- int messageQueue;
- int sceneId;
- int field_28;
- int flags;
- int stringObj;
+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;
+ int _messageQueue;
+ int _sceneId;
+ int _field_28;
+ int _flags;
+ char *_stringObj;
+
+ public:
+ CInteraction();
+ virtual bool load(MfcArchive &file);
};
class CInteractionController : public CObject {
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 0057e4c694..e1c6d55bd0 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -251,4 +251,40 @@ CInputController::CInputController() {
// TODO
}
+CInteraction::CInteraction() {
+ _objectId1 = 0;
+ _objectId2 = 0;
+ _staticsId1 = 0;
+ _objectId3 = 0;
+ _objectState2 = 0;
+ _objectState1 = 0;
+ _messageQueue = 0;
+ _flags = 0;
+ _yOffs = 0;
+ _xOffs = 0;
+ _staticsId2 = 0;
+ _field_28 = 0;
+ _sceneId = -1;
+}
+
+bool CInteraction::load(MfcArchive &file) {
+ _objectId1 = file.readUint16LE();
+ _objectId2 = file.readUint16LE();
+ _staticsId1 = file.readUint16LE();
+ _staticsId2 = file.readUint16LE();
+ _objectId3 = file.readUint16LE();
+ _objectState2 = file.readUint32LE();
+ _objectState1 = file.readUint32LE();
+ _xOffs = file.readUint32LE();
+ _yOffs = file.readUint32LE();
+ _sceneId = file.readUint32LE();
+ _flags = file.readUint32LE();
+ _stringObj = file.readPascalString();
+
+ // messageQueue
+
+ return true;
+}
+
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index e1031cf0ed..75e5f69f8d 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -47,12 +47,61 @@ int MfcArchive::readCount() {
return count;
}
+enum {
+ kCInteraction = 0
+};
+
+const struct {
+ const char *name;
+ int id;
+} classMap[] = {
+ { "CInteraction", kCInteraction },
+ { 0, 0 }
+};
+
+MfcArchive::MfcArchive() {
+ for (int i; classMap[i].name; i++) {
+ _classMap[classMap[i].name] = classMap[i].id;
+ }
+
+ _lastIndex = 1;
+}
+
CObject *MfcArchive::parseClass() {
- CObject *res;
+ char *name;
+ int objectId;
+
+ uint obTag = readUint16LE();
+
+ if (obTag == 0xffff) {
+ int schema = readUint16LE();
+
+ name = readPascalString();
+
+ if (!_classMap.contains(name)) {
+ error("Unknown class in MfcArchive: %s", name);
+ }
+
+ _objectMap[_lastIndex] = objectId = _classMap[name];
+ _lastIndex++;
+ } else {
+ obTag &= ~0x8000;
+
+ if (_objectMap.size() < obTag) {
+ error("Object index too big: %d", obTag);
+ }
+
+ objectId = _objectMap[obTag];
+ }
- res = new CInventory2();
+ switch (objectId) {
+ case kCInteraction:
+ return new CInteraction();
+ default:
+ error("Unknown objectId: %d", objectId);
+ }
- return res;
+ return 0;
}
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 492f5ac6bf..a791139a6b 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -23,15 +23,27 @@
#ifndef FULLPIPE_UTILS_H
#define FULLPIPE_UTILS_H
+#include "common/hash-str.h"
+#include "common/array.h"
+
namespace Fullpipe {
class CObject;
+typedef Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ClassMap;
+
class MfcArchive : public Common::File {
- public:
- char *readPascalString();
- int readCount();
- CObject *parseClass();
+ ClassMap _classMap;
+ Common::Array<int> _objectMap;
+
+ int _lastIndex;
+
+ public:
+ MfcArchive();
+
+ char *readPascalString();
+ int readCount();
+ CObject *parseClass();
};
} // End of namespace Fullpipe