X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmapinfo.qh;h=0ac0c6230548692303cf5c685cdd10dddbb6f882;hb=61ec7040b5c809cc0ff62e92f21d5cbb8183bfb9;hp=7059a122d7129d0bcf93105aa3cc5361baa0206b;hpb=42a881cbe552bb6ce4a13106cafc9d2f1a8152de;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 7059a122d..0ac0c6230 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -21,6 +21,7 @@ const int GAMETYPE_FLAG_USEPOINTS = BIT(1); // gametype has point-based sc const int GAMETYPE_FLAG_PREFERRED = BIT(2); // preferred (when available) in random selections const int GAMETYPE_FLAG_PRIORITY = BIT(3); // priority selection when preferred gametype isn't available in random selections const int GAMETYPE_FLAG_HIDELIMITS = BIT(4); // don't display a score limit needed for winning the match in the scoreboard +const int GAMETYPE_FLAG_WEAPONARENA = BIT(5); // gametype has a forced weapon arena, weapon arena mutators should disable themselves when this is set int MAPINFO_TYPE_ALL; .int m_flags; @@ -41,6 +42,8 @@ CLASS(Gametype, Object) ATTRIB(Gametype, frags, bool, true); /** should this gametype display a score limit in the scoreboard? */ ATTRIB(Gametype, m_hidelimits, bool, false); + /** does this gametype enforce its own weapon arena? */ + ATTRIB(Gametype, m_weaponarena, bool, false); /** game type defaults */ ATTRIB(Gametype, model2, string); /** game type description */ @@ -107,6 +110,7 @@ CLASS(Gametype, Object) this.frags = (gflags & GAMETYPE_FLAG_USEPOINTS); this.m_priority = ((gflags & GAMETYPE_FLAG_PREFERRED) ? 2 : ((gflags & GAMETYPE_FLAG_PRIORITY) ? 1 : 0)); this.m_hidelimits = (gflags & GAMETYPE_FLAG_HIDELIMITS); + this.m_weaponarena = (gflags & GAMETYPE_FLAG_WEAPONARENA); // same as `1 << m_id` MAPINFO_TYPE_ALL |= this.items = this.m_flags = (MAPINFO_TYPE_ALL + 1); @@ -119,9 +123,13 @@ REGISTRY_SORT(Gametypes); REGISTRY_CHECK(Gametypes) REGISTRY_DEFINE_GET(Gametypes, NULL) +STATIC_INIT(Gametypes_renumber) { FOREACH(Gametypes, true, it.m_id = i); } #define REGISTER_GAMETYPE(NAME, inst) REGISTER(Gametypes, MAPINFO_TYPE, NAME, m_id, inst) +#ifndef CSQC +// NOTE: ISGAMETYPE in csqc (temporary hack) #define IS_GAMETYPE(NAME) (MapInfo_LoadedGametype == MAPINFO_TYPE_##NAME) +#endif const int MAPINFO_FEATURE_WEAPONS = 1; // not defined for instagib-only maps const int MAPINFO_FEATURE_VEHICLES = 2; @@ -150,7 +158,7 @@ int MapInfo_ForbiddenFlags(); // retrieves current flags from cvars int MapInfo_RequiredFlags(); // retrieves current flags from cvars // load info about the i-th map into the MapInfo_Map_* globals -float MapInfo_Get_ByID(float i); // 1 on success, 0 on failure +bool MapInfo_Get_ByID(int i); // 1 on success, 0 on failure string MapInfo_BSPName_ByID(float i); // load info about a map by name into the MapInfo_Map_* globals @@ -174,7 +182,7 @@ string MapInfo_ListAllAllowedMaps(float pFlagsRequired, float pFlagsForbidden); // gets a gametype from a string string _MapInfo_GetDefaultEx(Gametype t); float _MapInfo_GetTeamPlayBool(Gametype t); -Gametype MapInfo_Type_FromString(string t); +Gametype MapInfo_Type_FromString(string t, bool dowarn); string MapInfo_Type_Description(Gametype t); string MapInfo_Type_ToString(Gametype t); string MapInfo_Type_ToText(Gametype t);