From 8afd739673301e42c768d757859ee977fd18fccc Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 19 Jun 2020 14:01:12 +0200 Subject: [PATCH] Don't call setorigin if the origin hasn't changed --- qcsrc/client/shownames.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 3 ++- qcsrc/server/client.qc | 3 ++- qcsrc/server/g_damage.qc | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index 87633056d..8d219c544 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -213,7 +213,7 @@ void Draw_ShowNames_All() it.sameteam = false; } bool dead = entcs_IsDead(i) || entcs_IsSpectating(i); - if (!it.csqcmodel_isdead || it.alpha > 0) + if ((!it.csqcmodel_isdead || it.alpha > 0) && entcs.origin != it.origin) setorigin(it, entcs.origin); it.csqcmodel_isdead = dead; Draw_ShowNames(it); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index d85b16b0e..4c2b5ff26 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -1166,7 +1166,8 @@ void Monster_Frozen_Think(entity this) { STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + this.ticrate * this.revive_speed, 1); SetResourceExplicit(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * this.max_health)); - this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1); + if (this.iceblock) + this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1); if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite) WaypointSprite_UpdateHealth(this.sprite, GetResource(this, RES_HEALTH)); diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index fe2952711..ea2a62977 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2474,7 +2474,8 @@ void PlayerPreThink (entity this) { STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + frametime * this.revive_speed, 1); SetResourceExplicit(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * start_health)); - this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1); + if (this.iceblock) + this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1); if (STAT(REVIVE_PROGRESS, this) >= 1) Unfreeze(this, false); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index e5363db77..48aa78bcf 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -468,7 +468,9 @@ void Ice_Think(entity this) delete(this); return; } - setorigin(this, this.owner.origin - '0 0 16'); + vector ice_org = this.owner.origin - '0 0 16'; + if (this.origin != ice_org) + setorigin(this, ice_org); this.nextthink = time; } @@ -494,6 +496,7 @@ void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint) entity ice = new(ice); ice.owner = targ; ice.scale = targ.scale; + // set_movetype(ice, MOVETYPE_FOLLOW) would rotate the ice model with the player setthink(ice, Ice_Think); ice.nextthink = time; ice.frame = floor(random() * 21); // ice model has 20 different looking frames -- 2.39.2