This repository has been archived by the owner on Sep 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
ctf.h
278 lines (241 loc) · 7.97 KB
/
ctf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf.h $
// $Revision:: 11 $
// $Author:: Aldie $
// $Date:: 5/18/99 7:07p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/ctf.h $
//
// 11 5/18/99 7:07p Aldie
// Fix for forcejoin
//
// 10 3/19/99 9:41p Aldie
// Changed max_regen_health to 300 instead of 400
//
// 9 3/19/99 7:35p Aldie
// Added CTF_DROPPED_FLAG_TIMEOUT
//
// 8 3/19/99 4:28p Aldie
// externed ctfgame
//
// 7 3/19/99 4:19p Aldie
// Added tech regen time, changed grapple speed and max health
//
// 6 3/12/99 10:19p Aldie
// Change HALF to Shield
//
// 5 3/12/99 8:12p Aldie
// Added deathquad
//
// 4 3/12/99 4:55p Aldie
// Added CTF_CalcScores
//
// 3 3/02/99 9:16p Aldie
// Added CTF game code
//
// 2 2/16/99 4:08p Aldie
//
// 1 2/11/99 1:38p Aldie
//
// 2 10/10/98 3:03a Jimdose
// Created file
//
// 1 10/10/98 3:02a Jimdose
//
// DESCRIPTION:
// Game code for Threewave Capture the Flag.
//
// The original source for this code was graciously provided by Zoid and
// Id Software. Many thanks!
//
// Original credits:
//
// Programming - Dave 'Zoid' Kirsch
// Original CTF Art Design - Brian 'Whaleboy' Cozzens
//
#ifndef __CTF_H__
#define __CTF_H__
#include "g_local.h"
#include "inventoryitem.h"
#include "specialfx.h"
#include "player.h"
#define CTF_VERSION 1.00
#define CTF_VSTRING2(x) #x
#define CTF_VSTRING(x) CTF_VSTRING2(x)
#define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION)
#define STAT_CTF_TECH 7
#define STAT_CTF_ID_VIEW 8
#define STAT_CTF_TEAM1_PIC 11
#define STAT_CTF_TEAM1_CAPS 12
#define STAT_CTF_TEAM2_PIC 13
#define STAT_CTF_TEAM2_CAPS 14
#define STAT_CTF_FLAG_PIC 15
#define STAT_CTF_JOINED_TEAM1_PIC 16
#define STAT_CTF_JOINED_TEAM2_PIC 17
#define STAT_CTF_TEAM1_HEADER 18
#define STAT_CTF_TEAM2_HEADER 19
typedef enum
{
CTF_NOTEAM,
CTF_TEAM_HARDCORPS,
CTF_TEAM_SINTEK
} ctfteam_t;
typedef enum
{
CTF_STATE_START,
CTF_STATE_PLAYING
} ctfstate_t;
typedef enum
{
CTF_GRAPPLE_STATE_FLY,
CTF_GRAPPLE_STATE_PULL,
CTF_GRAPPLE_STATE_HANG
} ctfgrapplestate_t;
typedef enum
{
FIRE,
DAMAGE
} ctfsoundevent_t;
typedef struct ctfgame_s
{
int team_hardcorps;
int team_sintek;
int total_hardcorps, total_sintek; // these are only set when going into intermission!
float last_flag_capture;
int last_capture_team;
} ctfgame_t;
extern ctfgame_t ctfgame;
extern cvar_t *ctf;
extern cvar_t *ctf_hardcorps_skin;
extern cvar_t *ctf_sintek_skin;
extern cvar_t *ctf_forcejoin;
#define CTF_CAPTURE_BONUS 15 // what you get for capture
#define CTF_TEAM_BONUS 10 // what your team gets for capture
#define CTF_RECOVERY_BONUS 1 // what you get for recovery
#define CTF_FLAG_BONUS 0 // what you get for picking up enemy flag
#define CTF_FRAG_CARRIER_BONUS 2 // what you get for fragging enemy flag carrier
#define CTF_FLAG_RETURN_TIME 40 // seconds until auto return
#define CTF_CARRIER_DANGER_PROTECT_BONUS 2 // bonus for fraggin someone who has recently hurt your flag carrier
#define CTF_CARRIER_PROTECT_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag carrier
#define CTF_FLAG_DEFENSE_BONUS 1 // bonus for fraggin someone while either you or your target are near your flag
#define CTF_RETURN_FLAG_ASSIST_BONUS 1 // awarded for returning a flag that causes a capture to happen almost immediately
#define CTF_FRAG_CARRIER_ASSIST_BONUS 2 // award for fragging a flag carrier if a capture happens almost immediately
#define CTF_TARGET_PROTECT_RADIUS 400 // the radius around an object being defended where a target will be worth extra frags
#define CTF_ATTACKER_PROTECT_RADIUS 400 // the radius around an object being defended where an attacker will get extra frags when making kills
#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8
#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10
#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10
#define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 // number of seconds before dropped flag auto-returns
#define CTF_DROPPED_FLAG_RETURN_TIMEOUT 10 // number of seconds before dropped flag returns
#define CTF_TECH_TIMEOUT 60 // seconds before techs spawn again
#define CTF_GRAPPLE_SPEED 1000 // speed of grapple in flight
#define CTF_GRAPPLE_PULL_SPEED 700 // speed player is pulled at
#define CTF_TECH_REGENERATION_HEALTH 300 // max health with regeneration
#define CTF_TECH_REGENERATION_TIME 0.7 // time between regenerations
// FLAGS
class EXPORT_FROM_DLL CTF_Flag : public InventoryItem
{
protected:
ctfteam_t ctf_team;
virtual void PickupFlag( Event *ev );
virtual void ResetFlag( Event *ev );
public:
qboolean limp;
CLASS_PROTOTYPE( CTF_Flag );
CTF_Flag();
};
class EXPORT_FROM_DLL CTF_Flag_Hardcorps : public CTF_Flag
{
public:
CLASS_PROTOTYPE( CTF_Flag_Hardcorps );
CTF_Flag_Hardcorps();
};
class EXPORT_FROM_DLL CTF_Flag_Sintek : public CTF_Flag
{
public:
CLASS_PROTOTYPE( CTF_Flag_Sintek );
CTF_Flag_Sintek();
};
// TECH
class EXPORT_FROM_DLL CTF_Tech : public InventoryItem
{
protected:
Vector FindSpawnLocation( void );
void Timeout( Event *ev );
virtual void Pickup( Event *ev );
virtual qboolean Pickupable( Entity *other );
void HasTechMsg( edict_t *who );
public:
CLASS_PROTOTYPE( CTF_Tech );
CTF_Tech();
};
class EXPORT_FROM_DLL CTF_Tech_Regeneration : public CTF_Tech
{
protected:
void Regenerate( Event *ev );
float last_sound_event;
public:
CLASS_PROTOTYPE( CTF_Tech_Regeneration );
CTF_Tech_Regeneration();
};
class EXPORT_FROM_DLL CTF_Tech_Double : public CTF_Tech
{
public:
CLASS_PROTOTYPE( CTF_Tech_Double );
CTF_Tech_Double();
};
class EXPORT_FROM_DLL CTF_Tech_Shield : public CTF_Tech
{
public:
CLASS_PROTOTYPE( CTF_Tech_Shield );
CTF_Tech_Shield();
};
class EXPORT_FROM_DLL CTF_Tech_Aqua : public CTF_Tech
{
public:
CLASS_PROTOTYPE( CTF_Tech_Aqua );
CTF_Tech_Aqua();
};
class EXPORT_FROM_DLL CTF_Tech_Jump : public CTF_Tech
{
public:
CLASS_PROTOTYPE( CTF_Tech_Jump );
CTF_Tech_Jump();
};
class EXPORT_FROM_DLL CTF_Tech_Empathy : public CTF_Tech
{
public:
CLASS_PROTOTYPE( CTF_Tech_Empathy );
CTF_Tech_Empathy();
};
class EXPORT_FROM_DLL CTF_Tech_DeathQuad : public CTF_Tech
{
private:
float last_sound_event;
public:
CLASS_PROTOTYPE( CTF_Tech_DeathQuad );
CTF_Tech_DeathQuad();
void Damage( Event *ev );
};
void CTF_Init(void);
char *CTF_TeamName(int team);
char *CTF_OtherTeamName(int team);
int CTF_OtherTeam( int team );
void CTF_UpdateStats( Player *player );
void CTF_ScoreboardMessage( Entity *ent, Entity *killer );
qboolean CTF_CheckRules( void );
Entity *SelectCTFSpawnPoint (edict_t *ent);
void CTF_InitFlags( void );
void CTF_FragBonuses( Sentient *targ, Sentient *attacker );
void CTF_CheckHurtCarrier( Entity *targ, Entity *attacker );
void CTF_CalcScores( void );
extern Event EV_Flag_Reset;
extern Event EV_Tech_Timeout;
#endif /* ctf.h */