hedgewars/uWorld.pas
changeset 5682 06d5f561f772
parent 5675 cd10d6cba644
child 5683 8a5efade0b93
equal deleted inserted replaced
5681:5fc750c7f2b4 5682:06d5f561f772
    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: LongWord);
       
    35 procedure InitCameraBorders;
    35 procedure MoveCamera;
    36 procedure MoveCamera;
    36 procedure onFocusStateChanged;
    37 procedure onFocusStateChanged;
    37 
    38 
    38 implementation
    39 implementation
    39 uses
    40 uses
   173 
   174 
   174 cWaveWidth:= SpritesData[sprWater].Width;
   175 cWaveWidth:= SpritesData[sprWater].Width;
   175 //cWaveHeight:= SpritesData[sprWater].Height;
   176 //cWaveHeight:= SpritesData[sprWater].Height;
   176 cWaveHeight:= 32;
   177 cWaveHeight:= 32;
   177 
   178 
   178 cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50);
   179 InitCameraBorders();
   179 uCursor.init();
   180 uCursor.init();
   180 prevPoint.X:= 0;
   181 prevPoint.X:= 0;
   181 prevPoint.Y:= cScreenHeight div 2;
   182 prevPoint.Y:= cScreenHeight div 2;
   182 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   183 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   183 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   184 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   194 AMxShift:= AMWidth;
   195 AMxShift:= AMWidth;
   195 SkyOffset:= 0;
   196 SkyOffset:= 0;
   196 HorizontOffset:= 0;
   197 HorizontOffset:= 0;
   197 end;
   198 end;
   198 
   199 
       
   200 procedure InitCameraBorders;
       
   201 begin
       
   202 cGearScrEdgesDist:= min(2 * cScreenHeight div 5, 2 * cScreenWidth div 5);
       
   203 end;
   199 
   204 
   200 procedure ShowAmmoMenu;
   205 procedure ShowAmmoMenu;
   201 const MENUSPEED = 15;
   206 const MENUSPEED = 15;
   202 const BORDERSIZE = 2;
   207 const BORDERSIZE = 2;
   203 var x, y, i, t, g: LongInt;
   208 var x, y, i, t, g: LongInt;
  1188         prevPoint:= CursorPoint;
  1193         prevPoint:= CursorPoint;
  1189         exit
  1194         exit
  1190     end
  1195     end
  1191     else
  1196     else
  1192     begin
  1197     begin
  1193         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8;
  1198         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * (FollowGear^.dX.QWordValue div _0_01.QWordValue) * 3 + WorldDx) div 8;
  1194         CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8;
  1199         CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * (FollowGear^.dY.QWordValue div _0_01.QWordValue) * 3 + WorldDy)) div 8;
  1195     end;
  1200     end;
  1196 
  1201 
  1197 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
  1202 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
  1198 if WorldDy < wdy then WorldDy:= wdy;
  1203 if WorldDy < wdy then WorldDy:= wdy;
  1199 
  1204