Scriptable Asset: Difference between revisions
Aerosoul94 (talk | contribs) No edit summary |
Aerosoul94 (talk | contribs) No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 5: | Line 5: | ||
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. | 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. | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
struct | struct ScriptableEventShakeDef | ||
{ | { | ||
char * | const char *rumbleName; | ||
char | 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 | struct ScriptableEventSunlightSettingsDef | ||
{ | { | ||
char | char color[4]; | ||
char | char transStateStreamIndex; | ||
char | 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 | 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 | struct ScriptableEventPhysicsDef | ||
{ | { | ||
char | XModel *model; | ||
char | char launchDirX; | ||
char launchDirY; | |||
char launchDirZ; | |||
unsigned __int16 explForceScale; | |||
unsigned __int16 bulletForceScale; | |||
}; | }; | ||
struct | struct ScriptableEventHealthDef | ||
{ | { | ||
unsigned __int16 amount; | |||
char | unsigned __int16 interval; | ||
unsigned __int16 badPlaceRadius; | |||
char streamIndex; | |||
}; | }; | ||
struct | struct ScriptableEventExplodeDef | ||
{ | { | ||
unsigned __int16 forceMin; | |||
unsigned __int16 forceMax; | |||
unsigned __int16 radius; | |||
unsigned __int16 damageMin; | |||
unsigned __int16 damageMax; | |||
bool aiAvoid; | |||
}; | }; | ||
struct ScriptableEventAnimationDef | |||
{ | { | ||
char | 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 | 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 | 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 | struct Scriptable | ||
{ | { | ||
const char * name; | const char *name; | ||
XModel * | XModel *baseModel; | ||
char * | const char *baseCollisionBrush; | ||
char * | const char *destroyedCollisionBrush; | ||
ScriptablePartDef *parts; //count = partCount | |||
ScriptableNotetrackDef *notetracks; //count = notetrackCount | |||
char | ScriptableType type; | ||
byte | char flags; | ||
char | byte partCount; | ||
char serverInstancePartCount; | |||
char serverControlledPartCount; | |||
char notetrackCount; | |||
char eventStreamSize; | |||
char eventConstantsSize; | |||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 09:43, 22 December 2014
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;
};