FX Asset (CoD4)

From COD Engine Research
Revision as of 08:49, 18 January 2014 by Aerosoul94 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
/* FxEffectDef::flags */
#define FX_ELEM_LOOPING				0x1
#define FX_ELEM_USE_RAND_COLOR			0x2
#define FX_ELEM_USE_RAND_ALPHA			0x4
#define FX_ELEM_USE_RAND_SIZE0			0x8
#define FX_ELEM_USE_RAND_SIZE1			0x10
#define FX_ELEM_USE_RAND_SCALE			0x20
#define FX_ELEM_USE_RAND_ROT_DELTA		0x40
#define FX_ELEM_MOD_COLOR_BY_ALPHA		0x80
#define FX_ELEM_USE_RAND_VEL0			0x100
#define FX_ELEM_USE_RAND_VEL1			0x200
#define FX_ELEM_USE_BACK_COMPAT_VEL		0x400
#define FX_ELEM_ABS_VEL0			0x800
#define FX_ELEM_ABS_VEL1			0x1000
#define FX_ELEM_PLAY_ON_TOUCH			0x2000
#define FX_ELEM_PLAY_ON_DEATH			0x4000
#define FX_ELEM_PLAY_ON_RUN			0x8000
#define FX_ELEM_PLAY_ON_ATTACHED		0x40000
#define FX_ELEM_BOUNDING_SPHERE			0x10000
#define FX_ELEM_USE_ITEM_CLIP			0x20000
#define FX_ELEM_DISABLED			0x80000000
 
/* FxElemDef::flags */
#define FX_ELEM_SPAWN_RELATIVE_TO_EFFECT	0x2
#define FX_ELEM_SPAWN_FRUSTUM_CULL		0x4
#define FX_ELEM_RUNNER_USES_RAND_ROT		0x8
#define FX_ELEM_SPAWN_OFFSET_NONE		0x0
#define FX_ELEM_SPAWN_OFFSET_SPHERE		0x10
#define FX_ELEM_SPAWN_OFFSET_CYLINDER		0x20
#define FX_ELEM_SPAWN_OFFSET_MASK		0x30
#define FX_ELEM_RUN_RELATIVE_TO_WORLD		0x0
#define FX_ELEM_RUN_RELATIVE_TO_SPAWN		0x40
#define FX_ELEM_RUN_RELATIVE_TO_EFFECT		0x80
#define FX_ELEM_RUN_RELATIVE_TO_OFFSET		0xC0
#define FX_ELEM_RUN_MASK			0xC0
#define FX_ELEM_USE_COLLISION			0x100
#define FX_ELEM_DIE_ON_TOUCH			0x200
#define FX_ELEM_DRAW_PAST_FOG			0x400
#define FX_ELEM_DRAW_WITH_VIEWMODEL		0x800
#define FX_ELEM_BLOCK_SIGHT			0x1000
#define FX_ELEM_USE_MODEL_PHYSICS		0x8000000
#define FX_ELEM_NONUNIFORM_SCALE		0x10000000
 
/* FxElemAtlas::behavior */
#define FX_ATLAS_START_FIXED		0x0
#define FX_ATLAS_START_RANDOM		0x1
#define FX_ATLAS_START_INDEXED		0x2
#define FX_ATLAS_START_MASK		0x3
#define FX_ATLAS_PLAY_OVER_LIFE		0x4
#define FX_ATLAS_LOOP_ONLY_N_TIMES	0x8
 
enum FxElemType : char
{
  FX_ELEM_TYPE_SPRITE_BILLBOARD = 0x0,
  FX_ELEM_TYPE_SPRITE_ORIENTED = 0x1,
  FX_ELEM_TYPE_TAIL = 0x2,
  FX_ELEM_TYPE_TRAIL = 0x3,
  FX_ELEM_TYPE_CLOUD = 0x4,
  FX_ELEM_TYPE_MODEL = 0x5,
  FX_ELEM_TYPE_OMNI_LIGHT = 0x6,
  FX_ELEM_TYPE_SPOT_LIGHT = 0x7,
  FX_ELEM_TYPE_SOUND = 0x8,
  FX_ELEM_TYPE_DECAL = 0x9,
  FX_ELEM_TYPE_RUNNER = 0xA,
  FX_ELEM_TYPE_COUNT = 0xB,
  FX_ELEM_TYPE_LAST_SPRITE = 0x3,
  FX_ELEM_TYPE_LAST_DRAWN = 0x7,
};
 
struct FxTrailVertex
{
  float pos[2];
  float normal[2];
  float texCoord;
};
 
struct FxTrailDef
{
  int scrollTimeMsec;
  int repeatDist;
  int splitDist;
  int vertCount;
  FxTrailVertex *verts;
  int indCount;
  unsigned __int16 *inds;
};
 
union FxElemVisuals
{
  const void *anonymous;
  Material *material;		// FxElemDef::elemType != 7 or 8
  XModel *model;		// FxElemDef::elemType == 6
  FxEffectDefRef effectDef;	// FxElemDef::elemType == 11
  const char *soundName;	// FxElemDef::elemType == 9
};
 
struct FxElemMarkVisuals
{
  Material *materials[2];
};
 
union FxElemDefVisuals
{
  FxElemMarkVisuals *markArray;	// FxElemDef::elemType == 10
  FxElemVisuals *array;		// FxElemDef::elemType != 10 && visualCount > 1
  FxElemVisuals instance;	// FxElemDef::elemType != 10 && visualCount == 1
};
 
struct FxElemVec3Range
{
  float base[3];
  float amplitude[3];
};
 
struct FxElemVelStateInFrame
{
  FxElemVec3Range velocity;
  FxElemVec3Range totalDelta;
};
 
struct FxElemVelStateSample
{
  FxElemVelStateInFrame local;
  FxElemVelStateInFrame world;
};
 
struct FxElemVisualState
{
  char color[4];
  float rotationDelta;
  float rotationTotal;
  float size[2];
  float scale;
};
 
struct FxElemVisStateSample
{
  FxElemVisualState base;
  FxElemVisualState amplitude;
};
 
struct FxElemAtlas
{
  char behavior;
  char index;
  char fps;
  char loopCount;
  char colIndexBits;
  char rowIndexBits;
  __int16 entryCount;
};
 
struct FxIntRange
{
  int base;
  int amplitude;
};
 
struct FxFloatRange
{
  float base;
  float amplitude;
};
 
union FxSpawnDef
{
  FxSpawnDefLooping looping;
  FxSpawnDefOneShot oneShot;
};
 
#pragma pack(push, 4)
struct FxElemDef
{
  int flags;
  FxSpawnDef spawn;
  FxFloatRange spawnRange;
  FxFloatRange fadeInRange;
  FxFloatRange fadeOutRange;
  float spawnFrustumCullRadius;
  FxIntRange spawnDelayMsec;
  FxIntRange lifeSpanMsec;
  FxFloatRange spawnOrigin[3];
  FxFloat spawnOffsetRadius;
  FxFloatRange spawnOffsetHeight;
  FxFloatRange spawnAngles[3];
  FxFloatRange angularVelocity[3];
  FxFloatRange initialRotation;
  int rotationAxis;
  FxFloatRange gravity;
  FxFloatRange reflectionFactor;
  FxElemAtlas atlas;
  char elemType;
  char visualCount;
  char velIntervalCount;
  char visStateIntervalCount;
  FxElemVelStateSample *velSamples;
  FxElemVisStateSample *visSamples;
  FxElemDefVisuals visuals;
  float collMins[3];
  float collMaxs[3];
  FxEffectDefRef effectOnImpact;
  FxEffectDefRef effectOnDeath;
  FxEffectDefRef effectEmitted;
  FxFloatRange emitDist;
  FxFloatRange emitDistVariance;
  FxTrailDef *trailDef;
  char sortOrder;
  char lightingFrac;
};
 
struct FxEffectDef
{
  const char *name;
  int flags;
  int totalSize;
  int msecLoopingLife;
  int elemDefCountLooping;
  int elemDefCountOneShot;
  int elemDefCountEmission;
  FxElemDef *elemDefs;
};
#pragma pack(pop)