Counter Strike : Global Offensive Source Code
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.

106 lines
3.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Holds defintion for game ammo types
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #ifndef AI_AMMODEF_H
  10. #define AI_AMMODEF_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. class ConVar;
  15. struct Ammo_t
  16. {
  17. char *pName;
  18. int nDamageType;
  19. int eTracerType;
  20. int nMinSplashSize;
  21. int nMaxSplashSize;
  22. int nFlags;
  23. // Values for player/NPC damage and carrying capability
  24. // If the integers are set, they override the CVars
  25. int pPlrDmg; // CVar for player damage amount
  26. int pNPCDmg; // CVar for NPC damage amount
  27. int pMaxCarry; // CVar for maximum number can carry
  28. int pPhysicsForceImpulse; // CVar for the physics impulse
  29. const ConVar* pPlrDmgCVar; // CVar for player damage amount
  30. const ConVar* pNPCDmgCVar; // CVar for NPC damage amount
  31. const ConVar* pMaxCarryCVar; // CVar for maximum number can carry
  32. const ConVar* pPhysicsForceImpulseCVar; // CVar for maximum number can carry
  33. };
  34. // Used to tell AmmoDef to use the cvars, not the integers
  35. #define USE_CVAR -1
  36. // Ammo is infinite
  37. #define INFINITE_AMMO -2
  38. enum AmmoTracer_t
  39. {
  40. TRACER_NONE,
  41. TRACER_LINE,
  42. TRACER_RAIL,
  43. TRACER_BEAM,
  44. TRACER_LINE_AND_WHIZ,
  45. };
  46. enum AmmoFlags_t
  47. {
  48. AMMO_FORCE_DROP_IF_CARRIED = 0x1,
  49. AMMO_INTERPRET_PLRDAMAGE_AS_DAMAGE_TO_PLAYER = 0x2,
  50. };
  51. #include "shareddefs.h"
  52. //=============================================================================
  53. // >> CAmmoDef
  54. //=============================================================================
  55. class CAmmoDef
  56. {
  57. public:
  58. int m_nAmmoIndex;
  59. Ammo_t m_AmmoType[MAX_AMMO_TYPES];
  60. Ammo_t *GetAmmoOfIndex(int nAmmoIndex);
  61. int Index(const char *psz);
  62. int PlrDamage(int nAmmoIndex);
  63. int NPCDamage(int nAmmoIndex);
  64. int MaxCarry(int nAmmoIndex, const CBaseCombatCharacter *owner);
  65. bool CanCarryInfiniteAmmo(int nAmmoIndex);
  66. int DamageType(int nAmmoIndex);
  67. int TracerType(int nAmmoIndex);
  68. float DamageForce(int nAmmoIndex);
  69. int MinSplashSize(int nAmmoIndex);
  70. int MaxSplashSize(int nAmmoIndex);
  71. int Flags(int nAmmoIndex);
  72. void AddAmmoType(char const* name, int damageType, int tracerType, int plr_dmg, int npc_dmg, int carry, int impulse, int nFlags, int minSplashSize = 4, int maxSplashSize = 8 );
  73. void AddAmmoType(char const* name, int damageType, int tracerType, char const* plr_cvar, char const* npc_var, char const* carry_cvar, char const* impulse_cvar, int nFlags, int minSplashSize = 4, int maxSplashSize = 8 );
  74. int NumAmmoTypes() { return m_nAmmoIndex; }
  75. CAmmoDef(void);
  76. virtual ~CAmmoDef( void );
  77. private:
  78. bool AddAmmoType(char const* name, int damageType, int tracerType, int nFlags, int minSplashSize, int maxSplashSize );
  79. };
  80. // Get the global ammodef object. This is usually implemented in each mod's game rules file somewhere,
  81. // so the mod can setup custom ammo types.
  82. CAmmoDef* GetAmmoDef();
  83. #endif // AI_AMMODEF_H