hedgewars/uWorld.pas
changeset 4374 bcefeeabaa33
parent 4371 ae172b2b03ed
child 4375 ae5507ddb989
equal deleted inserted replaced
4373:fe0e3903bb9e 4374:bcefeeabaa33
    43     uAmmos,
    43     uAmmos,
    44     uVisualGears,
    44     uVisualGears,
    45     uChat,
    45     uChat,
    46     uLandTexture,
    46     uLandTexture,
    47     GLunit,
    47     GLunit,
    48     uVariables
    48     uVariables,
       
    49     uUtils
    49     ;
    50     ;
    50 
    51 
    51 type TCaptionStr = record
    52 type TCaptionStr = record
    52                    Tex: PTexture;
    53                    Tex: PTexture;
    53                    EndTime: LongWord;
    54                    EndTime: LongWord;
   383     FreeWeaponTooltip;
   384     FreeWeaponTooltip;
   384 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   385 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   385 {$IFDEF IPHONEOS}
   386 {$IFDEF IPHONEOS}
   386     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1);
   387     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1);
   387 {$ELSE}
   388 {$ELSE}
   388     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   389     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   389 {$ENDIF}
   390 {$ENDIF}
   390 
   391 
   391 bSelected:= false;
   392 bSelected:= false;
   392 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   393 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   393 end;
   394 end;
   568 
   569 
   569     if (cReducedQuality and rqNoBackground) = 0 then
   570     if (cReducedQuality and rqNoBackground) = 0 then
   570     begin
   571     begin
   571         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   572         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   572         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
   573         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
   573         offsetY:= 10 * min(0, -145 - ScreenBottom);
   574         offsetY:= 10 * Min(0, -145 - ScreenBottom);
   574         SkyOffset:= offsetY div 35 + cWaveHeight;
   575         SkyOffset:= offsetY div 35 + cWaveHeight;
   575         HorizontOffset:= SkyOffset;
   576         HorizontOffset:= SkyOffset;
   576         if ScreenBottom > SkyOffset then
   577         if ScreenBottom > SkyOffset then
   577             HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20);
   578             HorizontOffset:= HorizontOffset + ((ScreenBottom-SkyOffset) div 20);
   578 
   579 
   862 if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then
   863 if not isFirstFrame and (missionTimer <> 0) or isPaused or fastUntilLag or (GameState = gsConfirm) then
   863     begin
   864     begin
   864     if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag);
   865     if (ReadyTimeLeft = 0) and (missionTimer > 0) then dec(missionTimer, Lag);
   865     if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
   866     if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
   866     if missionTex <> nil then
   867     if missionTex <> nil then
   867         DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex);
   868         DrawCentered(0, Min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex);
   868     end;
   869     end;
   869 
   870 
   870 // fps
   871 // fps
   871 {$IFDEF IPHONEOS}
   872 {$IFDEF IPHONEOS}
   872 offsetX:= 8;
   873 offsetX:= 8;
  1153     if missionTex <> nil then FreeTexture(missionTex);
  1154     if missionTex <> nil then FreeTexture(missionTex);
  1154 end;
  1155 end;
  1155 
  1156 
  1156 procedure ShakeCamera(amount: LongWord);
  1157 procedure ShakeCamera(amount: LongWord);
  1157 begin
  1158 begin
  1158     amount:= max(1, amount);
  1159     amount:= Max(1, amount);
  1159     WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2));
  1160     WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2));
  1160     WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
  1161     WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
  1161 end;
  1162 end;
  1162 
  1163 
  1163 procedure initModule;
  1164 procedure initModule;