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.

208 lines
5.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef SDK_SHAREDDEFS_H
  7. #define SDK_SHAREDDEFS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //=========================
  12. // GAMEPLAY RELATED OPTIONS
  13. //=========================
  14. // NOTES: The Wizard automatically replaces these strings! If you extract the source as is, you will have to add the defines manually!
  15. //
  16. // Will your mod be team based?
  17. // define SDK_USE_TEAMS
  18. #define SDK_USE_TEAMS
  19. //
  20. // Do you use player classes?
  21. // define SDK_USE_PLAYERCLASSES
  22. #define SDK_USE_PLAYERCLASSES
  23. //================================
  24. // PLAYER MOVEMENT RELATED OPTIONS
  25. //================================
  26. //
  27. // Do your players have stamina? - this is a pre-requisite for sprinting, if you define sprinting, and don't uncomment this, it will be included anyway.
  28. // define SDK_USE_STAMINA
  29. #define SDK_USE_STAMINA
  30. //
  31. // Are your players able to sprint?
  32. // define SDK_USE_SPRINTING
  33. #define SDK_USE_SPRINTING
  34. //Tony; stamina is a pre-requisite to sprinting, if you don't declare stamina but you do declare sprinting
  35. //stamina needs to be included.
  36. #if defined ( SDK_USE_SPRINTING ) && !defined( SDK_USE_STAMINA )
  37. #define SDK_USE_STAMINA
  38. #endif
  39. //
  40. // Can your players go prone?
  41. // define SDK_USE_PRONE
  42. #define SDK_USE_PRONE
  43. //=====================
  44. // EXTRA WEAPON OPTIONS
  45. //=====================
  46. //
  47. // If you're allowing sprinting, do you want to be able to shoot while sprinting?
  48. // define SDK_SHOOT_WHILE_SPRINTING
  49. #define SDK_SHOOT_WHILE_SPRINTING
  50. //
  51. // Do you want your players to be able to shoot while climing ladders?
  52. // define SDK_SHOOT_ON_LADDERS
  53. #define SDK_SHOOT_ON_LADDERS
  54. //
  55. // Do you want your players to be able to shoot while jumping?
  56. // define SDK_SHOOT_WHILE_JUMPING
  57. #define SDK_SHOOT_WHILE_JUMPING
  58. #define SDK_GAME_DESCRIPTION "SDK Template mod v1"
  59. //================================================================================
  60. // Most elements below here are specific to the options above.
  61. //================================================================================
  62. #if defined ( SDK_USE_TEAMS )
  63. enum sdkteams_e
  64. {
  65. SDK_TEAM_BLUE = LAST_SHARED_TEAM+1,
  66. SDK_TEAM_RED,
  67. };
  68. #endif // SDK_USE_TEAMS
  69. #if defined ( SDK_USE_PRONE )
  70. #define TIME_TO_PRONE 1.2f
  71. #define VEC_PRONE_HULL_MIN SDKGameRules()->GetSDKViewVectors()->m_vProneHullMin
  72. #define VEC_PRONE_HULL_MAX SDKGameRules()->GetSDKViewVectors()->m_vProneHullMax
  73. #define VEC_PRONE_VIEW SDKGameRules()->GetSDKViewVectors()->m_vProneView
  74. #endif // SDK_USE_PRONE
  75. #if defined ( SDK_USE_SPRINTING )
  76. #define INITIAL_SPRINT_STAMINA_PENALTY 15
  77. #define LOW_STAMINA_THRESHOLD 35
  78. #endif // SDK_USE_SPRINTING
  79. #if defined ( SDK_USE_PLAYERCLASSES )
  80. #define SDK_NUM_PLAYERCLASSES 3 //Tony; our template sample has 3 player classes.
  81. #define SDK_PLAYERCLASS_IMAGE_LENGTH 64
  82. #define PLAYERCLASS_RANDOM -2
  83. #define PLAYERCLASS_UNDEFINED -1
  84. #if defined ( SDK_USE_TEAMS )
  85. //Tony; using teams with classes, so make sure the team class panel names are defined.
  86. #define PANEL_CLASS_BLUE "class_blue"
  87. #define PANEL_CLASS_RED "class_red"
  88. extern const char *pszTeamBlueClasses[];
  89. extern const char *pszTeamRedClasses[];
  90. #else
  91. #define PANEL_CLASS_NOTEAMS "class_noteams"
  92. extern const char *pszPlayerClasses[];
  93. #endif // SDK_USE_TEAMS
  94. #endif // SDK_USE_PLAYERCLASSES
  95. #define SDK_PLAYER_MODEL "models/player/american_rifleman.mdl"
  96. //Tony; We need to precache all possible player models that we're going to use
  97. extern const char *pszPossiblePlayerModels[];
  98. extern const char *pszTeamNames[];
  99. //Tony; these defines handle the default speeds for all of these - all are listed regardless of which option is enabled.
  100. #define SDK_DEFAULT_PLAYER_RUNSPEED 220
  101. #define SDK_DEFAULT_PLAYER_SPRINTSPEED 330
  102. #define SDK_DEFAULT_PLAYER_PRONESPEED 50
  103. //--------------------------------------------------------------------------------------------------------
  104. //
  105. // Weapon IDs for all SDK Game weapons
  106. //
  107. typedef enum
  108. {
  109. WEAPON_NONE = 0,
  110. SDK_WEAPON_NONE = WEAPON_NONE,
  111. SDK_WEAPON_MP5,
  112. SDK_WEAPON_SHOTGUN,
  113. SDK_WEAPON_GRENADE,
  114. SDK_WEAPON_PISTOL,
  115. SDK_WEAPON_CROWBAR,
  116. WEAPON_MAX, // number of weapons weapon index
  117. } SDKWeaponID;
  118. typedef enum
  119. {
  120. FM_AUTOMATIC = 0,
  121. FM_SEMIAUTOMATIC,
  122. FM_BURST,
  123. } SDK_Weapon_Firemodes;
  124. const char *WeaponIDToAlias( int id );
  125. int AliasToWeaponID( const char *alias );
  126. // The various states the player can be in during the join game process.
  127. enum SDKPlayerState
  128. {
  129. // Happily running around in the game.
  130. // You can't move though if CSGameRules()->IsFreezePeriod() returns true.
  131. // This state can jump to a bunch of other states like STATE_PICKINGCLASS or STATE_DEATH_ANIM.
  132. STATE_ACTIVE=0,
  133. // This is the state you're in when you first enter the server.
  134. // It's switching between intro cameras every few seconds, and there's a level info
  135. // screen up.
  136. STATE_WELCOME, // Show the level intro screen.
  137. // During these states, you can either be a new player waiting to join, or
  138. // you can be a live player in the game who wants to change teams.
  139. // Either way, you can't move while choosing team or class (or while any menu is up).
  140. #if defined ( SDK_USE_TEAMS )
  141. STATE_PICKINGTEAM, // Choosing team.
  142. #endif
  143. #if defined ( SDK_USE_PLAYERCLASSES )
  144. STATE_PICKINGCLASS, // Choosing class.
  145. #endif
  146. STATE_DEATH_ANIM, // Playing death anim, waiting for that to finish.
  147. STATE_OBSERVER_MODE, // Noclipping around, watching players, etc.
  148. NUM_PLAYER_STATES
  149. };
  150. #define SDK_PLAYER_DEATH_TIME 5.0f //Minimum Time before respawning
  151. // Special Damage types
  152. enum
  153. {
  154. SDK_DMG_CUSTOM_NONE = 0,
  155. SDK_DMG_CUSTOM_SUICIDE,
  156. };
  157. // Player avoidance
  158. #define PUSHAWAY_THINK_INTERVAL (1.0f / 20.0f)
  159. #endif // SDK_SHAREDDEFS_H