Quake-2

Quake 2 GPL Source Release
Log | Files | Refs

g_ctf.h (6124B)


      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.09b
     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 
     39 #define CONFIG_CTF_MATCH (CS_MAXCLIENTS-1)
     40 
     41 typedef enum {
     42 	CTF_NOTEAM,
     43 	CTF_TEAM1,
     44 	CTF_TEAM2
     45 } ctfteam_t;
     46 
     47 typedef enum {
     48 	CTF_GRAPPLE_STATE_FLY,
     49 	CTF_GRAPPLE_STATE_PULL,
     50 	CTF_GRAPPLE_STATE_HANG
     51 } ctfgrapplestate_t;
     52 
     53 typedef struct ghost_s {
     54 	char netname[16];
     55 	int number;
     56 
     57 	// stats
     58 	int deaths;
     59 	int kills;
     60 	int caps;
     61 	int basedef;
     62 	int carrierdef;
     63 
     64 	int code; // ghost code
     65 	int team; // team
     66 	int score; // frags at time of disconnect
     67 	edict_t *ent;
     68 } ghost_t;
     69 
     70 extern cvar_t *ctf;
     71 
     72 #define CTF_TEAM1_SKIN "ctf_r"
     73 #define CTF_TEAM2_SKIN "ctf_b"
     74 
     75 #define DF_CTF_FORCEJOIN	131072	
     76 #define DF_ARMOR_PROTECT	262144
     77 #define DF_CTF_NO_TECH      524288
     78 
     79 #define CTF_CAPTURE_BONUS		15	// what you get for capture
     80 #define CTF_TEAM_BONUS			10	// what your team gets for capture
     81 #define CTF_RECOVERY_BONUS		1	// what you get for recovery
     82 #define CTF_FLAG_BONUS			0	// what you get for picking up enemy flag
     83 #define CTF_FRAG_CARRIER_BONUS	2	// what you get for fragging enemy flag carrier
     84 #define CTF_FLAG_RETURN_TIME	40	// seconds until auto return
     85 
     86 #define CTF_CARRIER_DANGER_PROTECT_BONUS	2	// bonus for fraggin someone who has recently hurt your flag carrier
     87 #define CTF_CARRIER_PROTECT_BONUS			1	// bonus for fraggin someone while either you or your target are near your flag carrier
     88 #define CTF_FLAG_DEFENSE_BONUS				1	// bonus for fraggin someone while either you or your target are near your flag
     89 #define CTF_RETURN_FLAG_ASSIST_BONUS		1	// awarded for returning a flag that causes a capture to happen almost immediately
     90 #define CTF_FRAG_CARRIER_ASSIST_BONUS		2	// award for fragging a flag carrier if a capture happens almost immediately
     91 
     92 #define CTF_TARGET_PROTECT_RADIUS			400	// the radius around an object being defended where a target will be worth extra frags
     93 #define CTF_ATTACKER_PROTECT_RADIUS			400	// the radius around an object being defended where an attacker will get extra frags when making kills
     94 
     95 #define CTF_CARRIER_DANGER_PROTECT_TIMEOUT	8
     96 #define CTF_FRAG_CARRIER_ASSIST_TIMEOUT		10
     97 #define CTF_RETURN_FLAG_ASSIST_TIMEOUT		10
     98 
     99 #define CTF_AUTO_FLAG_RETURN_TIMEOUT		30	// number of seconds before dropped flag auto-returns
    100 
    101 #define CTF_TECH_TIMEOUT					60  // seconds before techs spawn again
    102 
    103 #define CTF_GRAPPLE_SPEED					650 // speed of grapple in flight
    104 #define CTF_GRAPPLE_PULL_SPEED				650	// speed player is pulled at
    105 
    106 void CTFInit(void);
    107 void CTFSpawn(void);
    108 
    109 void SP_info_player_team1(edict_t *self);
    110 void SP_info_player_team2(edict_t *self);
    111 
    112 char *CTFTeamName(int team);
    113 char *CTFOtherTeamName(int team);
    114 void CTFAssignSkin(edict_t *ent, char *s);
    115 void CTFAssignTeam(gclient_t *who);
    116 edict_t *SelectCTFSpawnPoint (edict_t *ent);
    117 qboolean CTFPickup_Flag(edict_t *ent, edict_t *other);
    118 qboolean CTFDrop_Flag(edict_t *ent, gitem_t *item);
    119 void CTFEffects(edict_t *player);
    120 void CTFCalcScores(void);
    121 void SetCTFStats(edict_t *ent);
    122 void CTFDeadDropFlag(edict_t *self);
    123 void CTFScoreboardMessage (edict_t *ent, edict_t *killer);
    124 void CTFTeam_f (edict_t *ent);
    125 void CTFID_f (edict_t *ent);
    126 void CTFSay_Team(edict_t *who, char *msg);
    127 void CTFFlagSetup (edict_t *ent);
    128 void CTFResetFlag(int ctf_team);
    129 void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker);
    130 void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker);
    131 
    132 // GRAPPLE
    133 void CTFWeapon_Grapple (edict_t *ent);
    134 void CTFPlayerResetGrapple(edict_t *ent);
    135 void CTFGrapplePull(edict_t *self);
    136 void CTFResetGrapple(edict_t *self);
    137 
    138 //TECH
    139 gitem_t *CTFWhat_Tech(edict_t *ent);
    140 qboolean CTFPickup_Tech (edict_t *ent, edict_t *other);
    141 void CTFDrop_Tech(edict_t *ent, gitem_t *item);
    142 void CTFDeadDropTech(edict_t *ent);
    143 void CTFSetupTechSpawn(void);
    144 int CTFApplyResistance(edict_t *ent, int dmg);
    145 int CTFApplyStrength(edict_t *ent, int dmg);
    146 qboolean CTFApplyStrengthSound(edict_t *ent);
    147 qboolean CTFApplyHaste(edict_t *ent);
    148 void CTFApplyHasteSound(edict_t *ent);
    149 void CTFApplyRegeneration(edict_t *ent);
    150 qboolean CTFHasRegeneration(edict_t *ent);
    151 void CTFRespawnTech(edict_t *ent);
    152 void CTFResetTech(void);
    153 
    154 void CTFOpenJoinMenu(edict_t *ent);
    155 qboolean CTFStartClient(edict_t *ent);
    156 void CTFVoteYes(edict_t *ent);
    157 void CTFVoteNo(edict_t *ent);
    158 void CTFReady(edict_t *ent);
    159 void CTFNotReady(edict_t *ent);
    160 qboolean CTFNextMap(void);
    161 qboolean CTFMatchSetup(void);
    162 qboolean CTFMatchOn(void);
    163 void CTFGhost(edict_t *ent);
    164 void CTFAdmin(edict_t *ent);
    165 qboolean CTFInMatch(void);
    166 void CTFStats(edict_t *ent);
    167 void CTFWarp(edict_t *ent);
    168 void CTFBoot(edict_t *ent);
    169 void CTFPlayerList(edict_t *ent);
    170 
    171 qboolean CTFCheckRules(void);
    172 
    173 void SP_misc_ctf_banner (edict_t *ent);
    174 void SP_misc_ctf_small_banner (edict_t *ent);
    175 
    176 extern char *ctf_statusbar;
    177 
    178 void UpdateChaseCam(edict_t *ent);
    179 void ChaseNext(edict_t *ent);
    180 void ChasePrev(edict_t *ent);
    181 
    182 void CTFObserver(edict_t *ent);
    183 
    184 void SP_trigger_teleport (edict_t *ent);
    185 void SP_info_teleport_destination (edict_t *ent);