diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/fullpipe/motion.cpp | 40 | ||||
-rw-r--r-- | engines/fullpipe/motion.h | 51 | ||||
-rw-r--r-- | engines/fullpipe/objects.h | 5 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 16 | ||||
-rw-r--r-- | engines/fullpipe/utils.cpp | 27 | ||||
-rw-r--r-- | engines/fullpipe/utils.h | 1 |
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(); |