From: z411 Date: Thu, 25 Nov 2021 18:25:37 +0000 (-0300) Subject: powerups_dropondeath: Fix reverse health bar X-Git-Tag: xonotic-v0.8.5~273^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c32f6db197c65950717f8339d7523e1bfdd948b7;p=xonotic%2Fxonotic-data.pk3dir.git powerups_dropondeath: Fix reverse health bar --- 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,