From: terencehill Date: Wed, 17 Aug 2016 21:51:47 +0000 (+0200) Subject: Update spectatee_status in the server immediately, it fixes various glitches in the... X-Git-Tag: xonotic-v0.8.2~682^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=45b05dec0ca9d6ad1530659240b1cef34840eceb;p=xonotic%2Fxonotic-data.pk3dir.git Update spectatee_status in the server immediately, it fixes various glitches in the client when going spec: cl_deathscoreboard, cl_eventchase_death and hud_dynamic_shake starting for one server frame because health is updated (-666) while spectatee_status isn't yet --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 0a608e979..c6eee3fb5 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -158,7 +158,8 @@ void ClientData_Touch(entity e) .string netname_previous; -void SetSpectatee(entity player, entity spectatee); +void SetSpectatee(entity this, entity spectatee); +void SetSpectatee_status(entity this, int spectatee_num); /* @@ -300,6 +301,7 @@ void PutObserverInServer(entity this) this.teleportable = TELEPORT_SIMPLE; this.damagedbycontents = false; this.health = FRAGS_SPECTATOR; + SetSpectatee_status(this, etof(this)); this.takedamage = DAMAGE_NO; this.solid = SOLID_NOT; set_movetype(this, MOVETYPE_FLY_WORLDONLY); // user preference is controlled by playerprethink @@ -514,6 +516,7 @@ void PutClientInServer(entity this) } TRANSMUTE(Player, this); + this.wasplayer = true; this.iscreature = true; this.teleportable = TELEPORT_NORMAL; @@ -555,6 +558,7 @@ void PutClientInServer(entity this) this.armorvalue = start_armorvalue; this.weapons = start_weapons; } + SetSpectatee_status(this, 0); this.superweapons_finished = (this.weapons & WEPSET_SUPERWEAPONS) ? time + autocvar_g_balance_superweapons_time : 0; @@ -1725,6 +1729,18 @@ bool SpectateSet(entity this) return true; } +void SetSpectatee_status(entity this, int spectatee_num) +{ + int oldspectatee_status = this.spectatee_status; + this.spectatee_status = spectatee_num; + + if (this.spectatee_status != oldspectatee_status) + { + ClientData_Touch(this); + if (g_race || g_cts) race_InitSpectator(); + } +} + void SetSpectatee(entity this, entity spectatee) { entity old_spectatee = this.enemy; @@ -1752,6 +1768,9 @@ void SetSpectatee(entity this, entity spectatee) } } + if (this.enemy) + SetSpectatee_status(this, etof(this.enemy)); + // needed to update spectator list if(old_spectatee) { ClientData_Touch(old_spectatee); } } @@ -2430,19 +2449,6 @@ void PlayerPreThink (entity this) ); } - int oldspectatee_status = this.spectatee_status; - if (IS_SPEC(this)) { - this.spectatee_status = etof(this.enemy); - } else if (IS_OBSERVER(this)) { - this.spectatee_status = etof(this); - } else { - this.spectatee_status = 0; - } - if (this.spectatee_status != oldspectatee_status) { - ClientData_Touch(this); - if (g_race || g_cts) race_InitSpectator(); - } - if (this.teamkill_soundtime && time > this.teamkill_soundtime) { this.teamkill_soundtime = 0;