From c32f6db197c65950717f8339d7523e1bfdd948b7 Mon Sep 17 00:00:00 2001 From: z411 Date: Thu, 25 Nov 2021 15:25:37 -0300 Subject: [PATCH] powerups_dropondeath: Fix reverse health bar --- .../mutators/mutator/powerups/sv_powerups.qc | 1 - .../mutator/waypoints/waypointsprites.qc | 16 ++++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc index 181c56834..63e64c1a3 100644 --- a/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc +++ b/qcsrc/common/mutators/mutator/powerups/sv_powerups.qc @@ -114,7 +114,6 @@ void powerups_DropItem(entity this, StatusEffects effect) wp.wp_extra = item.m_id; wp.wp_reverse = 1; WaypointSprite_UpdateBuildFinished(e.waypointsprite_attached, time + time_to_live); - WaypointSprite_Ping(this.waypointsprite_attached); } MUTATOR_HOOKFUNCTION(powerups, ItemTouched) diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index b6c4f5558..239992a5d 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -655,20 +655,12 @@ void Draw_WaypointSprite(entity this) { if (time < this.build_finished + 0.25) { - float vhealth; - if (time < this.build_started) - vhealth = this.build_starthealth; + SetResourceExplicit(this, RES_HEALTH, this.build_starthealth); else if (time < this.build_finished) - vhealth = (time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth; + SetResourceExplicit(this, RES_HEALTH, (time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth); else - vhealth = 1; - - if (this.build_reverse) - vhealth = 1 - vhealth; - - LOG_INFOF( "Setting health to %f (%f)", vhealth, this.build_starthealth); - SetResourceExplicit(this, RES_HEALTH, vhealth); + SetResourceExplicit(this, RES_HEALTH, 1); } else SetResourceExplicit(this, RES_HEALTH, -1); @@ -736,7 +728,7 @@ void Draw_WaypointSprite(entity this) drawhealthbar( o, 0, - GetResource(this, RES_HEALTH), + (this.build_reverse ? 1 - GetResource(this, RES_HEALTH) : GetResource(this, RES_HEALTH)), '0 0 0', '0 0 0', SPRITE_HEALTHBAR_WIDTH * t, -- 2.39.2