hedgewars/uVisualGearsHandlers.pas
branchios-develop
changeset 13413 ba39a1d396c0
parent 13235 9f5023a5f9e1
child 14564 78363dbfd5dc
--- a/hedgewars/uVisualGearsHandlers.pas	Sun Jun 10 18:56:51 2018 +0200
+++ b/hedgewars/uVisualGearsHandlers.pas	Sun Jun 10 19:12:26 2018 +0200
@@ -561,7 +561,7 @@
 
 procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword);
 var i: Longword;
-    b: boolean;
+    b, noHogs: boolean;
     t, h: LongInt;
 begin
 {$IFNDEF PAS2C}
@@ -606,12 +606,20 @@
 t:= - 4;
 for i:= 0 to Pred(TeamsCount) do
         with thexchar[i] do
-          if team^.TeamHealth > 0 then
+          begin
+          noHogs:= true;
+          for h:= 0 to cMaxHHIndex do
+              // Check if all hogs are hidden
+              if team^.Hedgehogs[h].Gear <> nil then
+                  noHogs:= false;
+          // Skip team bar if all hogs are dead or hidden
+          if (team^.TeamHealth > 0) and (noHogs = false) then
             begin
             dec(t, team^.Clan^.HealthTex^.h + 2);
             ny:= t;
             dy:= dy - ny
             end;
+          end;
 
 Gear^.Timer:= cSorterWorkTime;
 Gear^.doStep:= @doStepTeamHealthSorterWork;
@@ -632,12 +640,14 @@
         begin
         Gear^.X:= hwFloat2Float(realgear^.X) + (Gear^.Tex^.w div 2  - Gear^.Tag);
         Gear^.Y:= hwFloat2Float(realgear^.Y) - (realgear^.Radius + Gear^.Tex^.h);
+        Gear^.Angle:= 1; // Mark speech bubble as ready for rendering
         end
     end
 else if Gear^.Hedgehog^.Gear <> nil then
     begin
     Gear^.X:= hwFloat2Float(Gear^.Hedgehog^.Gear^.X) + (Gear^.Tex^.w div 2  - Gear^.Tag);
     Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (cHHRadius + Gear^.Tex^.h);
+    Gear^.Angle:= 1; // Mark speech bubble as ready for rendering
     end;
 
 if (Gear^.Timer = 0) or ((realgear = nil) and (Gear^.Frame <> 0))  then