g_ctf.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. // Copyright (c) ZeniMax Media Inc.
  2. // Licensed under the GNU General Public License 2.0.
  3. #define CTF_VERSION 1.52
  4. #define CTF_VSTRING2(x) #x
  5. #define CTF_VSTRING(x) CTF_VSTRING2(x)
  6. #define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION)
  7. enum ctfteam_t
  8. {
  9. CTF_NOTEAM,
  10. CTF_TEAM1,
  11. CTF_TEAM2
  12. };
  13. enum ctfgrapplestate_t
  14. {
  15. CTF_GRAPPLE_STATE_FLY,
  16. CTF_GRAPPLE_STATE_PULL,
  17. CTF_GRAPPLE_STATE_HANG
  18. };
  19. struct ghost_t
  20. {
  21. char netname[MAX_NETNAME];
  22. int number;
  23. // stats
  24. int deaths;
  25. int kills;
  26. int caps;
  27. int basedef;
  28. int carrierdef;
  29. int code; // ghost code
  30. ctfteam_t team; // team
  31. int score; // frags at time of disconnect
  32. edict_t *ent;
  33. };
  34. extern cvar_t *ctf;
  35. extern cvar_t *g_teamplay_force_join;
  36. extern cvar_t *teamplay;
  37. constexpr const char *CTF_TEAM1_SKIN = "ctf_r";
  38. constexpr const char *CTF_TEAM2_SKIN = "ctf_b";
  39. constexpr int32_t CTF_CAPTURE_BONUS = 15; // what you get for capture
  40. constexpr int32_t CTF_TEAM_BONUS = 10; // what your team gets for capture
  41. constexpr int32_t CTF_RECOVERY_BONUS = 1; // what you get for recovery
  42. constexpr int32_t CTF_FLAG_BONUS = 0; // what you get for picking up enemy flag
  43. constexpr int32_t CTF_FRAG_CARRIER_BONUS = 2; // what you get for fragging enemy flag carrier
  44. constexpr gtime_t CTF_FLAG_RETURN_TIME = 40_sec; // seconds until auto return
  45. constexpr int32_t CTF_CARRIER_DANGER_PROTECT_BONUS = 2; // bonus for fraggin someone who has recently hurt your flag carrier
  46. constexpr int32_t CTF_CARRIER_PROTECT_BONUS = 1; // bonus for fraggin someone while either you or your target are near your flag carrier
  47. constexpr int32_t CTF_FLAG_DEFENSE_BONUS = 1; // bonus for fraggin someone while either you or your target are near your flag
  48. constexpr int32_t CTF_RETURN_FLAG_ASSIST_BONUS = 1; // awarded for returning a flag that causes a capture to happen almost immediately
  49. constexpr int32_t CTF_FRAG_CARRIER_ASSIST_BONUS = 2; // award for fragging a flag carrier if a capture happens almost immediately
  50. constexpr float CTF_TARGET_PROTECT_RADIUS = 400; // the radius around an object being defended where a target will be worth extra frags
  51. constexpr float CTF_ATTACKER_PROTECT_RADIUS = 400; // the radius around an object being defended where an attacker will get extra frags when making kills
  52. constexpr gtime_t CTF_CARRIER_DANGER_PROTECT_TIMEOUT = 8_sec;
  53. constexpr gtime_t CTF_FRAG_CARRIER_ASSIST_TIMEOUT = 10_sec;
  54. constexpr gtime_t CTF_RETURN_FLAG_ASSIST_TIMEOUT = 10_sec;
  55. constexpr gtime_t CTF_AUTO_FLAG_RETURN_TIMEOUT = 30_sec; // number of seconds before dropped flag auto-returns
  56. constexpr gtime_t CTF_TECH_TIMEOUT = 60_sec; // seconds before techs spawn again
  57. constexpr int32_t CTF_DEFAULT_GRAPPLE_SPEED = 650; // speed of grapple in flight
  58. constexpr float CTF_DEFAULT_GRAPPLE_PULL_SPEED = 650; // speed player is pulled at
  59. void CTFInit();
  60. void CTFSpawn();
  61. void CTFPrecache();
  62. bool G_TeamplayEnabled();
  63. void G_AdjustTeamScore(ctfteam_t team, int32_t offset);
  64. void SP_info_player_team1(edict_t *self);
  65. void SP_info_player_team2(edict_t *self);
  66. const char *CTFTeamName(int team);
  67. const char *CTFOtherTeamName(int team);
  68. void CTFAssignSkin(edict_t *ent, const char *s);
  69. void CTFAssignTeam(gclient_t *who);
  70. edict_t *SelectCTFSpawnPoint(edict_t *ent, bool force_spawn);
  71. bool CTFPickup_Flag(edict_t *ent, edict_t *other);
  72. void CTFDrop_Flag(edict_t *ent, gitem_t *item);
  73. void CTFEffects(edict_t *player);
  74. void CTFCalcScores();
  75. void CTFCalcRankings(std::array<uint32_t, MAX_CLIENTS> &player_ranks); // [Paril-KEX]
  76. void CheckEndTDMLevel(); // [Paril-KEX]
  77. void SetCTFStats(edict_t *ent);
  78. void CTFDeadDropFlag(edict_t *self);
  79. void CTFScoreboardMessage(edict_t *ent, edict_t *killer);
  80. void CTFTeam_f(edict_t *ent);
  81. void CTFID_f(edict_t *ent);
  82. #ifndef KEX_Q2_GAME
  83. void CTFSay_Team(edict_t *who, const char *msg);
  84. #endif
  85. void CTFFlagSetup(edict_t *ent);
  86. void CTFResetFlag(int ctf_team);
  87. void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker);
  88. void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker);
  89. void CTFDirtyTeamMenu();
  90. // GRAPPLE
  91. void CTFWeapon_Grapple(edict_t *ent);
  92. void CTFPlayerResetGrapple(edict_t *ent);
  93. void CTFGrapplePull(edict_t *self);
  94. void CTFResetGrapple(edict_t *self);
  95. // TECH
  96. gitem_t *CTFWhat_Tech(edict_t *ent);
  97. bool CTFPickup_Tech(edict_t *ent, edict_t *other);
  98. void CTFDrop_Tech(edict_t *ent, gitem_t *item);
  99. void CTFDeadDropTech(edict_t *ent);
  100. void CTFSetupTechSpawn();
  101. int CTFApplyResistance(edict_t *ent, int dmg);
  102. int CTFApplyStrength(edict_t *ent, int dmg);
  103. bool CTFApplyStrengthSound(edict_t *ent);
  104. bool CTFApplyHaste(edict_t *ent);
  105. void CTFApplyHasteSound(edict_t *ent);
  106. void CTFApplyRegeneration(edict_t *ent);
  107. bool CTFHasRegeneration(edict_t *ent);
  108. void CTFRespawnTech(edict_t *ent);
  109. void CTFResetTech();
  110. void CTFOpenJoinMenu(edict_t *ent);
  111. bool CTFStartClient(edict_t *ent);
  112. void CTFVoteYes(edict_t *ent);
  113. void CTFVoteNo(edict_t *ent);
  114. void CTFReady(edict_t *ent);
  115. void CTFNotReady(edict_t *ent);
  116. bool CTFNextMap();
  117. bool CTFMatchSetup();
  118. bool CTFMatchOn();
  119. void CTFGhost(edict_t *ent);
  120. void CTFAdmin(edict_t *ent);
  121. bool CTFInMatch();
  122. void CTFStats(edict_t *ent);
  123. void CTFWarp(edict_t *ent);
  124. void CTFBoot(edict_t *ent);
  125. void CTFPlayerList(edict_t *ent);
  126. bool CTFCheckRules();
  127. void SP_misc_ctf_banner(edict_t *ent);
  128. void SP_misc_ctf_small_banner(edict_t *ent);
  129. void UpdateChaseCam(edict_t *ent);
  130. void ChaseNext(edict_t *ent);
  131. void ChasePrev(edict_t *ent);
  132. void CTFObserver(edict_t *ent);
  133. void SP_trigger_teleport(edict_t *ent);
  134. void SP_info_teleport_destination(edict_t *ent);
  135. void CTFSetPowerUpEffect(edict_t *ent, effects_t def);