hedgewars/uWorld.pas
changeset 14282 6015b74eea55
parent 14281 e754b516cc35
child 14299 5cff42e1dd92
equal deleted inserted replaced
14281:e754b516cc35 14282:6015b74eea55
   889     begin
   889     begin
   890 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type.  Prob also, say, trigger a border animation timer on an impact. *)
   890 (* I think for a bounded world, will fill the left and right areas with black or something. Also will probably want various border effects/animations based on border type.  Prob also, say, trigger a border animation timer on an impact. *)
   891 
   891 
   892     rect.y:= ViewTopY;
   892     rect.y:= ViewTopY;
   893     rect.h:= ViewHeight;
   893     rect.h:= ViewHeight;
   894     tmp:= LongInt(leftX) + WorldDx;
   894     tmp:= leftX + WorldDx;
   895     w:= tmp - ViewLeftX;
   895     w:= tmp - ViewLeftX;
   896 
   896 
   897     if w > 0 then
   897     if w > 0 then
   898         begin
   898         begin
   899         rect.w:= w;
   899         rect.w:= w;
   901         DrawRect(rect, $10, $10, $10, $80, true);
   901         DrawRect(rect, $10, $10, $10, $80, true);
   902         if WorldEdge = weBounce then
   902         if WorldEdge = weBounce then
   903             DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF);
   903             DrawLineOnScreen(tmp - 1, ViewTopY, tmp - 1, ViewBottomY, 2, $54, $54, $FF, $FF);
   904         end;
   904         end;
   905 
   905 
   906     tmp:= LongInt(rightX) + WorldDx;
   906     tmp:= rightX + WorldDx;
   907     w:= ViewRightX - tmp;
   907     w:= ViewRightX - tmp;
   908 
   908 
   909     if w > 0 then
   909     if w > 0 then
   910         begin
   910         begin
   911         rect.w:= w;
   911         rect.w:= w;
  1208     replicateToLeft := false;
  1208     replicateToLeft := false;
  1209     replicateToRight:= false;
  1209     replicateToRight:= false;
  1210     end
  1210     end
  1211 else
  1211 else
  1212     begin
  1212     begin
  1213     replicateToLeft := (LongInt(leftX)  + WorldDx > ViewLeftX);
  1213     replicateToLeft := (leftX  + WorldDx > ViewLeftX);
  1214     replicateToRight:= (LongInt(rightX) + WorldDx < ViewRightX);
  1214     replicateToRight:= (rightX + WorldDx < ViewRightX);
  1215     end;
  1215     end;
  1216 
  1216 
  1217 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1217 ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
  1218 
  1218 
  1219 // note: offsetY is negative!
  1219 // note: offsetY is negative!
  1829         begin
  1829         begin
  1830             dstX:= hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx;
  1830             dstX:= hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx;
  1831 
  1831 
  1832             if (WorldEdge = weWrap) then
  1832             if (WorldEdge = weWrap) then
  1833                 begin
  1833                 begin
  1834                     if dstX - prevPoint.X < (LongInt(leftX) - LongInt(rightX)) div 2 then
  1834                     if dstX - prevPoint.X < (leftX - rightX) div 2 then
  1835                         CursorPoint.X:= (prevPoint.X * 7 + dstX - (leftX - rightX)) div 8
  1835                         CursorPoint.X:= (prevPoint.X * 7 + dstX - (leftX - rightX)) div 8
  1836                     else if dstX - prevPoint.X > (LongInt(rightX) - LongInt(leftX)) div 2 then
  1836                     else if dstX - prevPoint.X > (rightX - leftX) div 2 then
  1837                         CursorPoint.X:= (prevPoint.X * 7 + dstX - (rightX - leftX)) div 8
  1837                         CursorPoint.X:= (prevPoint.X * 7 + dstX - (rightX - leftX)) div 8
  1838                     else
  1838                     else
  1839                         CursorPoint.X:= (prevPoint.X * 7 + dstX) div 8;
  1839                         CursorPoint.X:= (prevPoint.X * 7 + dstX) div 8;
  1840                 end
  1840                 end
  1841             else // usual camera movement routine
  1841             else // usual camera movement routine
  1849             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1849             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1850         end;
  1850         end;
  1851 
  1851 
  1852 if (WorldEdge = weWrap) then
  1852 if (WorldEdge = weWrap) then
  1853     begin
  1853     begin
  1854         if -WorldDx < LongInt(leftX) then
  1854         if -WorldDx < leftX then
  1855             WorldDx:= WorldDx - LongInt(rightX) + leftX
  1855             WorldDx:= WorldDx - rightX + leftX
  1856         else if -WorldDx > LongInt(rightX) then
  1856         else if -WorldDx > rightX then
  1857             WorldDx:= WorldDx + LongInt(rightX) - leftX;
  1857             WorldDx:= WorldDx + rightX - leftX;
  1858     end;
  1858     end;
  1859 
  1859 
  1860 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - (cVisibleWater + trunc(CinematicBarH / (cScaleFactor / 2.0)));
  1860 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - (cVisibleWater + trunc(CinematicBarH / (cScaleFactor / 2.0)));
  1861 if WorldDy < wdy then
  1861 if WorldDy < wdy then
  1862     WorldDy:= wdy;
  1862     WorldDy:= wdy;