Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
5.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef CS_WEAPON_PARSE_H
  7. #define CS_WEAPON_PARSE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "weapon_parse.h"
  12. #include "networkvar.h"
  13. //--------------------------------------------------------------------------------------------------------
  14. enum CSWeaponType
  15. {
  16. WEAPONTYPE_KNIFE=0,
  17. WEAPONTYPE_PISTOL,
  18. WEAPONTYPE_SUBMACHINEGUN,
  19. WEAPONTYPE_RIFLE,
  20. WEAPONTYPE_SHOTGUN,
  21. WEAPONTYPE_SNIPER_RIFLE,
  22. WEAPONTYPE_MACHINEGUN,
  23. WEAPONTYPE_C4,
  24. WEAPONTYPE_GRENADE,
  25. WEAPONTYPE_UNKNOWN
  26. };
  27. //--------------------------------------------------------------------------------------------------------
  28. enum CSWeaponID
  29. {
  30. WEAPON_NONE = 0,
  31. WEAPON_P228,
  32. WEAPON_GLOCK,
  33. WEAPON_SCOUT,
  34. WEAPON_HEGRENADE,
  35. WEAPON_XM1014,
  36. WEAPON_C4,
  37. WEAPON_MAC10,
  38. WEAPON_AUG,
  39. WEAPON_SMOKEGRENADE,
  40. WEAPON_ELITE,
  41. WEAPON_FIVESEVEN,
  42. WEAPON_UMP45,
  43. WEAPON_SG550,
  44. WEAPON_GALIL,
  45. WEAPON_FAMAS,
  46. WEAPON_USP,
  47. WEAPON_AWP,
  48. WEAPON_MP5NAVY,
  49. WEAPON_M249,
  50. WEAPON_M3,
  51. WEAPON_M4A1,
  52. WEAPON_TMP,
  53. WEAPON_G3SG1,
  54. WEAPON_FLASHBANG,
  55. WEAPON_DEAGLE,
  56. WEAPON_SG552,
  57. WEAPON_AK47,
  58. WEAPON_KNIFE,
  59. WEAPON_P90,
  60. WEAPON_SHIELDGUN, // BOTPORT: Is this still needed?
  61. WEAPON_KEVLAR,
  62. WEAPON_ASSAULTSUIT,
  63. WEAPON_NVG,
  64. WEAPON_MAX, // number of weapons weapon index
  65. };
  66. #define MAX_EQUIPMENT (WEAPON_MAX - WEAPON_KEVLAR)
  67. void PrepareEquipmentInfo( void );
  68. //--------------------------------------------------------------------------------------------------------
  69. const char * WeaponClassAsString( CSWeaponType weaponType );
  70. //--------------------------------------------------------------------------------------------------------
  71. CSWeaponType WeaponClassFromString( const char* weaponType );
  72. //--------------------------------------------------------------------------------------------------------
  73. CSWeaponType WeaponClassFromWeaponID( CSWeaponID weaponID );
  74. //--------------------------------------------------------------------------------------------------------
  75. const char * WeaponIdAsString( CSWeaponID weaponID );
  76. //--------------------------------------------------------------------------------------------------------
  77. CSWeaponID WeaponIdFromString( const char *szWeaponName );
  78. //--------------------------------------------------------------------------------------------------------
  79. class CCSWeaponInfo : public FileWeaponInfo_t
  80. {
  81. public:
  82. DECLARE_CLASS_GAMEROOT( CCSWeaponInfo, FileWeaponInfo_t );
  83. CCSWeaponInfo();
  84. virtual void Parse( ::KeyValues *pKeyValuesData, const char *szWeaponName );
  85. int GetRealWeaponPrice( void ) { return m_iWeaponPrice; }
  86. public:
  87. float m_flMaxSpeed; // How fast the player can run while this is his primary weapon.
  88. CSWeaponType m_WeaponType;
  89. bool m_bFullAuto; // is this a fully automatic weapon?
  90. int m_iTeam; // Which team can have this weapon. TEAM_UNASSIGNED if both can have it.
  91. float m_flBotAudibleRange; // How far away a bot can hear this weapon.
  92. float m_flArmorRatio;
  93. int m_iCrosshairMinDistance;
  94. int m_iCrosshairDeltaDistance;
  95. bool m_bCanUseWithShield;
  96. char m_WrongTeamMsg[32]; // Reference to a string describing the error if someone tries to buy
  97. // this weapon but they're on the wrong team to have it.
  98. // Zero-length if no specific message for this weapon.
  99. char m_szAnimExtension[16];
  100. char m_szShieldViewModel[64];
  101. char m_szAddonModel[MAX_WEAPON_STRING]; // If this is set, it is used as the addon model. Otherwise, szWorldModel is used.
  102. char m_szDroppedModel[MAX_WEAPON_STRING]; // Alternate dropped model, if different from the szWorldModel the player holds
  103. char m_szSilencerModel[MAX_WEAPON_STRING]; // Alternate model with silencer attached
  104. int m_iMuzzleFlashStyle;
  105. float m_flMuzzleScale;
  106. // Parameters for FX_FireBullets:
  107. int m_iPenetration;
  108. int m_iDamage;
  109. float m_flRange;
  110. float m_flRangeModifier;
  111. int m_iBullets;
  112. float m_flCycleTime;
  113. // Variables that control how fast the weapon's accuracy changes as it is fired.
  114. bool m_bAccuracyQuadratic;
  115. float m_flAccuracyDivisor;
  116. float m_flAccuracyOffset;
  117. float m_flMaxInaccuracy;
  118. // variables for new accuracy model
  119. float m_fSpread[2];
  120. float m_fInaccuracyCrouch[2];
  121. float m_fInaccuracyStand[2];
  122. float m_fInaccuracyJump[2];
  123. float m_fInaccuracyLand[2];
  124. float m_fInaccuracyLadder[2];
  125. float m_fInaccuracyImpulseFire[2];
  126. float m_fInaccuracyMove[2];
  127. float m_fRecoveryTimeStand;
  128. float m_fRecoveryTimeCrouch;
  129. float m_fInaccuracyReload;
  130. float m_fInaccuracyAltSwitch;
  131. // Delay until the next idle animation after shooting.
  132. float m_flTimeToIdleAfterFire;
  133. float m_flIdleInterval;
  134. int GetWeaponPrice( void ) const;
  135. int GetDefaultPrice( void );
  136. int GetPrevousPrice( void );
  137. void SetWeaponPrice( int iPrice ) { m_iWeaponPrice = iPrice; }
  138. void SetDefaultPrice( int iPrice ) { m_iDefaultPrice = iPrice; }
  139. void SetPreviousPrice( int iPrice ) { m_iPreviousPrice = iPrice; }
  140. private:
  141. int m_iWeaponPrice;
  142. int m_iDefaultPrice;
  143. int m_iPreviousPrice;
  144. };
  145. #endif // CS_WEAPON_PARSE_H