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.

261 lines
7.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Shared CS definitions.
  4. //
  5. //=============================================================================//
  6. #ifndef CS_SHAREDDEFS_H
  7. #define CS_SHAREDDEFS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. /*======================*/
  12. // Menu stuff //
  13. /*======================*/
  14. #include <game/client/iviewport.h>
  15. //=============================================================================
  16. // HPE_BEGIN:
  17. // Including Achievement ID Definitions
  18. //=============================================================================
  19. #include "cs_achievementdefs.h"
  20. //=============================================================================
  21. // HPE_END
  22. //=============================================================================
  23. // CS-specific viewport panels
  24. #define PANEL_CLASS_CT "class_ct"
  25. #define PANEL_CLASS_TER "class_ter"
  26. // Buy sub menus
  27. #define MENU_PISTOL "menu_pistol"
  28. #define MENU_SHOTGUN "menu_shotgun"
  29. #define MENU_RIFLE "menu_rifle"
  30. #define MENU_SMG "menu_smg"
  31. #define MENU_MACHINEGUN "menu_mg"
  32. #define MENU_EQUIPMENT "menu_equip"
  33. #define MAX_HOSTAGES 12
  34. #define MAX_HOSTAGE_RESCUES 4
  35. #define CSTRIKE_DEFAULT_AVATAR "avatar_default_64"
  36. #define CSTRIKE_DEFAULT_T_AVATAR "avatar_default-t_64"
  37. #define CSTRIKE_DEFAULT_CT_AVATAR "avatar_default_64"
  38. extern const float CS_PLAYER_SPEED_RUN;
  39. extern const float CS_PLAYER_SPEED_VIP;
  40. extern const float CS_PLAYER_SPEED_WALK;
  41. extern const float CS_PLAYER_SPEED_SHIELD;
  42. extern const float CS_PLAYER_SPEED_STOPPED;
  43. extern const float CS_PLAYER_SPEED_OBSERVER;
  44. extern const float CS_PLAYER_SPEED_DUCK_MODIFIER;
  45. extern const float CS_PLAYER_SPEED_WALK_MODIFIER;
  46. extern const float CS_PLAYER_SPEED_CLIMB_MODIFIER;
  47. template< class T >
  48. class CUtlVectorInitialized : public CUtlVector< T >
  49. {
  50. public:
  51. CUtlVectorInitialized( T* pMemory, int numElements ) : CUtlVector< T >( pMemory, numElements )
  52. {
  53. this->SetSize( numElements );
  54. }
  55. };
  56. extern CUtlVectorInitialized< const char * > CTPlayerModels;
  57. extern CUtlVectorInitialized< const char * > TerroristPlayerModels;
  58. // These go in CCSPlayer::m_iAddonBits and get sent to the client so it can create
  59. // grenade models hanging off players.
  60. #define ADDON_FLASHBANG_1 0x001
  61. #define ADDON_FLASHBANG_2 0x002
  62. #define ADDON_HE_GRENADE 0x004
  63. #define ADDON_SMOKE_GRENADE 0x008
  64. #define ADDON_C4 0x010
  65. #define ADDON_DEFUSEKIT 0x020
  66. #define ADDON_PRIMARY 0x040
  67. #define ADDON_PISTOL 0x080
  68. #define ADDON_PISTOL2 0x100
  69. #define NUM_ADDON_BITS 9
  70. // Indices of each weapon slot.
  71. #define WEAPON_SLOT_RIFLE 0 // (primary slot)
  72. #define WEAPON_SLOT_PISTOL 1 // (secondary slot)
  73. #define WEAPON_SLOT_KNIFE 2
  74. #define WEAPON_SLOT_GRENADES 3
  75. #define WEAPON_SLOT_C4 4
  76. #define WEAPON_SLOT_FIRST 0
  77. #define WEAPON_SLOT_LAST 4
  78. // CS Team IDs.
  79. #define TEAM_TERRORIST 2
  80. #define TEAM_CT 3
  81. #define TEAM_MAXCOUNT 4 // update this if we ever add teams (unlikely)
  82. #define MAX_CLAN_TAG_LENGTH 16 // max for new tags is actually 12, this allows some backward compat.
  83. //=============================================================================
  84. // HPE_BEGIN:
  85. // [menglish] CS specific death animation time now that freeze cam is implemented
  86. // in order to linger on the players body less
  87. // [tj] The number of times you must kill a given player to be dominating them
  88. // [menglish] Flags to use upon player death
  89. //=============================================================================
  90. // [menglish] CS specific death animation time now that freeze cam is implemented
  91. // in order to linger on the players body less
  92. #define CS_DEATH_ANIMATION_TIME 0.8
  93. // [tj] The number of times you must kill a given player to be dominating them
  94. // Should always be more than 1
  95. #define CS_KILLS_FOR_DOMINATION 4
  96. #define CS_DEATH_DOMINATION 0x0001 // killer is dominating victim
  97. #define CS_DEATH_REVENGE 0x0002 // killer got revenge on victim
  98. //=============================================================================
  99. // HPE_END
  100. //=============================================================================
  101. //--------------
  102. // CSPort Specific damage flags
  103. //--------------
  104. #define DMG_HEADSHOT (DMG_LASTGENERICFLAG<<1)
  105. // The various states the player can be in during the join game process.
  106. enum CSPlayerState
  107. {
  108. // Happily running around in the game.
  109. // You can't move though if CSGameRules()->IsFreezePeriod() returns true.
  110. // This state can jump to a bunch of other states like STATE_PICKINGCLASS or STATE_DEATH_ANIM.
  111. STATE_ACTIVE=0,
  112. // This is the state you're in when you first enter the server.
  113. // It's switching between intro cameras every few seconds, and there's a level info
  114. // screen up.
  115. STATE_WELCOME, // Show the level intro screen.
  116. // During these states, you can either be a new player waiting to join, or
  117. // you can be a live player in the game who wants to change teams.
  118. // Either way, you can't move while choosing team or class (or while any menu is up).
  119. STATE_PICKINGTEAM, // Choosing team.
  120. STATE_PICKINGCLASS, // Choosing class.
  121. STATE_DEATH_ANIM, // Playing death anim, waiting for that to finish.
  122. STATE_DEATH_WAIT_FOR_KEY, // Done playing death anim. Waiting for keypress to go into observer mode.
  123. STATE_OBSERVER_MODE, // Noclipping around, watching players, etc.
  124. NUM_PLAYER_STATES
  125. };
  126. enum e_RoundEndReason
  127. {
  128. Invalid_Round_End_Reason = -1,
  129. Target_Bombed,
  130. VIP_Escaped,
  131. VIP_Assassinated,
  132. Terrorists_Escaped,
  133. CTs_PreventEscape,
  134. Escaping_Terrorists_Neutralized,
  135. Bomb_Defused,
  136. CTs_Win,
  137. Terrorists_Win,
  138. Round_Draw,
  139. All_Hostages_Rescued,
  140. Target_Saved,
  141. Hostages_Not_Rescued,
  142. Terrorists_Not_Escaped,
  143. VIP_Not_Escaped,
  144. Game_Commencing,
  145. RoundEndReason_Count
  146. };
  147. #define PUSHAWAY_THINK_INTERVAL (1.0f / 20.0f)
  148. enum
  149. {
  150. CS_CLASS_NONE=0,
  151. // Terrorist classes (keep in sync with FIRST_T_CLASS/LAST_T_CLASS).
  152. CS_CLASS_PHOENIX_CONNNECTION,
  153. CS_CLASS_L337_KREW,
  154. CS_CLASS_ARCTIC_AVENGERS,
  155. CS_CLASS_GUERILLA_WARFARE,
  156. // CT classes (keep in sync with FIRST_CT_CLASS/LAST_CT_CLASS).
  157. CS_CLASS_SEAL_TEAM_6,
  158. CS_CLASS_GSG_9,
  159. CS_CLASS_SAS,
  160. CS_CLASS_GIGN,
  161. CS_NUM_CLASSES
  162. };
  163. //=============================================================================
  164. // HPE_BEGIN:
  165. // [menglish] List of equipment dropped by players with freeze panel callouts
  166. //=============================================================================
  167. enum
  168. {
  169. DROPPED_C4,
  170. DROPPED_DEFUSE,
  171. DROPPED_WEAPON,
  172. DROPPED_GRENADE, // This could be an HE greande, flashbang, or smoke
  173. DROPPED_COUNT
  174. };
  175. //=============================================================================
  176. // HPE_END
  177. //=============================================================================
  178. //=============================================================================
  179. //
  180. // MVP reasons
  181. //
  182. enum CSMvpReason_t
  183. {
  184. CSMVP_UNDEFINED = 0,
  185. CSMVP_ELIMINATION,
  186. CSMVP_BOMBPLANT,
  187. CSMVP_BOMBDEFUSE,
  188. CSMVP_HOSTAGERESCUE,
  189. };
  190. // Keep these in sync with CSClasses.
  191. #define FIRST_T_CLASS CS_CLASS_PHOENIX_CONNNECTION
  192. #define LAST_T_CLASS CS_CLASS_GUERILLA_WARFARE
  193. #define FIRST_CT_CLASS CS_CLASS_SEAL_TEAM_6
  194. #define LAST_CT_CLASS CS_CLASS_GIGN
  195. #define CS_MUZZLEFLASH_NONE -1
  196. #define CS_MUZZLEFLASH_NORM 0
  197. #define CS_MUZZLEFLASH_X 1
  198. class CCSClassInfo
  199. {
  200. public:
  201. const char *m_pClassName;
  202. };
  203. const CCSClassInfo* GetCSClassInfo( int i );
  204. extern const char *pszWinPanelCategoryHeaders[];
  205. #endif // CS_SHAREDDEFS_H