topY too
authornemo
Fri, 23 Nov 2018 21:38:34 -0500
changeset 14286 7a7c090f96f6
parent 14285 a7810074c20d
child 14287 9f0d81213d65
topY too
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsRender.pas
hedgewars/uLand.pas
hedgewars/uLandGenTemplateBased.pas
hedgewars/uLandGraphics.pas
--- a/hedgewars/uGearsHandlersMess.pas	Fri Nov 23 16:38:47 2018 -0500
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Nov 23 21:38:34 2018 -0500
@@ -6615,7 +6615,7 @@
 if (Gear^.State and gstTmpFlag <> 0) or (GameTicks and $7 = 0) then
     begin
     doStepFallingGear(Gear);
-    if (Gear^.Tag = 1) and (GameTicks and $FF = 0) and (hwRound(Gear^.X) < leftX) or (hwRound(Gear^.X) > rightX) or (hwRound(Gear^.Y) < LongInt(topY)) then
+    if (Gear^.Tag = 1) and (GameTicks and $FF = 0) and (hwRound(Gear^.X) < leftX) or (hwRound(Gear^.X) > rightX) or (hwRound(Gear^.Y) < topY) then
         begin
         Gear^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
         Gear^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
--- a/hedgewars/uGearsRender.pas	Fri Nov 23 16:38:47 2018 -0500
+++ b/hedgewars/uGearsRender.pas	Fri Nov 23 21:38:34 2018 -0500
@@ -820,7 +820,7 @@
                                 DrawSpriteClipped(sprGirder,
                                                 rightX+(ox-leftX)-256,
                                                 oy-256,
-                                                LongInt(topY)+WorldDy,
+                                                topY+WorldDy,
                                                 rightX+WorldDx,
                                                 cWaterLine+WorldDy,
                                                 leftX+WorldDx);
@@ -828,7 +828,7 @@
                                 DrawSpriteClipped(sprGirder,
                                                 leftX-(rightX-ox)-256,
                                                 oy-256,
-                                                LongInt(topY)+WorldDy,
+                                                topY+WorldDy,
                                                 rightX+WorldDx,
                                                 cWaterLine+WorldDy,
                                                 leftX+WorldDx)
@@ -836,7 +836,7 @@
                         DrawSpriteClipped(sprGirder,
                                         ox-256,
                                         oy-256,
-                                        LongInt(topY)+WorldDy,
+                                        topY+WorldDy,
                                         rightX+WorldDx,
                                         cWaterLine+WorldDy,
                                         leftX+WorldDx)
--- a/hedgewars/uLand.pas	Fri Nov 23 16:38:47 2018 -0500
+++ b/hedgewars/uLand.pas	Fri Nov 23 21:38:34 2018 -0500
@@ -379,7 +379,7 @@
     if gameFlags and gfShoppaBorder <> 0 then DrawShoppaBorder;
 
     for x:= LongWord(leftX+2) to LongWord(rightX-2) do
-        for y:= topY+2 to LAND_HEIGHT-3 do
+        for y:= LongWord(topY+2) to LAND_HEIGHT-3 do
             if (Land[y, x] = 0) and
                (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or
                ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then
@@ -754,7 +754,7 @@
 if (GameFlags and gfBorder) <> 0 then
     hasBorder:= true
 else
-    for y:= topY to topY + 5 do
+    for y:= LongWord(topY) to LongWord(topY + 5) do
         for x:= LongWord(leftX) to LongWord(rightX) do
             if Land[y, x] <> 0 then
                 begin
@@ -772,12 +772,12 @@
         begin
         for y:= 0 to LAND_HEIGHT - 1 do
             for x:= 0 to LAND_WIDTH - 1 do
-                if (y < topY) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then
+                if (y < LongWord(topY)) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then
                     Land[y, x]:= lfIndestructible;
         end
     else if topY > 0 then
         begin
-        for y:= 0 to LongInt(topY) - 1 do
+        for y:= 0 to LongWord(topY - 1) do
             for x:= 0 to LAND_WIDTH - 1 do
                 Land[y, x]:= lfIndestructible;
         end;
@@ -786,7 +786,7 @@
     for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade
         begin
         if (WorldEdge <> weBounce) and (WorldEdge <> weWrap) then
-            for y:= topY to LAND_HEIGHT - 1 do
+            for y:= LongWord(topY) to LAND_HEIGHT - 1 do
                     begin
                     Land[y, leftX + w]:= lfIndestructible;
                     Land[y, rightX - w]:= lfIndestructible;
@@ -847,7 +847,7 @@
     begin
     if (cReducedQuality and rqBlurryLand) = 0 then
         for x:= LongWord(leftX) to LongWord(rightX) do
-            for y:= topY to LAND_HEIGHT-1 do
+            for y:= LongWord(topY) to LAND_HEIGHT-1 do
                 begin
                 w:= LandPixels[y,x];
                 w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED +
@@ -860,7 +860,7 @@
                 end
     else
         for x:= LongWord(leftX div 2) to LongWord(rightX div 2) do
-            for y:= topY div 2 to LAND_HEIGHT-1 div 2 do
+            for y:= LongWord(topY div 2) to LAND_HEIGHT-1 div 2 do
                 begin
                 w:= LandPixels[y div 2,x div 2];
                 w:= ((w shr RShift and $FF) +  (w shr BShift and $FF) + (w shr GShift and $FF)) div 3;
--- a/hedgewars/uLandGenTemplateBased.pas	Fri Nov 23 16:38:47 2018 -0500
+++ b/hedgewars/uLandGenTemplateBased.pas	Fri Nov 23 21:38:34 2018 -0500
@@ -116,7 +116,7 @@
             or (dab < minDistance * 3)
             or (mp.x < leftX + mapBorderMargin)
             or (mp.x > rightX - mapBorderMargin)
-            or (mp.y < LongInt(topY) + mapBorderMargin)
+            or (mp.y < topY + mapBorderMargin)
             or (mp.y > LongInt(LAND_HEIGHT) - mapBorderMargin)
     then
     begin
@@ -146,7 +146,7 @@
     if b <> 0 then
     begin
         // top border
-        ix:= (LongInt(topY) + mapBorderMargin - mp.y) * a div b + mp.x;
+        ix:= (topY + mapBorderMargin - mp.y) * a div b + mp.x;
         d:= DistanceI(mp.y - topY - mapBorderMargin, mp.x - ix).Round;
         t2:= b * (mp.y - mapBorderMargin) + a * (mp.x - ix);
         if t2 > 0 then distL:= min(d, distL) else distR:= min(d, distR);
--- a/hedgewars/uLandGraphics.pas	Fri Nov 23 16:38:47 2018 -0500
+++ b/hedgewars/uLandGraphics.pas	Fri Nov 23 21:38:34 2018 -0500
@@ -753,7 +753,7 @@
                    ((not force) and (Land[cpY + y, cpX + x] <> 0))) or
 
                    (not outOfMap and
-                       (((cpY + y) <= Longint(topY)) or ((cpY + y) >= LAND_HEIGHT) or
+                       (((cpY + y) <= topY) or ((cpY + y) >= LAND_HEIGHT) or
                        ((cpX + x) <= leftX) or ((cpX + x) >= rightX) or
                        ((not force) and (Land[cpY + y, cpX + x] <> 0)))) then
                    begin
@@ -873,7 +873,7 @@
         begin
         for x:= 0 to Pred(w) do
             if ((PLongword(@(p^[x * 4]))^) and AMask) <> 0 then
-                if ((cpY + y) <= Longint(topY)) or ((cpY + y) >= LAND_HEIGHT) or
+                if ((cpY + y) <= topY) or ((cpY + y) >= LAND_HEIGHT) or
                    ((cpX + x) <= leftX) or ((cpX + x) >= rightX) then
                    begin
                    if SDL_MustLock(Image) then
@@ -976,7 +976,7 @@
     begin
     for x:= 0 to Pred(w) do
         if ((p^[x] and AMask) <> 0)
-            and (((cpY + y) < Longint(topY)) or ((cpY + y) >= LAND_HEIGHT) or
+            and (((cpY + y) < topY) or ((cpY + y) >= LAND_HEIGHT) or
             ((cpX + x) < leftX) or ((cpX + x) > rightX) or (Land[cpY + y, cpX + x] <> 0)) then
                 pt^[x]:= cWhiteColor
         else
@@ -1074,7 +1074,7 @@
     exit;
 
 // check location
-if (Y <= LongInt(topY) + 1) or (Y >= LAND_HEIGHT-2)
+if (Y <= topY + 1) or (Y >= LAND_HEIGHT-2)
 or (X <= leftX + 1) or (X >= rightX - 1) then
     exit;
 
@@ -1126,7 +1126,7 @@
 procedure Smooth_oldImpl(X, Y: LongInt);
 begin
 // a bit of AA for explosions
-if (Land[Y, X] = 0) and (Y > LongInt(topY) + 1) and
+if (Land[Y, X] = 0) and (Y > topY + 1) and
     (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then
     begin
     if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0))
@@ -1185,7 +1185,7 @@
     end
 else if ((cReducedQuality and rqBlurryLand) = 0) and ((LandPixels[Y, X] and AMask) = AMask)
 and (Land[Y, X] and (lfDamaged or lfBasic) = lfBasic)
-and (Y > LongInt(topY) + 1) and (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then
+and (Y > topY + 1) and (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then
     begin
     if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0))
     or (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then