]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/duel
authorMario <mario@smbclan.net>
Sat, 29 Sep 2018 13:59:52 +0000 (23:59 +1000)
committerMario <mario@smbclan.net>
Sat, 29 Sep 2018 13:59:52 +0000 (23:59 +1000)
1  2 
qcsrc/common/mapinfo.qh
qcsrc/server/client.qc
qcsrc/server/client.qh

diff --combined qcsrc/common/mapinfo.qh
index bddefb22d57815c6be45c42db2b0163c65908142,63723afd7ab2deb70023f05a2762d108d082f9c8..4ece9215609bf05fb0b6fd4cce295bc58512351b
@@@ -57,6 -57,10 +57,10 @@@ CLASS(Gametype, Object
      {
          return false;
      }
+     METHOD(Gametype, m_isForcedSupported, bool(Gametype this))
+     {
+         return false;
+     }
  
      METHOD(Gametype, describe, string(Gametype this))
      {
@@@ -202,6 -206,16 +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);
@@@ -480,18 -494,6 +494,27 @@@ CLASS(Invasion, Gametype
  ENDCLASS(Invasion)
  REGISTER_GAMETYPE(INVASION, NEW(Invasion));
  
-         return (diameter < 8192);
 +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;
diff --combined qcsrc/server/client.qc
index e8ca9649fde09b89d84f0175d582c653560d6988,3e457df14e740a9c2b24e8f3938f8bf8e2e706ed..e705ab3d3a1fa1eaabf69eeefa7c276a4d0aa488
@@@ -274,7 -274,7 +274,7 @@@ void PutObserverInServer(entity this
  
      RemoveGrapplingHooks(this);
        Portal_ClearAll(this);
-       Unfreeze(this);
+       Unfreeze(this, false);
        SetSpectatee(this, NULL);
  
        if (this.alivetime)
        this.crouch = false;
        STAT(REVIVE_PROGRESS, this) = 0;
        this.revival_time = 0;
+       this.draggable = drag_undraggable;
  
        this.items = 0;
        STAT(WEAPONS, this) = '0 0 0';
@@@ -677,6 -678,8 +678,8 @@@ void PutPlayerInServer(entity this
        this.event_damage = PlayerDamage;
        this.event_heal = PlayerHeal;
  
+       this.draggable = func_null;
        if(!this.bot_attack)
                IL_PUSH(g_bot_targets, this);
        this.bot_attack = true;
                //spot.target = s;
        }
  
-       Unfreeze(this);
+       Unfreeze(this, false);
  
        MUTATOR_CALLHOOK(PlayerSpawn, this, spot);
  
@@@ -1143,6 -1146,8 +1146,8 @@@ void ClientConnect(entity this
        if (IS_REAL_CLIENT(this))
                sv_notice_join(this);
  
+       this.move_qcphysics = true;
        // update physics stats (players can spawn before physics runs)
        Physics_UpdateStats(this);
  
@@@ -1196,7 -1201,7 +1201,7 @@@ void ClientDisconnect(entity this
  
        Portal_ClearAll(this);
  
-       Unfreeze(this);
+       Unfreeze(this, false);
  
        RemoveGrapplingHooks(this);
  
@@@ -1236,7 -1241,7 +1241,7 @@@ void ChatBubbleThink(entity this
  
        if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
        {
-               if ( CS(this.owner).active_minigame )
+               if ( CS(this.owner).active_minigame && PHYS_INPUT_BUTTON_MINIGAME(this.owner) )
                        this.mdl = "models/sprites/minigame_busy.iqm";
                else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
                        this.mdl = "models/misc/chatbubble.spr";
@@@ -1911,14 -1916,6 +1916,14 @@@ void Join(entity this
        this.team_selected = false;
  }
  
 +int GetPlayerLimit()
 +{
 +      int player_limit = autocvar_g_maxplayers;
 +      MUTATOR_CALLHOOK(GetPlayerLimit, player_limit);
 +      player_limit = M_ARGV(0, int);
 +      return player_limit;
 +}
 +
  /**
   * Determines whether the player is allowed to join. This depends on cvar
   * g_maxplayers, if it isn't used this function always return true, otherwise
@@@ -1951,13 -1948,11 +1956,13 @@@ int nJoinAllowed(entity this, entity ig
                        ++currentlyPlaying;
        });
  
 +      int player_limit = GetPlayerLimit();
 +
        float free_slots = 0;
 -      if (!autocvar_g_maxplayers)
 +      if (!player_limit)
                free_slots = maxclients - totalClients;
 -      else if(currentlyPlaying < autocvar_g_maxplayers)
 -              free_slots = min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying);
 +      else if(currentlyPlaying < player_limit)
 +              free_slots = min(maxclients - totalClients, player_limit - currentlyPlaying);
  
        static float join_prevent_msg_time = 0;
        if(this && ignore && !free_slots && time > join_prevent_msg_time)
@@@ -2414,16 -2409,16 +2419,16 @@@ void PlayerPreThink (entity this
  
        if(IS_PLAYER(this))
        {
-               if (STAT(FROZEN, this) == 2)
+               if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING)
                {
                        STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + frametime * this.revive_speed, 1);
                        SetResourceAmountExplicit(this, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * start_health));
                        this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
  
                        if (STAT(REVIVE_PROGRESS, this) >= 1)
-                               Unfreeze(this);
+                               Unfreeze(this, false);
                }
-               else if (STAT(FROZEN, this) == 3)
+               else if (STAT(FROZEN, this) == FROZEN_TEMP_DYING)
                {
                        STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - frametime * this.revive_speed, 1);
                        SetResourceAmountExplicit(this, RESOURCE_HEALTH, max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
                                        this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, DMG_NOWEP, this.origin, '0 0 0');
                        }
                        else if (STAT(REVIVE_PROGRESS, this) <= 0)
-                               Unfreeze(this);
+                               Unfreeze(this, false);
                }
        }
  
@@@ -2572,7 -2567,7 +2577,7 @@@ void DrownPlayer(entity this
  
  void Player_Physics(entity this)
  {
-       set_movetype(this, this.move_movetype);
+       this.movetype = (this.move_qcphysics) ? MOVETYPE_QCPLAYER : this.move_movetype;
  
        if(!this.move_qcphysics)
                return;
@@@ -2684,7 -2679,7 +2689,7 @@@ void PM_UpdateButtons(entity this, enti
                store.impulse = this.impulse;
        this.impulse = 0;
  
-       bool typing = this.buttonchat;
+       bool typing = this.buttonchat || this.button14;
  
        store.button0 = (typing) ? 0 : this.button0;
        //button1?!
diff --combined qcsrc/server/client.qh
index 8b925680679f23006e8008d9d24de88ba35d1d7f,80965de759808a0fb8b9c0fe190532b4b4d10ef2..605b78ff913b38b13aeb55dfe42cfbdb48b14762
@@@ -145,6 -145,7 +145,7 @@@ CLASS(Client, Object
      ATTRIB(Client, cvar_cl_accuracy_data_receive, bool, this.cvar_cl_accuracy_data_receive);
      ATTRIBARRAY(Client, cvar_cl_weaponpriorities, string, 10);
      ATTRIB(Client, cvar_cl_weaponpriority, string, this.cvar_cl_weaponpriority);
+     ATTRIB(Client, cvar_cl_cts_noautoswitch, bool, this.cvar_cl_cts_noautoswitch);
  
      METHOD(Client, m_unwind, bool(Client this));
  
@@@ -276,8 -277,6 +277,8 @@@ void FixPlayermodel(entity player)
  
  void ClientInit_misc(entity this);
  
 +int GetPlayerLimit();
 +
  bool joinAllowed(entity this);
  void Join(entity this);