hedgewars/uWorld.pas
changeset 5380 6ba1e40a360c
parent 5372 7283bc768228
child 5399 cdef954f8aec
child 5485 e943a005d0e8
equal deleted inserted replaced
5378:f633d57b971e 5380:6ba1e40a360c
   747 var i, t: LongInt;
   747 var i, t: LongInt;
   748     r: TSDL_Rect;
   748     r: TSDL_Rect;
   749     tdx, tdy: Double;
   749     tdx, tdy: Double;
   750     s: string[15];
   750     s: string[15];
   751     highlight: Boolean;
   751     highlight: Boolean;
   752     offsetX, offsetY, screenBottom: LongInt;
   752     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
   753     VertexBuffer: array [0..3] of TVertex2f;
   753     VertexBuffer: array [0..3] of TVertex2f;
   754 begin
   754 begin
   755     if (cReducedQuality and rqNoBackground) = 0 then
   755     if (cReducedQuality and rqNoBackground) = 0 then
   756     begin
   756     begin
   757         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   757         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   905 
   905 
   906 // Captions
   906 // Captions
   907 DrawCaptions;
   907 DrawCaptions;
   908 
   908 
   909 // Teams Healths
   909 // Teams Healths
       
   910 if TeamsCount * 20 > cScreenHeight div 7 then  // take up less screen on small displays
       
   911     begin
       
   912     SetScale(1.5);
       
   913     smallScreenOffset:= cScreenHeight div 6;
       
   914     if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80);
       
   915     end
       
   916 else smallScreenOffset:= 0;
   910 for t:= 0 to Pred(TeamsCount) do
   917 for t:= 0 to Pred(TeamsCount) do
   911    with TeamsArray[t]^ do
   918    with TeamsArray[t]^ do
   912       begin
   919       begin
   913       highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500);
   920       highlight:= bShowFinger and (CurrentTeam = TeamsArray[t]) and ((RealTicks mod 1000) < 500);
   914 
   921 
   915       if highlight then
   922       if highlight then
   916          Tint(Clan^.Color shl 8 or $FF);
   923          Tint(Clan^.Color shl 8 or $FF);
   917 
   924 
   918       // draw name
   925       // draw name
   919       DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY, NameTagTex);
   926       DrawTexture(-NameTagTex^.w - 16, cScreenHeight + DrawHealthY + smallScreenOffset, NameTagTex);
   920 
   927 
   921       // draw flag
   928       // draw flag
   922       DrawTexture(-14, cScreenHeight + DrawHealthY, FlagTex);
   929       DrawTexture(-14, cScreenHeight + DrawHealthY + smallScreenOffset, FlagTex);
   923 
   930 
   924       // draw health bar
   931       // draw health bar
   925       r.x:= 0;
   932       r.x:= 0;
   926       r.y:= 0;
   933       r.y:= 0;
   927       r.w:= 2 + TeamHealthBarWidth;
   934       r.w:= 2 + TeamHealthBarWidth;
   928       r.h:= HealthTex^.h;
   935       r.h:= HealthTex^.h;
   929       DrawFromRect(14, cScreenHeight + DrawHealthY, @r, HealthTex);
   936       DrawFromRect(14, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
   930 
   937 
   931       // draw health bars right border
   938       // draw health bars right border
   932       inc(r.x, cTeamHealthWidth + 2);
   939       inc(r.x, cTeamHealthWidth + 2);
   933       r.w:= 3;
   940       r.w:= 3;
   934       DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY, @r, HealthTex);
   941       DrawFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
   935 
   942 
   936       // draw ai kill counter for gfAISurvival
   943       // draw ai kill counter for gfAISurvival
   937       if (GameFlags and gfAISurvival) <> 0 then begin
   944       if (GameFlags and gfAISurvival) <> 0 then begin
   938           DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY,
   945           DrawTexture(TeamHealthBarWidth + 22, cScreenHeight + DrawHealthY + smallScreenOffset,
   939               AIKillsTex);
   946               AIKillsTex);
   940       end;
   947       end;
   941 
   948 
   942       // if highlighted, draw flag and other contents again to keep their colors
   949       // if highlighted, draw flag and other contents again to keep their colors
   943       // this approach should be faster than drawing all borders one by one tinted or not
   950       // this approach should be faster than drawing all borders one by one tinted or not
   944       if highlight then
   951       if highlight then
   945          begin
   952          begin
   946          Tint($FF, $FF, $FF, $FF);
   953          if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80)
       
   954          else Tint($FF, $FF, $FF, $FF);
   947 
   955 
   948          // draw name
   956          // draw name
   949          r.x:= 2;
   957          r.x:= 2;
   950          r.y:= 2;
   958          r.y:= 2;
   951          r.w:= NameTagTex^.w - 4;
   959          r.w:= NameTagTex^.w - 4;
   952          r.h:= NameTagTex^.h - 4;
   960          r.h:= NameTagTex^.h - 4;
   953          DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + 2, @r, NameTagTex);
   961          DrawFromRect(-NameTagTex^.w - 14, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, NameTagTex);
   954          // draw flag
   962          // draw flag
   955          r.w:= 22;
   963          r.w:= 22;
   956          r.h:= 15;
   964          r.h:= 15;
   957          DrawFromRect(-12, cScreenHeight + DrawHealthY + 2, @r, FlagTex);
   965          DrawFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex);
   958          // draw health bar
   966          // draw health bar
   959          r.w:= TeamHealthBarWidth + 1;
   967          r.w:= TeamHealthBarWidth + 1;
   960          r.h:= HealthTex^.h - 4;
   968          r.h:= HealthTex^.h - 4;
   961          DrawFromRect(16, cScreenHeight + DrawHealthY + 2, @r, HealthTex);
   969          DrawFromRect(16, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex);
   962          end;
   970          end;
   963       end;
   971       end;
       
   972 if smallScreenOffset <> 0 then
       
   973     begin
       
   974     SetScale(zoom);
       
   975     if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$FF);
       
   976     end;
   964 
   977 
   965 // Lag alert
   978 // Lag alert
   966 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   979 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   967 
   980 
   968 // Wind bar
   981 // Wind bar