]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/invasion/invasion.qh
Merge branch 'master' into terencehill/lms_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / invasion / invasion.qh
index 85cd7ec09a3af959fa8d2d9ee35592c47cbd6c68..2195b84c71f6597713a3fba5e956213735d5ed87 100644 (file)
@@ -1,48 +1,33 @@
 #pragma once
 
-#ifdef SVQC
-#include <common/mutators/base.qh>
-#define autocvar_g_invasion_point_limit cvar("g_invasion_point_limit")
-int autocvar_g_invasion_teams;
-int autocvar_g_invasion_type;
-bool autocvar_g_invasion_team_spawns;
-bool g_invasion;
-void invasion_Initialize();
-
-REGISTER_MUTATOR(inv, false)
-{
-    MUTATOR_STATIC();
-       MUTATOR_ONADD
-       {
-               if (autocvar_g_invasion_teams >= 2) {
-                       GameRules_teams(true);
-                       GameRules_spawning_teams(autocvar_g_invasion_team_spawns);
-               }
-        GameRules_limit_score(autocvar_g_invasion_point_limit);
-
-               g_invasion = true;
-               cvar_settemp("g_monsters", "1");
-               invasion_Initialize();
-       }
-       return 0;
-}
-
-float inv_numspawned;
-float inv_maxspawned;
-float inv_roundcnt;
-float inv_maxrounds;
-float inv_numkilled;
-float inv_lastcheck;
-float inv_maxcurrent;
-
-float invasion_teams;
-float inv_monsters_perteam[17];
-
-float inv_monsterskill;
-
-const float ST_INV_KILLS = 1;
-
-const int INV_TYPE_ROUND = 0; // round-based waves of enemies
-const int INV_TYPE_HUNT = 1; // clear the map of placed enemies
-const int INV_TYPE_STAGE = 2; // reach the end of the level
-#endif
+#include <common/mapinfo.qh>
+
+CLASS(Invasion, Gametype)
+    INIT(Invasion)
+    {
+        this.gametype_init(this, _("Invasion"),"inv","g_invasion",GAMETYPE_FLAG_USEPOINTS,"","pointlimit=50 teams=0 type=0",_("Survive against waves of monsters"));
+    }
+    METHOD(Invasion, m_parse_mapinfo, bool(string k, string v))
+    {
+        switch (k) {
+            case "teams":
+                cvar_set("g_invasion_teams", v);
+                return true;
+            case "type":
+                cvar_set("g_invasion_type", v);
+                return true;
+        }
+        return false;
+    }
+    METHOD(Invasion, m_generate_mapinfo, void(Gametype this, string v))
+    {
+        if(v == "invasion_spawnpoint")
+            MapInfo_Map_supportedGametypes |= this.m_flags;
+    }
+    METHOD(Invasion, 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))
+    {
+        TC(Gametype, this);
+        returns(menu, _("Point limit:"),    50,  500, 10, string_null,                 string_null,                    string_null);
+    }
+ENDCLASS(Invasion)
+REGISTER_GAMETYPE(INVASION, NEW(Invasion));