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;
|
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
|
} // End of namespace Fullpipe
|
||||||
|
|
|
@ -71,26 +71,39 @@ class Unk2 : public CObject {
|
||||||
Unk2() : _items(0), _count(0) {}
|
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 {
|
class CMovGraphLink : public CObject {
|
||||||
int movGraphNode1;
|
CMovGraphNode *_movGraphNode1;
|
||||||
int movGraphNode2;
|
CMovGraphNode *_movGraphNode2;
|
||||||
int dwordArray1;
|
CDWordArray _dwordArray1;
|
||||||
int field_10;
|
CDWordArray _dwordArray2;
|
||||||
int field_14;
|
int _flags;
|
||||||
int field_18;
|
int _field_38;
|
||||||
int field_1C;
|
int _field_3C;
|
||||||
int dwordArray2;
|
double _distance;
|
||||||
int field_24;
|
double _angle;
|
||||||
int field_28;
|
CMovGraphReact *_movGraphReact;
|
||||||
int field_2C;
|
char *_name;
|
||||||
int field_30;
|
|
||||||
int flags;
|
public:
|
||||||
int field_38;
|
CMovGraphLink();
|
||||||
int field_3C;
|
virtual bool load(MfcArchive &file);
|
||||||
double distance;
|
|
||||||
double angle;
|
|
||||||
int movGraphReact;
|
|
||||||
int name;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMovGraph : public CMotionController {
|
class CMovGraph : public CMotionController {
|
||||||
|
|
|
@ -59,6 +59,11 @@ class CObArray : public Common::Array<CObject>, public CObject {
|
||||||
virtual bool load(MfcArchive &file);
|
virtual bool load(MfcArchive &file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CDWordArray : public Common::Array<int32>, public CObject {
|
||||||
|
public:
|
||||||
|
virtual bool load(MfcArchive &file);
|
||||||
|
};
|
||||||
|
|
||||||
struct CNode {
|
struct CNode {
|
||||||
CNode *pNext;
|
CNode *pNext;
|
||||||
CNode *pPrev;
|
CNode *pPrev;
|
||||||
|
|
|
@ -504,4 +504,20 @@ bool Sc2::load(MfcArchive &file) {
|
||||||
return true;
|
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
|
} // End of namespace Fullpipe
|
||||||
|
|
|
@ -56,6 +56,23 @@ int MfcArchive::readCount() {
|
||||||
return count;
|
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 {
|
enum {
|
||||||
kNullObject,
|
kNullObject,
|
||||||
kCInteraction,
|
kCInteraction,
|
||||||
|
@ -64,7 +81,9 @@ enum {
|
||||||
kCObjstateCommand,
|
kCObjstateCommand,
|
||||||
kCGameVar,
|
kCGameVar,
|
||||||
kCMctlCompound,
|
kCMctlCompound,
|
||||||
kCMovGraph
|
kCMovGraph,
|
||||||
|
kCMovGraphLink,
|
||||||
|
kCMovGraphNode
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
|
@ -78,6 +97,8 @@ const struct {
|
||||||
{ "CGameVar", kCGameVar },
|
{ "CGameVar", kCGameVar },
|
||||||
{ "CMctlCompound", kCMctlCompound },
|
{ "CMctlCompound", kCMctlCompound },
|
||||||
{ "CMovGraph", kCMovGraph },
|
{ "CMovGraph", kCMovGraph },
|
||||||
|
{ "CMovGraphLink", kCMovGraphLink },
|
||||||
|
{ "CMovGraphNode", kCMovGraphNode },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,6 +129,10 @@ static CObject *createObject(int objectId) {
|
||||||
return new CMctlCompound();
|
return new CMctlCompound();
|
||||||
case kCMovGraph:
|
case kCMovGraph:
|
||||||
return new CMovGraph();
|
return new CMovGraph();
|
||||||
|
case kCMovGraphLink:
|
||||||
|
return new CMovGraphLink();
|
||||||
|
case kCMovGraphNode:
|
||||||
|
return new CMovGraphNode();
|
||||||
default:
|
default:
|
||||||
error("Unknown objectId: %d", objectId);
|
error("Unknown objectId: %d", objectId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ class MfcArchive : public Common::File {
|
||||||
|
|
||||||
char *readPascalString(bool twoByte = false);
|
char *readPascalString(bool twoByte = false);
|
||||||
int readCount();
|
int readCount();
|
||||||
|
double readDouble();
|
||||||
CObject *parseClass(bool *isCopyReturned);
|
CObject *parseClass(bool *isCopyReturned);
|
||||||
CObject *readClass();
|
CObject *readClass();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue