Collision Map Asset (Ghosts): Difference between revisions
Created page with "__NOTOC__ Category:Assets Category:Ghosts The collision map (or clip map) has existed on every Call of Duty so far and is part of the D3DBSP system produced by Radiant..." |
Aerosoul94 (talk | contribs) No edit summary |
||
| Line 7: | Line 7: | ||
#pragma pack(push, 4) | #pragma pack(push, 4) | ||
struct Bounds | |||
{ | |||
float midPoint[3]; | |||
float halfSize[3]; | |||
}; | |||
struct cplane_s | struct cplane_s | ||
{ | { | ||
| Line 24: | Line 30: | ||
}; | }; | ||
struct | struct ClipMaterial | ||
{ | { | ||
char * | const char *name; | ||
int surfaceFlags; | int surfaceFlags; | ||
int | int contents; | ||
}; | }; | ||
| Line 114: | Line 120: | ||
struct cbrush_t | struct cbrush_t | ||
{ | { | ||
unsigned __int16 numsides; | |||
cbrushside_t * sides; | unsigned __int16 glassPieceIndex; | ||
cbrushedge_t * | cbrushside_t *sides; | ||
cbrushedge_t *baseAdjacentSide; | |||
__int16 axialMaterialNum[2][3]; | |||
char firstAdjacentSideOffsets[2][3]; | |||
char edgeCount[2][3]; | |||
}; | }; | ||
| Line 140: | Line 149: | ||
float productsOfInertia[3]; | float productsOfInertia[3]; | ||
int contents; | int contents; | ||
}; | |||
struct DynEntityHingeDef | |||
{ | |||
float axisOrigin[3]; | |||
float axisDir[3]; | |||
bool isLimited; | |||
float angleMin; | |||
float angleMax; | |||
float momentOfInertia; | |||
float friction; | |||
}; | |||
struct DynEntityLinkToDef | |||
{ | |||
int anchorIndex; | |||
float originOffset[3]; | |||
float angleOffset[3]; | |||
}; | }; | ||
| Line 151: | Line 178: | ||
FxEffectDef *destroyFx; | FxEffectDef *destroyFx; | ||
PhysPreset *physPreset; | PhysPreset *physPreset; | ||
DynEntityHingeDef *hinge; | |||
DynEntityLinkToDef; | |||
PhysMass mass; | PhysMass mass; | ||
int contents; | |||
}; | }; | ||
| Line 179: | Line 206: | ||
}; | }; | ||
struct | struct ClipInfo | ||
{ | { | ||
int planeCount; | int planeCount; | ||
cplane_s *planes; | cplane_s *planes; | ||
unsigned int numMaterials; | unsigned int numMaterials; | ||
ClipMaterial *materials; | |||
unsigned int numBrushSides; | unsigned int numBrushSides; | ||
cbrushside_t *brushsides; | cbrushside_t *brushsides; | ||
| Line 195: | Line 222: | ||
unsigned __int16 numBrushes; | unsigned __int16 numBrushes; | ||
cbrush_t *brushes; | cbrush_t *brushes; | ||
Bounds *brushBounds; //Size = ((numBrushes << 1) + numBrushes) << 3 | |||
int *brushContents; //Count = numBrushes | |||
}; | }; | ||
struct | struct cmodel_t | ||
{ | { | ||
Bounds bounds; | |||
float radius; | |||
ClipInfo *info; | |||
cLeaf_t leaf; | |||
}; | }; | ||
struct | struct Stage | ||
{ | { | ||
const char *name; | |||
float origin[3]; | |||
unsigned __int16 triggerIndex; | |||
char sunPrimaryLightIndex; | |||
char | |||
}; | }; | ||
struct | struct ScriptableInstance | ||
{ | { | ||
ScriptTableDef *def; //ScriptTable asset | |||
char *eventConstantsBuf; //Count = def->eventConstantsSize | |||
float origin[3]; | |||
float angles[3]; | |||
ScriptString targetname; | |||
unsigned __int16 preBrushModel; | |||
unsigned __int16 postBrushModel; | |||
char flags; | |||
XModel * | XModel *currentModel; | ||
ScriptableInstancePartState *partStates; //Count = def->partCount | |||
char * | char *eventStreamBuf; //Size = def->eventStreamSize | ||
unsigned int currentPartBits[6]; // 0x34 | |||
unsigned int damageOwnerEntHandle; | |||
unsigned __int16 updateNextInstance; | |||
unsigned __int16 linkedObject; | |||
}; | }; | ||
struct | struct ScriptableAnimationEntry // size = 0x10 | ||
{ | { | ||
char * | const char *animName; | ||
char | char runtimeBuf[0xC]; // was 0x10, on ps3 its 0xC, pc its unsigned __int64 | ||
}; | }; | ||
struct | struct ScriptableMapEnts | ||
{ | { | ||
int | unsigned int instanceStateSize; | ||
int | unsigned int instanceCount; | ||
int | unsigned int reservedInstanceCount; | ||
ScriptableInstance *instances; //Count = instanceCount | |||
int | unsigned int animEntryCount; | ||
ScriptableAnimationEntry *animEntries; //Count = animEntryCount | |||
int | unsigned int replicatedInstanceCount; | ||
}; | }; | ||
struct SModelAabbNode | |||
{ | |||
Bounds bounds; | |||
unsigned __int16 firstChild; | |||
unsigned __int16 childCount; | |||
}; | |||
struct clipMap_t | struct clipMap_t | ||
{ | { | ||
const char *name; | const char *name; | ||
int isInUse; | |||
ClipInfo info; | |||
ClipInfo *pInfo; | |||
unsigned int numStaticModels; | unsigned int numStaticModels; | ||
cStaticModel_s *staticModelList; | cStaticModel_s *staticModelList; | ||
| Line 272: | Line 308: | ||
int aabbTreeCount; | int aabbTreeCount; | ||
CollisionAabbTree *aabbTrees; | CollisionAabbTree *aabbTrees; | ||
unsigned int numSubModels; | |||
cmodel_t *cmodels; //Count = numSubModels | |||
MapEnts *mapEnts; | MapEnts *mapEnts; | ||
Stage *stages; //Count = stageCount | |||
char stageCount; | |||
MapTriggers stageTrigger; // see Ghosts MapEnts Asset | |||
unsigned __int16 smodelNodeCount; | |||
SModelAabbNode *smodelNodes; //This is loaded before cmodels, Size = smodelNodeCount * 0x1C | |||
unsigned __int16 dynEntCount[2]; | unsigned __int16 dynEntCount[2]; | ||
DynEntityDef *dynEntDefList[2]; | DynEntityDef *dynEntDefList[2]; | ||
| Line 285: | Line 321: | ||
DynEntityClient *dynEntClientList[2]; | DynEntityClient *dynEntClientList[2]; | ||
DynEntityColl *dynEntCollList[2]; | DynEntityColl *dynEntCollList[2]; | ||
unsigned int dynEntAnchorCount; | |||
ScriptString *dynEntAnchorNames; | |||
ScriptableMapEnts scriptableMapEnts; | |||
char unknown3[0x74]; // 0x8C on ps3 | |||
}; | }; | ||
#pragma pack(pop) | #pragma pack(pop) | ||
Revision as of 11:56, 22 December 2014
The collision map (or clip map) has existed on every Call of Duty so far and is part of the D3DBSP system produced by Radiant. Ghosts has only one clip map asset type per executable (col_map_mp on MP and col_map_sp on SP).
typedef char cbrushedge_t;
#pragma pack(push, 4)
struct Bounds
{
float midPoint[3];
float halfSize[3];
};
struct cplane_s
{
float normal[3];
float dist;
char type;
char signbits;
};
struct cStaticModel_s
{
XModel *xmodel;
float origin[3];
float invScaledAxis[3][3];
float absmin[3];
float absmax[3];
};
struct ClipMaterial
{
const char *name;
int surfaceFlags;
int contents;
};
struct cbrushside_t
{
cplane_s *plane;
unsigned int materialNum;
};
struct cNode_t
{
cplane_s *plane;
__int16 children[2];
};
struct cLeaf_t
{
unsigned __int16 firstCollAabbIndex;
unsigned __int16 collAabbCount;
int brushContents;
int terrainContents;
float mins[3];
float maxs[3];
int leafBrushNode;
};
struct cLeafBrushNodeLeaf_t
{
unsigned __int16 *brushes;
};
struct cLeafBrushNodeChildren_t
{
float dist;
float range;
unsigned __int16 childOffset[6];
};
union cLeafBrushNodeData_t
{
cLeafBrushNodeLeaf_t leaf;
cLeafBrushNodeChildren_t children;
};
struct cLeafBrushNode_s
{
char axis;
__int16 leafBrushCount;
int contents;
cLeafBrushNodeData_t data;
};
struct CollisionBorder
{
float distEq[3];
float zBase;
float zSlope;
float start;
float length;
};
struct CollisionPartition
{
char triCount;
char borderCount;
int firstTri;
CollisionBorder *borders;
};
union CollisionAabbTreeIndex
{
int firstChildIndex;
int partitionIndex;
};
struct CollisionAabbTree
{
float origin[3];
float halfSize[3];
unsigned __int16 materialIndex;
unsigned __int16 childCount;
CollisionAabbTreeIndex u;
};
struct cbrush_t
{
unsigned __int16 numsides;
unsigned __int16 glassPieceIndex;
cbrushside_t *sides;
cbrushedge_t *baseAdjacentSide;
__int16 axialMaterialNum[2][3];
char firstAdjacentSideOffsets[2][3];
char edgeCount[2][3];
};
enum DynEntityType
{
DYNENT_TYPE_INVALID = 0x0,
DYNENT_TYPE_CLUTTER = 0x1,
DYNENT_TYPE_DESTRUCT = 0x2,
DYNENT_TYPE_COUNT = 0x3,
};
struct GfxPlacement
{
float quat[4];
float origin[3];
};
struct PhysMass
{
float centerOfMass[3];
float momentsOfInertia[3];
float productsOfInertia[3];
int contents;
};
struct DynEntityHingeDef
{
float axisOrigin[3];
float axisDir[3];
bool isLimited;
float angleMin;
float angleMax;
float momentOfInertia;
float friction;
};
struct DynEntityLinkToDef
{
int anchorIndex;
float originOffset[3];
float angleOffset[3];
};
struct DynEntityDef
{
DynEntityType type;
GfxPlacement pose;
XModel *xModel;
unsigned __int16 brushModel;
unsigned __int16 physicsBrushModel;
FxEffectDef *destroyFx;
PhysPreset *physPreset;
DynEntityHingeDef *hinge;
DynEntityLinkToDef;
PhysMass mass;
int contents;
};
struct DynEntityPose
{
GfxPlacement pose;
float radius;
};
struct DynEntityClient
{
int physObjId;
unsigned int flags;
unsigned __int16 lightingHandle;
int health;
};
struct DynEntityColl
{
unsigned __int16 sector;
unsigned __int16 nextEntInSector;
float linkMins[2];
float linkMaxs[2];
};
struct ClipInfo
{
int planeCount;
cplane_s *planes;
unsigned int numMaterials;
ClipMaterial *materials;
unsigned int numBrushSides;
cbrushside_t *brushsides;
unsigned int numBrushEdges;
cbrushedge_t *brushEdges;
unsigned int leafbrushNodesCount;
cLeafBrushNode_s *leafbrushNodes;
unsigned int numLeafBrushes;
unsigned __int16 *leafbrushes;
unsigned __int16 numBrushes;
cbrush_t *brushes;
Bounds *brushBounds; //Size = ((numBrushes << 1) + numBrushes) << 3
int *brushContents; //Count = numBrushes
};
struct cmodel_t
{
Bounds bounds;
float radius;
ClipInfo *info;
cLeaf_t leaf;
};
struct Stage
{
const char *name;
float origin[3];
unsigned __int16 triggerIndex;
char sunPrimaryLightIndex;
};
struct ScriptableInstance
{
ScriptTableDef *def; //ScriptTable asset
char *eventConstantsBuf; //Count = def->eventConstantsSize
float origin[3];
float angles[3];
ScriptString targetname;
unsigned __int16 preBrushModel;
unsigned __int16 postBrushModel;
char flags;
XModel *currentModel;
ScriptableInstancePartState *partStates; //Count = def->partCount
char *eventStreamBuf; //Size = def->eventStreamSize
unsigned int currentPartBits[6]; // 0x34
unsigned int damageOwnerEntHandle;
unsigned __int16 updateNextInstance;
unsigned __int16 linkedObject;
};
struct ScriptableAnimationEntry // size = 0x10
{
const char *animName;
char runtimeBuf[0xC]; // was 0x10, on ps3 its 0xC, pc its unsigned __int64
};
struct ScriptableMapEnts
{
unsigned int instanceStateSize;
unsigned int instanceCount;
unsigned int reservedInstanceCount;
ScriptableInstance *instances; //Count = instanceCount
unsigned int animEntryCount;
ScriptableAnimationEntry *animEntries; //Count = animEntryCount
unsigned int replicatedInstanceCount;
};
struct SModelAabbNode
{
Bounds bounds;
unsigned __int16 firstChild;
unsigned __int16 childCount;
};
struct clipMap_t
{
const char *name;
int isInUse;
ClipInfo info;
ClipInfo *pInfo;
unsigned int numStaticModels;
cStaticModel_s *staticModelList;
unsigned int numNodes;
cNode_t *nodes;
unsigned int numLeafs;
cLeaf_t *leafs;
unsigned int vertCount;
float (*verts)[3];
int triCount;
unsigned __int16 *triIndices;
char *triEdgeIsWalkable; //Size = ((triCount << 1) + triCount + 0x1F) >> 3 << 2
int borderCount;
CollisionBorder *borders;
int partitionCount;
CollisionPartition *partitions;
int aabbTreeCount;
CollisionAabbTree *aabbTrees;
unsigned int numSubModels;
cmodel_t *cmodels; //Count = numSubModels
MapEnts *mapEnts;
Stage *stages; //Count = stageCount
char stageCount;
MapTriggers stageTrigger; // see Ghosts MapEnts Asset
unsigned __int16 smodelNodeCount;
SModelAabbNode *smodelNodes; //This is loaded before cmodels, Size = smodelNodeCount * 0x1C
unsigned __int16 dynEntCount[2];
DynEntityDef *dynEntDefList[2];
DynEntityPose *dynEntPoseList[2];
DynEntityClient *dynEntClientList[2];
DynEntityColl *dynEntCollList[2];
unsigned int dynEntAnchorCount;
ScriptString *dynEntAnchorNames;
ScriptableMapEnts scriptableMapEnts;
char unknown3[0x74]; // 0x8C on ps3
};
#pragma pack(pop)Keep in mind that the checksum is checked on other clients using the mapcrc dvar.
Source Format
The currently accepted source format is to dump the verticies and faces to "raw/maps/mp/(MAPNAME).d3dbsp.obj" because obj files are simple and easy to dump to. This clearly skips most of the clip map, so a more effiecient dumping method must be found.