Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
tka.qh
Go to the documentation of this file.
1#pragma once
2
5#include <common/mapinfo.qh>
6#if defined(CSQC)
8#endif
9
12 {
13 this.gametype_init(this, _("Team Keepaway"),"tka","g_tka",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("Keep the ball in your team's possession to get points for kills"));
14 }
15 METHOD(TeamKeepaway, m_parse_mapinfo, bool(string k, string v))
16 {
17 if (!k)
18 {
19 cvar_set("g_tka_teams", cvar_defstring("g_tka_teams"));
20 return true;
21 }
22 switch (k)
23 {
24 case "teams":
25 cvar_set("g_tka_teams", v);
26 return true;
27 }
28 return false;
29 }
30 METHOD(TeamKeepaway, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
31 {
32 if(spawnpoints >= 8 && diameter > 4096)
33 return true;
34 return false;
35 }
37 {
38 if(cvar("g_tka_on_ka_maps"))
39 {
40 // if this is set, all KA maps support TKA too
41 if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEEPAWAY.gametype_flags))
42 return true; // TODO: references another gametype (alternatively, we could check which gametypes are always enabled and append this if any are supported)
43 }
44 if(cvar("g_tka_on_tdm_maps"))
45 {
46 // if this is set, all TDM maps support TKA too
47 if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_TEAM_DEATHMATCH.gametype_flags))
48 return true; // TODO: references another gametype (alternatively, we could check which gametypes are always enabled and append this if any are supported)
49 }
50 return false;
51 }
52 METHOD(TeamKeepaway, m_setTeams, void(string sa))
53 {
54 cvar_set("g_tka_teams", sa);
55 }
56#ifdef CSQC
57 ATTRIB(TeamKeepaway, m_modicons, void(vector pos, vector mySize), HUD_Mod_TeamKeepaway);
58#endif
61
62const int TKA_BALL_TAKEN_RED = BIT(0);
63const int TKA_BALL_TAKEN_BLUE = BIT(1);
65const int TKA_BALL_TAKEN_PINK = BIT(3);
66const int TKA_BALL_CARRYING = BIT(4);
67const int TKA_BALL_DROPPED = BIT(5);
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
void HUD_Mod_TeamKeepaway(vector pos, vector mySize)
Definition cl_tka.qc:13
virtual void gametype_init()
Definition mapinfo.qh:117
virtual void m_isAlwaysSupported()
Definition tka.qh:30
virtual void m_parse_mapinfo()
Definition tka.qh:15
TeamKeepaway()
Definition tka.qh:11
virtual void m_setTeams()
Definition tka.qh:52
virtual void m_isForcedSupported()
Definition tka.qh:36
vector MapInfo_Map_supportedGametypes
Definition mapinfo.qh:13
const int GAMETYPE_FLAG_USEPOINTS
Definition mapinfo.qh:20
#define REGISTER_GAMETYPE(NAME, inst)
Definition mapinfo.qh:149
const int GAMETYPE_FLAG_TEAMPLAY
Definition mapinfo.qh:19
vector gametype_flags
Definition mapinfo.qh:28
void cvar_set(string name, string value)
float cvar(string name)
const string cvar_defstring(string name)
#define NEW(cname,...)
Definition oo.qh:117
#define INIT(cname)
Definition oo.qh:210
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define ATTRIB(...)
Definition oo.qh:148
vector
Definition self.qh:92
const int TKA_BALL_CARRYING
Definition tka.qh:66
const int TKA_BALL_TAKEN_YELLOW
Definition tka.qh:64
const int TKA_BALL_TAKEN_RED
Definition tka.qh:62
const int TKA_BALL_DROPPED
Definition tka.qh:67
const int TKA_BALL_TAKEN_PINK
Definition tka.qh:65
const int TKA_BALL_TAKEN_BLUE
Definition tka.qh:63