FX Map Asset: Difference between revisions

From COD Engine Research
No edit summary
No edit summary
Line 6: Line 6:
The fx_map asset is a new addition to Modern Warfare 2, and only exists on Infinity Ward games from then on. It is part of the D3DBSP system produced by Radiant. Although it appears to have changed very little throughout the series, there is virtually no known information about it.
The fx_map asset is a new addition to Modern Warfare 2, and only exists on Infinity Ward games from then on. It is part of the D3DBSP system produced by Radiant. Although it appears to have changed very little throughout the series, there is virtually no known information about it.
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
struct GlassPane
union GfxColor
{
{
   char unknown1[0x18];
   char array[4];
   Material * glassMaterial;
  unsigned int packed;
   Material * glassSpiderwebMaterial;
};
   PhysPreset * glassChunkPhysics;
 
struct __declspec(align(4)) FxGlassDef
{
  float halfThickness;
  float texVecs[2][2];
  GfxColor color;
   Material *material;
   Material *materialShattered;
   PhysPreset *physPreset;
#ifdef Ghosts
#ifdef Ghosts
   FxEffectDef * shatterPiece;
   FxEffectDef *pieceBreakEffect;
   FxEffectDef * shatterLargeFx;
   FxEffectDef *shatterEffect;
   FxEffectDef * shatterSmallFx;
   FxEffectDef *shatterSmallEffect;
   FxEffectDef * unknownFx4;
   FxEffectDef *crackDecalEffect;
   snd_alias_list_name shatterSound;
   snd_alias_list_name damagedSound;
   snd_alias_list_name blowoutSound;
   snd_alias_list_name destroyedSound;
   snd_alias_list_name breakoutSound;
   snd_alias_list_name destroyedQuietSound;
   char unknown3[8];
   int numCrackRings;
  bool isOpaque;
#endif
#endif
   char unknown2[8];
   char unknown2[4];
};
};


struct FxWorld
struct FxSpatialFrame
{
  float quat[4];
  float origin[3];
};
 
union FxGlassPiecePlace
{
  struct
  {
    FxSpatialFrame frame;
    float radius;
  };
  unsigned int nextFree;
};
 
struct FxGlassPieceState
{
  float texCoordOrigin[2];
  unsigned int supportMask;
  unsigned __int16 initIndex;
  unsigned __int16 geoDataStart;
  unsigned __int16 lightingIndex;
  char defIndex;
  char pad[3];
  char vertCount;
  char holeDataCount;
  char crackDataCount;
  char fanDataCount;
  unsigned __int16 flags;
  float areaX2;
};
 
struct FxGlassPieceDynamics
{
  int fallTime;
  __int64 physObjId;
  __int64 physJointId;
  float vel[3];
  float avel[3];
};
 
struct FxGlassVertex
{
  __int16 x;
  __int16 y;
};
 
struct FxGlassHoleHeader
{
  unsigned __int16 uniqueVertCount;
  char touchVert;
  char pad[1];
};
 
struct FxGlassCrackHeader
{
  unsigned __int16 uniqueVertCount;
  char beginVertIndex;
  char endVertIndex;
};
 
union FxGlassGeometryData
{
  FxGlassVertex vert;
  FxGlassHoleHeader hole;
  FxGlassCrackHeader crack;
  char asBytes[4];
  __int16 anonymous[2];
};
 
struct __declspec(align(4)) FxGlassInitPieceState //Note, on MW3 this is missing 4 bytes, just not sure whats missing yet
{
{
   char unknown1[8];
   FxSpatialFrame frame;
  unsigned int glassCount;
   float radius;
  unsigned int unknownCount2;
   float texCoordOrigin[2];
  unsigned int unknownCount3;
   unsigned int supportMask;
  unsigned int unknownCount4;
   float areaX2;
   unsigned int unknownCount5;
   unsigned __int16 lightingIndex;
   char unknown2[8];
   char defIndex;
   unsigned int unknownCount7;
   char vertCount;
   int unknown6;
   char fanDataCount;
   unsigned int unknownCount6;
   char pad[1];
  GlassPane * glasses;
};
   char * unknown3; //Size = unknownCount2 << 5
   char * unknown4; //Size = unknownCount2 << 5
   char * unknown5; //Size = ((unknownCount2 << 3) + unknownCount2) << 2
   char * unknown7; //Size = unknownCount7 << 2
  unsigned int * unknown8; //Count = unknownCount3
  unsigned int * unknown9; //Count = unknownCount3 * unknownCount5
  unsigned __int16 * unknownA; //Total size = (unknownCount2 + 0xF) & 0xFF
  char * unknownB; //Size = ((unknownCount2 << 1) + unknownCount2) << 2
  char * unknownC; //Size = ((unknownCount2 + 3) << 2) & 0xFFFFFFF0
  unsigned short unknownD; //Count = unknownCount4;
#ifdef Ghosts
  char * unknownE; //Size = unknownCount4 * 0x38
#else
  char * unknownE; //Size = unknownCount4 * 0x34
#endif


   char * unknownF; //Size = unknownCount6 << 2
struct __declspec(align(8)) FxGlassSystem
   char unknown10[0xC];
{
  int time;
  int prevTime;
  unsigned int defCount;
  unsigned int pieceLimit;
  unsigned int pieceWordCount;
  unsigned int initPieceCount;
  unsigned int cellCount;
  unsigned int activePieceCount;
  unsigned int firstFreePiece;
  unsigned int geoDataLimit;
  unsigned int geoDataCount;
  unsigned int initGeoDataCount;
  FxGlassDef *defs;
  FxGlassPiecePlace *piecePlaces;
  FxGlassPieceState *pieceStates;
  FxGlassPieceDynamics *pieceDynamics;
  FxGlassGeometryData *geoData;
  unsigned int *isInUse;
  unsigned int *cellBits;
   char *visData;
   float (*linkOrg)[3];
  float *halfThickness;
  unsigned __int16 *lightingHandles;
  FxGlassInitPieceState *initPieceStates;
  FxGlassGeometryData *initGeoData;
  bool needToCompactData;
  char initCount;
  float effectChanceAccum;
  int lastPieceDeletionTime;
};
};


struct FxMap
struct FxWorld
{
{
   const char * name;
   const char * name;
   FxWorld surfaces;
   FxGlassSystem glassSys;
};
};
</syntaxhighlight>
</syntaxhighlight>

Revision as of 05:49, 22 December 2014

The fx_map asset is a new addition to Modern Warfare 2, and only exists on Infinity Ward games from then on. It is part of the D3DBSP system produced by Radiant. Although it appears to have changed very little throughout the series, there is virtually no known information about it.

union GfxColor
{
  char array[4];
  unsigned int packed;
};

struct __declspec(align(4)) FxGlassDef
{
  float halfThickness;
  float texVecs[2][2];
  GfxColor color;
  Material *material;
  Material *materialShattered;
  PhysPreset *physPreset;
#ifdef Ghosts
  FxEffectDef *pieceBreakEffect;
  FxEffectDef *shatterEffect;
  FxEffectDef *shatterSmallEffect;
  FxEffectDef *crackDecalEffect;
  snd_alias_list_name damagedSound;
  snd_alias_list_name destroyedSound;
  snd_alias_list_name destroyedQuietSound;
  int numCrackRings;
  bool isOpaque;
#endif
  char unknown2[4];
};

struct FxSpatialFrame
{
  float quat[4];
  float origin[3];
};

union FxGlassPiecePlace
{
  struct
  {
    FxSpatialFrame frame;
    float radius;
  };
  unsigned int nextFree;
};

struct FxGlassPieceState
{
  float texCoordOrigin[2];
  unsigned int supportMask;
  unsigned __int16 initIndex;
  unsigned __int16 geoDataStart;
  unsigned __int16 lightingIndex;
  char defIndex;
  char pad[3];
  char vertCount;
  char holeDataCount;
  char crackDataCount;
  char fanDataCount;
  unsigned __int16 flags;
  float areaX2;
};

struct FxGlassPieceDynamics
{
  int fallTime;
  __int64 physObjId;
  __int64 physJointId;
  float vel[3];
  float avel[3];
};

struct FxGlassVertex
{
  __int16 x;
  __int16 y;
};

struct FxGlassHoleHeader
{
  unsigned __int16 uniqueVertCount;
  char touchVert;
  char pad[1];
};

struct FxGlassCrackHeader
{
  unsigned __int16 uniqueVertCount;
  char beginVertIndex;
  char endVertIndex;
};

union FxGlassGeometryData
{
  FxGlassVertex vert;
  FxGlassHoleHeader hole;
  FxGlassCrackHeader crack;
  char asBytes[4];
  __int16 anonymous[2];
};

struct __declspec(align(4)) FxGlassInitPieceState //Note, on MW3 this is missing 4 bytes, just not sure whats missing yet
{
  FxSpatialFrame frame;
  float radius;
  float texCoordOrigin[2];
  unsigned int supportMask;
  float areaX2;
  unsigned __int16 lightingIndex;
  char defIndex;
  char vertCount;
  char fanDataCount;
  char pad[1];
};

struct __declspec(align(8)) FxGlassSystem
{
  int time;
  int prevTime;
  unsigned int defCount;
  unsigned int pieceLimit;
  unsigned int pieceWordCount;
  unsigned int initPieceCount;
  unsigned int cellCount;
  unsigned int activePieceCount;
  unsigned int firstFreePiece;
  unsigned int geoDataLimit;
  unsigned int geoDataCount;
  unsigned int initGeoDataCount;
  FxGlassDef *defs;
  FxGlassPiecePlace *piecePlaces;
  FxGlassPieceState *pieceStates;
  FxGlassPieceDynamics *pieceDynamics;
  FxGlassGeometryData *geoData;
  unsigned int *isInUse;
  unsigned int *cellBits;
  char *visData;
  float (*linkOrg)[3];
  float *halfThickness;
  unsigned __int16 *lightingHandles;
  FxGlassInitPieceState *initPieceStates;
  FxGlassGeometryData *initGeoData;
  bool needToCompactData;
  char initCount;
  float effectChanceAccum;
  int lastPieceDeletionTime;
};

struct FxWorld
{
  const char * name;
  FxGlassSystem glassSys;
};