1 #ifndef _CTF
2 #define _CTF
3 
4 #define CTF_VERSION			1.02
5 #define CTF_VSTRING2(x) #x
6 #define CTF_VSTRING(x) CTF_VSTRING2(x)
7 #define CTF_STRING_VERSION  CTF_VSTRING(CTF_VERSION)
8 
9 #define STAT_CTF_TEAM1_PIC			17
10 #define STAT_CTF_TEAM1_CAPS			18
11 #define STAT_CTF_TEAM2_PIC			19
12 #define STAT_CTF_TEAM2_CAPS			20
13 #define STAT_CTF_FLAG_PIC			21
14 #define STAT_CTF_JOINED_TEAM1_PIC	22
15 #define STAT_CTF_JOINED_TEAM2_PIC	23
16 #define STAT_CTF_TEAM1_HEADER		24
17 #define STAT_CTF_TEAM2_HEADER		25
18 #define STAT_CTF_TECH				26
19 #define STAT_CTF_ID_VIEW			27
20 
21 typedef enum {
22 	CTF_NOTEAM,
23 	CTF_TEAM1,
24 	CTF_TEAM2
25 } ctfteam_t;
26 
27 typedef enum {
28 	CTF_STATE_START,
29 	CTF_STATE_PLAYING
30 } ctfstate_t;
31 
32 typedef enum {
33 	CTF_GRAPPLE_STATE_FLY,
34 	CTF_GRAPPLE_STATE_PULL,
35 	CTF_GRAPPLE_STATE_HANG
36 } ctfgrapplestate_t;
37 
38 extern cvar_t *ctf;
39 
40 #define CTF_TEAM1_SKIN "ctf_r"
41 #define CTF_TEAM2_SKIN "ctf_b"
42 
43 #define DF_CTF_FORCEJOIN	131072
44 #define DF_ARMOR_PROTECT	262144
45 #define DF_CTF_NO_TECH      524288
46 
47 #define CTF_CAPTURE_BONUS		15	// what you get for capture
48 #define CTF_TEAM_BONUS			10	// what your team gets for capture
49 #define CTF_RECOVERY_BONUS		1	// what you get for recovery
50 #define CTF_FLAG_BONUS			0	// what you get for picking up enemy flag
51 #define CTF_FRAG_CARRIER_BONUS	2	// what you get for fragging enemy flag carrier
52 #define CTF_FLAG_RETURN_TIME	40	// seconds until auto return
53 
54 #define CTF_CARRIER_DANGER_PROTECT_BONUS	2	// bonus for fraggin someone who has recently hurt your flag carrier
55 #define CTF_CARRIER_PROTECT_BONUS			1	// bonus for fraggin someone while either you or your target are near your flag carrier
56 #define CTF_FLAG_DEFENSE_BONUS				1	// bonus for fraggin someone while either you or your target are near your flag
57 #define CTF_RETURN_FLAG_ASSIST_BONUS		1	// awarded for returning a flag that causes a capture to happen almost immediately
58 #define CTF_FRAG_CARRIER_ASSIST_BONUS		2	// award for fragging a flag carrier if a capture happens almost immediately
59 
60 #define CTF_TARGET_PROTECT_RADIUS			400	// the radius around an object being defended where a target will be worth extra frags
61 #define CTF_ATTACKER_PROTECT_RADIUS			400	// the radius around an object being defended where an attacker will get extra frags when making kills
62 
63 #define CTF_CARRIER_DANGER_PROTECT_TIMEOUT	8
64 #define CTF_FRAG_CARRIER_ASSIST_TIMEOUT		10
65 #define CTF_RETURN_FLAG_ASSIST_TIMEOUT		10
66 
67 #define CTF_AUTO_FLAG_RETURN_TIMEOUT		30	// number of seconds before dropped flag auto-returns
68 
69 #define CTF_TECH_TIMEOUT					60  // seconds before techs spawn again
70 
71 #define CTF_GRAPPLE_SPEED					650 // speed of grapple in flight
72 #define CTF_GRAPPLE_PULL_SPEED				650	// speed player is pulled at
73 
74 void CTFInit(void);
75 
76 void SP_info_player_team1(edict_t *self);
77 void SP_info_player_team2(edict_t *self);
78 
79 char *CTFTeamName(int team);
80 char *CTFOtherTeamName(int team);
81 void CTFAssignSkin(edict_t *ent, char *s);
82 void CTFAssignTeam(gclient_t *who);
83 edict_t *SelectCTFSpawnPoint (edict_t *ent);
84 qboolean CTFPickup_Flag(edict_t *ent, edict_t *other);
85 void CTFDrop_Flag(edict_t *ent, gitem_t *item); //was qboolean
86 void CTFEffects(edict_t *player);
87 void CTFCalcScores(void);
88 void SetCTFStats(edict_t *ent);
89 void CTFDeadDropFlag(edict_t *self);
90 void CTFScoreboardMessage (edict_t *ent, edict_t *killer);
91 void CTFTeam_f (edict_t *ent);
92 void CTFID_f (edict_t *ent);
93 void CTFSay_Team(edict_t *who, char *msg);
94 void CTFFlagSetup (edict_t *ent);
95 void CTFResetFlag(int ctf_team);
96 void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker);
97 void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker);
98 
99 // GRAPPLE
100 void CTFWeapon_Grapple (edict_t *ent);
101 void CTFPlayerResetGrapple(edict_t *ent);
102 void CTFGrapplePull(edict_t *self);
103 void CTFResetGrapple(edict_t *self);
104 
105 //TECH
106 gitem_t *CTFWhat_Tech(edict_t *ent);
107 qboolean CTFPickup_Tech (edict_t *ent, edict_t *other);
108 void CTFDrop_Tech(edict_t *ent, gitem_t *item);
109 void CTFDeadDropTech(edict_t *ent);
110 void CTFSetupTechSpawn(void);
111 int CTFApplyResistance(edict_t *ent, int dmg);
112 int CTFApplyStrength(edict_t *ent, int dmg);
113 qboolean CTFApplyStrengthSound(edict_t *ent);
114 qboolean CTFApplyHaste(edict_t *ent);
115 void CTFApplyHasteSound(edict_t *ent);
116 void CTFApplyRegeneration(edict_t *ent);
117 qboolean CTFHasRegeneration(edict_t *ent);
118 void CTFRespawnTech(edict_t *ent);
119 
120 void CTFOpenJoinMenu(edict_t *ent);
121 qboolean CTFStartClient(edict_t *ent);
122 
123 qboolean CTFCheckRules(void);
124 
125 void SP_misc_ctf_banner (edict_t *ent);
126 void SP_misc_ctf_small_banner (edict_t *ent);
127 
128 extern char *ctf_statusbar;
129 
130 void UpdateChaseCam(edict_t *ent);
131 void ChaseNext(edict_t *ent);
132 void ChasePrev(edict_t *ent);
133 
134 void SP_trigger_teleport (edict_t *ent);
135 void SP_info_teleport_destination (edict_t *ent);
136 #endif
137