]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
powerups_dropondeath: Fix reverse health bar
authorz411 <z411@omaera.org>
Thu, 25 Nov 2021 18:25:37 +0000 (15:25 -0300)
committerz411 <z411@omaera.org>
Thu, 25 Nov 2021 18:25:37 +0000 (15:25 -0300)
qcsrc/common/mutators/mutator/powerups/sv_powerups.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc

index 181c56834200782a3c101acda066846fab20ad36..63e64c1a37b2a591a0dd9f722168721e9ab96454 100644 (file)
@@ -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)
index b6c4f5558990181d1aef0c11b6446009a5318767..239992a5d27f1b6a9f7aea45c0b2e9390c32000a 100644 (file)
@@ -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,