hedgewars/uWorld.pas
changeset 6011 519f8a58c021
parent 5862 b4229b0abc70
child 6016 85410eef7ba4
equal deleted inserted replaced
6010:10913a80cb50 6011:519f8a58c021
    29 procedure InitWorld;
    29 procedure InitWorld;
    30 procedure DrawWorld(Lag: LongInt);
    30 procedure DrawWorld(Lag: LongInt);
    31 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
    31 procedure DrawWorldStereo(Lag: LongInt; RM: TRenderMode);
    32 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    32 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    33 procedure HideMission;
    33 procedure HideMission;
    34 procedure ShakeCamera(amount: LongWord);
    34 procedure ShakeCamera(amount: LongInt);
    35 procedure InitCameraBorders;
    35 procedure InitCameraBorders;
    36 procedure MoveCamera;
    36 procedure MoveCamera;
    37 procedure onFocusStateChanged;
    37 procedure onFocusStateChanged;
    38 
    38 
    39 implementation
    39 implementation
   912 
   912 
   913 // Captions
   913 // Captions
   914 DrawCaptions;
   914 DrawCaptions;
   915 
   915 
   916 // Teams Healths
   916 // Teams Healths
   917 if TeamsCount * 20 > cScreenHeight div 7 then  // take up less screen on small displays
   917 if TeamsCount * 20 > Longword(cScreenHeight) div 7 then  // take up less screen on small displays
   918     begin
   918     begin
   919     SetScale(1.5);
   919     SetScale(1.5);
   920     smallScreenOffset:= cScreenHeight div 6;
   920     smallScreenOffset:= cScreenHeight div 6;
   921     if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80);
   921     if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80);
   922     end
   922     end
   923 else smallScreenOffset:= 0;
   923 else smallScreenOffset:= 0;
   924 for t:= 0 to Pred(TeamsCount) do
   924 for t:= 0 to Pred(TeamsCount) do
   925    with TeamsArray[t]^ do
   925    with TeamsArray[t]^ do
   926       begin
   926       begin
   955 
   955 
   956       // if highlighted, draw flag and other contents again to keep their colors
   956       // if highlighted, draw flag and other contents again to keep their colors
   957       // this approach should be faster than drawing all borders one by one tinted or not
   957       // this approach should be faster than drawing all borders one by one tinted or not
   958       if highlight then
   958       if highlight then
   959          begin
   959          begin
   960          if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$80)
   960          if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$80)
   961          else Tint($FF, $FF, $FF, $FF);
   961          else Tint($FF, $FF, $FF, $FF);
   962 
   962 
   963          // draw name
   963          // draw name
   964          r.x:= 2;
   964          r.x:= 2;
   965          r.y:= 2;
   965          r.y:= 2;
   977          end;
   977          end;
   978       end;
   978       end;
   979 if smallScreenOffset <> 0 then
   979 if smallScreenOffset <> 0 then
   980     begin
   980     begin
   981     SetScale(cDefaultZoomLevel);
   981     SetScale(cDefaultZoomLevel);
   982     if TeamsCount * 20 > cScreenHeight div 5 then Tint($FF,$FF,$FF,$FF);
   982     if TeamsCount * 20 > Longword(cScreenHeight) div 5 then Tint($FF,$FF,$FF,$FF);
   983     end;
   983     end;
   984 
   984 
   985 // Lag alert
   985 // Lag alert
   986 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   986 if isInLag then DrawSprite(sprLag, 32 - (cScreenWidth shr 1), 32, (RealTicks shr 7) mod 12);
   987 
   987 
  1310 begin
  1310 begin
  1311     missionTimer:= 0;
  1311     missionTimer:= 0;
  1312     if missionTex <> nil then FreeTexture(missionTex);
  1312     if missionTex <> nil then FreeTexture(missionTex);
  1313 end;
  1313 end;
  1314 
  1314 
  1315 procedure ShakeCamera(amount: LongWord);
  1315 procedure ShakeCamera(amount: LongInt);
  1316 begin
  1316 begin
  1317     if isCursorVisible then exit;
  1317     if isCursorVisible then exit;
  1318     amount:= Max(1, round(amount*zoom/2));
  1318     amount:= Max(1, round(amount*zoom/2));
  1319     WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2));
  1319     WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2));
  1320     WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2));
  1320     WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2));