1 /* 2 Copyright (C) 1997-2001 Id Software, Inc. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 */ 20 21 #define CTF_VERSION 1.52 22 #define CTF_VSTRING2(x) #x 23 #define CTF_VSTRING(x) CTF_VSTRING2(x) 24 #define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION) 25 26 #define STAT_CTF_TEAM1_PIC 17 27 #define STAT_CTF_TEAM1_CAPS 18 28 #define STAT_CTF_TEAM2_PIC 19 29 #define STAT_CTF_TEAM2_CAPS 20 30 #define STAT_CTF_FLAG_PIC 21 31 #define STAT_CTF_JOINED_TEAM1_PIC 22 32 #define STAT_CTF_JOINED_TEAM2_PIC 23 33 #define STAT_CTF_TEAM1_HEADER 24 34 #define STAT_CTF_TEAM2_HEADER 25 35 #define STAT_CTF_TECH 26 36 #define STAT_CTF_ID_VIEW 27 37 #define STAT_CTF_MATCH 28 38 #define STAT_CTF_ID_VIEW_COLOR 29 39 #define STAT_CTF_TEAMINFO 30 40 41 #define CONFIG_CTF_MATCH (CS_AIRACCEL-1) 42 #define CONFIG_CTF_TEAMINFO (CS_AIRACCEL-2) 43 44 typedef enum { 45 CTF_NOTEAM, 46 CTF_TEAM1, 47 CTF_TEAM2 48 } ctfteam_t; 49 50 typedef enum { 51 CTF_GRAPPLE_STATE_FLY, 52 CTF_GRAPPLE_STATE_PULL, 53 CTF_GRAPPLE_STATE_HANG 54 } ctfgrapplestate_t; 55 56 typedef struct ghost_s { 57 char netname[16]; 58 int number; 59 60 // stats 61 int deaths; 62 int kills; 63 int caps; 64 int basedef; 65 int carrierdef; 66 67 int code; // ghost code 68 int team; // team 69 int score; // frags at time of disconnect 70 edict_t *ent; 71 } ghost_t; 72 73 extern cvar_t *ctf; 74 75 #define CTF_TEAM1_SKIN "ctf_r" 76 #define CTF_TEAM2_SKIN "ctf_b" 77 78 #define DF_CTF_FORCEJOIN 131072 79 #define DF_ARMOR_PROTECT 262144 80 #define DF_CTF_NO_TECH 524288 81 82 #define CTF_CAPTURE_BONUS 15 // what you get for capture 83 #define CTF_TEAM_BONUS 10 // what your team gets for capture 84 #define CTF_RECOVERY_BONUS 1 // what you get for recovery 85 #define CTF_FLAG_BONUS 0 // what you get for picking up enemy flag 86 #define CTF_FRAG_CARRIER_BONUS 2 // what you get for fragging enemy flag carrier 87 #define CTF_FLAG_RETURN_TIME 40 // seconds until auto return 88 89 #define CTF_CARRIER_DANGER_PROTECT_BONUS 2 // bonus for fraggin someone who has recently hurt your flag carrier 90 #define CTF_CARRIER_PROTECT_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag carrier 91 #define CTF_FLAG_DEFENSE_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag 92 #define CTF_RETURN_FLAG_ASSIST_BONUS 1 // awarded for returning a flag that causes a capture to happen almost immediately 93 #define CTF_FRAG_CARRIER_ASSIST_BONUS 2 // award for fragging a flag carrier if a capture happens almost immediately 94 95 #define CTF_TARGET_PROTECT_RADIUS 400 // the radius around an object being defended where a target will be worth extra frags 96 #define CTF_ATTACKER_PROTECT_RADIUS 400 // the radius around an object being defended where an attacker will get extra frags when making kills 97 98 #define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8 99 #define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10 100 #define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10 101 102 #define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 // number of seconds before dropped flag auto-returns 103 104 #define CTF_TECH_TIMEOUT 60 // seconds before techs spawn again 105 106 #define CTF_GRAPPLE_SPEED 650 // speed of grapple in flight 107 #define CTF_GRAPPLE_PULL_SPEED 650 // speed player is pulled at 108 109 void CTFInit(void); 110 void CTFSpawn(void); 111 void CTFPrecache(void); 112 113 void SP_info_player_team1(edict_t *self); 114 void SP_info_player_team2(edict_t *self); 115 116 char *CTFTeamName(int team); 117 char *CTFOtherTeamName(int team); 118 void CTFAssignSkin(edict_t *ent, char *s); 119 void CTFAssignTeam(gclient_t *who); 120 edict_t *SelectCTFSpawnPoint (edict_t *ent); 121 qboolean CTFPickup_Flag(edict_t *ent, edict_t *other); 122 void CTFDrop_Flag(edict_t *ent, gitem_t *item); 123 void CTFEffects(edict_t *player); 124 void CTFCalcScores(void); 125 void SetCTFStats(edict_t *ent); 126 void CTFDeadDropFlag(edict_t *self); 127 void CTFScoreboardMessage (edict_t *ent, edict_t *killer); 128 void CTFTeam_f (edict_t *ent); 129 void CTFID_f (edict_t *ent); 130 void CTFSay_Team(edict_t *who, char *msg); 131 void CTFFlagSetup (edict_t *ent); 132 void CTFResetFlag(int ctf_team); 133 void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker); 134 void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker); 135 136 // GRAPPLE 137 void CTFWeapon_Grapple (edict_t *ent); 138 void CTFPlayerResetGrapple(edict_t *ent); 139 void CTFGrapplePull(edict_t *self); 140 void CTFResetGrapple(edict_t *self); 141 142 //TECH 143 gitem_t *CTFWhat_Tech(edict_t *ent); 144 qboolean CTFPickup_Tech (edict_t *ent, edict_t *other); 145 void CTFDrop_Tech(edict_t *ent, gitem_t *item); 146 void CTFDeadDropTech(edict_t *ent); 147 void CTFSetupTechSpawn(void); 148 int CTFApplyResistance(edict_t *ent, int dmg); 149 int CTFApplyStrength(edict_t *ent, int dmg); 150 qboolean CTFApplyStrengthSound(edict_t *ent); 151 qboolean CTFApplyHaste(edict_t *ent); 152 void CTFApplyHasteSound(edict_t *ent); 153 void CTFApplyRegeneration(edict_t *ent); 154 qboolean CTFHasRegeneration(edict_t *ent); 155 void CTFRespawnTech(edict_t *ent); 156 void CTFResetTech(void); 157 158 void CTFOpenJoinMenu(edict_t *ent); 159 qboolean CTFStartClient(edict_t *ent); 160 void CTFVoteYes(edict_t *ent); 161 void CTFVoteNo(edict_t *ent); 162 void CTFReady(edict_t *ent); 163 void CTFNotReady(edict_t *ent); 164 qboolean CTFNextMap(void); 165 qboolean CTFMatchSetup(void); 166 qboolean CTFMatchOn(void); 167 void CTFGhost(edict_t *ent); 168 void CTFAdmin(edict_t *ent); 169 qboolean CTFInMatch(void); 170 void CTFStats(edict_t *ent); 171 void CTFWarp(edict_t *ent); 172 void CTFBoot(edict_t *ent); 173 void CTFPlayerList(edict_t *ent); 174 175 qboolean CTFCheckRules(void); 176 177 void SP_misc_ctf_banner (edict_t *ent); 178 void SP_misc_ctf_small_banner (edict_t *ent); 179 180 extern char *ctf_statusbar; 181 182 void UpdateChaseCam(edict_t *ent); 183 void ChaseNext(edict_t *ent); 184 void ChasePrev(edict_t *ent); 185 186 void CTFObserver(edict_t *ent); 187 188 void SP_trigger_teleport (edict_t *ent); 189 void SP_info_teleport_destination (edict_t *ent); 190 191 void CTFSetPowerUpEffect(edict_t *ent, int def); 192 193