FULLPIPE: Reading CMovGraphNode
This commit is contained in:
parent
a8d733b2b2
commit
5ea45699a8
6 changed files with 120 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ class MfcArchive : public Common::File {
|
|||
|
||||
char *readPascalString(bool twoByte = false);
|
||||
int readCount();
|
||||
double readDouble();
|
||||
CObject *parseClass(bool *isCopyReturned);
|
||||
CObject *readClass();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue