Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
tdm.qh
Go to the documentation of this file.
1#pragma once
2
4#include <common/mapinfo.qh>
5
8 {
9 this.gametype_init(this, _("Team Deathmatch"),"tdm","g_tdm",GAMETYPE_FLAG_TEAMPLAY | GAMETYPE_FLAG_USEPOINTS | GAMETYPE_FLAG_PRIORITY,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("Help your team score the most frags against the enemy team"));
10 }
11 METHOD(TeamDeathmatch, m_parse_mapinfo, bool(string k, string v))
12 {
13 if (!k)
14 {
15 cvar_set("g_tdm_teams", cvar_defstring("g_tdm_teams"));
16 return true;
17 }
18 switch (k)
19 {
20 case "teams":
21 cvar_set("g_tdm_teams", v);
22 return true;
23 }
24 return false;
25 }
26 METHOD(TeamDeathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
27 {
28 if(spawnpoints >= 8 && diameter > 3250)
29 return true;
30 return false;
31 }
33 {
34 if(cvar("g_tdm_on_dm_maps"))
35 {
36 // if this is set, all DM maps support TDM too
37 if(!(MapInfo_Map_supportedGametypes & this.gametype_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.gametype_flags))
38 return true; // TODO: references another gametype (alternatively, we could check which gametypes are always enabled and append this if any are supported)
39 }
40 return false;
41 }
42 METHOD(TeamDeathmatch, m_setTeams, void(string sa))
43 {
44 cvar_set("g_tdm_teams", sa);
45 }
46 METHOD(TeamDeathmatch, m_configuremenu, void(Gametype this, entity menu, void(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip) returns))
47 {
48 TC(Gametype, this);
49 returns(menu, _("Point limit:"), 5, 100, 5, "g_tdm_point_limit", "g_tdm_teams_override", _("The amount of points needed before the match will end"));
50 }
51 ATTRIB(TeamDeathmatch, m_legacydefaults, string, "50 20 2 0");
54#define g_tdm IS_GAMETYPE(TEAM_DEATHMATCH)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
virtual void gametype_init()
Definition mapinfo.qh:117
TeamDeathmatch()
Definition tdm.qh:7
virtual void m_configuremenu()
Definition tdm.qh:46
virtual void m_isForcedSupported()
Definition tdm.qh:32
virtual void m_setTeams()
Definition tdm.qh:42
virtual void m_parse_mapinfo()
Definition tdm.qh:11
virtual void m_isAlwaysSupported()
Definition tdm.qh:26
string m_legacydefaults
Definition tdm.qh:51
#define TC(T, sym)
Definition _all.inc:82
vector MapInfo_Map_supportedGametypes
Definition mapinfo.qh:13
const int GAMETYPE_FLAG_PRIORITY
Definition mapinfo.qh:22
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