]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/frags_remaining_announcer'
authorterencehill <piuntn@gmail.com>
Wed, 25 Mar 2020 17:47:52 +0000 (18:47 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 25 Mar 2020 17:47:52 +0000 (18:47 +0100)
23 files changed:
.gitlab-ci.yml
_hud_descriptions.cfg
gamemodes-server.cfg
hud_luma.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
mutators.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/miscfunctions.qc
qcsrc/client/miscfunctions.qh
qcsrc/common/gamemodes/gamemode/ctf/cl_ctf.qc
qcsrc/common/gamemodes/gamemode/keepaway/cl_keepaway.qc
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc
qcsrc/common/mutators/mutator/itemstime/itemstime.qc
qcsrc/common/stats.qh
qcsrc/server/client.qc
qcsrc/server/defs.qh
qcsrc/server/sv_main.qc

index 15ea0ec5399f86916f9f8545ec80a42087866aea..27ecdcb3435a0a5640af1d65315a6b6e4491f063 100644 (file)
@@ -29,7 +29,7 @@ test_sv_game:
     - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
     - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
     - make
-    - EXPECT=6535600492e1cb63af8e449570bffe4a
+    - EXPECT=bf2cc71d0f8c160bd28a417978aa6a1a
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index 30e5a8bee9a8756fe9fafe883306260e1e4025aa..9bb1b84a620f61cc2672d4d85a52817d384b21a1 100644 (file)
@@ -21,6 +21,7 @@ seta hud_progressbar_shield_color "" "R G B vector of the progress bar backgroun
 seta hud_progressbar_health_color "" "R G B vector of the progress bar background color"
 seta hud_progressbar_armor_color "" "R G B vector of the progress bar background color"
 seta hud_progressbar_fuel_color "" "R G B vector of the progress bar background color"
+seta hud_progressbar_oxygen_color "" "R G B vector of the progress bar background color"
 seta hud_progressbar_nexball_color "" "R G B vector of the progress bar background color"
 seta hud_progressbar_speed_color "" "R G B vector of the progress bar background color"
 seta hud_progressbar_acceleration_color "" "R G B vector of the progress bar background color"
index 501f07f035d6ce675f4f4fe5ca28b72a7de8d280..b1631b2333f56e6ba6ad1d9290fd89f0f77cddb8 100644 (file)
@@ -76,7 +76,7 @@ alias sv_vote_gametype_hook_duel
 // ===========
 // this means that timelimit can be overidden globally and fraglimit can be overidden for each game mode: DM/TDM, Domination, CTF, and Runematch.
 set leadlimit 0
-set leadlimit_and_fraglimit 0 "if set, leadlimit is ANDed with fraglimit (otherwise ORed)"
+set leadlimit_and_fraglimit 0 "both leadlimit AND fraglimit must be reached"
 set timelimit_override -1      "Time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
 set fraglimit_override -1      "Frag limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
 set leadlimit_override -1      "Lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
index 813ecbaef0df64396789d8115bce2c758deaec4d..84e73404d078d1daef56af39b2bbb46661081975 100644 (file)
@@ -22,6 +22,7 @@ seta hud_progressbar_shield_color "0.36 1 0.07"
 seta hud_progressbar_health_color "0.83 0.12 0"
 seta hud_progressbar_armor_color "0.28 0.8 0"
 seta hud_progressbar_fuel_color "0.77 0.67 0"
+seta hud_progressbar_oxygen_color "0.1 1 1"
 seta hud_progressbar_nexball_color "0.2 0.65 0.93"
 seta hud_progressbar_speed_color "0.77 0.67 0"
 seta hud_progressbar_acceleration_color "0.2 0.65 0.93"
index c5cfe4ac548fdc62e070ac1cda9ed08d4a9c3524..2b0d14a2735052c1d61a690b9a72963dc460a947 100644 (file)
@@ -22,6 +22,7 @@ seta hud_progressbar_shield_color "0.6 0 0.6"
 seta hud_progressbar_health_color "0.6 0 0"
 seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
+seta hud_progressbar_oxygen_color "0 1 1"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1"
index b7282584637aba28087bec61f8c071f5ac97df68..be4a87ae29967cb03d7ed11664abb48f161617a4 100644 (file)
@@ -22,6 +22,7 @@ seta hud_progressbar_shield_color "0.6 0 0.6"
 seta hud_progressbar_health_color "0.6 0 0"
 seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
+seta hud_progressbar_oxygen_color "0 1 1"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1"
index 3bfd694b19cf2f0977c36c437ed7ee5c8220d5f9..db0fc51c6e18bbd47eb8d8ccab963150668b1cdd 100644 (file)
@@ -22,6 +22,7 @@ seta hud_progressbar_shield_color "0.6 0 0.6"
 seta hud_progressbar_health_color "0.6 0 0"
 seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
+seta hud_progressbar_oxygen_color "0 1 1"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1"
index c808f62fb5b10ca9f430153f3260821fc0280ff9..4baea48523d4579afcd2cd94f39afb06f14ceefe 100644 (file)
@@ -22,6 +22,7 @@ seta hud_progressbar_shield_color "0.6 0 0.6"
 seta hud_progressbar_health_color "0.6 0 0"
 seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
+seta hud_progressbar_oxygen_color "0 1 1"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1"
index b0b02d080c6e6517407ca8706a8315bca9160f46..726620501f0635cca1e0384257bac0bf274069dd 100644 (file)
@@ -22,6 +22,7 @@ seta hud_progressbar_shield_color "0.6 0 0.6"
 seta hud_progressbar_health_color "0.6 0 0"
 seta hud_progressbar_armor_color "0 0.6 0"
 seta hud_progressbar_fuel_color "0.6 0.6 0"
+seta hud_progressbar_oxygen_color "0 1 1"
 seta hud_progressbar_nexball_color "0.7 0.1 0"
 seta hud_progressbar_speed_color "1 0.75 0"
 seta hud_progressbar_acceleration_color "0.5 0.75 1"
index abf689625a20646571ccd41e8e826ec6ce3d5bcc..f3ed5e07690c3bd5599d767159e290b23b0c16bc 100644 (file)
@@ -290,6 +290,7 @@ set g_campcheck 0 "damages campers every few seconds"
 set g_campcheck_interval 10
 set g_campcheck_damage 100
 set g_campcheck_distance 1800
+set g_campcheck_typecheck 0 "damage campers who are typing"
 
 
 // ==========
index f87b94e8e37fc132f02d81be3d33075c1ac6e9a9..6759c80782484fbd786c0e1e6b070231541ea88b 100644 (file)
@@ -363,6 +363,7 @@ vector autocvar_hud_progressbar_acceleration_neg_color;
 float autocvar_hud_progressbar_alpha;
 vector autocvar_hud_progressbar_armor_color;
 vector autocvar_hud_progressbar_fuel_color;
+vector autocvar_hud_progressbar_oxygen_color = '0.1 1 1';
 vector autocvar_hud_progressbar_health_color;
 vector autocvar_hud_progressbar_nexball_color;
 vector autocvar_hud_progressbar_shield_color;
index a6c22c74eee9bf113f4d71570b90ec57f7a33938..27a33c408b50de484b40dbbd9722b47972756e4e 100644 (file)
@@ -45,6 +45,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                HUD_Write_Cvar("hud_progressbar_health_color");
                HUD_Write_Cvar("hud_progressbar_armor_color");
                HUD_Write_Cvar("hud_progressbar_fuel_color");
+               HUD_Write_Cvar("hud_progressbar_oxygen_color");
                HUD_Write_Cvar("hud_progressbar_nexball_color");
                HUD_Write_Cvar("hud_progressbar_speed_color");
                HUD_Write_Cvar("hud_progressbar_acceleration_color");
index 1e124dd94243fa63af52906cd410d927933d83f8..1a61a96d3d1c90bad00b39a7f0fa79ddf9a181c8 100644 (file)
@@ -9,7 +9,7 @@
 
 void HUD_HealthArmor()
 {
-       int armor, health, fuel;
+       int armor, health, fuel, air_time;
        if(!autocvar__hud_configure)
        {
                if((!autocvar_hud_panel_healtharmor) || (spectatee_status == -1))
@@ -52,12 +52,14 @@ void HUD_HealthArmor()
                        prev_armor = 0;
                }
                fuel = STAT(FUEL);
+               air_time = bound(0, STAT(AIR_FINISHED) - time, 10);
        }
        else
        {
                health = 150;
                armor = 75;
                fuel = 20;
+               air_time = 6;
        }
 
        HUD_Panel_LoadCvars();
@@ -79,6 +81,13 @@ void HUD_HealthArmor()
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
+       float air_alpha = 1;
+       if (STAT(AIR_FINISHED) && time > STAT(AIR_FINISHED))
+       {
+               air_alpha = blink_synced(0.5, 0.5, 7, STAT(AIR_FINISHED), -1);
+               air_time = 10;
+       }
+
        int baralign = autocvar_hud_panel_healtharmor_baralign;
        int iconalign = autocvar_hud_panel_healtharmor_iconalign;
 
@@ -112,6 +121,8 @@ void HUD_HealthArmor()
 
                if(fuel)
                        HUD_Panel_DrawProgressBar(pos, vec2(mySize.x, 0.2 * mySize.y), "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+               if(air_time)
+                       HUD_Panel_DrawProgressBar(pos + eY * 0.8 * mySize.y, vec2(mySize.x, 0.2 * mySize.y), "progressbar", air_time / 10, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_oxygen_color, air_alpha * panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
        }
        else
        {
@@ -135,13 +146,13 @@ void HUD_HealthArmor()
                                armor_offset.y = mySize.y;
                }
 
-               bool health_baralign, armor_baralign, fuel_baralign;
+               bool health_baralign, armor_baralign, fuel_baralign, air_align;
                bool health_iconalign, armor_iconalign;
                if (autocvar_hud_panel_healtharmor_flip)
                {
                        armor_baralign = (autocvar_hud_panel_healtharmor_baralign == 2 || autocvar_hud_panel_healtharmor_baralign == 1);
                        health_baralign = (autocvar_hud_panel_healtharmor_baralign == 3 || autocvar_hud_panel_healtharmor_baralign == 1);
-                       fuel_baralign = health_baralign;
+                       air_align = fuel_baralign = health_baralign;
                        armor_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 2 || autocvar_hud_panel_healtharmor_iconalign == 1);
                        health_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 3 || autocvar_hud_panel_healtharmor_iconalign == 1);
                }
@@ -149,7 +160,7 @@ void HUD_HealthArmor()
                {
                        health_baralign = (autocvar_hud_panel_healtharmor_baralign == 2 || autocvar_hud_panel_healtharmor_baralign == 1);
                        armor_baralign = (autocvar_hud_panel_healtharmor_baralign == 3 || autocvar_hud_panel_healtharmor_baralign == 1);
-                       fuel_baralign = armor_baralign;
+                       air_align = fuel_baralign = armor_baralign;
                        health_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 2 || autocvar_hud_panel_healtharmor_iconalign == 1);
                        armor_iconalign = (autocvar_hud_panel_healtharmor_iconalign == 3 || autocvar_hud_panel_healtharmor_iconalign == 1);
                }
@@ -197,10 +208,7 @@ void HUD_HealthArmor()
 
                                        if (health <= autocvar_hud_panel_healtharmor_progressbar_gfx_lowhealth)
                                        {
-                                               float BLINK_FACTOR = 0.15;
-                                               float BLINK_BASE = 0.85;
-                                               float BLINK_FREQ = 9;
-                                               pain_health_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
+                                               pain_health_alpha = blink(0.85, 0.15, 9);
                                        }
                                }
                                HUD_Panel_DrawProgressBar(pos + health_offset, mySize, autocvar_hud_panel_healtharmor_progressbar_health, p_health/maxhealth, is_vertical, health_baralign, autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * pain_health_alpha, DRAWFLAG_NORMAL);
@@ -256,7 +264,8 @@ void HUD_HealthArmor()
                                DrawNumIcon(pos + armor_offset, mySize, armor, "armor", is_vertical, armor_iconalign, HUD_Get_Num_Color(armor, maxarmor), 1);
                }
 
-               if(fuel)
+               vector cell_size = mySize;
+               if (fuel || air_time)
                {
                        if (is_vertical)
                                mySize.x *= 0.2 / 2; //if vertical always halve x to not cover too much numbers with 3 digits
@@ -266,7 +275,20 @@ void HUD_HealthArmor()
                                mySize.x *= 2; //restore full panel size
                        else if (panel_ar < 1/4)
                                mySize.y *= 2; //restore full panel size
-                       HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, fuel_baralign, autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                       if (fuel)
+                               HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", fuel/100, is_vertical, fuel_baralign, autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                       if (air_time)
+                       {
+                               if (panel_ar > 1 && panel_ar < 4)
+                                       pos.y += cell_size.y;
+                               else if (panel_ar > 1/4 && panel_ar <= 1)
+                                       pos.x += cell_size.x;
+                               if (is_vertical)
+                                       pos.x += cell_size.x - mySize.x;
+                               else
+                                       pos.y += cell_size.y - mySize.y;
+                               HUD_Panel_DrawProgressBar(pos, mySize, "progressbar", air_time / 10, is_vertical, air_align, autocvar_hud_progressbar_oxygen_color, air_alpha * panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                       }
                }
        }
 
index bb0bfe12c7642bc09bc595d4982a80fb9913e581..d801ceabd7d7ccde6edf099e3aacd4b6f67b1a44 100644 (file)
@@ -214,6 +214,28 @@ vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float b
        return boxsize * (0.5 * (1 - sz));
 }
 
+// NOTE base is the central value
+// freq: circle frequency, = 2*pi*frequency in hertz
+// start_pos:
+//  -1 start from the lower value
+//   0 start from the base value
+//   1 start from the higher value
+float blink_synced(float base, float range, float freq, float start_time, int start_pos)
+{
+       // note:
+       //   RMS = sqrt(base^2 + 0.5 * range^2)
+       // thus
+       //   base = sqrt(RMS^2 - 0.5 * range^2)
+       // ensure RMS == 1
+
+       return base + range * sin((time - start_time - (M_PI / 2) * start_pos) * freq);
+}
+
+float blink(float base, float range, float freq)
+{
+       return blink_synced(base, range, freq, 0, 0);
+}
+
 void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag)
 {
        vector line_dim = '0 0 0';
index d259efe66036ed21404fac890ca60b32b9d28787..3397ab7059133106f8f8a2008a44c619ac7dbafe 100644 (file)
@@ -52,6 +52,9 @@ float expandingbox_sizefactor_from_fadelerp(float fadelerp);
 
 vector expandingbox_resize_centered_box_offset(float sz, vector boxsize, float boxxsizefactor);
 
+float blink_synced(float base, float range, float freq, float start_time, int start_blink);
+float blink(float base, float range, float freq);
+
 void drawborderlines(float thickness, vector pos, vector dim, vector color, float theAlpha, float drawflag);
 
 void drawpic_tiled(vector pos, string pic, vector sz, vector area, vector color, float theAlpha, float drawflag);
index c82e0bce9310b978ea4e943fe1b34e88e0183a53..cbbe9afb7efd5545b4967b16c96ce445df078d02 100644 (file)
@@ -69,15 +69,6 @@ void HUD_Mod_CTF(vector pos, vector mySize)
     X(neutral);
     #undef X
 
-    const float BLINK_FACTOR = 0.15;
-    const float BLINK_BASE = 0.85;
-    // note:
-    //   RMS = sqrt(BLINK_BASE^2 + 0.5 * BLINK_FACTOR^2)
-    // thus
-    //   BLINK_BASE = sqrt(RMS^2 - 0.5 * BLINK_FACTOR^2)
-    // ensure RMS == 1
-    const float BLINK_FREQ = 5; // circle frequency, = 2*pi*frequency in hertz
-
     #define X(team, cond) \
     string team##_icon = string_null, team##_icon_prevstatus = string_null; \
     int team##_alpha, team##_alpha_prevstatus; \
@@ -86,7 +77,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
         switch (team##flag) { \
             case 1: team##_icon = "flag_" #team "_taken"; break; \
             case 2: team##_icon = "flag_" #team "_lost"; break; \
-            case 3: team##_icon = "flag_" #team "_carrying"; team##_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break; \
+            case 3: team##_icon = "flag_" #team "_carrying"; team##_alpha = blink(0.85, 0.15, 5); break; \
             default: \
                 if ((stat_items & CTF_SHIELDED) && (cond)) { \
                     team##_icon = "flag_" #team "_shielded"; \
@@ -98,7 +89,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
         switch (team##flag_prevstatus) { \
             case 1: team##_icon_prevstatus = "flag_" #team "_taken"; break; \
             case 2: team##_icon_prevstatus = "flag_" #team "_lost"; break; \
-            case 3: team##_icon_prevstatus = "flag_" #team "_carrying"; team##_alpha_prevstatus = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ); break; \
+            case 3: team##_icon_prevstatus = "flag_" #team "_carrying"; team##_alpha_prevstatus = blink(0.85, 0.15, 5); break; \
             default: \
                 if (team##flag == 3) { \
                     team##_icon_prevstatus = "flag_" #team "_carrying"; /* make it more visible */\
index b2d08742854e6cf04f2f68e6cbc346c5b9e77934..660a5511ec551f9f2e57ef7bc2a2a8a9a3e76f59 100644 (file)
@@ -13,10 +13,7 @@ void HUD_Mod_Keepaway(vector pos, vector mySize)
 {
        mod_active = 1; // keepaway should always show the mod HUD
 
-       float BLINK_FACTOR = 0.15;
-       float BLINK_BASE = 0.85;
-       float BLINK_FREQ = 5;
-       float kaball_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
+       float kaball_alpha = blink(0.85, 0.15, 5);
 
        int stat_items = STAT(ITEMS);
        int kaball = (stat_items/IT_KEY1) & 1;
index 97e63161d54a062a771fd8129a9884ebff34cd52..f53d8c356a5bac8c59f0f2e5682c65fb0d5b00cc 100644 (file)
@@ -4,6 +4,7 @@ string autocvar_g_campcheck;
 float autocvar_g_campcheck_damage;
 float autocvar_g_campcheck_distance;
 float autocvar_g_campcheck_interval;
+bool autocvar_g_campcheck_typecheck;
 
 REGISTER_MUTATOR(campcheck, expr_evaluate(autocvar_g_campcheck));
 
@@ -24,9 +25,7 @@ MUTATOR_HOOKFUNCTION(campcheck, Damage_Calculate)
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
 
-       if(IS_PLAYER(frag_target))
-       if(IS_PLAYER(frag_attacker))
-       if(frag_attacker != frag_target)
+       if(frag_attacker != frag_target && IS_PLAYER(frag_target) && IS_PLAYER(frag_attacker))
        {
                frag_target.campcheck_traveled_distance = autocvar_g_campcheck_distance;
                frag_attacker.campcheck_traveled_distance = autocvar_g_campcheck_distance;
@@ -40,11 +39,9 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
 
        if(autocvar_g_campcheck_interval)
        if(!game_stopped && !warmup_stage && time >= game_starttime)
-       if(IS_PLAYER(player))
-       if(!IS_DEAD(player))
-       if(!STAT(FROZEN, player))
-       if(!PHYS_INPUT_BUTTON_CHAT(player))
-       if(IS_REAL_CLIENT(player)) // bots may camp, but that's no reason to constantly kill them
+       if(IS_PLAYER(player) && !IS_DEAD(player) && !STAT(FROZEN, player))
+       if(autocvar_g_campcheck_typecheck || !PHYS_INPUT_BUTTON_CHAT(player))
+       if(IS_REAL_CLIENT(player)) // only apply to real clients (bots may "camp" due to missing waypoints in the map, but that's no reason to constantly kill them, clones can't move)
        if(!weaponLocked(player))
        {
                // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
index 8d2bb318f0f2443f1200545a675f23b1d31d433c..5add006c3d2c6bc7082ff8f7cc59294652f9dcef 100644 (file)
@@ -194,12 +194,7 @@ void DrawItemsTimeItem(vector myPos, vector mySize, float ar, string item_icon,
     if (autocvar_hud_panel_itemstime_hidespawned == 2)
         picalpha = 1;
     else if (item_available)
-    {
-        float BLINK_FACTOR = 0.15;
-        float BLINK_BASE = 0.85;
-        float BLINK_FREQ = 5;
-        picalpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
-    }
+        picalpha = blink(0.85, 0.15, 5);
     else
         picalpha = 0.5;
     t = floor(item_time - time + 0.999);
index ed37073fbeec0867b2b54e587204ca693ecb7126..612e5b6cde29b84add48892088141f3a636544d3 100644 (file)
@@ -92,6 +92,7 @@ REGISTER_STAT(HIT_TIME, float)
 REGISTER_STAT(DAMAGE_DEALT_TOTAL, int)
 REGISTER_STAT(TYPEHIT_TIME, float)
 REGISTER_STAT(SUPERWEAPONS_FINISHED, float)
+REGISTER_STAT(AIR_FINISHED, float)
 REGISTER_STAT(VEHICLESTAT_HEALTH, int)
 REGISTER_STAT(VEHICLESTAT_SHIELD, int)
 REGISTER_STAT(VEHICLESTAT_ENERGY, int)
index dd906931176d48a4293b2792044ff4258da73496..dcddced84ffc39ba07b961850b1fa28cfca81fcb 100644 (file)
@@ -337,6 +337,7 @@ void PutObserverInServer(entity this)
        this.strength_finished = 0;
        this.invincible_finished = 0;
        this.superweapons_finished = 0;
+       this.air_finished_stat = 0;
        //this.dphitcontentsmask = 0;
        this.dphitcontentsmask = DPCONTENTS_SOLID;
        if (autocvar_g_playerclip_collisions)
@@ -647,7 +648,7 @@ void PutPlayerInServer(entity this)
        STAT(BUFFS, this) = 0;
        STAT(BUFF_TIME, this) = 0;
 
-       this.air_finished = time + 12;
+       this.air_finished = time + autocvar_g_balance_contents_drowndelay;
        this.waterlevel = WATERLEVEL_NONE;
        this.watertype = CONTENT_EMPTY;
 
@@ -1690,6 +1691,7 @@ void SpectateCopy(entity this, entity spectatee)
        this.strength_finished = spectatee.strength_finished;
        this.invincible_finished = spectatee.invincible_finished;
        this.superweapons_finished = spectatee.superweapons_finished;
+       this.air_finished_stat = spectatee.air_finished_stat;
        STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
        STAT(WEAPONS, this) = STAT(WEAPONS, spectatee);
        this.punchangle = spectatee.punchangle;
@@ -2617,6 +2619,7 @@ void DrownPlayer(entity this)
                if(this.air_finished < time)
                        PlayerSound(this, playersound_gasp, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND);
                this.air_finished = time + autocvar_g_balance_contents_drowndelay;
+               this.air_finished_stat = 0;
        }
        else if (this.air_finished < time)
        {       // drown!
@@ -2625,7 +2628,10 @@ void DrownPlayer(entity this)
                        Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_drowning * autocvar_g_balance_contents_damagerate, DEATH_DROWN.m_id, DMG_NOWEP, this.origin, '0 0 0');
                        this.pain_finished = time + 0.5;
                }
+               this.air_finished_stat = this.air_finished;
        }
+       else
+               this.air_finished_stat = this.air_finished;
 }
 
 .bool move_qcphysics;
index 29621f61d83ff80fc73163281d1a9bd0c33da6f8..9036ee22219f46aa4baf8724c5d2faee709a818a 100644 (file)
@@ -51,6 +51,7 @@ float server_is_dedicated;
 .float  crouch;        // Crouching or not?
 
 const .float superweapons_finished = _STAT(SUPERWEAPONS_FINISHED);
+const .float air_finished_stat = _STAT(AIR_FINISHED);
 
 .float cnt; // used in too many places
 .float count;
index ea89794357517cb79b5a83887712579e067dfc6b..367cc99b7a64f3f45f25a2242b8ec0c350ba1219 100644 (file)
@@ -89,7 +89,7 @@ void CreatureFrame_Liquids(entity this)
                        this.flags &= ~FL_INWATER;
                        this.dmgtime = 0;
                }
-               this.air_finished = time + 12;
+               this.air_finished = time + autocvar_g_balance_contents_drowndelay;
        }
 }