]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/duel
authorMario <zacjardine@y7mail.com>
Fri, 21 Sep 2018 01:57:08 +0000 (11:57 +1000)
committerMario <zacjardine@y7mail.com>
Fri, 21 Sep 2018 01:57:08 +0000 (11:57 +1000)
1  2 
qcsrc/common/mapinfo.qc
qcsrc/server/bot/default/bot.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/compat/quake3.qc
qcsrc/server/g_world.qc

diff --combined qcsrc/common/mapinfo.qc
index f5a0f666bdb57e3d8de103fe21b032aaefd53121,859ec51d54809709a8fd9a52f922902fed7ee112..8d8884f21ddd09cb06ec94da5bb3dad95884d42e
@@@ -854,6 -854,9 +854,9 @@@ float MapInfo_Get_ByName_NoFallbacks(st
                        if(fexists(strcat("scripts/", pFilename, ".arena")))
                                fputs(fh, "settemp_for_type all sv_q3acompat_machineshotgunswap 1\n");
  
+                       if(fexists(strcat("scripts/", pFilename, ".defi")))
+                               fputs(fh, "settemp_for_type all sv_vq3compat 1\n");
                        fputs(fh, "// optional: fog density red green blue alpha mindist maxdist\n");
                        fputs(fh, "// optional: settemp_for_type (all|gametypename) cvarname value\n");
                        fputs(fh, "// optional: clientsettemp_for_type (all|gametypename) cvarname value\n");
@@@ -1064,11 -1067,6 +1067,11 @@@ int MapInfo_Get_ByName(string pFilename
  {
        int r = MapInfo_Get_ByName_NoFallbacks(pFilename, pAllowGenerate, pGametypeToSet);
  
 +      // 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 & MAPINFO_TYPE_DUEL.m_flags) && (MapInfo_Map_supportedGametypes & MAPINFO_TYPE_DEATHMATCH.m_flags))
 +              _MapInfo_Map_ApplyGametypeEx ("", pGametypeToSet, MAPINFO_TYPE_DUEL);
 +
        if(cvar("g_tdm_on_dm_maps"))
        {
                // if this is set, all DM maps support TDM too
index 10ececff6362a3964c13d9c4c3ea181e536bc671,2a6164a2826875af507597ba8523bf629bee0403..ec84e55167618aea25811a9242963c40a5e22c52
@@@ -593,10 -593,7 +593,8 @@@ float bot_fixcount(
                });
        }
  
 +      //int player_limit = GetPlayerLimit(); // TODO: use this instead of maxclients!
        int bots;
-       // add/remove bots if needed to make sure there are at least
-       // minplayers+bot_number, or remove all bots if no one is playing
        // But don't remove bots immediately on level change, as the real players
        // usually haven't rejoined yet
        bots_would_leave = false;
                bots = min(ceil(fabs(autocvar_bot_vs_human) * activerealplayers), maxclients - realplayers);
        else if ((realplayers || autocvar_bot_join_empty || (currentbots > 0 && time < 5)))
        {
-               float realminplayers, minplayers;
-               realminplayers = autocvar_minplayers;
-               minplayers = max(0, floor(realminplayers));
+               int minplayers = max(0, floor(autocvar_minplayers));
+               int minbots = max(0, floor(autocvar_bot_number));
  
-               float realminbots, minbots;
-               realminbots = autocvar_bot_number;
-               minbots = max(0, floor(realminbots));
+               // add bots to reach minplayers if needed
+               bots = max(minbots, minplayers - activerealplayers);
+               // cap bots to the max players allowed by the server
+               bots = min(bots, maxclients - realplayers);
  
-               bots = min(max(minbots, minplayers - activerealplayers), maxclients - realplayers);
                if(bots > minbots)
                        bots_would_leave = true;
        }
diff --combined qcsrc/server/client.qc
index 88f423e7a6473939f180e5c014a0085f5ea1af14,da0d84979f5e139531a89f86f410184b51ea7759..e8ca9649fde09b89d84f0175d582c653560d6988
  #include "../common/wepent.qh"
  #include <common/state.qh>
  
+ #include "compat/quake3.qh"
  #include <common/effects/qc/globalsound.qh>
  
  #include "../common/mapobjects/func/conveyor.qh"
  #include "../common/mapobjects/teleporters.qh"
  #include "../common/mapobjects/target/spawnpoint.qh"
+ #include <common/mapobjects/trigger/counter.qh>
  
  #include "../common/vehicles/all.qh"
  
@@@ -705,6 -708,9 +708,9 @@@ void PutPlayerInServer(entity this
  
        this.speedrunning = false;
  
+       this.counter_cnt = 0;
+       this.fragsfilter_cnt = 0;
        target_voicescript_clear(this);
  
        // reset fields the weapons may use
        });
  
        {
-               string s = spot.target;
-               spot.target = string_null;
+               //string s = spot.target;
+               //spot.target = string_null;
                SUB_UseTargets(spot, this, NULL);
-               spot.target = s;
+               //spot.target = s;
        }
  
        Unfreeze(this);
@@@ -1905,14 -1911,6 +1911,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
@@@ -1945,13 -1943,11 +1951,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)
diff --combined qcsrc/server/client.qh
index c6e4b7879d327f4936695ed77f58674ef9fd2c6b,26388e7b37e417cab785c318673ffec45462c6a5..8b925680679f23006e8008d9d24de88ba35d1d7f
@@@ -17,7 -17,7 +17,7 @@@ CLASS(Client, Object
      /** Client IP */
      ATTRIB(Client, netaddress, string, this.netaddress);
      ATTRIB(Client, playermodel, string, this.playermodel);
-     ATTRIB(Client, playerskin, int, this.playerskin);
+     ATTRIB(Client, playerskin, string, this.playerskin);
  
      /** fingerprint of CA key the player used to authenticate */
      ATTRIB(Client, crypto_keyfp, string, this.crypto_keyfp);
@@@ -276,8 -276,6 +276,8 @@@ void FixPlayermodel(entity player)
  
  void ClientInit_misc(entity this);
  
 +int GetPlayerLimit();
 +
  bool joinAllowed(entity this);
  void Join(entity this);
  
index 232795fa6e14e8c24f75bd2f6a0aaaccd9e215ab,4f5c242c09aa5847f3be769a783af174e3796afa..65f231374f56a8053f23a2c2cce49f98df729c15
@@@ -6,6 -6,7 +6,7 @@@
  #include <server/resources.qh>
  #include <common/t_items.qh>
  #include <common/mapobjects/triggers.qh>
+ #include <common/mapobjects/trigger/counter.qh>
  #include <common/weapons/_all.qh>
  
  //***********************
@@@ -183,6 -184,37 +184,37 @@@ spawnfunc(target_give
        InitializeEntity(this, target_give_init, INITPRIO_FINDTARGET);
  }
  
+ void score_use(entity this, entity actor, entity trigger)
+ {
+       if(!IS_PLAYER(actor))
+               return;
+       actor.fragsfilter_cnt += this.count;
+ }
+ spawnfunc(target_score)
+ {
+       if(!g_cts) { delete(this); return; }
+       if(!this.count)
+               this.count = 1;
+       this.use = score_use;
+ }
+ void fragsfilter_use(entity this, entity actor, entity trigger)
+ {
+       if(!IS_PLAYER(actor))
+               return;
+       if(actor.fragsfilter_cnt >= this.frags)
+               SUB_UseTargets(this, actor, trigger);
+ }
+ spawnfunc(target_fragsFilter)
+ {
+       if(!g_cts) { delete(this); return; }
+       if(!this.frags)
+               this.frags = 1;
+       this.use = fragsfilter_use;
+ }
  //spawnfunc(item_flight)       /* handled by buffs mutator */
  //spawnfunc(item_haste)        /* handled by buffs mutator */
  //spawnfunc(item_health)       /* handled in t_quake.qc */
@@@ -233,8 -265,6 +265,8 @@@ bool DoesQ3ARemoveThisEntity(entity thi
                        gametypename = "team";
                if(g_ctf)
                        gametypename = "ctf";
 +              if(g_duel)
 +                      gametypename = "tournament";
                if(maxclients == 1)
                        gametypename = "single";
                // we do not have the other types (oneflag, obelisk, harvester, teamtournament)
diff --combined qcsrc/server/g_world.qc
index 05bff142184be3208664ab82f807bb27f4ccd34b,28aa46cc43ddfa4c9de5f80fc2fb1ddbeca28dc5..522f4f041cc49af4810c0f53fb2070f30c4e75e4
@@@ -265,7 -265,6 +265,7 @@@ void cvar_changes_init(
                BADCVAR("g_dm");
                BADCVAR("g_domination");
                BADCVAR("g_domination_default_teams");
 +              BADCVAR("g_duel");
                BADCVAR("g_freezetag");
                BADCVAR("g_freezetag_teams");
                BADCVAR("g_invasion_teams");
@@@ -1612,7 -1611,9 +1612,9 @@@ float InitiateSuddenDeath(
        // - for this timelimit_overtime needs to be >0 of course
        // - also check the winning condition calculated in the previous frame and only add normal overtime
        //   again, if at the point at which timelimit would be extended again, still no winner was found
-       if (!autocvar_g_campaign && (checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes || autocvar_timelimit_overtimes < 0) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
+       if (!autocvar_g_campaign && checkrules_overtimesadded >= 0
+               && (checkrules_overtimesadded < autocvar_timelimit_overtimes || autocvar_timelimit_overtimes < 0)
+               && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
        {
                return 1; // need to call InitiateOvertime later
        }
@@@ -1635,11 -1636,7 +1637,7 @@@ void InitiateOvertime() // ONLY call th
  {
        ++checkrules_overtimesadded;
        //add one more overtime by simply extending the timelimit
-       float tl;
-       tl = autocvar_timelimit;
-       tl += autocvar_timelimit_overtime;
-       cvar_set("timelimit", ftos(tl));
+       cvar_set("timelimit", ftos(autocvar_timelimit + autocvar_timelimit_overtime));
        Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime * 60);
  }
  
@@@ -1778,7 -1775,7 +1776,7 @@@ float WinningCondition_RanOutOfSpawns(
        {
                Team_SetTeamScore(Team_GetTeamFromIndex(i), 0);
        }
-       
        FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it),
        {
                if (Team_IsValidTeam(it.team))