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.

151 lines
2.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Headers and defines for Autobuy and Rebuy
  4. //
  5. //=============================================================================//
  6. /**
  7. * Weapon classes as used by the AutoBuy
  8. * Has to be different that the previous ones because these are bitmasked values as a weapon can be from
  9. * more than one class. This also includes all the classes of equipment that a player can buy.
  10. */
  11. enum AutoBuyClassType
  12. {
  13. AUTOBUYCLASS_PRIMARY = 1,
  14. AUTOBUYCLASS_SECONDARY = 2,
  15. AUTOBUYCLASS_AMMO = 4,
  16. AUTOBUYCLASS_ARMOR = 8,
  17. AUTOBUYCLASS_DEFUSER = 16,
  18. AUTOBUYCLASS_PISTOL = 32,
  19. AUTOBUYCLASS_SMG = 64,
  20. AUTOBUYCLASS_RIFLE = 128,
  21. AUTOBUYCLASS_SNIPERRIFLE = 256,
  22. AUTOBUYCLASS_SHOTGUN = 512,
  23. AUTOBUYCLASS_MACHINEGUN = 1024,
  24. AUTOBUYCLASS_GRENADE = 2048,
  25. AUTOBUYCLASS_NIGHTVISION = 4096,
  26. AUTOBUYCLASS_SHIELD = 8192,
  27. };
  28. struct AutoBuyInfoStruct
  29. {
  30. AutoBuyClassType m_class;
  31. loadout_positions_t m_LoadoutPosition;
  32. char *m_command;
  33. char *m_classname;
  34. };
  35. class RebuyStruct
  36. {
  37. private:
  38. int m_nPrimaryPos;
  39. int m_nSecondaryPos;
  40. CSWeaponID m_tertiaryId; // used just for taser right now
  41. CSWeaponID m_grenades[8];
  42. int m_armor; // 0, 1, or 2 (0 = none, 1 = vest, 2 = vest + helmet)
  43. bool m_defuser; // do we want a defuser
  44. bool m_nightVision; // do we want night vision
  45. bool m_isNotEmpty;
  46. public:
  47. RebuyStruct()
  48. {
  49. Clear();
  50. }
  51. void Clear()
  52. {
  53. memset(this, 0, sizeof(RebuyStruct));
  54. }
  55. bool isEmpty( void )
  56. {
  57. return !m_isNotEmpty;
  58. }
  59. void SetPrimary( int nPrimaryPos )
  60. {
  61. m_nPrimaryPos = nPrimaryPos;
  62. m_isNotEmpty = true;
  63. }
  64. int GetPrimary( void )
  65. {
  66. return m_nPrimaryPos;
  67. }
  68. void SetSecondary( int nSecondaryPos )
  69. {
  70. m_nSecondaryPos = nSecondaryPos;
  71. m_isNotEmpty = true;
  72. }
  73. int GetSecondary( void )
  74. {
  75. return m_nSecondaryPos;
  76. }
  77. void SetTertiary( CSWeaponID tertiary )
  78. {
  79. m_tertiaryId = tertiary;
  80. m_isNotEmpty = true;
  81. }
  82. CSWeaponID GetTertiary( void )
  83. {
  84. return m_tertiaryId;
  85. }
  86. void SetGrenade( int index, CSWeaponID grenade )
  87. {
  88. m_grenades[ index ] = grenade;
  89. m_isNotEmpty = true;
  90. }
  91. CSWeaponID GetGrenade( int index )
  92. {
  93. return m_grenades[index];
  94. }
  95. void SetArmor( int armor )
  96. {
  97. m_armor = armor;
  98. m_isNotEmpty = true;
  99. }
  100. int GetArmor( void )
  101. {
  102. return m_armor;
  103. }
  104. void SetDefuser( bool defuser )
  105. {
  106. m_defuser = defuser;
  107. m_isNotEmpty = true;
  108. }
  109. bool GetDefuser( void )
  110. {
  111. return m_defuser;
  112. }
  113. void SetNightVision( bool nv )
  114. {
  115. m_nightVision = nv;
  116. m_isNotEmpty = true;
  117. }
  118. bool GetNightVision( void )
  119. {
  120. return m_nightVision;
  121. }
  122. int numGrenades( void )
  123. {
  124. return ARRAYSIZE( m_grenades );
  125. }
  126. };
  127. extern AutoBuyInfoStruct g_autoBuyInfo[];