]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/combined_updates
authorSamual Lenks <samual@xonotic.org>
Sun, 16 Feb 2014 04:56:23 +0000 (23:56 -0500)
committerSamual Lenks <samual@xonotic.org>
Sun, 16 Feb 2014 04:56:23 +0000 (23:56 -0500)
1  2 
defaultXonotic.cfg
gamemodes.cfg
qcsrc/menu/xonotic/dialog_settings_misc_cvars.c
qcsrc/server/autocvars.qh
qcsrc/server/cl_player.qc

diff --combined defaultXonotic.cfg
index b9817ca1bcd9d99bc6c515d5134c08b3f49f3854,747e0c4192e9a77e434719bbeaf6cc4d0268ccdf..996391a06238e40a8b1faedcd76a3bc097611513
@@@ -60,8 -60,7 +60,8 @@@ seta cl_reticle_stretch 0 "whether to s
  seta cl_reticle_item_nex 1 "draw aiming reticle for the nex weapon's zoom, 0 disables and values between 0 and 1 change alpha"
  seta cl_reticle_item_normal 1 "draw reticle when zooming with the zoom button, 0 disables and values between 0 and 1 change alpha"
  fov 100
 -seta cl_velocityzoom 0        "velocity based zooming of fov, negative values zoom out"
 +seta cl_velocityzoom_enabled 0 "velocity based zooming of fov"
 +seta cl_velocityzoom_factor 0 "factor of fov zooming (negative values zoom out)"
  seta cl_velocityzoom_type 3 "how to factor in speed, 1 = all velocity in all directions, 2 = velocity only in forward direction (can be negative), 3 = velocity only in forward direction (limited to forward only)"
  seta cl_velocityzoom_speed 1000 "target speed for fov factoring"
  seta cl_velocityzoom_time 0.2 "time value for averaging speed values"
@@@ -471,7 -470,10 +471,10 @@@ set g_spawn_alloweffects 1 "allow clien
  set g_spawn_furthest 1 "this amount of the spawns shall be far away from any players"
  set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
  // respawn delay
- set g_respawn_delay 2 "number of seconds you have to wait before you can respawn again"
+ set g_respawn_delay_small 2 "small game number of seconds you have to wait before you can respawn again"
+ set g_respawn_delay_small_count 0 "Player count per team for g_respawn_delay_small. <=0 values mean the minimum amount of players to have gameplay (typically 2 in FFA, 1 in teamplay)."
+ set g_respawn_delay_large 2 "large game number of seconds you have to wait before you can respawn again"
+ set g_respawn_delay_large_count 8 "Player count per team for g_respawn_delay_large. <=0 values mean the minimum amount of players to have gameplay (typically 2 in FFA, 1 in teamplay)."
  set g_respawn_delay_max 0 "number of seconds you can wait before you're forced to respawn (only effective with g_forced_respawn 1)"
  set g_respawn_waves 0 "respawn in waves (every n seconds), intended to decrease overwhelming base attacks"
  
@@@ -987,7 -989,7 +990,7 @@@ seta menu_slist_showempty 1 "show serve
  seta menu_slist_modfilter "" // set to either: !modname or modname. modname of = means "same as we are running now".
  
  // other serverlist cvars
 -seta menu_slist_categories 1
 +seta menu_slist_categories 0
  seta menu_slist_categories_onlyifmultiple 1
  seta menu_slist_purethreshold 0
  seta menu_slist_modimpurity 0
@@@ -1255,7 -1257,7 +1258,7 @@@ set bot_sound_monopoly 0 "when enabled
  
  set cl_loddistance1 1024
  set cl_loddistance2 3072
 -seta cl_playerdetailreduction 1       "the higher, the less detailed player models are displayed (LOD)"
 +seta cl_playerdetailreduction 2       "the higher, the less detailed player models are displayed (LOD)"
  seta cl_modeldetailreduction 1        "the higher, the less detailed certain map models are displayed (LOD)"
  
  set g_mapinfo_settemp_acl "+*" "ACL for mapinfo setting cvars"
@@@ -1582,3 -1584,8 +1585,8 @@@ set cl_simpleitems_postfix "_simple" "p
  set cl_fullbright_items 0 "enable fullbright items (if server allows, controled by g_fullbrightitems)"
  set cl_weapon_stay_color "2 0.5 0.5" "Color of picked up weapons when g_weapon_stay > 0"
  set cl_weapon_stay_alpha 0.75 "Alpha of picked up weapons when g_weapon_stay > 0"
+ // Facility for config.cfg use ONLY.
+ // Interpreted in post-config.cfg.
+ seta menu_forced_saved_cvars "" "These cvars will always be saved, despite engine/Xonotic cvar saving status"
+ set menu_reverted_nonsaved_cvars "" "These cvars are currently marked as saved in the flags, but have been reverted and won't stay saved. INTERNAL USE ONLY."
diff --combined gamemodes.cfg
index 3e9edeef1a61125058a16fa6abf162ba5bf45825,bf6ba106d30da188e22f48db1c904a9cb5d89408..16cea0046936cddc600312b8829f27ed43d35b8e
@@@ -18,7 -18,6 +18,7 @@@ alias asay_drop "say_team (%l) dropped 
  // =================
  //  gamestart hooks
  // =================
 +seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to 
  alias _cl_hook_gamestart "set _cl_hook_gametype $1; _cl_hook_gamestart_stage2"
  alias _cl_hook_gamestart_stage2 "cl_hook_gamestart_all; cl_hook_gamestart_${_cl_hook_gametype}"
  alias cl_hook_gamestart_all
@@@ -38,7 -37,7 +38,7 @@@ alias cl_hook_gamestart_ct
  alias cl_hook_gamestart_ka
  alias cl_hook_gamestart_ft
  alias cl_hook_gamestart_inv
 -alias cl_hook_gameend
 +alias cl_hook_gameend "rpn /cl_matchcount dup load 1 + =" // increase match count every time a game ends
  alias cl_hook_activeweapon
  
  alias _sv_hook_gamestart "set _sv_hook_gametype $1; _sv_hook_gamestart_stage2"
@@@ -87,52 -86,111 +87,111 @@@ seta g_invasion_round_limit -1 "Invasio
  // =================================
  //  respawn delay/waves/weapon_stay
  // =================================
- // when variables are set to anything other than 0, they take over the global setting...
- // to force disable delay or waves, set them to 0.125
- set g_ctf_respawn_delay 5
+ // when variables are set to anything other than 0, they take over the global setting. Negative values force an output value of zero.
+ set g_ctf_respawn_delay_small 1
+ set g_ctf_respawn_delay_small_count 1
+ set g_ctf_respawn_delay_large 5
+ set g_ctf_respawn_delay_large_count 5
+ set g_ctf_respawn_delay_max 0
  set g_ctf_respawn_waves 0
  set g_ctf_weapon_stay 0
- set g_dm_respawn_delay 0
+ set g_dm_respawn_delay_small 0
+ set g_dm_respawn_delay_small_count 0
+ set g_dm_respawn_delay_large 0
+ set g_dm_respawn_delay_large_count 0
+ set g_dm_respawn_delay_max 0
  set g_dm_respawn_waves 0
  set g_dm_weapon_stay 0
- set g_dom_respawn_delay 0
+ set g_dom_respawn_delay_small 0
+ set g_dom_respawn_delay_small_count 0
+ set g_dom_respawn_delay_large 0
+ set g_dom_respawn_delay_large_count 0
+ set g_dom_respawn_delay_max 0
  set g_dom_respawn_waves 0
  set g_dom_weapon_stay 0
- set g_lms_respawn_delay 0
+ set g_lms_respawn_delay_small 0
+ set g_lms_respawn_delay_small_count 0
+ set g_lms_respawn_delay_large 0
+ set g_lms_respawn_delay_large_count 0
+ set g_lms_respawn_delay_max 0
  set g_lms_respawn_waves 0
  set g_lms_weapon_stay 0
- set g_tdm_respawn_delay 0
+ set g_tdm_respawn_delay_small 0
+ set g_tdm_respawn_delay_small_count 0
+ set g_tdm_respawn_delay_large 0
+ set g_tdm_respawn_delay_large_count 0
+ set g_tdm_respawn_delay_max 0
  set g_tdm_respawn_waves 0
  set g_tdm_weapon_stay 0
- set g_ka_respawn_delay 0
+ set g_ka_respawn_delay_small 0
+ set g_ka_respawn_delay_small_count 0
+ set g_ka_respawn_delay_large 0
+ set g_ka_respawn_delay_large_count 0
+ set g_ka_respawn_delay_max 0
  set g_ka_respawn_waves 0
  set g_ka_weapon_stay 0
- set g_kh_respawn_delay 0
+ set g_kh_respawn_delay_small 0
+ set g_kh_respawn_delay_small_count 0
+ set g_kh_respawn_delay_large 0
+ set g_kh_respawn_delay_large_count 0
+ set g_kh_respawn_delay_max 0
  set g_kh_respawn_waves 0
  set g_kh_weapon_stay 0
- set g_ca_respawn_delay 0
+ set g_ca_respawn_delay_small 0
+ set g_ca_respawn_delay_small_count 0
+ set g_ca_respawn_delay_large 0
+ set g_ca_respawn_delay_large_count 0
+ set g_ca_respawn_delay_max 0
  set g_ca_respawn_waves 0
  set g_ca_weapon_stay 0
- set g_nb_respawn_delay 0
+ set g_nb_respawn_delay_small 0
+ set g_nb_respawn_delay_small_count 0
+ set g_nb_respawn_delay_large 0
+ set g_nb_respawn_delay_large_count 0
+ set g_nb_respawn_delay_max 0
  set g_nb_respawn_waves 0
  set g_nb_weapon_stay 0
- set g_as_respawn_delay 0
+ set g_as_respawn_delay_small 0
+ set g_as_respawn_delay_small_count 0
+ set g_as_respawn_delay_large 0
+ set g_as_respawn_delay_large_count 0
+ set g_as_respawn_delay_max 0
  set g_as_respawn_waves 0
  set g_as_weapon_stay 0
- set g_ons_respawn_delay 0
+ set g_ons_respawn_delay_small 0
+ set g_ons_respawn_delay_small_count 0
+ set g_ons_respawn_delay_large 0
+ set g_ons_respawn_delay_large_count 0
+ set g_ons_respawn_delay_max 0
  set g_ons_respawn_waves 0
  set g_ons_weapon_stay 0
+ set g_rc_respawn_delay_small 0
+ set g_rc_respawn_delay_small_count 0
+ set g_rc_respawn_delay_large 0
+ set g_rc_respawn_delay_large_count 0
+ set g_rc_respawn_delay_max 0
  set g_rc_respawn_waves 0
- set g_rc_respawn_delay 0
  set g_rc_weapon_stay 0
+ set g_cts_respawn_delay_small -1  // CTS shall have instant respawn.
+ set g_cts_respawn_delay_small_count 0
+ set g_cts_respawn_delay_large -1  // CTS shall have instant respawn.
+ set g_cts_respawn_delay_large_count 0
+ set g_cts_respawn_delay_max 0
  set g_cts_respawn_waves 0
- set g_cts_respawn_delay 0
  set g_cts_weapon_stay 2
+ set g_ft_respawn_delay_small 0
+ set g_ft_respawn_delay_small_count 0
+ set g_ft_respawn_delay_large 0
+ set g_ft_respawn_delay_large_count 0
+ set g_ft_respawn_delay_max 0
  set g_ft_respawn_waves 0
- set g_ft_respawn_delay 0
  set g_ft_weapon_stay 0
+ set g_inv_respawn_delay_small 0
+ set g_inv_respawn_delay_small_count 0
+ set g_inv_respawn_delay_large 0
+ set g_inv_respawn_delay_large_count 0
+ set g_inv_respawn_delay_max 0
  set g_inv_respawn_waves 0
- set g_inv_respawn_delay 0
  set g_inv_weapon_stay 0
  
  
index 99f2dbec614b964e201b4edcb9133675144fc88c,f511ec361cb6fbf4bd44e803fe341a41b2db7d49..c2ea2a5b66167c8dfc366bd8361ba0238a7e9c22
@@@ -28,9 -28,6 +28,9 @@@ void XonoticCvarsDialog_fill(entity me
                cvarlist.colorC =
                SKINCOLOR_CVARLIST_CONTROLS;
  
 +      // todo:
 +      // add button which does cvar_resettodefaults_saveonly
 +
        me.TR(me);
                me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Cvar filter:")));
                me.TD(me, 1, me.columns - 1, e = makeXonoticInputBox(0, string_null));
@@@ -43,8 -40,8 +43,8 @@@
                        e.onChangeEntity = cvarlist;
                        cvarlist.controlledTextbox = e; // this COULD also be the Value box, but this leads to accidentally editing stuff
        me.TR(me);
-               me.TD(me, me.rows - me.currentRow - 7, me.columns, cvarlist);
-       me.gotoRC(me, me.rows - 6, 0);
+               me.TD(me, me.rows - me.currentRow - 9, me.columns, cvarlist);
+       me.gotoRC(me, me.rows - 8, 0);
                me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Setting:")));
                me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
                        cvarlist.cvarNameBox = e;
@@@ -71,6 -68,7 +71,7 @@@
                        e.onClickEntity = cvarlist;
                        e.allowCut = 1;
                        e.marginLeft = e.marginRight = 0.5;
+       me.TR(me);
        me.TR(me);
                me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Description:")));
                me.TD(me, 1, me.columns - 1, e = makeXonoticTextLabel(0, string_null));
index 30dfc9a6f85bad37c4e85409d8554a45f5feb1b7,69d66cc041f1a834d6f40b9769c1df0213ee0dc1..a87e2789e8626ce1b2dc2d65e840978e6b33e987
@@@ -795,7 -795,6 +795,6 @@@ float autocvar_g_domination_point_leadl
  float autocvar_g_domination_point_rate;
  float autocvar_g_domination_teams_override;
  float autocvar_g_forced_respawn;
- float autocvar_g_respawn_delay_max;
  string autocvar_g_forced_team_blue;
  string autocvar_g_forced_team_otherwise;
  string autocvar_g_forced_team_pink;
@@@ -932,6 -931,7 +931,6 @@@ float autocvar_g_pickup_shells_max
  float autocvar_g_player_alpha;
  float autocvar_g_player_brightness;
  float autocvar_g_playerclip_collisions;
 -string autocvar_g_playerstats_uri;
  float autocvar_g_powerups;
  float autocvar_g_projectiles_damage;
  float autocvar_g_projectiles_keep_owner;
@@@ -943,7 -943,11 +942,11 @@@ float autocvar_g_projectiles_spread_sty
  float autocvar_g_race_qualifying_timelimit;
  float autocvar_g_race_qualifying_timelimit_override;
  float autocvar_g_race_teams;
- float autocvar_g_respawn_delay;
+ float autocvar_g_respawn_delay_small;
+ float autocvar_g_respawn_delay_small_count;
+ float autocvar_g_respawn_delay_large;
+ float autocvar_g_respawn_delay_large_count;
+ float autocvar_g_respawn_delay_max;
  float autocvar_g_respawn_ghosts;
  float autocvar_g_respawn_ghosts_maxtime;
  float autocvar_g_respawn_ghosts_speed;
index 0ac4c90ea53874cb2e966e90152c493e044ca29b,67738c4c6c0d28fb4c59a960203330356dd1567a..1490a9ca938965e2503899982c61f2e03d2d1e59
@@@ -322,11 -322,107 +322,107 @@@ void PlayerCorpseDamage (entity inflict
        }
  }
  
+ // g_<gametype>_str:
+ // If 0, default is used.
+ // If <0, 0 is used.
+ // Otherwise, g_str (default value) is used.
+ // For consistency, negative values there are mapped to zero too.
+ #define GAMETYPE_DEFAULTED_SETTING(str) \
+       ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \
+        (gametype_setting_tmp < 0) ? 0 : \
+        (gametype_setting_tmp == 0) ? max(0, autocvar_g_##str) : \
+        gametype_setting_tmp)
+ void calculate_player_respawn_time()
+ {
+       float gametype_setting_tmp;
+       float sdelay_max = GAMETYPE_DEFAULTED_SETTING(respawn_delay_max);
+       float sdelay_small = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small);
+       float sdelay_large = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large);
+       float sdelay_small_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small_count);
+       float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count);
+       float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves);
+       float pcount = 1;  // Include myself whether or not team is already set right and I'm a "player".
+       entity pl;
+       if (teamplay)
+       {
+               FOR_EACH_PLAYER(pl)
+                       if (pl != self)
+                               if (pl.team == self.team)
+                                       ++pcount;
+               if (sdelay_small_count == 0)
+                       sdelay_small_count = 1;
+               if (sdelay_large_count == 0)
+                       sdelay_large_count = 1;
+       }
+       else
+       {
+               FOR_EACH_PLAYER(pl)
+                       if (pl != self)
+                               ++pcount;
+               if (sdelay_small_count == 0)
+               {
+                       if (g_cts)
+                       {
+                               // Players play independently. No point in requiring enemies.
+                               sdelay_small_count = 1;
+                       }
+                       else
+                       {
+                               // Players play AGAINST each other. Enemies required.
+                               sdelay_small_count = 2;
+                       }
+               }
+               if (sdelay_large_count == 0)
+               {
+                       if (g_cts)
+                       {
+                               // Players play independently. No point in requiring enemies.
+                               sdelay_large_count = 1;
+                       }
+                       else
+                       {
+                               // Players play AGAINST each other. Enemies required.
+                               sdelay_large_count = 2;
+                       }
+               }
+       }
+       float sdelay;
+       if (pcount <= sdelay_small_count)
+               sdelay = sdelay_small;
+       else if (pcount >= sdelay_large_count)
+               sdelay = sdelay_large;
+       else  // NOTE: this case implies sdelay_large_count > sdelay_small_count.
+               sdelay = sdelay_small + (sdelay_large - sdelay_small) * (pcount - sdelay_small_count) / (sdelay_large_count - sdelay_small_count);
+       if(waves)
+               self.respawn_time = ceil((time + sdelay) / waves) * waves;
+       else
+               self.respawn_time = time + sdelay;
+       if(sdelay < sdelay_max)
+               self.respawn_time_max = time + sdelay_max;
+       else
+               self.respawn_time_max = self.respawn_time;
+       if((sdelay + waves >= 5.0) && (self.respawn_time - time > 1.75))
+               self.respawn_countdown = 10; // first number to count down from is 10
+       else
+               self.respawn_countdown = -1; // do not count down
+       if(g_cts || autocvar_g_forced_respawn)
+               self.respawn_flags = self.respawn_flags | RESPAWN_FORCE;
+ }
  void ClientKill_Now_TeamChange();
  
  void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
  {
-       float take, save, waves, sdelay, dh, da, j;
+       float take, save, dh, da, j;
        vector v;
        float valid_damage_for_weaponstats;
        float excess;
  
                if(self.alivetime)
                {
 -                      PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
 +                      PS_GR_P_ADDVAL(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
                        self.alivetime = 0;
                }
  
                // dying animation
                self.deadflag = DEAD_DYING;
                // when to allow respawn
-               sdelay = 0;
-               waves = 0;
-               sdelay = cvar(strcat("g_", GetGametype(), "_respawn_delay"));
-               if(!sdelay)
-               {
-                       if(g_cts)
-                               sdelay = 0; // no respawn delay in CTS
-                       else
-                               sdelay = autocvar_g_respawn_delay;
-               }
-               waves = cvar(strcat("g_", GetGametype(), "_respawn_waves"));
-               if(!waves)
-                       waves = autocvar_g_respawn_waves;
-               if(waves)
-                       self.respawn_time = ceil((time + sdelay) / waves) * waves;
-               else
-                       self.respawn_time = time + sdelay;
-               if(autocvar_g_respawn_delay_max > sdelay)
-                       self.respawn_time_max = time + autocvar_g_respawn_delay_max;
-               else
-                       self.respawn_time_max = self.respawn_time;
-               if((sdelay + waves >= 5.0) && (self.respawn_time - time > 1.75))
-                       self.respawn_countdown = 10; // first number to count down from is 10
-               else
-                       self.respawn_countdown = -1; // do not count down
-               if(g_cts || autocvar_g_forced_respawn)
-                       self.respawn_flags = self.respawn_flags | RESPAWN_FORCE;
+               calculate_player_respawn_time();
  
                self.death_time = time;
                if (random() < 0.5)