Scriptable Asset

From COD Engine Research
Jump to: navigation, search

The scriptable asset is used in Ghost and Advanced Warfare. It appears to be a format used to hold some scripting information for models and the collision map. Since it is so new, there is virtually nothing known about it.

struct ScriptableEventShakeDef
{
  const char *rumbleName;
  unsigned __int16 duration;
  unsigned __int16 durationFadeUp;
  unsigned __int16 durationFadeDown;
  unsigned __int16 radius;
  unsigned __int16 exponent;
  unsigned __int16 scaleEarthquake;
  char scalePitch;
  char scaleYaw;
  char scaleRoll;
  char frequencyPitch;
  char frequencyYaw;
  char frequencyRoll;
  char flags;
};
 
struct ScriptableEventSunlightSettingsDef
{
  char color[4];
  char transStateStreamIndex;
  char flags;
  unsigned __int16 intensityScaleMin;
  unsigned __int16 intensityScaleMax;
  unsigned __int16 pitchMin;
  unsigned __int16 pitchMax;
  unsigned __int16 headingMin;
  unsigned __int16 headingMax;
  unsigned __int16 transitionTimeMin;
  unsigned __int16 transitionTimeMax;
};
 
struct ScriptableEventLightSettingsDef
{
  char color[4];
  char lightIndexConstIndex;
  char transStateStreamIndex;
  char useColor;
  char useStateTransitionTime;
  unsigned __int16 intensityScaleMin;
  unsigned __int16 intensityScaleMax;
  unsigned __int16 radiusScaleMin;
  unsigned __int16 radiusScaleMax;
  const char *noteworthy;
  unsigned __int16 transitionTimeMin;
  unsigned __int16 transitionTimeMax;
};
 
struct ScriptableEventPhysicsDef
{
  XModel *model;
  char launchDirX;
  char launchDirY;
  char launchDirZ;
  unsigned __int16 explForceScale;
  unsigned __int16 bulletForceScale;
};
 
struct ScriptableEventHealthDef
{
  unsigned __int16 amount;
  unsigned __int16 interval;
  unsigned __int16 badPlaceRadius;
  char streamIndex;
};
 
struct ScriptableEventExplodeDef
{
  unsigned __int16 forceMin;
  unsigned __int16 forceMax;
  unsigned __int16 radius;
  unsigned __int16 damageMin;
  unsigned __int16 damageMax;
  bool aiAvoid;
};
 
struct ScriptableEventAnimationDef
{
  const char *animName;
  bool override;
  bool stateful;
  char animEntryIndex;
  char animPlaybackStreamIndex;
  unsigned __int16 timeOffsetMin;
  unsigned __int16 timeOffsetMax;
  unsigned __int16 playbackRateMin;
  unsigned __int16 playbackRateMax;
  unsigned __int16 blendTime;
};
 
struct ScriptableEventSoundDef
{
  snd_alias_list_t *alias;
  bool looping;
};
 
struct ScriptableEventFxDef
{
  FxEffectDef *handle;
  scr_string_t tagName;
  unsigned __int16 loopTime;
  char loopTimeStreamIndex;
  bool tagUseAngles;
};
 
struct ScriptableEventModelDef
{
  XModel *model;
};
 
struct ScriptableEventStateChangeDef
{
  char targetIndex;
  char delayStreamIndex;
  unsigned __int16 delayMin;
  unsigned __int16 delayMax;
};
 
union ScriptableEventDataUnion
{
  ScriptableEventStateChangeDef stateChange;  //If parent->type == 0xA
  ScriptableEventModelDef setModel;//else if == 0
  ScriptableEventFxDef playFx; //else if == 1
  ScriptableEventSoundDef playSound; //else if == 2
  ScriptableEventAnimationDef playAnim; //else if == 3
  ScriptableEventExplodeDef doExplosion;  //else if == 4
  ScriptableEventHealthDef healthDrain;  //else if == 5
  ScriptableEventPhysicsDef physicsLaunch; //else if == 6
  ScriptableEventLightSettingsDef lightSettings; //else if == 7
  ScriptableEventSunlightSettingsDef sunlightSettings; //else if == 8
  ScriptableEventShakeDef shake; //else if == 9
};
 
enum ScriptableEventType
{
  SCRIPTABLE_EVENT_MODEL = 0x0,
  SCRIPTABLE_EVENT_FX = 0x1,
  SCRIPTABLE_EVENT_SOUND = 0x2,
  SCRIPTABLE_EVENT_ANIMATION = 0x3,
  SCRIPTABLE_EVENT_EXPLODE = 0x4,
  SCRIPTABLE_EVENT_HEALTHDRAIN = 0x5,
  SCRIPTABLE_EVENT_PHYSICSLAUNCH = 0x6,
  SCRIPTABLE_EVENT_LIGHTSETTINGS = 0x7,
  SCRIPTABLE_EVENT_SUNLIGHTSETTINGS = 0x8,
  SCRIPTABLE_EVENT_SHAKE = 0x9,
  SCRIPTABLE_EVENT_STATECHANGE = 0xA,
  SCRIPTABLE_EVENT_COUNT = 0xB,
};
 
struct ScriptableEventDef
{
  ScriptableEventType type;
  ScriptableEventDataUnion data;
};
 
struct ScriptableStateDef
{
  scr_string_t name;
  scr_string_t tagName;
  ScriptableEventDef *onEnterEvents; // count = onEnterEventCount
  char onEnterEventCount;
  char damageFlags;
  char damageParentTransferRate;
  char damageParentReceiveRate;
  unsigned __int16 maxHealth;
};
 
struct ScriptablePartDef
{
  ScriptableStateDef *states; // count = stateCount
  scr_string_t name;
  char stateCount;
  char flags;
  char eventStreamTimeRemainIndex;
  char eventStreamNextChangeTimeIndex;
};
 
 
struct ScriptableNotetrackFxDef
{
  FxEffectDef *handle;
  scr_string_t tagName;
  bool useAngles;
};
 
struct ScriptableNotetrackSoundDef
{
  snd_alias_list_t *alias;
};
 
union ScriptableNotetrackDataUnion
{
  ScriptableNotetrackFxDef playFx;
  ScriptableNotetrackSoundDef playSound;
};
 
enum ScriptableNotetrackType
{
  SCRIPTABLE_NT_FX = 0x0,
  SCRIPTABLE_NT_SOUND = 0x1,
  SCRIPTABLE_NT_COUNT = 0x2,
};
 
struct ScriptableNotetrackDef
{
  scr_string_t name;
  ScriptableNotetrackType type;
  ScriptableNotetrackDataUnion data;
};
 
/* ScriptableDef->type */
enum ScriptableType
{
  SCRIPTABLE_TYPE_GENERAL = 0x0,
  SCRIPTABLE_TYPE_CHARACTER = 0x1,
  SCRIPTABLE_TYPE_COUNT = 0x2,
};
 
struct Scriptable
{
  const char *name;
  XModel *baseModel;
  const char *baseCollisionBrush;
  const char *destroyedCollisionBrush;
  ScriptablePartDef *parts; //count = partCount
  ScriptableNotetrackDef *notetracks; //count = notetrackCount
  ScriptableType type;
  char flags;
  byte partCount;
  char serverInstancePartCount;
  char serverControlledPartCount;
  char notetrackCount;
  char eventStreamSize;
  char eventConstantsSize;
};