# HG changeset patch # User Wuzzy # Date 1520891608 -3600 # Node ID 061d55939e47682b9b7914187abb829c641fb14f # Parent 4d1cf0d76eb7ce7314c66254f6b7a6b1a22e828a Use visible team count instead of total team count to determine rendered team bar height diff -r 4d1cf0d76eb7 -r 061d55939e47 hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Mon Mar 12 19:39:00 2018 +0100 +++ b/hedgewars/uTeams.pas Mon Mar 12 22:53:28 2018 +0100 @@ -398,6 +398,7 @@ TeamsArray[TeamsCount]:= team; inc(TeamsCount); +inc(VisibleTeamsCount); team^.Binds:= DefaultBinds; diff -r 4d1cf0d76eb7 -r 061d55939e47 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Mon Mar 12 19:39:00 2018 +0100 +++ b/hedgewars/uVariables.pas Mon Mar 12 22:53:28 2018 +0100 @@ -2497,7 +2497,8 @@ PreviousTeam: PTeam; CurrentHedgehog: PHedgehog; TeamsArray: array[0..Pred(cMaxTeams)] of PTeam; - TeamsCount: Longword; + TeamsCount: Longword; // number of teams on game start + VisibleTeamsCount: Longword; // number of teams visible in team bar ClansArray, SpawnClansArray: TClansArray; ClansCount: Longword; LocalClan: LongInt; // last non-bot, non-extdriven clan diff -r 4d1cf0d76eb7 -r 061d55939e47 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Mon Mar 12 19:39:00 2018 +0100 +++ b/hedgewars/uWorld.pas Mon Mar 12 22:53:28 2018 +0100 @@ -1027,20 +1027,21 @@ procedure RenderTeamsHealth; -var t, i, h, smallScreenOffset, TeamHealthBarWidth : LongInt; +var t, i, h, v, smallScreenOffset, TeamHealthBarWidth : LongInt; r: TSDL_Rect; highlight: boolean; hasVisibleHog: boolean; htex: PTexture; begin -if TeamsCount * 20 > Longword(cScreenHeight) div 7 then // take up less screen on small displays +if VisibleTeamsCount * 20 > Longword(cScreenHeight) div 7 then // take up less screen on small displays begin SetScale(1.5); smallScreenOffset:= cScreenHeight div 6; - if TeamsCount * 100 > Longword(cScreenHeight) then + if VisibleTeamsCount * 100 > Longword(cScreenHeight) then Tint($FF,$FF,$FF,$80); end else smallScreenOffset:= 0; +v:= 0; // for updating VisibleTeamsCount for t:= 0 to Pred(TeamsCount) do with TeamsArray[t]^ do begin @@ -1050,6 +1051,8 @@ hasVisibleHog:= true; if (TeamHealth > 0) and hasVisibleHog then begin + // count visible teams + inc(v); highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500); if highlight then @@ -1104,7 +1107,7 @@ // this approach should be faster than drawing all borders one by one tinted or not if highlight then begin - if TeamsCount * 100 > Longword(cScreenHeight) then + if VisibleTeamsCount * 100 > Longword(cScreenHeight) then Tint($FF,$FF,$FF,$80) else untint; @@ -1153,9 +1156,10 @@ if smallScreenOffset <> 0 then begin SetScale(cDefaultZoomLevel); - if TeamsCount * 20 > Longword(cScreenHeight) div 5 then + if VisibleTeamsCount * 20 > Longword(cScreenHeight) div 5 then untint; end; +VisibleTeamsCount:= v; end;