]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/eventchase_spectated_change' into 'master'
authorMario <zacjardine@y7mail.com>
Fri, 21 Sep 2018 02:04:35 +0000 (02:04 +0000)
committerMario <zacjardine@y7mail.com>
Fri, 21 Sep 2018 02:04:35 +0000 (02:04 +0000)
Eeventchase when changing spectated player

See merge request xonotic/xonotic-data.pk3dir!594

qcsrc/client/autocvars.qh
qcsrc/client/defs.qh
qcsrc/client/main.qc
qcsrc/client/shownames.qc
qcsrc/client/view.qc
xonotic-client.cfg

index 9c63f431267b47977c5303182ca9600f22008c95..06544187023cd8100e6f0d65e79dcde946989935 100644 (file)
@@ -411,6 +411,7 @@ float autocvar_cl_hitsound_min_pitch = 0.75;
 float autocvar_cl_hitsound_max_pitch = 1.5;
 float autocvar_cl_hitsound_nom_damage = 25;
 float autocvar_cl_hitsound_antispam_time;
+int autocvar_cl_eventchase_spectated_change = 1;
 int autocvar_cl_eventchase_death = 1;
 float autocvar_cl_eventchase_distance = 140;
 bool autocvar_cl_eventchase_frozen = false;
index 22cbc1a2df32b072905fa8ce9caee5de4f256dc4..5204e8f36dbcd09f54912bab92b453094914e01c 100644 (file)
@@ -77,6 +77,7 @@ float nb_pb_period;
 // 0 - playing
 // >0 - id of spectated player
 float spectatee_status;
+float spectatee_status_changed_time;
 
 // short mapname
 string shortmapname;
index 6844b1e078d7ad30380aae9913c1301832a5bc1d..955cfa7ff3ebc4b5d304ee3d6ff5a56d5ad623d8 100644 (file)
@@ -528,6 +528,7 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
                race_laptime = 0;
                race_checkpointtime = 0;
                hud_dynamic_shake_factor = -1;
+               spectatee_status_changed_time = time;
        }
        if (autocvar_hud_panel_healtharmor_progressbar_gfx)
        {
index 7c1ece5a3dc395c0afea7f4f2bfdfd8ab8519d4f..eac36c1ae8e2b6ceda0ef179deec7978d2207787 100644 (file)
@@ -38,8 +38,18 @@ const float SHOWNAMES_FADESPEED = 4;
 const float SHOWNAMES_FADEDELAY = 0.4;
 void Draw_ShowNames(entity this)
 {
-       if (this.sv_entnum == (current_player + 1))  // self or spectatee
-               if (!(autocvar_hud_shownames_self && autocvar_chase_active)) return;
+       if (this.sv_entnum == current_player + 1) // self or spectatee
+       {
+               if (!autocvar_chase_active)
+                       return;
+
+               if (!autocvar_hud_shownames_self
+                       && !(spectatee_status > 0 && time <= spectatee_status_changed_time + 1))
+               {
+                       return;
+               }
+       }
+
        if (!this.sameteam && !autocvar_hud_shownames_enemies) return;
        bool hit;
        if (!autocvar_hud_shownames_crosshairdistance && this.sameteam)
index ff9b47cbcdaa97fb2c7d735bc96167d09b02298b..9e7ecb67cd6fe1a5a2944a32a98ed1ec423f0a3a 100644 (file)
@@ -827,6 +827,9 @@ bool WantEventchase(entity this)
                        }
                        else return true;
                }
+               if (spectatee_status > 0 && autocvar_cl_eventchase_spectated_change
+                       && time <= spectatee_status_changed_time + 0.5)
+                       return true;
        }
        return false;
 }
index af69bbb2145677c5b05116f215f9ec6c9f44d787..ed81e0fb558ebb17c1645912208ab96e1f161e8b 100644 (file)
@@ -197,6 +197,7 @@ seta cl_hitsound_min_pitch 0.75 "minimum pitch of hit sound"
 seta cl_hitsound_max_pitch 1.5 "maximum pitch of hit sound"
 seta cl_hitsound_nom_damage 25 "damage amount at which hitsound bases pitch off"
 
+seta cl_eventchase_spectated_change 1 "camera goes into 3rd person mode for a moment when changing spectated player"
 seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead; set to 2 to active the effect only when the corpse doesn't move anymore"
 seta cl_eventchase_frozen 0 "camera goes into 3rd person mode when the player is frozen"
 seta cl_eventchase_nexball 1 "camera goes into 3rd person mode when in nexball game-mode"