aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-06-16 16:10:46 +0300
committerEugene Sandulenko2013-09-06 14:48:12 +0300
commit5ea45699a889cdc15f33f449a4d8c20dd231b8e9 (patch)
tree9e036de60800bbaf6dd03902f6d77e102d35f134
parenta8d733b2b2c8c110bada0c99ac801ecc1ca0b844 (diff)
downloadscummvm-rg350-5ea45699a889cdc15f33f449a4d8c20dd231b8e9.tar.gz
scummvm-rg350-5ea45699a889cdc15f33f449a4d8c20dd231b8e9.tar.bz2
scummvm-rg350-5ea45699a889cdc15f33f449a4d8c20dd231b8e9.zip
FULLPIPE: Reading CMovGraphNode
-rw-r--r--engines/fullpipe/motion.cpp40
-rw-r--r--engines/fullpipe/motion.h51
-rw-r--r--engines/fullpipe/objects.h5
-rw-r--r--engines/fullpipe/stateloader.cpp16
-rw-r--r--engines/fullpipe/utils.cpp27
-rw-r--r--engines/fullpipe/utils.h1
6 files changed, 120 insertions, 20 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index d3688bd9f2..815b0c365e 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -76,4 +76,44 @@ bool CMovGraph::load(MfcArchive &file) {
return true;
}
+CMovGraphLink::CMovGraphLink() {
+ _distance = 0;
+ _angle = 0;
+ _flags = 0x10000000;
+ _movGraphNode2 = 0;
+ _movGraphNode1 = 0;
+ _field_3C = 0;
+ _field_38 = 0;
+ _movGraphReact = 0;
+}
+
+bool CMovGraphLink::load(MfcArchive &file) {
+ _dwordArray1.load(file);
+ _dwordArray2.load(file);
+
+ _flags = file.readUint32LE();
+
+ _movGraphNode1 = (CMovGraphNode *)file.readClass();
+ _movGraphNode2 = (CMovGraphNode *)file.readClass();
+
+ _distance = file.readDouble();
+ _angle = file.readDouble();
+
+ debug(0, "distance: %g, angle: %g", _distance, _angle);
+
+ _movGraphReact = (CMovGraphReact *)file.readClass();
+ _name = file.readPascalString();
+
+ return true;
+}
+
+bool CMovGraphNode::load(MfcArchive &file) {
+ _field_14 = file.readUint32LE();
+ _x = file.readUint32LE();
+ _y = file.readUint32LE();
+ _distance = file.readUint32LE();
+
+ return true;
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index 5bd18f3746..508a7f7af6 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -71,26 +71,39 @@ class Unk2 : public CObject {
Unk2() : _items(0), _count(0) {}
};
+class CMovGraphNode : public CObject {
+ int _x;
+ int _y;
+ int _distance;
+ int16 _field_10;
+ int16 _field_12;
+ int _field_14;
+
+ public:
+ CMovGraphNode() : _x(0), _y(0), _distance(0), _field_10(0), _field_14(0) {}
+ virtual bool load(MfcArchive &file);
+};
+
+class CMovGraphReact : public CObject {
+ // Empty
+};
+
class CMovGraphLink : public CObject {
- int movGraphNode1;
- int movGraphNode2;
- int dwordArray1;
- int field_10;
- int field_14;
- int field_18;
- int field_1C;
- int dwordArray2;
- int field_24;
- int field_28;
- int field_2C;
- int field_30;
- int flags;
- int field_38;
- int field_3C;
- double distance;
- double angle;
- int movGraphReact;
- int name;
+ CMovGraphNode *_movGraphNode1;
+ CMovGraphNode *_movGraphNode2;
+ CDWordArray _dwordArray1;
+ CDWordArray _dwordArray2;
+ int _flags;
+ int _field_38;
+ int _field_3C;
+ double _distance;
+ double _angle;
+ CMovGraphReact *_movGraphReact;
+ char *_name;
+
+ public:
+ CMovGraphLink();
+ virtual bool load(MfcArchive &file);
};
class CMovGraph : public CMotionController {
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index 1d4167053c..e385acf406 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -59,6 +59,11 @@ class CObArray : public Common::Array<CObject>, public CObject {
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;
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 75669df602..d5a9fe2102 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -504,4 +504,20 @@ bool Sc2::load(MfcArchive &file) {
return true;
}
+bool CDWordArray::load(MfcArchive &file) {
+ int count = file.readCount();
+
+ debug(0, "CDWordArray::count: %d", count);
+
+ resize(count);
+
+ for (int i = 0; i < count; i++) {
+ int32 t = file.readUint32LE();
+
+ push_back(t);
+ }
+
+ return true;
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index ba014a54cc..4add1bae22 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -56,6 +56,23 @@ int MfcArchive::readCount() {
return count;
}
+double MfcArchive::readDouble() {
+ // FIXME: This is utterly cruel and unportable
+
+ union {
+ struct {
+ int32 a;
+ int32 b;
+ } i;
+ double d;
+ } tmp;
+
+ tmp.i.a = readUint32LE();
+ tmp.i.b = readUint32LE();
+
+ return tmp.d;
+}
+
enum {
kNullObject,
kCInteraction,
@@ -64,7 +81,9 @@ enum {
kCObjstateCommand,
kCGameVar,
kCMctlCompound,
- kCMovGraph
+ kCMovGraph,
+ kCMovGraphLink,
+ kCMovGraphNode
};
const struct {
@@ -78,6 +97,8 @@ const struct {
{ "CGameVar", kCGameVar },
{ "CMctlCompound", kCMctlCompound },
{ "CMovGraph", kCMovGraph },
+ { "CMovGraphLink", kCMovGraphLink },
+ { "CMovGraphNode", kCMovGraphNode },
{ 0, 0 }
};
@@ -108,6 +129,10 @@ static CObject *createObject(int objectId) {
return new CMctlCompound();
case kCMovGraph:
return new CMovGraph();
+ case kCMovGraphLink:
+ return new CMovGraphLink();
+ case kCMovGraphNode:
+ return new CMovGraphNode();
default:
error("Unknown objectId: %d", objectId);
}
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index 7b117ef91c..c46fe38620 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -45,6 +45,7 @@ class MfcArchive : public Common::File {
char *readPascalString(bool twoByte = false);
int readCount();
+ double readDouble();
CObject *parseClass(bool *isCopyReturned);
CObject *readClass();