Xonotic
duel.qh
Go to the documentation of this file.
1 #pragma once
2 
4 #include <common/mapinfo.qh>
5 
8  {
9  this.gametype_init(this, _("Duel"),"duel","g_duel",GAMETYPE_FLAG_USEPOINTS,"","timelimit=10 pointlimit=0 leadlimit=0",_("Fight in a one versus one arena battle to decide the winner"));
10  }
11  METHOD(Duel, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
12  {
13  return (diameter < 16384);
14  }
15  METHOD(Duel, m_isForcedSupported, bool(Gametype this))
16  {
17  if(!cvar("g_duel_not_dm_maps"))
18  {
19  // if this is set, all DM maps support duel too
20  // TODO: we should really check the size of maps, some DM maps do not work for duel!
21  if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags))
22  return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported)
23  }
24  return false;
25  }
27 REGISTER_GAMETYPE(DUEL, NEW(Duel));
28 #define g_duel IS_GAMETYPE(DUEL)
Definition: duel.qh:6
#define NEW(cname,...)
Definition: oo.qh:105
CLASS(Object) Object
Definition: oo.qh:318
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
int m_flags
Definition: mapinfo.qh:27
#define INIT(cname)
Definition: oo.qh:198
int MapInfo_Map_supportedGametypes
Definition: mapinfo.qh:13
REGISTER_GAMETYPE(DUEL, NEW(Duel))
const int GAMETYPE_FLAG_USEPOINTS
Definition: mapinfo.qh:20
#define ENDCLASS(cname)
Definition: oo.qh:269