hedgewars/GSHandlers.inc
changeset 4254 47515c926984
parent 4246 e5cb885492df
child 4256 e78cb3eb228e
--- a/hedgewars/GSHandlers.inc	Fri Nov 12 17:17:25 2010 +0100
+++ b/hedgewars/GSHandlers.inc	Fri Nov 12 12:20:50 2010 -0500
@@ -3990,7 +3990,7 @@
 var 
     HHGear: PGear;
     rx, ry, speed: hwFloat;
-    gX, gY: LongInt;
+    i, gX, gY: LongInt;
     Fire: PGear;
 begin
     AllInactive := false;
@@ -4000,25 +4000,25 @@
     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
     
     if (GameTicks and $FF) = 0 then
-    begin
+        begin
         if (HHGear^.Message and gmRight) <> 0 then
-        begin
+            begin
             if HHGear^.dX.isNegative and (Gear^.Tag < 20) then inc(Gear^.Tag)
             else if Gear^.Tag > 5 then dec(Gear^.Tag);
-        end
+            end
         else if (HHGear^.Message and gmLeft) <> 0 then
-        begin
+            begin
             if HHGear^.dX.isNegative and (Gear^.Tag > 5) then dec(Gear^.Tag)
             else if Gear^.Tag < 20 then inc(Gear^.Tag);
-        end
-    end;
+            end
+        end;
     
     dec(Gear^.Timer);
     if Gear^.Timer = 0 then
-    begin
+        begin
         dec(Gear^.Health);
         if (Gear^.Health mod 10) = 0 then
-        begin
+            begin
             rx := rndSign(getRandom * _0_1);
             ry := rndSign(getRandom * _0_1);
             speed := _0_8 * (_10 / Gear^.Tag);
@@ -4032,21 +4032,26 @@
                 Fire := AddGear(gx, gy, gtFlame, 0,
                             SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx,
                     AngleCos(HHGear^.Angle) * ( - speed) + ry, 0);
-        end;
+            end;
         Gear^.Timer:= Gear^.Tag
-    end;
+        end;
 
     if (Gear^.Health = 0) or (HHGear^.Damage <> 0) then
-    begin
+        begin
         DeleteGear(Gear);
         AfterAttack
-    end
+        end
     else
-    begin
-        if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
-        Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 5)) +
-                     '%', cWhiteColor, fntSmall) 
-    end
+        begin
+        i:= round(Gear^.Health / 5);
+        if i <> Gear^.Tag then
+            begin
+            Gear^.Tag:= i;
+            if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
+            Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(i) +
+                         '%', cWhiteColor, fntSmall)
+            end
+        end
 end;
 
 procedure doStepFlamethrower(Gear: PGear);