X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmapinfo.qh;h=4ece9215609bf05fb0b6fd4cce295bc58512351b;hp=f37e2db060881e23088652e012926e668b731216;hb=34f3c1d754abe766f800408a3e7bb0172ddda21f;hpb=641c47df604de42c11c68a7d80813b29affcefb2 diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index f37e2db06..4ece92156 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -1,10 +1,5 @@ #pragma once -bool autocvar_developer_mapper; - -#define LOG_MAPWARN(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARN(__VA_ARGS__); } MACRO_END -#define LOG_MAPWARNF(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNF(__VA_ARGS__); } MACRO_END - #include "util.qh" // info about a map that MapInfo loads @@ -62,6 +57,10 @@ CLASS(Gametype, Object) { return false; } + METHOD(Gametype, m_isForcedSupported, bool(Gametype this)) + { + return false; + } METHOD(Gametype, describe, string(Gametype this)) { @@ -101,7 +100,7 @@ REGISTRY_CHECK(Gametypes) CLASS(Deathmatch, Gametype) INIT(Deathmatch) { - this.gametype_init(this, _("Deathmatch"),"dm","g_dm",false,"","timelimit=20 pointlimit=30 leadlimit=0",_("Score as many frags as you can")); + this.gametype_init(this, _("Deathmatch"),"dm","g_dm",false,"","timelimit=15 pointlimit=30 leadlimit=0",_("Score as many frags as you can")); } METHOD(Deathmatch, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) { @@ -186,7 +185,7 @@ REGISTER_GAMETYPE(CTS, NEW(RaceCTS)); CLASS(TeamDeathmatch, Gametype) INIT(TeamDeathmatch) { - this.gametype_init(this, _("Team Deathmatch"),"tdm","g_tdm",true,"","timelimit=20 pointlimit=50 teams=2 leadlimit=0",_("Help your team score the most frags against the enemy team")); + this.gametype_init(this, _("Team Deathmatch"),"tdm","g_tdm",true,"","timelimit=15 pointlimit=50 teams=2 leadlimit=0",_("Help your team score the most frags against the enemy team")); } METHOD(TeamDeathmatch, m_parse_mapinfo, bool(string k, string v)) { @@ -207,6 +206,16 @@ CLASS(TeamDeathmatch, Gametype) return true; return false; } + METHOD(TeamDeathmatch, m_isForcedSupported, bool(Gametype this)) + { + if(cvar("g_tdm_on_dm_maps")) + { + // if this is set, all DM maps support TDM too + if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags)) + return true; // TODO: references another gametype (alternatively, we could check which gamemodes are always enabled and append this if any are supported) + } + return false; + } METHOD(TeamDeathmatch, m_setTeams, void(string sa)) { cvar_set("g_tdm_teams", sa); @@ -410,7 +419,7 @@ REGISTER_GAMETYPE(NEXBALL, NEW(NexBall)); CLASS(FreezeTag, Gametype) INIT(FreezeTag) { - this.gametype_init(this, _("Freeze Tag"),"ft","g_freezetag",true,"","timelimit=20 pointlimit=10 teams=2 leadlimit=0",_("Kill enemies to freeze them, stand next to teammates to revive them, freeze the most enemies to win")); + this.gametype_init(this, _("Freeze Tag"),"ft","g_freezetag",true,"","timelimit=20 pointlimit=10 teams=2 leadlimit=0",_("Kill enemies to freeze them, stand next to frozen teammates to revive them; freeze all enemies to win")); } METHOD(FreezeTag, m_parse_mapinfo, bool(string k, string v)) { @@ -448,7 +457,7 @@ void HUD_Mod_Keepaway(vector pos, vector mySize); CLASS(Keepaway, Gametype) INIT(Keepaway) { - this.gametype_init(this, _("Keepaway"),"ka","g_keepaway",true,"","timelimit=20 pointlimit=30",_("Hold the ball to get points for kills")); + this.gametype_init(this, _("Keepaway"),"ka","g_keepaway",false,"","timelimit=20 pointlimit=30",_("Hold the ball to get points for kills")); } METHOD(Keepaway, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) { @@ -463,7 +472,7 @@ REGISTER_GAMETYPE(KEEPAWAY, NEW(Keepaway)); CLASS(Invasion, Gametype) INIT(Invasion) { - this.gametype_init(this, _("Invasion"),"inv","g_invasion",false,"","pointlimit=50 teams=0",_("Survive against waves of monsters")); + this.gametype_init(this, _("Invasion"),"inv","g_invasion",false,"","pointlimit=50 teams=0 type=0",_("Survive against waves of monsters")); } METHOD(Invasion, m_parse_mapinfo, bool(string k, string v)) { @@ -471,6 +480,9 @@ CLASS(Invasion, Gametype) case "teams": cvar_set("g_invasion_teams", v); return true; + case "type": + cvar_set("g_invasion_type", v); + return true; } return false; } @@ -482,6 +494,27 @@ CLASS(Invasion, Gametype) ENDCLASS(Invasion) REGISTER_GAMETYPE(INVASION, NEW(Invasion)); +CLASS(Duel, Gametype) + INIT(Duel) + { + this.gametype_init(this, _("Duel"),"duel","g_duel",false,"","timelimit=10 pointlimit=0 leadlimit=0",_("Fight in a one versus one arena battle to decide the winner")); + } + METHOD(Duel, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter)) + { + return (diameter < 16384); + } + METHOD(Duel, m_isForcedSupported, bool(Gametype this)) + { + // force all DM maps to work in duel?! + // TODO: we should really check the size of maps, some DM maps do not work for duel! + if(!(MapInfo_Map_supportedGametypes & this.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags)) + return true; + return false; + } +ENDCLASS(Duel) +REGISTER_GAMETYPE(DUEL, NEW(Duel)); +#define g_duel IS_GAMETYPE(DUEL) + const int MAPINFO_FEATURE_WEAPONS = 1; // not defined for instagib-only maps const int MAPINFO_FEATURE_VEHICLES = 2; const int MAPINFO_FEATURE_TURRETS = 4;