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.

321 lines
9.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef TFC_SHAREDDEFS_H
  7. #define TFC_SHAREDDEFS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "shareddefs.h"
  12. // Using MAP_DEBUG mode?
  13. #ifdef MAP_DEBUG
  14. #define MDEBUG(x) x
  15. #else
  16. #define MDEBUG(x)
  17. #endif
  18. #define TFC_PLAYER_VIEW_OFFSET Vector( 0, 0, 53.5 )
  19. // Team IDs.
  20. // #define TEAM_SPECTATOR 0 // This is set in shareddefs.h
  21. #define TEAM_BLUE 1
  22. #define TEAM_RED 2
  23. #define TEAM_YELLOW 3
  24. #define TEAM_GREEN 4
  25. #define TEAM_MAXCOUNT 5 // update this if we ever add teams (unlikely)
  26. // Defines for the playerclass
  27. #define PC_UNDEFINED 0
  28. #define PC_SCOUT 1
  29. #define PC_SNIPER 2
  30. #define PC_SOLDIER 3
  31. #define PC_DEMOMAN 4
  32. #define PC_MEDIC 5
  33. #define PC_HWGUY 6
  34. #define PC_PYRO 7
  35. #define PC_SPY 8
  36. #define PC_ENGINEER 9
  37. #define PC_LAST_NORMAL_CLASS 9
  38. #define PC_CIVILIAN 10 // Civilians are a special class. They cannot
  39. // be chosen by players, only enforced by maps
  40. #define PC_LASTCLASS 11 // Use this as the high-boundary for any loops
  41. // through the playerclass.
  42. /*======================*/
  43. // Menu stuff //
  44. /*======================*/
  45. #define MENU_DEFAULT 1
  46. #define MENU_TEAM 2
  47. #define MENU_CLASS 3
  48. #define MENU_MAPBRIEFING 4
  49. #define MENU_INTRO 5
  50. #define MENU_CLASSHELP 6
  51. #define MENU_CLASSHELP2 7
  52. #define MENU_REPEATHELP 8
  53. #define MENU_SPECHELP 9
  54. #define MENU_SPY 12
  55. #define MENU_SPY_SKIN 13
  56. #define MENU_SPY_COLOR 14
  57. #define MENU_ENGINEER 15
  58. #define MENU_ENGINEER_FIX_DISPENSER 16
  59. #define MENU_ENGINEER_FIX_SENTRYGUN 17
  60. #define MENU_ENGINEER_FIX_MORTAR 18
  61. #define MENU_DISPENSER 19
  62. #define MENU_CLASS_CHANGE 20
  63. #define MENU_TEAM_CHANGE 21
  64. #define MENU_REFRESH_RATE 25
  65. #define MENU_VOICETWEAK 50
  66. // Additional classes
  67. // NOTE: adding them onto the Class_T's in baseentity.h is cheesy, but so is
  68. // having an #ifdef for each mod in baseentity.h.
  69. #define CLASS_TFGOAL ((Class_T)NUM_AI_CLASSES)
  70. #define CLASS_TFGOAL_TIMER ((Class_T)(NUM_AI_CLASSES+1))
  71. #define CLASS_TFGOAL_ITEM ((Class_T)(NUM_AI_CLASSES+2))
  72. #define CLASS_TFSPAWN ((Class_T)(NUM_AI_CLASSES+3))
  73. #define CLASS_MACHINE ((Class_T)(NUM_AI_CLASSES+4))
  74. // Building types
  75. #define BUILD_DISPENSER 1
  76. #define BUILD_SENTRYGUN 2
  77. #define BUILD_MORTAR 3
  78. #define BUILD_TELEPORTER_ENTRY 4
  79. #define BUILD_TELEPORTER_EXIT 5
  80. // Grenade types.
  81. enum GrenadeType_t
  82. {
  83. GR_TYPE_NONE=0,
  84. GR_TYPE_NORMAL,
  85. GR_TYPE_CONCUSSION,
  86. GR_TYPE_NAIL,
  87. GR_TYPE_MIRV,
  88. GR_TYPE_NAPALM,
  89. GR_TYPE_GAS,
  90. GR_TYPE_EMP,
  91. GR_TYPE_CALTROP,
  92. NUM_GRENADE_TYPES
  93. };
  94. // Max amount of each grenade each player can carry.
  95. // This is in addition to the player's
  96. extern int g_nMaxGrenades[NUM_GRENADE_TYPES];
  97. // These are the names of the ammo types that go in the CAmmoDefs and that the
  98. // weapon script files reference.
  99. // These directly correspond to ammo_X in the goldsrc tfc code.
  100. #define TFC_AMMO_DUMMY 0 // This is a dummy index, to make the CAmmoDef indices correct for the other ammo types.
  101. #define TFC_AMMO_SHELLS 1
  102. #define TFC_AMMO_SHELLS_NAME "TFC_AMMO_SHELLS"
  103. #define TFC_AMMO_NAILS 2
  104. #define TFC_AMMO_NAILS_NAME "TFC_AMMO_NAILS"
  105. #define TFC_AMMO_ROCKETS 3
  106. #define TFC_AMMO_ROCKETS_NAME "TFC_AMMO_ROCKETS"
  107. #define TFC_AMMO_CELLS 4
  108. #define TFC_AMMO_CELLS_NAME "TFC_AMMO_CELLS"
  109. #define TFC_AMMO_MEDIKIT 5
  110. #define TFC_AMMO_MEDIKIT_NAME "TFC_AMMO_MEDIKIT"
  111. #define TFC_AMMO_DETPACK 6
  112. #define TFC_AMMO_DETPACK_NAME "TFC_AMMO_DETPACK"
  113. #define TFC_AMMO_GRENADES1 7
  114. #define TFC_AMMO_GRENADES1_NAME "TFC_AMMO_GRENADES1"
  115. #define TFC_AMMO_GRENADES2 8
  116. #define TFC_AMMO_GRENADES2_NAME "TFC_AMMO_GRENADES2"
  117. #define TFC_NUM_AMMO_TYPES 9 // NOTE: KEEP THESE UP TO DATE WITH g_AmmoTypeNames[]
  118. extern const char* g_AmmoTypeNames[TFC_NUM_AMMO_TYPES];
  119. // TeamFortress State Flags
  120. #define TFSTATE_GRENPRIMED 0x000001 // Whether the player has a primed grenade
  121. #define TFSTATE_RELOADING 0x000002 // Whether the player is reloading
  122. #define TFSTATE_ALTKILL 0x000004 // #TRUE if killed with a weapon not in self.weapon: NOT USED ANYMORE
  123. #define TFSTATE_RANDOMPC 0x000008 // Whether Playerclass is random, new one each respawn
  124. #define TFSTATE_INFECTED 0x000010 // set when player is infected by the bioweapon
  125. #define TFSTATE_INVINCIBLE 0x000020 // Player has permanent Invincibility (Usually by GoalItem)
  126. #define TFSTATE_INVISIBLE 0x000040 // Player has permanent Invisibility (Usually by GoalItem)
  127. #define TFSTATE_QUAD 0x000080 // Player has permanent Quad Damage (Usually by GoalItem)
  128. #define TFSTATE_RADSUIT 0x000100 // Player has permanent Radsuit (Usually by GoalItem)
  129. #define TFSTATE_BURNING 0x000200 // Is on fire
  130. #define TFSTATE_GRENTHROWING 0x000400 // is throwing a grenade
  131. #define TFSTATE_AIMING 0x000800 // is using the laser sight
  132. #define TFSTATE_ZOOMOFF 0x001000 // doesn't want the FOV changed when zooming
  133. #define TFSTATE_RESPAWN_READY 0x002000 // is waiting for respawn, and has pressed fire
  134. #define TFSTATE_HALLUCINATING 0x004000 // set when player is hallucinating
  135. #define TFSTATE_TRANQUILISED 0x008000 // set when player is tranquilised
  136. #define TFSTATE_CANT_MOVE 0x010000 // set when player is setting a detpack
  137. #define TFSTATE_RESET_FLAMETIME 0x020000 // set when the player has to have his flames increased in health
  138. #define TFSTATE_HIGHEST_VALUE TFSTATE_RESET_FLAMETIME
  139. // items
  140. #define IT_SHOTGUN (1<<0)
  141. #define IT_SUPER_SHOTGUN (1<<1)
  142. #define IT_NAILGUN (1<<2)
  143. #define IT_SUPER_NAILGUN (1<<3)
  144. #define IT_GRENADE_LAUNCHER (1<<4)
  145. #define IT_ROCKET_LAUNCHER (1<<5)
  146. #define IT_LIGHTNING (1<<6)
  147. #define IT_EXTRA_WEAPON (1<<7)
  148. #define IT_SHELLS (1<<8)
  149. #define IT_NAILS (1<<9)
  150. #define IT_ROCKETS (1<<10)
  151. #define IT_CELLS (1<<11)
  152. #define IT_AXE (1<<12)
  153. #define IT_ARMOR1 (1<<13)
  154. #define IT_ARMOR2 (1<<14)
  155. #define IT_ARMOR3 (1<<15)
  156. #define IT_SUPERHEALTH (1<<16)
  157. #define IT_KEY1 (1<<17)
  158. #define IT_KEY2 (1<<18)
  159. #define IT_INVISIBILITY (1<<19)
  160. #define IT_INVULNERABILITY (1<<20)
  161. #define IT_SUIT (1<<21)
  162. #define IT_QUAD (1<<22)
  163. #define IT_HOOK (1<<23)
  164. #define IT_KEY3 (1<<24) // Stomp invisibility
  165. #define IT_KEY4 (1<<25) // Stomp invulnerability
  166. #define IT_LAST_ITEM IT_KEY4
  167. enum TFCTimer_t
  168. {
  169. TF_TIMER_ANY=0,
  170. TF_TIMER_CONCUSSION,
  171. TF_TIMER_INFECTION,
  172. TF_TIMER_HALLUCINATION,
  173. TF_TIMER_TRANQUILISATION,
  174. TF_TIMER_ROTHEALTH,
  175. TF_TIMER_REGENERATION,
  176. TF_TIMER_GRENPRIME,
  177. TF_TIMER_CELLREGENERATION,
  178. TF_TIMER_DETPACKSET,
  179. TF_TIMER_DETPACKDISARM,
  180. TF_TIMER_BUILD,
  181. TF_TIMER_CHECKBUILDDISTANCE,
  182. TF_TIMER_DISGUISE,
  183. TF_TIMER_DISPENSERREFILL,
  184. // Non player timers.
  185. TF_TIMER_RETURNITEM,
  186. TF_TIMER_DELAYEDGOAL,
  187. TF_TIMER_ENDROUND
  188. };
  189. /*==================================================*/
  190. /* New Weapon Related Defines */
  191. /*==================================================*/
  192. // Medikit
  193. #define WEAP_MEDIKIT_OVERHEAL 50 // Amount of superhealth over max_health the medikit will dispense
  194. #define WEAP_MEDIKIT_HEAL 200 // Amount medikit heals per hit
  195. //--------------
  196. // TFC Specific damage flags
  197. //--------------
  198. #define DMG_IGNORE_MAXHEALTH (DMG_LASTGENERICFLAG<<1)
  199. #define DMG_IGNOREARMOR (DMG_LASTGENERICFLAG<<2)
  200. // ------------------------------------------------------------------------------ //
  201. // Info for each player class.
  202. // ------------------------------------------------------------------------------ //
  203. class CTFCPlayerClassInfo
  204. {
  205. public:
  206. const char *m_pClassName;
  207. const char *m_pModelName; // What model this class uses.
  208. float m_flMaxSpeed;
  209. int m_iMaxHealth;
  210. int m_iInitArmor;
  211. int m_iMaxArmor;
  212. float m_flInitArmorType;
  213. float m_flMaxArmorType;
  214. int m_iInitArmorClass;
  215. int m_nArmorClasses;
  216. // What types of grenades does this guy carry?
  217. // GR_TYPE_ defines.
  218. GrenadeType_t m_iGrenadeType1;
  219. GrenadeType_t m_iGrenadeType2;
  220. int m_InitAmmo[TFC_NUM_AMMO_TYPES]; // These are in the same order as g_AmmoTypeNames.
  221. int m_MaxAmmo[TFC_NUM_AMMO_TYPES]; // These are in the same order as g_AmmoTypeNames.
  222. };
  223. const CTFCPlayerClassInfo* GetTFCClassInfo( int iClass );
  224. // The various states the player can be in during the join game process.
  225. enum TFCPlayerState
  226. {
  227. // Happily running around in the game.
  228. // You can't move though if CSGameRules()->IsFreezePeriod() returns true.
  229. // This state can jump to a bunch of other states like STATE_PICKINGCLASS or STATE_DEATH_ANIM.
  230. STATE_ACTIVE=0,
  231. // This is the state you're in when you first enter the server.
  232. // It's switching between intro cameras every few seconds, and there's a level info
  233. // screen up.
  234. STATE_WELCOME, // Show the level intro screen.
  235. // During these states, you can either be a new player waiting to join, or
  236. // you can be a live player in the game who wants to change teams.
  237. // Either way, you can't move while choosing team or class (or while any menu is up).
  238. STATE_PICKINGTEAM, // Choosing team.
  239. STATE_PICKINGCLASS, // Choosing class.
  240. STATE_OBSERVER_MODE,
  241. STATE_DYING,
  242. TFC_NUM_PLAYER_STATES
  243. };
  244. #endif // TFC_SHAREDDEFS_H