hedgewars/uVisualGearsHandlers.pas
branchios-develop
changeset 13413 ba39a1d396c0
parent 13235 9f5023a5f9e1
child 14564 78363dbfd5dc
equal deleted inserted replaced
13411:6e8b807bda4b 13413:ba39a1d396c0
   559     end
   559     end
   560 end;
   560 end;
   561 
   561 
   562 procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword);
   562 procedure doStepTeamHealthSorter(Gear: PVisualGear; Steps: Longword);
   563 var i: Longword;
   563 var i: Longword;
   564     b: boolean;
   564     b, noHogs: boolean;
   565     t, h: LongInt;
   565     t, h: LongInt;
   566 begin
   566 begin
   567 {$IFNDEF PAS2C}
   567 {$IFNDEF PAS2C}
   568 Steps:= Steps; // avoid compiler hint
   568 Steps:= Steps; // avoid compiler hint
   569 {$ENDIF}
   569 {$ENDIF}
   604     until b;
   604     until b;
   605 
   605 
   606 t:= - 4;
   606 t:= - 4;
   607 for i:= 0 to Pred(TeamsCount) do
   607 for i:= 0 to Pred(TeamsCount) do
   608         with thexchar[i] do
   608         with thexchar[i] do
   609           if team^.TeamHealth > 0 then
   609           begin
       
   610           noHogs:= true;
       
   611           for h:= 0 to cMaxHHIndex do
       
   612               // Check if all hogs are hidden
       
   613               if team^.Hedgehogs[h].Gear <> nil then
       
   614                   noHogs:= false;
       
   615           // Skip team bar if all hogs are dead or hidden
       
   616           if (team^.TeamHealth > 0) and (noHogs = false) then
   610             begin
   617             begin
   611             dec(t, team^.Clan^.HealthTex^.h + 2);
   618             dec(t, team^.Clan^.HealthTex^.h + 2);
   612             ny:= t;
   619             ny:= t;
   613             dy:= dy - ny
   620             dy:= dy - ny
   614             end;
   621             end;
       
   622           end;
   615 
   623 
   616 Gear^.Timer:= cSorterWorkTime;
   624 Gear^.Timer:= cSorterWorkTime;
   617 Gear^.doStep:= @doStepTeamHealthSorterWork;
   625 Gear^.doStep:= @doStepTeamHealthSorterWork;
   618 currsorter:= Gear;
   626 currsorter:= Gear;
   619 //doStepTeamHealthSorterWork(Gear, Steps)
   627 //doStepTeamHealthSorterWork(Gear, Steps)
   630     realgear:= GearByUID(Gear^.Frame);
   638     realgear:= GearByUID(Gear^.Frame);
   631     if realgear <> nil then
   639     if realgear <> nil then
   632         begin
   640         begin
   633         Gear^.X:= hwFloat2Float(realgear^.X) + (Gear^.Tex^.w div 2  - Gear^.Tag);
   641         Gear^.X:= hwFloat2Float(realgear^.X) + (Gear^.Tex^.w div 2  - Gear^.Tag);
   634         Gear^.Y:= hwFloat2Float(realgear^.Y) - (realgear^.Radius + Gear^.Tex^.h);
   642         Gear^.Y:= hwFloat2Float(realgear^.Y) - (realgear^.Radius + Gear^.Tex^.h);
       
   643         Gear^.Angle:= 1; // Mark speech bubble as ready for rendering
   635         end
   644         end
   636     end
   645     end
   637 else if Gear^.Hedgehog^.Gear <> nil then
   646 else if Gear^.Hedgehog^.Gear <> nil then
   638     begin
   647     begin
   639     Gear^.X:= hwFloat2Float(Gear^.Hedgehog^.Gear^.X) + (Gear^.Tex^.w div 2  - Gear^.Tag);
   648     Gear^.X:= hwFloat2Float(Gear^.Hedgehog^.Gear^.X) + (Gear^.Tex^.w div 2  - Gear^.Tag);
   640     Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (cHHRadius + Gear^.Tex^.h);
   649     Gear^.Y:= hwFloat2Float(Gear^.Hedgehog^.Gear^.Y) - (cHHRadius + Gear^.Tex^.h);
       
   650     Gear^.Angle:= 1; // Mark speech bubble as ready for rendering
   641     end;
   651     end;
   642 
   652 
   643 if (Gear^.Timer = 0) or ((realgear = nil) and (Gear^.Frame <> 0))  then
   653 if (Gear^.Timer = 0) or ((realgear = nil) and (Gear^.Frame <> 0))  then
   644     begin
   654     begin
   645     if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.SpeechGear = Gear) then
   655     if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.SpeechGear = Gear) then