Weapon Asset (Ghosts): Difference between revisions

From COD Engine Research
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
The purpose of the weapon asset should be fairly obvious, but the structure not so much. The weapon asset on Ghosts continues on the Modern Warfare 2 idea of the "WeaponVariantDef". Tthe WeaponVariantDef is 0xBC bytes, while the WeaponDef is 0x848.
The purpose of the weapon asset should be fairly obvious, but the structure not so much. The weapon asset on Ghosts continues on the Modern Warfare 2 idea of the "WeaponVariantDef". Tthe WeaponVariantDef is 0xBC bytes, while the WeaponDef is 0x848.
<source lang="cpp">
<source lang="cpp">
enum playerAnimType_t : int
enum ImpactType
{
  IMPACT_TYPE_NONE = 0x0,
  IMPACT_TYPE_BULLET_SMALL = 0x1,
  IMPACT_TYPE_BULLET_LARGE = 0x2,
  IMPACT_TYPE_BULLET_AP = 0x3,
  IMPACT_TYPE_BULLET_EXPLODE = 0x4,
  IMPACT_TYPE_SHOTGUN = 0x5,
  IMPACT_TYPE_SHOTGUN_EXPLODE = 0x6,
  IMPACT_TYPE_GRENADE_BOUNCE = 0x7,
  IMPACT_TYPE_GRENADE_EXPLODE = 0x8,
  IMPACT_TYPE_ROCKET_EXPLODE = 0x9,
  IMPACT_TYPE_PROJECTILE_DUD = 0xA,
  IMPACT_TYPE_COUNT = 0xB,
};
 
enum weaponIconRatioType_t : int
{
{
   none = 0x0,
   WEAPON_ICON_RATIO_1TO1 = 0,
   other = 0x1,
   WEAPON_ICON_RATIO_2TO1 = 1,
   pistol = 0x2,
   WEAPON_ICON_RATIO_4TO1 = 2,
   smg = 0x3,
   WEAPON_ICON_RATIO_MAX
  autorifle = 0x4,
  mg = 0x5,
  sniper = 0x6,
  rocketlauncher = 0x7,
  explosive = 0x8,
  grenade = 0x9,
  turret = 0xA,
  c4 = 0xB,
  m203 = 0xC,
  hold = 0xD,
  briefcase = 0xE,
  riotshield = 0xF,
  laptop = 0x10,
  throwingknife = 0x11,
  mortar = 0x12,
  juggernautmaniac = 0x13,
  claymore = 0x14,
  minigun = 0x15,
  drill = 0x16,
  dogwhistle = 0x17,
  smg_bullpup = 0x18,
  autorifle_bullpup = 0x19,
  sniper_bullpup = 0x1A,
  killstreaktrigger = 0x1B,
  trophysystem = 0x1C,
  PLAYER_ANIM_TYPE_MAX
};
};


Line 45: Line 35:
   WEAPTYPE_PROJECTILE,
   WEAPTYPE_PROJECTILE,
   WEAPTYPE_RIOTSHIELD,
   WEAPTYPE_RIOTSHIELD,
   WEAPTYPE_MAX
   WEAPTYPE_NUM
};
};


Line 62: Line 52:
   WEAPCLASS_NON_PLAYER = 10,
   WEAPCLASS_NON_PLAYER = 10,
   WEAPCLASS_ITEM = 11,
   WEAPCLASS_ITEM = 11,
   WEAPCLASS_MAX
   WEAPCLASS_NUM
};
};


Line 71: Line 61:
   PENETRATE_TYPE_MEDIUM = 2,
   PENETRATE_TYPE_MEDIUM = 2,
   PENETRATE_TYPE_LARGE = 3,
   PENETRATE_TYPE_LARGE = 3,
   PENETRATE_TYPE_MAX
   PENETRATE_TYPE_COUNT
};
};


Line 82: Line 72:
   WEAPINVENTORY_EXCLUSIVE = 4,
   WEAPINVENTORY_EXCLUSIVE = 4,
   WEAPINVENTORY_SCAVENGER = 5,
   WEAPINVENTORY_SCAVENGER = 5,
   WEAPINVENTORY_MAX
   WEAPINVENTORYCOUNT
};
};


Line 92: Line 82:
   WEAPON_FIRETYPE_BURSTFIRE3 = 0x3,
   WEAPON_FIRETYPE_BURSTFIRE3 = 0x3,
   WEAPON_FIRETYPE_BURSTFIRE4 = 0x4,
   WEAPON_FIRETYPE_BURSTFIRE4 = 0x4,
   WEAPON_FIRETYPE_DOUBLE_BARREL = 0x5,
   WEAPON_FIRETYPE_DOUBLEBARREL = 0x5,
   WEAPON_FIRETYPE_MAX
   WEAPON_FIRETYPECOUNT = 0x6,
  WEAPON_FIRETYPE_BURSTFIRE_FIRST = 0x2,
  WEAPON_FIRETYPE_BURSTFIRE_LAST = 0x4
};
 
enum OffhandClass
{
  OFFHAND_CLASS_NONE = 0x0,
  OFFHAND_CLASS_FRAG_GRENADE = 0x1,
  OFFHAND_CLASS_SMOKE_GRENADE = 0x2,
  OFFHAND_CLASS_FLASH_GRENADE = 0x3,
  OFFHAND_CLASS_THROWINGKNIFE = 0x4,
  OFFHAND_CLASS_OTHER = 0x5,
  OFFHAND_CLASS_COUNT = 0x6
};
 
enum weapStance_t
{
  WEAPSTANCE_STAND = 0x0,
  WEAPSTANCE_DUCK = 0x1,
  WEAPSTANCE_PRONE = 0x2,
  WEAPSTANCE_NUM = 0x3
};
};


Line 104: Line 115:
};
};


enum weaponIconRatioType_t : int
enum ammoCounterClipType_t
{
  AMMO_COUNTER_CLIP_NONE = 0x0,
  AMMO_COUNTER_CLIP_MAGAZINE = 0x1,
  AMMO_COUNTER_CLIP_SHORTMAGAZINE = 0x2,
  AMMO_COUNTER_CLIP_SHOTGUN = 0x3,
  AMMO_COUNTER_CLIP_ROCKET = 0x4,
  AMMO_COUNTER_CLIP_BELTFED = 0x5,
  AMMO_COUNTER_CLIP_ALTWEAPON = 0x6,
  AMMO_COUNTER_CLIP_COUNT = 0x7
};
 
enum weapOverlayReticle_t
{
  WEAPOVERLAYRETICLE_NONE = 0x0,
  WEAPOVERLAYRETICLE_CROSSHAIR = 0x1,
  WEAPOVERLAYRETICLE_NUM = 0x2
};
 
enum WeapOverlayInteface_t
{
  WEAPOVERLAYINTERFACE_NONE = 0x0,
  WEAPOVERLAYINTERFACE_JAVELIN = 0x1,
  WEAPOVERLAYINTERFACE_TURRETSCOPE = 0x2,
  WEAPOVERLAYINTERFACECOUNT = 0x3
};
 
enum weapProjExposion_t
{
{
   WEAPON_ICON_RATIO_1TO1 = 0,
   WEAPPROJEXP_GRENADE = 0x0,
   WEAPON_ICON_RATIO_2TO1 = 1,
   WEAPPROJEXP_ROCKET = 0x1,
   WEAPON_ICON_RATIO_4TO1 = 2,
   WEAPPROJEXP_FLASHBANG = 0x2,
   WEAPON_ICON_RATIO_MAX
   WEAPPROJEXP_NONE = 0x3,
  WEAPPROJEXP_DUD = 0x4,
  WEAPPROJEXP_SMOKE = 0x5,
  WEAPPROJEXP_HEAVY = 0x6,
  WEAPPROJEXP_NUM = 0x7,
};
};


enum WeapStickinessType
enum WeapStickinessType
{
{
   WEAP_STICK_DONT = 0,
   WEAPSTICKINESS_NONE = 0x0,
   WEAP_STICK_ALL,
   WEAPSTICKINESS_ALL = 0x1,
   WEAP_STICK_ALL_ORIENT,
   WEAPSTICKINESS_ALL_ORIENT = 0x2,
   WEAP_STICK_GROUND,
   WEAPSTICKINESS_GROUND = 0x3,
   WEAP_STICK_GROUND_YAW,
   WEAPSTICKINESS_GROUND_WITH_YAW = 0x4,
   WEAP_STICK_KNIFE,
   WEAPSTICKINESS_KNIFE = 0x5,
   WEAP_STICK_MAX
   WEAPSTICKINESS_COUNT = 0x6
};
 
enum guidedMissileType_t
{
  MISSILE_GUIDANCE_NONE = 0x0,
  MISSILE_GUIDANCE_SIDEWINDER = 0x1,
  MISSILE_GUIDANCE_HELLFIRE = 0x2,
  MISSILE_GUIDANCE_JAVELIN = 0x3,
  MISSILE_GUIDANCE_COUNT = 0x4
};
 
enum playerAnimType_t : int
{
  none = 0x0,
  other = 0x1,
  pistol = 0x2,
  smg = 0x3,
  autorifle = 0x4,
  mg = 0x5,
  sniper = 0x6,
  rocketlauncher = 0x7,
  explosive = 0x8,
  grenade = 0x9,
  turret = 0xA,
  c4 = 0xB,
  m203 = 0xC,
  hold = 0xD,
  briefcase = 0xE,
  riotshield = 0xF,
  laptop = 0x10,
  throwingknife = 0x11,
  mortar = 0x12,
  juggernautmaniac = 0x13,
  claymore = 0x14,
  minigun = 0x15,
  drill = 0x16,
  dogwhistle = 0x17,
  smg_bullpup = 0x18,
  autorifle_bullpup = 0x19,
  sniper_bullpup = 0x1A,
  killstreaktrigger = 0x1B,
  trophysystem = 0x1C,
  PLAYER_ANIM_TYPE_MAX
};
 
struct StateTimers
{
  int iFireDelay;
  int iMeleeDelay;
  int meleeChargeDelay;
  int iDetonateDelay;
  int iRechamberTime;
  int rechamberTimeOneHanded;
  int iRechamberBoltTime;
  int iHoldFireTime;
  int iHoldPrimeTime;
  int iDetonateTime;
  int iMeleeTime;
  int meleeChargeTime;
  int iReloadTime;
  int reloadShowRocketTime;
  int iReloadEmptyTime;
  int iReloadAddTime;
  int iReloadEmptyAddTime;
  int iReloadStartTime;
  int iReloadStartAddTime;
  int iReloadEndTime;
  int iDropTime;
  int iRaiseTime;
  int iAltDropTime;
  int quickDropTime;
  int quickRaiseTime;
  int iBreachRaiseTime;
  int iEmptyRaiseTime;
  int iEmptyDropTime;
  int sprintInTime;
  int sprintLoopTime;
  int sprintOutTime;
  int stunnedTimeBegin;
  int stunnedTimeLoop;
  int stunnedTimeEnd;
  int nightVisionWearTime;
  int nightVisionWearTimeFadeOutEnd;
  int nightVisionWearTimePowerUp;
  int nightVisionRemoveTime;
  int nightVisionRemoveTimePowerDown;
  int nightVisionRemoveTimeFadeInStart;
  int fuseTime;
  int aiFuseTime;
  int primeTime;
  bool bHoldFullPrime;
  int blastFrontTime;
  int blastRightTime;
  int blastBackTime;
  int blastLeftTime;
  int slideInTime;
  int slideLoopTime;
  int slideOutTime;
};
};


struct AdsOverlayStruct
struct __declspec(align(8)) ADSOverlay
{
{
   Material *adsOverlayShader;
   Material *shader;
   Material *adsOverlayShaderLowRes;
   Material *shaderLowRes;
   Material *adsOverlayShaderEMP;
   Material *shaderEMP;
   Material *adsOverlayShaderEMPLowRes;
   Material *shaderEMPLowRes;
   int adsOverlayReticle;
   weapOverlayReticle_t reticle;
   float adsOverlayWidth;
   float width;
   float adsOverlayHeight;
   float height;
   float adsOverlayWidthSplitscreen;
   float widthSplitscreen;
   float adsOverlayHeightSplitscreeen;
   float heightSplitscreen;
};
};


struct WeaponDef
struct WeaponDef
{
{
   char * szInternalName;
   const char *szOverlayName;
   XModel * *gunXModel;          //Count = 0x40
   XModel **gunXModel;          //Count = 0x40
   XModel * handModel;
   XModel *handXModel;
      XModel * unknownModel1;
  XModel *camoWorldModel;
      XModel * unknownModel2;
  XModel *camoViewModel;
      Material * unknownMaterial1;
  Material *camoWorldModelMaterialOverride;
      Material * unknownMaterial2;
  Material *camoViewModelMaterialOverride;
  Material ** camoMaterials; //Count = 0x3F
  Material **camoMaterialTarget; //Count = 0x3F
  XAnim ** animR; //Count = 0x7C
  XAnimParts **szXAnimsRightHanded; //Count = 0x7C
  XAnim ** animL; //Count = 0x7C
  XAnimParts **szXAnimsLeftHanded; //Count = 0x7C
  char * szModeName;
  const char *szModeName;
      ScriptString (*unkScriptStrings1[0x18]);
  scr_string_t (*notetrackSoundMapKeys)[0x18];
      ScriptString (*unkScriptStrings2[0x18]);
  scr_string_t (*notetrackSoundMapValues)[0x18];
      ScriptString (*unkScriptStrings3[0x18]);
  scr_string_t (*notetrackRumbleMapKeys)[0x18];
      ScriptString (*unkScriptStrings4[0x18]);
  scr_string_t (*notetrackRumbleMapValues)[0x18];
      ScriptString (*unkScriptStrings5[0x18]);
  scr_string_t (*notetrackFXMapKeys)[0x18];
      FxEffectDef ** unkFxArray; //Count = 0x10
  FxEffectDef ** notetrackFXMapValues; //Count = 0x10
      ScriptString (*unkScriptStrings6[0x10]);
  scr_string_t (*notetrackFXMapTagValues)[0x10];
   playerAnimType_t playerAnimType;
   playerAnimType_t playerAnimType;
   weapType_t weapType;
   weapType_t weapType;
Line 162: Line 302:
   weapInventoryType_t inventoryType;
   weapInventoryType_t inventoryType;
   weapFireType_t fireType;
   weapFireType_t fireType;
      char unknown1[0x10];
  float burstFireCooldown;
  OffhandClass offhandClass;
  weapStance_t stance;
  char rattleSoundType;
   FxEffectDef * viewFlashEffect;
   FxEffectDef * viewFlashEffect;
   FxEffectDef * worldFlashEffect;
   FxEffectDef * worldFlashEffect;
Line 213: Line 356:
   snd_alias_list_name putawaySoundPlayer;
   snd_alias_list_name putawaySoundPlayer;
   snd_alias_list_name scanSound;
   snd_alias_list_name scanSound;
      snd_alias_list_name unknownSound1;
  snd_alias_list_name changeVariableZoomSound;
   snd_alias_list_name * parallelBounceSound;
   snd_alias_list_name * parallelBounceSound;
   snd_alias_list_name * perpendicularBounceSound;
   snd_alias_list_name * perpendicularBounceSound;
Line 220: Line 363:
   FxEffectDef * viewLastShotEjectEffect;
   FxEffectDef * viewLastShotEjectEffect;
   FxEffectDef * worldLastShotEjectEffect;
   FxEffectDef * worldLastShotEjectEffect;
   FxEffectDef * unknownFx1;
   FxEffectDef * viewMagEjectEffect;
   Material * reticleCenter;
   Material * reticleCenter;
   Material * reticleSide;
   Material * reticleSide;
Line 258: Line 401:
   Material * ammoCounterIcon;
   Material * ammoCounterIcon;
   weaponIconRatioType_t ammoCounterIconRatio;
   weaponIconRatioType_t ammoCounterIconRatio;
      int ammoCounterClip;   //Missing enum
  ammoCounterClipType_t ammoCounterClip;
   int iStartAmmo;
   int iStartAmmo;
   const char *szAmmoName;
   const char *szAmmoName;
Line 267: Line 410:
   int shotCount;
   int shotCount;
   const char *szSharedAmmoCapName;
   const char *szSharedAmmoCapName;
  int iSharedAmmoCapIndex;
   int iSharedAmmoCap;
   int iSharedAmmoCap;
   int damage;
   int damage;
Line 272: Line 416:
   int iMeleeDamage;
   int iMeleeDamage;
   int iDamageType;
   int iDamageType;
   int iFireDelay;
   StateTimers stateTimers;
   int iMeleeDelay;
   StateTimers akimboStateTimers;
  int meleeChargeDelay;
  int iDetonateDelay;
  int iRechamberTime;
  int iRechamberOneHanded;
  int iRechamberBoltTime;
  int iHoldFireTime;
  int iDetonateTime;
      int unknown2;
  int iMeleeTime;
  int meleeChargeTime;
  int iReloadTime;
  int reloadShowRocketTime;
  int iReloadEmptyTime;
  int iReloadAddTime;
      int unknown3;
  int iReloadStartTime;
  int iReloadStartAddTime;
  int iReloadEndTime;
  int iDropTime;
  int iRaiseTime;
  int iAltDropTime;
  int quickDropTime;
  int quickRaiseTime;
  int iFirstRaiseTime;
  int iEmptyRaiseTime;
  int iEmptyDropTime;
  int sprintInTime;
  int sprintLoopTime;
  int sprintOutTime;
  int stunnedTimeBegin;
  int stunnedTimeLoop;
  int stunnedTimeEnd;
      char unknown4[0x114];
   float autoAimRange;
   float autoAimRange;
   float aimAssistRange;
   float aimAssistRange;
Line 315: Line 426:
   float adsMoveSpeedScale;
   float adsMoveSpeedScale;
   float sprintDurationScale;
   float sprintDurationScale;
   float adsZoomInFrac;
   float fAdsZoomInFrac;
   float adsZoomOutFrac;
   float fAdsZoomOutFrac;
   AdsOverlayStruct overlayInfo;
   ADSOverlay overlay;
      int unknown6;
  WeapOverlayInteface_t overlayInterface;
   float fAdsBobFactor;
   float fAdsBobFactor;
   float fAdsViewBobMult;
   float fAdsViewBobMult;
Line 342: Line 453:
   float fGunMaxPitch;
   float fGunMaxPitch;
   float fGunMaxYaw;
   float fGunMaxYaw;
      char unknown7[0xC];
  float adsIdleLerpStartTime;
  float adsIdleLerpTime;
  float swayMaxAngleSteadyAim;
   float swayMaxAngle;
   float swayMaxAngle;
   float swayLerpSpeed;
   float swayLerpSpeed;
Line 358: Line 471:
   float adsViewErrorMin;
   float adsViewErrorMin;
   float adsViewErrorMax;
   float adsViewErrorMax;
      int unknown8;
  float adsFireAnimFrac;
   PhysCollisionMap * collisions;
   PhysCollmap *physCollmap;
      char unknown9[0x28];
  float dualWieldViewModelOffset;
   int iDropAmmoMin;
  float fScopeDriftDelay;
  float fScopeDriftLerpInTime;
  float fScopeDriftSteadyTime;
  float fScopeDriftLerpOutTime;
  float fScopeDriftSteadyFactor;
  float fScopeDriftUnsteadyFactor;
  weaponIconRatioType_t killIconRatio;
  int iReloadAmmoAdd;
  int iReloadStartAdd;
   int ammoDropStockMin;
   int ammoDropClipPercentMin;
   int ammoDropClipPercentMin;
   int ammoDropClipPercentMax;
   int ammoDropClipPercentMax;
Line 378: Line 500:
   float timeToAccelerate;
   float timeToAccelerate;
   float projectileCurvature;
   float projectileCurvature;
      char * unknownString1;
  const char *projectileName;
      XModel * projectileModel;
  XModel *projectileModel;
      int projExplosiveType;   //Missing enum
  weapProjExposion_t projExplosion;
   FxEffectDef * projExplosionEffect;
   FxEffectDef * projExplosionEffect;
   FxEffectDef * projDudEffect;
   FxEffectDef * projDudEffect;
Line 388: Line 510:
   float lowAmmoWarningThreshold;
   float lowAmmoWarningThreshold;
   float ricochetChance;
   float ricochetChance;
      char unknown10[0xC];
  bool riotShieldEnableDamage;
   float (*parallelBounce[31]);
  int riotShieldHealth;
   float (*perpendicularBounce[31]);
  float riotShieldDamageMult;
   float (*parallelBounce)[31];
   float (*perpendicularBounce)[31];
   FxEffectDef * projTrailEffect;
   FxEffectDef * projTrailEffect;
   FxEffectDef * projBeaconEffect;
   FxEffectDef * projBeaconEffect;
   float vProjectileColor[3];
   float vProjectileColor[3];
      int guidedMissileType;   //Missing enum
  guidedMissileType_t guidedMissileType;
   float maxSteeringAccel;
   float maxSteeringAccel;
   float projIgnitionDelay;
   float projIgnitionDelay;
   FxEffectDef * projIgnitionEffect;
   FxEffectDef * projIgnitionEffect;
      char unknown11[0x38];
  snd_alias_list_name projIgnitionSound;
  float fAdsAimPitch;
  float fAdsCrosshairInFrac;
  float fAdsCrosshairOutFrac;
  bool adsShouldShowCrosshair;
  int adsGunKickReducedKickBullets;
  float adsGunKickReducedKickPercent;
  float fAdsGunKickPitchMin;
  float fAdsGunKickPitchMax;
  float fAdsGunKickYawMin;
  float fAdsGunKickYawMax;
  float fAdsGunKickMagMin;
  float fAdsGunKickAccel;
  float fAdsGunKickSpeedMax;
   float fAdsGunKickSpeedDecay;
   float fAdsGunKickSpeedDecay;
   float fAdsGunKickStaticDecay;
   float fAdsGunKickStaticDecay;
Line 405: Line 542:
   float fAdsViewKickYawMin;
   float fAdsViewKickYawMin;
   float fAdsViewKickYawMax;
   float fAdsViewKickYawMax;
      char unknown12[0xC];
  float fAdsViewKickMagMin;
  float fAdsViewScatterMin;
  float fAdsViewScatterMax;
   float fAdsSpread;
   float fAdsSpread;
   int hipGunKickReducedKickBullets;
   int hipGunKickReducedKickBullets;
Line 413: Line 552:
   float fHipGunKickYawMin;
   float fHipGunKickYawMin;
   float fHipGunKickYawMax;
   float fHipGunKickYawMax;
      int unknown13;
  float fHipGunKickMagMin;
   float fHipGunKickAccel;
   float fHipGunKickAccel;
   float fHipGunKickSpeedMax;
   float fHipGunKickSpeedMax;
Line 422: Line 561:
   float fHipViewKickYawMin;
   float fHipViewKickYawMin;
   float fHipViewKickYawMax;
   float fHipViewKickYawMax;
      char unknown14[0xC];
  float fHipViewKickMagMin;
  float fHipViewScatterMin;
  float fHipViewScatterMax;
   float fightDist;
   float fightDist;
   float maxDist;
   float maxDist;
Line 450: Line 591:
   const char *szUseHintString;
   const char *szUseHintString;
   const char *dropHintString;
   const char *dropHintString;
   int iUseHintStringIndex;
   unsigned int iUseHintStringIndex;
   int dropHintStringIndex;
   unsigned int dropHintStringIndex;
   float horizViewJitter;
   float horizViewJitter;
   float vertViewJitter;
   float vertViewJitter;
Line 461: Line 602:
   int minDamage;
   int minDamage;
   int minPlayerDamage;
   int minPlayerDamage;
   float maxDamageRange;
   float fMaxDamageRange;
   float minDamageRange;
   float fMinDamageRange;
   float destabilizationRateTime;
   float destabilizationRateTime;
   float destabilizationCurvatureMax;
   float destabilizationCurvatureMax;
   int destabilizeDistance;
   int destabilizeDistance;
   float (*locationDamageMultipliers[22]);
   float (*locationDamageMultipliers)[22];
   const char *fireRumble;
   const char *fireRumble;
   const char *meleeImpactRumble;
   const char *meleeImpactRumble;
   [[:Tracer Asset|Tracer]] * tracer;
   TracerDef *tracerType;
      char unknown15[0x2C];
  bool turretADSEnabled;
  float turretADSTime;
  float turretFov;
  float turretFovADS;
  float turretScopeZoomRate;
  float turretScopeZoomMin;
  float turretScopeZoomMax;
  float turretOverheatUpRate;
  float turretOverheatDownRate;
  float turretOverheatPenalty;
  snd_alias_list_name *turretOverheatSound;
   FxEffectDef *turretOverheatEffect;
   FxEffectDef *turretOverheatEffect;
   const char *turretBarrelSpinRumble;
   const char *turretBarrelSpinRumble;
   int turretBarrelSpinUpTime;
   float turretBarrelSpinSpeed;
   int turretBarrelSpinDownTime;
   float turretBarrelSpinUpTime;
   int turretBarrelSpinSpeed;
   float turretBarrelSpinDownTime;
   snd_alias_list_name turretBarrelSpinMaxSnd;
   snd_alias_list_name turretBarrelSpinMaxSnd;
   snd_alias_list_name turretBarrelSpinUpSnds[4];
   snd_alias_list_name turretBarrelSpinUpSnds[4];
Line 481: Line 632:
   snd_alias_list_name missileConeSoundAlias;
   snd_alias_list_name missileConeSoundAlias;
   snd_alias_list_name missileConeSoundAliasAtBase;
   snd_alias_list_name missileConeSoundAliasAtBase;
      char unknown16[0x34];
  float missileConeSoundRadiusAtTop;
   ScriptString unknownScriptString;
  float missileConeSoundRadiusAtBase;
      char unknown17[0x5E];
  float missileConeSoundHeight;
   ScriptString stowTag;
  float missileConeSoundOriginOffset;
   XModel * unknownModel3;
  float missileConeSoundVolumescaleAtCore;
  float missileConeSoundVolumescaleAtEdge;
  float missileConeSoundVolumescaleCoreSize;
  float missileConeSoundPitchAtTop;
  float missileConeSoundPitchAtBottom;
  float missileConeSoundPitchTopSize;
  float missileConeSoundPitchBottomSize;
  float missileConeSoundCrossfadeTopSize;
  float missileConeSoundCrossfadeBottomSize;
  scr_string_t knifeAttachTagOverride;
  bool knifeAlwaysAttached;
  bool meleeOverrideValues;
  float aim_automelee_lerp;
  float aim_automelee_range;
  float aim_automelee_region_height;
  float aim_automelee_region_width;
  float player_meleeHeight;
  float player_meleeRange;
   float player_meleeWidth;
  bool sharedAmmo;
   bool lockonSupported;
  bool requireLockonToFire;
  bool isAirburstWeapon;
  bool bigExplosion;
  bool noAdsWhenMagEmpty;
  bool avoidDropCleanup;
  bool inheritsPerks;
  bool crosshairColorChange;
  bool bRifleBullet;
  bool armorPiercing;
  bool bBoltAction;
  bool aimDownSight;
  bool canHoldBreath;
  bool meleeOnly;
  bool canVariableZoom;
  bool bRechamberWhileAds;
  bool bBulletExplosiveDamage;
  bool bCookOffHold;
  bool reticleSpin45;
  bool bClipOnly;
  bool noAmmoPickup;
  bool adsFireOnly;
  bool cancelAutoHolsterWhenEmpty;
  bool disableSwitchToWhenEmpty;
  bool suppressAmmoReserveDisplay;
  bool laserSightDuringNightvision;
  bool markableViewmodel;
  bool noDualWield;
  bool flipKillIcon;
  bool bNoPartialReload;
  bool bSegmentedReload;
  bool bMultipleReload;
  bool blocksProne;
  bool silenced;
  bool isRollingGrenade;
  bool projExplosionEffectForceNormalUp;
  bool projExplosionEffectInheritParentDirection;
  bool bProjImpactExplode;
  bool bProjTrajectoryEvents;
  bool bProjWhizByEnabled;
  bool stickToPlayers;
  bool stickToVehicles;
  bool stickToTurrets;
  bool thrownSideways;
  bool hasDetonator;
  bool disableFiring;
  bool timedDetonation;
  bool rotate;
  bool holdButtonToThrow;
  bool freezeMovementWhenFiring;
  bool thermalScope;
  bool thermalToggle;
  bool outlineEnemies;
  bool altModeSameWeapon;
  bool turretBarrelSpinEnabled;
  bool missileConeSoundEnabled;
  bool missileConeSoundPitchshiftEnabled;
  bool missileConeSoundCrossfadeEnabled;
  bool offhandHoldIsCancelable;
  bool doNotAllowAttachmentsToOverrideSpread;
  bool useFastReloadAnims;
  bool useScopeDrift;
  bool alwaysShatterGlassOnImpact;
  bool oldWeapon;
  scr_string_t stowTag;
   XModel *stowOffsetModel;
};
 
struct __declspec(align(8)) AnimOverrideEntry
{
  unsigned __int16 attachment1;
  unsigned __int16 attachment2;
  XAnimParts *overrideAnim;
  XAnimParts *altmodeAnim;
  unsigned int animTreeType;
  int animTime;
  int altTime;
};
};


struct unkWeaponVariantDefStruct1
struct __declspec(align(8)) FXOverrideEntry
{
{
   int unknown;
   unsigned __int16 attachment1;
   XAnim* unknownAnims[2];
  unsigned __int16 attachment2;
   char unkData[0xC];
  snd_alias_list_name overrideSound;
   snd_alias_list_name altmodeSound;
   unsigned int fxType;
};
};


struct unkWeaponVariantDefStruct2
struct __declspec(align(8)) FXOverrideEntry
{
{
   int unknown1;
   unsigned __int16 attachment1;
   snd_alias_list_name unknownSounds[2];
  unsigned __int16 attachment2;
   int unknown2;
  FxEffectDef *overrideFX;
   FxEffectDef *altmodeFX;
   unsigned int fxType;
};
};


struct unkWeaponVariantDefStruct3
struct ReloadStateTimerEntry
{
{
   int unknown1;
   int attachment;
   FxEffectDef* unknownFXs[2];
   int reloadAddTime;
   int unknown2;
  int reloadEmptyAddTime;
   int reloadStartAddTime;
};
};


struct unkWeaponVariantDefStruct4
struct NoteTrackToSoundEntry
{
{
  int unknown;
  int attachment;
  ScriptString (*unknownArrays[0x18])[2];
  scr_string_t (*notetrackSoundMapKeys)[0x18];
  scr_string_t (*notetrackSoundMapValues)[0x18];
};
};


struct WeaponVariantDef
struct WeaponCompleteDef
{
{
   char * name;
   const char *szInternalName;
   WeaponDef * info;
   WeaponDef *weapDef;
   const char * displayName;
   const char *szDisplayName;
   ScriptString (*hideTags[0x20]);
   scr_string_t (*hideTags)[0x20];
   AttachmentDef ** sights; //Count = 6
   WeaponAttachment **scopes; //Count = 6
   AttachmentDef ** underBarrel; //Count = 3
   WeaponAttachment **underBarrels; //Count = 3
   AttachmentDef ** barrelsAndMods; //Count = 8
   WeaponAttachment **others; //Count = 8
   XAnim ** szXAnims; //Count = 0x7C
   XAnimParts *const *szXAnims; //Count = 0x7C
      int unkCount1;
  unsigned int numAnimOverrides;
      unkWeaponVariantDefStruct1 * unkData1; //Count = unkCount1
  AnimOverrideEntry *animOverrides;
      int unkCount2;
  unsigned int numSoundOverrides;
      unkWeaponVariantDefStruct2 * unkData2; //Count = unkCount2
  SoundOverrideEntry *soundOverrides;
      int unkCount3;
  unsigned int numFXOverrides;
      unkWeaponVariantDefStruct3 * unkData3; //Count = unkCount3
  FXOverrideEntry *fxOverrides;
      int unkCount4;
  unsigned int numReloadStateTimerOverrides;
      char * unkData4; //Size = unkCount4 << 4
  ReloadStateTimerEntry *reloadOverrides;
      int unkCount5;
  unsigned int numNotetrackOverrides;
      unkWeaponVariantDefStruct4 * unkData5; //Count = unkCount5
  NoteTrackToSoundEntry *notetrackOverrides;
   float adsZoomFov;
   float fAdsZoomFov;
   int adsTransInTime;
   int iAdsTransInTime;
   int adsTransOutTime;
   int iAdsTransOutTime;
   int clipSize;
   int iClipSize;
      int unknown1;
  ImpactType impactType;
   int fireTime;
   int iFireTime;
      int unknown2;
  int iFireTimeAkimbo;
      int unknown3;
  weaponIconRatioType_t dpadIconRatio;
   float penetrateMultiplier;
   float penetrateMultiplier;
   float adsViewKickCenterSpeed;
   float fAdsViewKickCenterSpeed;
   float hipViewKickCenterSpeed;
   float fHipViewKickCenterSpeed;
   char *szAltWeaponName;
   const char *szAltWeaponName;
   int altWeaponFireTime;
   int altWeapon;
   int altWeaponIndex;
   int iAltRaiseTime;
   int altRaiseTime;
   int iAltRaiseTimeAkimbo;
   Material * killIcon;
   Material * killIcon;
   Material * dpadIcon;
   Material * dpadIcon;
      char unknown4[0x10];
  int fireAnimLength;
   int dropAmmoMax;
  int fireAnimLengthAkimbo;
  int iFirstRaiseTime;
  int iFirstRaiseTimeAkimbo;
   int ammoDropStockMax;
   float adsDofStart;
   float adsDofStart;
   float adsDofEnd;
   float adsDofEnd;
   short accuracyGraphKnotCount;
   unsigned __int16 accuracyGraphKnotCount;
   short originalAccuracyGraphKnotCount;
   unsigned __int16 originalAccuracyGraphKnotCount;
   vec2_t *accuracyGraphKnots;
   vec2_t *accuracyGraphKnots;
   vec2_t *originalAccuracyGraphKnots;
   vec2_t *originalAccuracyGraphKnots;
      int unknown5;
  bool motionTracker;
      char * unknownString;
  bool enhanced;
  bool dpadIconShowsAmmo;
  const char *szAdsrBaseSetting;
};
};
  </source>
  </source>
== Source Format ==
== Source Format ==
The weapon source files are raw text files with no extension, located at "raw/weapons/sp/" for SP weapons and "raw/weapons/mp/" for MP weapons. They use the same format as many other assets, with each setting name and value separated by a back-slash. The first setting identifies the file, and for weapons the identifier string is "WEAPONFILE".
The weapon source files are raw text files with no extension, located at "raw/weapons/sp/" for SP weapons and "raw/weapons/mp/" for MP weapons. They use the same format as many other assets, with each setting name and value separated by a back-slash. The first setting identifies the file, and for weapons the identifier string is "WEAPONFILE".

Latest revision as of 04:42, 22 December 2014

The purpose of the weapon asset should be fairly obvious, but the structure not so much. The weapon asset on Ghosts continues on the Modern Warfare 2 idea of the "WeaponVariantDef". Tthe WeaponVariantDef is 0xBC bytes, while the WeaponDef is 0x848.

enum ImpactType
{
  IMPACT_TYPE_NONE = 0x0,
  IMPACT_TYPE_BULLET_SMALL = 0x1,
  IMPACT_TYPE_BULLET_LARGE = 0x2,
  IMPACT_TYPE_BULLET_AP = 0x3,
  IMPACT_TYPE_BULLET_EXPLODE = 0x4,
  IMPACT_TYPE_SHOTGUN = 0x5,
  IMPACT_TYPE_SHOTGUN_EXPLODE = 0x6,
  IMPACT_TYPE_GRENADE_BOUNCE = 0x7,
  IMPACT_TYPE_GRENADE_EXPLODE = 0x8,
  IMPACT_TYPE_ROCKET_EXPLODE = 0x9,
  IMPACT_TYPE_PROJECTILE_DUD = 0xA,
  IMPACT_TYPE_COUNT = 0xB,
};

enum weaponIconRatioType_t : int
{
  WEAPON_ICON_RATIO_1TO1 = 0,
  WEAPON_ICON_RATIO_2TO1 = 1,
  WEAPON_ICON_RATIO_4TO1 = 2,
  WEAPON_ICON_RATIO_MAX
};

enum weapType_t : int
{
  WEAPTYPE_NONE,
  WEAPTYPE_BULLET,
  WEAPTYPE_GRENADE,
  WEAPTYPE_PROJECTILE,
  WEAPTYPE_RIOTSHIELD,
  WEAPTYPE_NUM
};

enum weapClass_t : int
{
  WEAPCLASS_RIFLE = 0,
  WEAPCLASS_SNIPER = 1,
  WEAPCLASS_MG = 2,
  WEAPCLASS_SMG = 3,
  WEAPCLASS_SPREAD = 4,
  WEAPCLASS_PISTOL = 5,
  WEAPCLASS_GRENADE = 6,
  WEAPCLASS_ROCKETLAUNCHER = 7,
  WEAPCLASS_TURRET = 8,
  WEAPCLASS_THROWINGKNIFE = 9,
  WEAPCLASS_NON_PLAYER = 10,
  WEAPCLASS_ITEM = 11,
  WEAPCLASS_NUM
};

enum PenetrateType : int
{
  PENETRATE_TYPE_NONE = 0,
  PENETRATE_TYPE_SMALL = 1,
  PENETRATE_TYPE_MEDIUM = 2,
  PENETRATE_TYPE_LARGE = 3,
  PENETRATE_TYPE_COUNT
};

enum weapInventoryType_t : int
{
  WEAPINVENTORY_PRIMARY = 0,
  WEAPINVENTORY_OFFHAND = 1,
  WEAPINVENTORY_ITEM = 2,
  WEAPINVENTORY_ALTMODE = 3,
  WEAPINVENTORY_EXCLUSIVE = 4,
  WEAPINVENTORY_SCAVENGER = 5,
  WEAPINVENTORYCOUNT
};

enum weapFireType_t : int
{
  WEAPON_FIRETYPE_FULLAUTO = 0x0,
  WEAPON_FIRETYPE_SINGLESHOT = 0x1,
  WEAPON_FIRETYPE_BURSTFIRE2 = 0x2,
  WEAPON_FIRETYPE_BURSTFIRE3 = 0x3,
  WEAPON_FIRETYPE_BURSTFIRE4 = 0x4,
  WEAPON_FIRETYPE_DOUBLEBARREL = 0x5,
  WEAPON_FIRETYPECOUNT = 0x6,
  WEAPON_FIRETYPE_BURSTFIRE_FIRST = 0x2,
  WEAPON_FIRETYPE_BURSTFIRE_LAST = 0x4
};

enum OffhandClass
{
  OFFHAND_CLASS_NONE = 0x0,
  OFFHAND_CLASS_FRAG_GRENADE = 0x1,
  OFFHAND_CLASS_SMOKE_GRENADE = 0x2,
  OFFHAND_CLASS_FLASH_GRENADE = 0x3,
  OFFHAND_CLASS_THROWINGKNIFE = 0x4,
  OFFHAND_CLASS_OTHER = 0x5,
  OFFHAND_CLASS_COUNT = 0x6
};

enum weapStance_t
{
  WEAPSTANCE_STAND = 0x0,
  WEAPSTANCE_DUCK = 0x1,
  WEAPSTANCE_PRONE = 0x2,
  WEAPSTANCE_NUM = 0x3
};

enum activeReticleType_t : int
{
  VEH_ACTIVE_RETICLE_NONE = 0,
  VEH_ACTIVE_RETICLE_PIP_ON_A_STICK = 1,
  VEH_ACTIVE_RETICLE_BOUNCING_DIAMOND = 2,
  VEH_ACTIVE_RETICLE_MAX
};

enum ammoCounterClipType_t
{
  AMMO_COUNTER_CLIP_NONE = 0x0,
  AMMO_COUNTER_CLIP_MAGAZINE = 0x1,
  AMMO_COUNTER_CLIP_SHORTMAGAZINE = 0x2,
  AMMO_COUNTER_CLIP_SHOTGUN = 0x3,
  AMMO_COUNTER_CLIP_ROCKET = 0x4,
  AMMO_COUNTER_CLIP_BELTFED = 0x5,
  AMMO_COUNTER_CLIP_ALTWEAPON = 0x6,
  AMMO_COUNTER_CLIP_COUNT = 0x7
};

enum weapOverlayReticle_t
{
  WEAPOVERLAYRETICLE_NONE = 0x0,
  WEAPOVERLAYRETICLE_CROSSHAIR = 0x1,
  WEAPOVERLAYRETICLE_NUM = 0x2
};

enum WeapOverlayInteface_t
{
  WEAPOVERLAYINTERFACE_NONE = 0x0,
  WEAPOVERLAYINTERFACE_JAVELIN = 0x1,
  WEAPOVERLAYINTERFACE_TURRETSCOPE = 0x2,
  WEAPOVERLAYINTERFACECOUNT = 0x3
};

enum weapProjExposion_t
{
  WEAPPROJEXP_GRENADE = 0x0,
  WEAPPROJEXP_ROCKET = 0x1,
  WEAPPROJEXP_FLASHBANG = 0x2,
  WEAPPROJEXP_NONE = 0x3,
  WEAPPROJEXP_DUD = 0x4,
  WEAPPROJEXP_SMOKE = 0x5,
  WEAPPROJEXP_HEAVY = 0x6,
  WEAPPROJEXP_NUM = 0x7,
};

enum WeapStickinessType
{
  WEAPSTICKINESS_NONE = 0x0,
  WEAPSTICKINESS_ALL = 0x1,
  WEAPSTICKINESS_ALL_ORIENT = 0x2,
  WEAPSTICKINESS_GROUND = 0x3,
  WEAPSTICKINESS_GROUND_WITH_YAW = 0x4,
  WEAPSTICKINESS_KNIFE = 0x5,
  WEAPSTICKINESS_COUNT = 0x6
};

enum guidedMissileType_t
{
  MISSILE_GUIDANCE_NONE = 0x0,
  MISSILE_GUIDANCE_SIDEWINDER = 0x1,
  MISSILE_GUIDANCE_HELLFIRE = 0x2,
  MISSILE_GUIDANCE_JAVELIN = 0x3,
  MISSILE_GUIDANCE_COUNT = 0x4
};

enum playerAnimType_t : int
{
  none = 0x0,
  other = 0x1,
  pistol = 0x2,
  smg = 0x3,
  autorifle = 0x4,
  mg = 0x5,
  sniper = 0x6,
  rocketlauncher = 0x7,
  explosive = 0x8,
  grenade = 0x9,
  turret = 0xA,
  c4 = 0xB, 
  m203 = 0xC, 
  hold = 0xD,
  briefcase = 0xE,
  riotshield = 0xF,
  laptop = 0x10,
  throwingknife = 0x11,
  mortar = 0x12,
  juggernautmaniac = 0x13,
  claymore = 0x14,
  minigun = 0x15,
  drill = 0x16,
  dogwhistle = 0x17,
  smg_bullpup = 0x18,
  autorifle_bullpup = 0x19,
  sniper_bullpup = 0x1A,
  killstreaktrigger = 0x1B,
  trophysystem = 0x1C,
  PLAYER_ANIM_TYPE_MAX
};

struct StateTimers
{
  int iFireDelay;
  int iMeleeDelay;
  int meleeChargeDelay;
  int iDetonateDelay;
  int iRechamberTime;
  int rechamberTimeOneHanded;
  int iRechamberBoltTime;
  int iHoldFireTime;
  int iHoldPrimeTime;
  int iDetonateTime;
  int iMeleeTime;
  int meleeChargeTime;
  int iReloadTime;
  int reloadShowRocketTime;
  int iReloadEmptyTime;
  int iReloadAddTime;
  int iReloadEmptyAddTime;
  int iReloadStartTime;
  int iReloadStartAddTime;
  int iReloadEndTime;
  int iDropTime;
  int iRaiseTime;
  int iAltDropTime;
  int quickDropTime;
  int quickRaiseTime;
  int iBreachRaiseTime;
  int iEmptyRaiseTime;
  int iEmptyDropTime;
  int sprintInTime;
  int sprintLoopTime;
  int sprintOutTime;
  int stunnedTimeBegin;
  int stunnedTimeLoop;
  int stunnedTimeEnd;
  int nightVisionWearTime;
  int nightVisionWearTimeFadeOutEnd;
  int nightVisionWearTimePowerUp;
  int nightVisionRemoveTime;
  int nightVisionRemoveTimePowerDown;
  int nightVisionRemoveTimeFadeInStart;
  int fuseTime;
  int aiFuseTime;
  int primeTime;
  bool bHoldFullPrime;
  int blastFrontTime;
  int blastRightTime;
  int blastBackTime;
  int blastLeftTime;
  int slideInTime;
  int slideLoopTime;
  int slideOutTime;
};

struct __declspec(align(8)) ADSOverlay
{
  Material *shader;
  Material *shaderLowRes;
  Material *shaderEMP;
  Material *shaderEMPLowRes;
  weapOverlayReticle_t reticle;
  float width;
  float height;
  float widthSplitscreen;
  float heightSplitscreen;
};

struct WeaponDef
{
  const char *szOverlayName;
  XModel **gunXModel;           //Count = 0x40
  XModel *handXModel;
  XModel *camoWorldModel;
  XModel *camoViewModel;
  Material *camoWorldModelMaterialOverride;
  Material *camoViewModelMaterialOverride;
  Material **camoMaterialTarget;	//Count = 0x3F
  XAnimParts **szXAnimsRightHanded;					//Count = 0x7C
  XAnimParts **szXAnimsLeftHanded;					//Count = 0x7C
  const char *szModeName;
  scr_string_t (*notetrackSoundMapKeys)[0x18];
  scr_string_t (*notetrackSoundMapValues)[0x18];
  scr_string_t (*notetrackRumbleMapKeys)[0x18];
  scr_string_t (*notetrackRumbleMapValues)[0x18];
  scr_string_t (*notetrackFXMapKeys)[0x18];
  FxEffectDef ** notetrackFXMapValues;				//Count = 0x10
  scr_string_t (*notetrackFXMapTagValues)[0x10];
  playerAnimType_t playerAnimType;
  weapType_t weapType;
  weapClass_t weaponClass;
  PenetrateType penetrateType;
  weapInventoryType_t inventoryType;
  weapFireType_t fireType;
  float burstFireCooldown;
  OffhandClass offhandClass;
  weapStance_t stance;
  char rattleSoundType;
  FxEffectDef * viewFlashEffect;
  FxEffectDef * worldFlashEffect;
  FxEffectDef * viewADSFlashEffect;
  snd_alias_list_name pickUpSound;
  snd_alias_list_name pickUpSoundPlayer;
  snd_alias_list_name ammoPickupSound;
  snd_alias_list_name ammoPickupSoundPlayer;
  snd_alias_list_name projectileSound;
  snd_alias_list_name pullbackSound;
  snd_alias_list_name pullbackSoundPlayer;
  snd_alias_list_name fireSound;
  snd_alias_list_name fireSoundPlayer;
  snd_alias_list_name fireSoundPlayerAkimbo;
  snd_alias_list_name loopFireSound;
  snd_alias_list_name loopFireSoundPlayer;
  snd_alias_list_name stopFireSound;
  snd_alias_list_name stopFireSoundPlayer;
  snd_alias_list_name lastShotSound;
  snd_alias_list_name lastShotSoundPlayer;
  snd_alias_list_name emptyFireSound;
  snd_alias_list_name emptyFireSoundPlayer;
  snd_alias_list_name meleeSwipeSound;
  snd_alias_list_name meleeSwipeSoundPlayer;
  snd_alias_list_name meleeHitSound;
  snd_alias_list_name meleeMissSound;
  snd_alias_list_name rechamberSound;
  snd_alias_list_name rechamberSoundPlayer;
  snd_alias_list_name reloadSound;
  snd_alias_list_name reloadSoundPlayer;
  snd_alias_list_name reloadEmptySound;
  snd_alias_list_name reloadEmptySoundPlayer;
  snd_alias_list_name reloadStartSound;
  snd_alias_list_name reloadStartSoundPlayer;
  snd_alias_list_name reloadEndSound;
  snd_alias_list_name reloadEndSoundPlayer;
  snd_alias_list_name detonateSound;
  snd_alias_list_name detonateSoundPlayer;
  snd_alias_list_name nightVisionWearSound;
  snd_alias_list_name nightVisionWearSoundPlayer;
  snd_alias_list_name nightVisionRemoveSound;
  snd_alias_list_name nightVisionRemoveSoundPlayer;
  snd_alias_list_name altSwitchSound;
  snd_alias_list_name altSwitchSoundPlayer;
  snd_alias_list_name raiseSound;
  snd_alias_list_name raiseSoundPlayer;
  snd_alias_list_name firstRaiseSound;
  snd_alias_list_name firstRaiseSoundPlayer;
  snd_alias_list_name putawaySound;
  snd_alias_list_name putawaySoundPlayer;
  snd_alias_list_name scanSound;
  snd_alias_list_name changeVariableZoomSound;
  snd_alias_list_name * parallelBounceSound;
  snd_alias_list_name * perpendicularBounceSound;
  FxEffectDef * viewShellEjectEffect;
  FxEffectDef * worldShellEjectEffect;
  FxEffectDef * viewLastShotEjectEffect;
  FxEffectDef * worldLastShotEjectEffect;
  FxEffectDef * viewMagEjectEffect;
  Material * reticleCenter;
  Material * reticleSide;
  int iReticleCenterSize;
  int iReticleSideSize;
  int iReticleMinOfs;
  activeReticleType_t activeReticleType;
  float vStandMove[3];
  float vStandRot[3];
  float vStrafeMove[3];
  float vStrafeRot[3];
  float vDuckedOfs[3];
  float vDuckedMove[3];
  float vDuckedRot[3];
  float vProneOfs[3];
  float vProneMove[3];
  float vProneRot[3];
  float fPosMoveRate;
  float fPosProneMoveRate;
  float fStandMoveMinSpeed;
  float fDuckedMoveMinSpeed;
  float fProneMoveMinSpeed;
  float fPosRotRate;
  float fPosProneRotRate;
  float fStandRotMinSpeed;
  float fDuckedRotMinSpeed;
  float fProneRotMinSpeed;
  XModel * * worldModel;          //Count = 0x40
  XModel * worldClipModel;
  XModel * rocketModel;
  XModel * knifeModel;
  XModel * worldKnifeModel;
  Material * hudIcon;
  weaponIconRatioType_t hudIconRatio;
  Material * pickupIcon;
  weaponIconRatioType_t pickupIconRatio;
  Material * ammoCounterIcon;
  weaponIconRatioType_t ammoCounterIconRatio;
  ammoCounterClipType_t ammoCounterClip;
  int iStartAmmo;
  const char *szAmmoName;
  int iAmmoIndex;
  const char *szClipName;
  int iClipIndex;
  int iMaxAmmo;
  int shotCount;
  const char *szSharedAmmoCapName;
  int iSharedAmmoCapIndex;
  int iSharedAmmoCap;
  int damage;
  int playerDamage;
  int iMeleeDamage;
  int iDamageType;
  StateTimers stateTimers;
  StateTimers akimboStateTimers;
  float autoAimRange;
  float aimAssistRange;
  float aimAssistRangeAds;
  float aimPadding;
  float enemyCrosshairRange;
  float moveSpeedScale;
  float adsMoveSpeedScale;
  float sprintDurationScale;
  float fAdsZoomInFrac;
  float fAdsZoomOutFrac;
  ADSOverlay overlay;
  WeapOverlayInteface_t overlayInterface;
  float fAdsBobFactor;
  float fAdsViewBobMult;
  float fHipSpreadStandMin;
  float fHipSpreadDuckedMin;
  float fHipSpreadProneMin;
  float hipSpreadStandMax;
  float hipSpreadDuckedMax;
  float hipSpreadProneMax;
  float fHipSpreadDecayRate;
  float fHipSpreadFireAdd;
  float fHipSpreadTurnAdd;
  float fHipSpreadMoveAdd;
  float fHipSpreadDuckedDecay;
  float fHipSpreadProneDecay;
  float fHipReticleSidePos;
  float fAdsIdleAmount;
  float fHipIdleAmount;
  float adsIdleSpeed;
  float hipIdleSpeed;
  float fIdleCrouchFactor;
  float fIdleProneFactor;
  float fGunMaxPitch;
  float fGunMaxYaw;
  float adsIdleLerpStartTime;
  float adsIdleLerpTime;
  float swayMaxAngleSteadyAim;
  float swayMaxAngle;
  float swayLerpSpeed;
  float swayPitchScale;
  float swayYawScale;
  float swayHorizScale;
  float swayVertScale;
  float swayShellShockScale;
  float adsSwayMaxAngle;
  float adsSwayLerpSpeed;
  float adsSwayPitchScale;
  float adsSwayYawScale;
  float adsSwayHorizScale;
  float adsSwayVertScale;
  float adsViewErrorMin;
  float adsViewErrorMax;
  float adsFireAnimFrac;
  PhysCollmap *physCollmap;
  float dualWieldViewModelOffset;
  float fScopeDriftDelay;
  float fScopeDriftLerpInTime;
  float fScopeDriftSteadyTime;
  float fScopeDriftLerpOutTime;
  float fScopeDriftSteadyFactor;
  float fScopeDriftUnsteadyFactor;
  weaponIconRatioType_t killIconRatio;
  int iReloadAmmoAdd;
  int iReloadStartAdd;
  int ammoDropStockMin;
  int ammoDropClipPercentMin;
  int ammoDropClipPercentMax;
  int iExplosionRadius;
  int iExplosionRadiusMin;
  int iExplosionInnerDamage;
  int iExplosionOuterDamage;
  float damageConeAngle;
  float bulletExplDmgMult;
  float bulletExplRadiusMult;
  int iProjectileSpeed;
  int iProjectileSpeedUp;
  int iProjectileSpeedForward;
  int iProjectileActivateDist;
  float projLifetime;
  float timeToAccelerate;
  float projectileCurvature;
  const char *projectileName;
  XModel *projectileModel;
  weapProjExposion_t projExplosion;
  FxEffectDef * projExplosionEffect;
  FxEffectDef * projDudEffect;
  snd_alias_list_name projExplosionSound;
  snd_alias_list_name projDudSound;
  WeapStickinessType stickiness;
  float lowAmmoWarningThreshold;
  float ricochetChance;
  bool riotShieldEnableDamage;
  int riotShieldHealth;
  float riotShieldDamageMult;
  float (*parallelBounce)[31];
  float (*perpendicularBounce)[31];
  FxEffectDef * projTrailEffect;
  FxEffectDef * projBeaconEffect;
  float vProjectileColor[3];
  guidedMissileType_t guidedMissileType;
  float maxSteeringAccel;
  float projIgnitionDelay;
  FxEffectDef * projIgnitionEffect;
  snd_alias_list_name projIgnitionSound;
  float fAdsAimPitch;
  float fAdsCrosshairInFrac;
  float fAdsCrosshairOutFrac;
  bool adsShouldShowCrosshair;
  int adsGunKickReducedKickBullets;
  float adsGunKickReducedKickPercent;
  float fAdsGunKickPitchMin;
  float fAdsGunKickPitchMax;
  float fAdsGunKickYawMin;
  float fAdsGunKickYawMax;
  float fAdsGunKickMagMin;
  float fAdsGunKickAccel;
  float fAdsGunKickSpeedMax;
  float fAdsGunKickSpeedDecay;
  float fAdsGunKickStaticDecay;
  float fAdsViewKickPitchMin;
  float fAdsViewKickPitchMax;
  float fAdsViewKickYawMin;
  float fAdsViewKickYawMax;
  float fAdsViewKickMagMin;
  float fAdsViewScatterMin;
  float fAdsViewScatterMax;
  float fAdsSpread;
  int hipGunKickReducedKickBullets;
  float hipGunKickReducedKickPercent;
  float fHipGunKickPitchMin;
  float fHipGunKickPitchMax;
  float fHipGunKickYawMin;
  float fHipGunKickYawMax;
  float fHipGunKickMagMin;
  float fHipGunKickAccel;
  float fHipGunKickSpeedMax;
  float fHipGunKickSpeedDecay;
  float fHipGunKickStaticDecay;
  float fHipViewKickPitchMin;
  float fHipViewKickPitchMax;
  float fHipViewKickYawMin;
  float fHipViewKickYawMax;
  float fHipViewKickMagMin;
  float fHipViewScatterMin;
  float fHipViewScatterMax;
  float fightDist;
  float maxDist;
  const char *accuracyGraphName[2];
  vec2_t * accuracyGraphKnots;
  vec2_t * originalAccuracyGraphKnots;
  short accuracyGraphKnotCount;
  short originalAccuracyGraphKnotCount;
  int iPositionReloadTransTime;
  float leftArc;
  float rightArc;
  float topArc;
  float bottomArc;
  float accuracy;
  float aiSpread;
  float playerSpread;
  float minVertTurnSpeed;
  float minHorTurnSpeed;
  float maxVertTurnSpeed;
  float maxHorTurnSpeed;
  float pitchConvergenceTime;
  float yawConvergenceTime;
  float suppressTime;
  float maxRange;
  float fAnimHorRotateInc;
  float fPlayerPositionDist;
  const char *szUseHintString;
  const char *dropHintString;
  unsigned int iUseHintStringIndex;
  unsigned int dropHintStringIndex;
  float horizViewJitter;
  float vertViewJitter;
  float scanSpeed;
  float scanAccel;
  int scanPauseTime;
  const char *szScript;
  float fOOPosAnimLength[2];
  int minDamage;
  int minPlayerDamage;
  float fMaxDamageRange;
  float fMinDamageRange;
  float destabilizationRateTime;
  float destabilizationCurvatureMax;
  int destabilizeDistance;
  float (*locationDamageMultipliers)[22];
  const char *fireRumble;
  const char *meleeImpactRumble;
  TracerDef *tracerType;
  bool turretADSEnabled;
  float turretADSTime;
  float turretFov;
  float turretFovADS;
  float turretScopeZoomRate;
  float turretScopeZoomMin;
  float turretScopeZoomMax;
  float turretOverheatUpRate;
  float turretOverheatDownRate;
  float turretOverheatPenalty;
  snd_alias_list_name *turretOverheatSound;
  FxEffectDef *turretOverheatEffect;
  const char *turretBarrelSpinRumble;
  float turretBarrelSpinSpeed;
  float turretBarrelSpinUpTime;
  float turretBarrelSpinDownTime;
  snd_alias_list_name turretBarrelSpinMaxSnd;
  snd_alias_list_name turretBarrelSpinUpSnds[4];
  snd_alias_list_name turretBarrelSpinDownSnds[4];
  snd_alias_list_name missileConeSoundAlias;
  snd_alias_list_name missileConeSoundAliasAtBase;
  float missileConeSoundRadiusAtTop;
  float missileConeSoundRadiusAtBase;
  float missileConeSoundHeight;
  float missileConeSoundOriginOffset;
  float missileConeSoundVolumescaleAtCore;
  float missileConeSoundVolumescaleAtEdge;
  float missileConeSoundVolumescaleCoreSize;
  float missileConeSoundPitchAtTop;
  float missileConeSoundPitchAtBottom;
  float missileConeSoundPitchTopSize;
  float missileConeSoundPitchBottomSize;
  float missileConeSoundCrossfadeTopSize;
  float missileConeSoundCrossfadeBottomSize;
  scr_string_t knifeAttachTagOverride;
  bool knifeAlwaysAttached;
  bool meleeOverrideValues;
  float aim_automelee_lerp;
  float aim_automelee_range;
  float aim_automelee_region_height;
  float aim_automelee_region_width;
  float player_meleeHeight;
  float player_meleeRange;
  float player_meleeWidth;
  bool sharedAmmo;
  bool lockonSupported;
  bool requireLockonToFire;
  bool isAirburstWeapon;
  bool bigExplosion;
  bool noAdsWhenMagEmpty;
  bool avoidDropCleanup;
  bool inheritsPerks;
  bool crosshairColorChange;
  bool bRifleBullet;
  bool armorPiercing;
  bool bBoltAction;
  bool aimDownSight;
  bool canHoldBreath;
  bool meleeOnly;
  bool canVariableZoom;
  bool bRechamberWhileAds;
  bool bBulletExplosiveDamage;
  bool bCookOffHold;
  bool reticleSpin45;
  bool bClipOnly;
  bool noAmmoPickup;
  bool adsFireOnly;
  bool cancelAutoHolsterWhenEmpty;
  bool disableSwitchToWhenEmpty;
  bool suppressAmmoReserveDisplay;
  bool laserSightDuringNightvision;
  bool markableViewmodel;
  bool noDualWield;
  bool flipKillIcon;
  bool bNoPartialReload;
  bool bSegmentedReload;
  bool bMultipleReload;
  bool blocksProne;
  bool silenced;
  bool isRollingGrenade;
  bool projExplosionEffectForceNormalUp;
  bool projExplosionEffectInheritParentDirection;
  bool bProjImpactExplode;
  bool bProjTrajectoryEvents;
  bool bProjWhizByEnabled;
  bool stickToPlayers;
  bool stickToVehicles;
  bool stickToTurrets;
  bool thrownSideways;
  bool hasDetonator;
  bool disableFiring;
  bool timedDetonation;
  bool rotate;
  bool holdButtonToThrow;
  bool freezeMovementWhenFiring;
  bool thermalScope;
  bool thermalToggle;
  bool outlineEnemies;
  bool altModeSameWeapon;
  bool turretBarrelSpinEnabled;
  bool missileConeSoundEnabled;
  bool missileConeSoundPitchshiftEnabled;
  bool missileConeSoundCrossfadeEnabled;
  bool offhandHoldIsCancelable;
  bool doNotAllowAttachmentsToOverrideSpread;
  bool useFastReloadAnims;
  bool useScopeDrift;
  bool alwaysShatterGlassOnImpact;
  bool oldWeapon;
  scr_string_t stowTag;
  XModel *stowOffsetModel;
};

struct __declspec(align(8)) AnimOverrideEntry
{
  unsigned __int16 attachment1;
  unsigned __int16 attachment2;
  XAnimParts *overrideAnim;
  XAnimParts *altmodeAnim;
  unsigned int animTreeType;
  int animTime;
  int altTime;
};

struct __declspec(align(8)) FXOverrideEntry
{
  unsigned __int16 attachment1;
  unsigned __int16 attachment2;
  snd_alias_list_name overrideSound;
  snd_alias_list_name altmodeSound;
  unsigned int fxType;
};

struct __declspec(align(8)) FXOverrideEntry
{
  unsigned __int16 attachment1;
  unsigned __int16 attachment2;
  FxEffectDef *overrideFX;
  FxEffectDef *altmodeFX;
  unsigned int fxType;
};

struct ReloadStateTimerEntry
{
  int attachment;
  int reloadAddTime;
  int reloadEmptyAddTime;
  int reloadStartAddTime;
};

struct NoteTrackToSoundEntry
{
  int attachment;
  scr_string_t (*notetrackSoundMapKeys)[0x18];
  scr_string_t (*notetrackSoundMapValues)[0x18];
};

struct WeaponCompleteDef
{
  const char *szInternalName;
  WeaponDef *weapDef;
  const char *szDisplayName;
  scr_string_t (*hideTags)[0x20];
  WeaponAttachment **scopes;				//Count = 6
  WeaponAttachment **underBarrels;				//Count = 3
  WeaponAttachment **others;				//Count = 8
  XAnimParts *const *szXAnims;							//Count = 0x7C
  unsigned int numAnimOverrides;
  AnimOverrideEntry *animOverrides;
  unsigned int numSoundOverrides;
  SoundOverrideEntry *soundOverrides;
  unsigned int numFXOverrides;
  FXOverrideEntry *fxOverrides;
  unsigned int numReloadStateTimerOverrides;
  ReloadStateTimerEntry *reloadOverrides;
  unsigned int numNotetrackOverrides;
  NoteTrackToSoundEntry *notetrackOverrides;
  float fAdsZoomFov;
  int iAdsTransInTime;
  int iAdsTransOutTime;
  int iClipSize;
  ImpactType impactType;
  int iFireTime;
  int iFireTimeAkimbo;
  weaponIconRatioType_t dpadIconRatio;
  float penetrateMultiplier;
  float fAdsViewKickCenterSpeed;
  float fHipViewKickCenterSpeed;
  const char *szAltWeaponName;
  int altWeapon;
  int iAltRaiseTime;
  int iAltRaiseTimeAkimbo;
  Material * killIcon;
  Material * dpadIcon;
  int fireAnimLength;
  int fireAnimLengthAkimbo;
  int iFirstRaiseTime;
  int iFirstRaiseTimeAkimbo;
  int ammoDropStockMax;
  float adsDofStart;
  float adsDofEnd;
  unsigned __int16 accuracyGraphKnotCount;
  unsigned __int16 originalAccuracyGraphKnotCount;
  vec2_t *accuracyGraphKnots;
  vec2_t *originalAccuracyGraphKnots;
  bool motionTracker;
  bool enhanced;
  bool dpadIconShowsAmmo;
  const char *szAdsrBaseSetting;
};

Source Format

The weapon source files are raw text files with no extension, located at "raw/weapons/sp/" for SP weapons and "raw/weapons/mp/" for MP weapons. They use the same format as many other assets, with each setting name and value separated by a back-slash. The first setting identifies the file, and for weapons the identifier string is "WEAPONFILE".