]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merged Lyberta/GunGame into Lyberta/master
authorLyberta <lyberta@lyberta.net>
Thu, 31 Aug 2017 12:27:37 +0000 (15:27 +0300)
committerLyberta <lyberta@lyberta.net>
Thu, 31 Aug 2017 12:27:37 +0000 (15:27 +0300)
1  2 
gamemodes-server.cfg
qcsrc/client/hud/panel/modicons.qc
qcsrc/common/mapinfo.qh
qcsrc/common/stats.qh
qcsrc/server/g_world.qc

index ed4c5c9b9859e3e2fd2072f17ddd947ba9d3b961,ab3b84b63e97407044269ca763f06f8ecd73e5db..1991f0c76f6d5d93cc52007e0fe2fd37feb677f9
@@@ -196,7 -198,15 +198,14 @@@ set g_inv_respawn_delay_large_count 
  set g_inv_respawn_delay_max 0
  set g_inv_respawn_waves 0
  set g_inv_weapon_stay 0
+ set g_gg_respawn_delay_small 0
+ set g_gg_respawn_delay_small_count 0
+ set g_gg_respawn_delay_large 0
+ set g_gg_respawn_delay_large_count 0
+ set g_gg_respawn_delay_max 0
+ set g_gg_respawn_waves 0
+ set g_gg_weapon_stay 0
  
 -
  // =========
  //  assault
  // =========
@@@ -522,4 -532,8 +531,10 @@@ set g_invasion_teams 0 "number of team
  set g_invasion_team_spawns 1 "use team spawns in teamplay invasion mode"
  set g_invasion_type 0 "type of invasion mode - 0: round-based, 1: hunting, 2: complete the stage (note: use mapinfo to set this)"
  
+ // =========
+ //  gungame
+ // =========
+ set g_gg 0 "GunGame: Kill players with all weapons"
+ set g_gg_weapons "vortex mortar machinegun hagar arc electro devastator crylink shotgun blaster"
++
 +exec survival.cfg // Lyberta: surv
index cf4184689215c1246bd1e9744bcdac814752ae2e,c63683dc805fd444649754408ebf969fd48d3cc8..2513a803f344cc13c5fc35062920a8a3a085bf93
@@@ -711,103 -711,38 +711,135 @@@ void HUD_Mod_Dom(vector myPos, vector m
        }
  }
  
+ void HUD_Mod_GG(vector pos, vector mySize)
+ {
+       mod_active = 1; // required in each mod function that always shows something
+       int stat_weapon = STAT(GUNGAME_LEADING_WEAPON);
+       vector pic_pos, pic_size;
+       if (mySize.x > mySize.y)
+       {
+               pic_pos = pos + eX * 0.25 * mySize.x;
+               pic_size = vec2(0.5 * mySize.x, mySize.y);
+       }
+       else
+       {
+               pic_pos = pos + eY * 0.25 * mySize.y;
+               pic_size = vec2(mySize.x, 0.5 * mySize.y);
+       }
+       string weapon_pic = string_null;
+       FOREACH(Weapons, it != WEP_Null,
+       {
+               if (it.m_id == stat_weapon)
+               {
+                       weapon_pic = it.model2;
+                       break;
+               }
+       });
+       if (!weapon_pic)
+       {
+               return;
+       }
+       drawpic_aspect_skin(pic_pos, weapon_pic, pic_size, '1 1 1', 1,
+               DRAWFLAG_NORMAL);
+ }
 +// Lyberta: surv
 +void HUD_Mod_SURV(vector mypos, vector mysize)
 +{
 +      mod_active = 1; // required in each mod function that always shows something
 +      float defenderhealth = STAT(SURV_DEFENDER_HEALTH);
 +      // Draw a health bar
 +      float margin = mysize.y / 10; // Leave a small margin to be stylish
 +      vector healthbarpos = mypos;
 +      healthbarpos.x += margin;
 +      healthbarpos.y += margin;
 +      vector healthbarsize = mysize;
 +      healthbarsize.x -= margin * 2;
 +      healthbarsize.y -= margin * 2;
 +      vector healthbarcolor;
 +      healthbarcolor.z = 0;
 +      if (defenderhealth > 0.5)
 +      {
 +              healthbarcolor.x = defenderhealth * -2 + 2;
 +              healthbarcolor.y = 1;
 +      }
 +      else
 +      {
 +              healthbarcolor.x = 1;
 +              healthbarcolor.y = defenderhealth;
 +      }
 +      HUD_Panel_DrawProgressBar(healthbarpos, healthbarsize, "progressbar",
 +              defenderhealth, false, 0, healthbarcolor, 0.50, DRAWFLAG_NORMAL);
 +      // Draw defender picture
 +      int defenderteam = STAT(SURV_DEFENDER_TEAM);
 +      string defenderpic = "";
 +      vector defendercolor;
 +      switch (defenderteam)
 +      {
 +              case 1:
 +              {
 +                      defenderpic = "player_red";
 +                      defendercolor = '1 0 0';
 +                      break;
 +              }
 +              case 2:
 +              {
 +                      defenderpic = "player_blue";
 +                      defendercolor = '0 0 1';
 +                      break;
 +              }
 +              default:
 +              {
 +                      defendercolor = '1 1 1';
 +                      break;
 +              }
 +      }
 +      vector picpos = mypos;
 +      vector picsize = mysize;
 +      picsize.x = picsize.y;
 +      drawpic_aspect_skin(picpos, defenderpic, picsize, '1 1 1', 1,
 +              DRAWFLAG_NORMAL);
 +      // Draw number of defenders
 +      int numalive = STAT(SURV_DEFENDERS_ALIVE);
 +      vector alivepos = mypos;
 +      alivepos.x += picsize.x;
 +      vector alivesize = picsize;
 +      drawstring_aspect(alivepos, ftos(numalive), alivesize, defendercolor, 1,
 +              DRAWFLAG_NORMAL);
 +      // Draw the time left
 +      float roundtime = STAT(SURV_ROUND_TIME);
 +      if (roundtime < 0)
 +      {
 +              roundtime = 0;
 +      }
 +      vector roundtimepos = mypos;
 +      roundtimepos.x += picsize.x * 2;
 +      vector roundtimesize = mysize;
 +      roundtimesize.x = mysize.x - picsize.x * 2;
 +      drawstring_aspect(roundtimepos, seconds_tostring(roundtime), roundtimesize,
 +              '1 1 1', 1, DRAWFLAG_NORMAL);
 +      if (autocvar_developer == 0)
 +      {
 +              return;
 +      }
 +      // Debug info below
 +      int redalive = STAT(REDALIVE);
 +      int bluealive = STAT(BLUEALIVE);
 +      int yellowalive = STAT(YELLOWALIVE);
 +      int pinkalive = STAT(PINKALIVE);
 +      string message = strcat(ftos(redalive), "/", ftos(yellowalive));
 +      vector redpos = mypos;
 +      redpos.y += mysize.y;
 +      vector statsize = mysize;
 +      statsize.x /= 2;
 +      drawstring_aspect(redpos, message, statsize, '1 0 0', 1, DRAWFLAG_NORMAL);
 +      message = strcat(ftos(bluealive), "/", ftos(pinkalive));
 +      vector bluepos = mypos;
 +      bluepos.x += mysize.x / 2;
 +      bluepos.y += mysize.y;
 +      drawstring_aspect(bluepos, message, statsize, '0 0 1', 1, DRAWFLAG_NORMAL);
 +}
 +
  void HUD_ModIcons_SetFunc()
  {
        HUD_ModIcons_GameType = gametype.m_modicons;
index 40a3f59cb38d7ebadbf14cafef373e85cd25d2d1,346e4077e39390796ed5c188d7f06de6a377f5c5..834b38550a9b83e2cc7fbb5fbccc235553284cb7
@@@ -482,28 -482,26 +482,49 @@@ REGISTER_GAMETYPE(INVASION, NEW(Invasio
  
  //=============================================================================
  
-     {
-         return true;
-     }
+ #ifdef CSQC
+ void HUD_Mod_GG(vector pos, vector mySize);
+ #endif
+ CLASS(GunGame, Gametype)
+     INIT(GunGame)
+     {
+         this.gametype_init(this, _("GunGame"), "gg", "g_gg", false, "", "timelimit=20", _("Kill players with all weapons"));
+     }
+     METHOD(GunGame, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
+     {
+         return true;
+     }
+ #ifdef CSQC
+     ATTRIB(GunGame, m_modicons, void(vector pos, vector mySize), HUD_Mod_GG);
+ #endif
+ ENDCLASS(GunGame)
+ REGISTER_GAMETYPE(GUNGAME, NEW(GunGame));
+ #define g_gg IS_GAMETYPE(GUNGAME)
+ //=============================================================================
++
 +// Lyberta: adding survival gametype
 +
 +#ifdef CSQC
 +void HUD_Mod_SURV(vector pos, vector mySize);
 +#endif
 +CLASS(Survival, Gametype)
 +    INIT(Survival)
 +    {
 +        this.gametype_init(this, _("Survival"), "surv", "g_surv", true, "", "timelimit=20 pointlimit=5 teams=2 leadlimit=0", _("Survive as long as you can"));
 +    }
 +    METHOD(Survival, m_isAlwaysSupported, bool(Gametype this, int spawnpoints, float diameter))
++      {
++              return true;
++      }
 +#ifdef CSQC
 +    ATTRIB(Survival, m_modicons, void(vector pos, vector mySize), HUD_Mod_SURV);
 +#endif
 +ENDCLASS(Survival)
 +REGISTER_GAMETYPE(SURVIVAL, NEW(Survival));
 +#define g_surv IS_GAMETYPE(SURVIVAL)
 +
 +//=============================================================================
  
  const int MAPINFO_FEATURE_WEAPONS       = 1; // not defined for instagib-only maps
  const int MAPINFO_FEATURE_VEHICLES      = 2;
index cedc2d972c09c913e46c2ca1d2e635ae7c26d486,8dc351122867c070dcd45ab8a4a681311d8931e1..1469eb09be900dd532212e0c7a87f43d6aa95c86
@@@ -283,12 -281,9 +283,15 @@@ REGISTER_STAT(DOM_PPS_BLUE, float
  REGISTER_STAT(DOM_PPS_YELLOW, float)
  REGISTER_STAT(DOM_PPS_PINK, float)
  
+ // gungame
+ REGISTER_STAT(GUNGAME_LEADING_WEAPON, int)
 +// Lyberta: survival
 +REGISTER_STAT(SURV_ROUND_TIME, float)
 +REGISTER_STAT(SURV_DEFENDER_TEAM, int)
 +REGISTER_STAT(SURV_DEFENDERS_ALIVE, int)
 +REGISTER_STAT(SURV_DEFENDER_HEALTH, float)
 +
  REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed)
  REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid)
  
Simple merge