some more fixing
authorsheepluva
Sat, 29 Nov 2014 03:13:06 +0100
changeset 10562 3388822b3914
parent 10560 9f09196d92a6
child 10564 0cb20aa8877a
some more fixing
hedgewars/uFloat.pas
hedgewars/uGearsRender.pas
hedgewars/uIO.pas
hedgewars/uLandGenTemplateBased.pas
hedgewars/uUtils.pas
hedgewars/uWorld.pas
--- a/hedgewars/uFloat.pas	Sat Nov 29 01:19:29 2014 +0100
+++ b/hedgewars/uFloat.pas	Sat Nov 29 03:13:06 2014 +0100
@@ -370,8 +370,8 @@
 
 function hwSqrt1(const t: hwFloat): hwFloat;
 const pwr = 8; // even value, feel free to adjust
-      rThreshold = 1 shl (pwr + 32);
-      lThreshold = 1 shl (pwr div 2 + 32);
+      rThreshold: QWord = 1 shl (pwr + 32);
+      lThreshold: QWord = 1 shl (pwr div 2 + 32);
 var l, r: QWord;
     c: hwFloat;
 begin
--- a/hedgewars/uGearsRender.pas	Sat Nov 29 01:19:29 2014 +0100
+++ b/hedgewars/uGearsRender.pas	Sat Nov 29 03:13:06 2014 +0100
@@ -166,8 +166,7 @@
 end;
 
 procedure DrawRope(Gear: PGear);
-var roplen: LongInt;
-    i: Longword;
+var roplen, i: LongInt;
 begin
     if (cReducedQuality and rqSimpleRope) <> 0 then
         DrawRopeLinesRQ(Gear)
@@ -711,7 +710,7 @@
                                             LongInt(rightX)+WorldDx,
                                             cWaterLine+WorldDy,
                                             LongInt(leftX)+WorldDx);
-                        if hwRound(Gear^.X) > rightX-256 then
+                        if hwRound(Gear^.X) > LongInt(rightX) - 256 then
                             DrawSpriteClipped(sprGirder,
                                             leftX-(rightX-ox)-256,
                                             oy-256,
@@ -1167,7 +1166,7 @@
                         end;
                     if Gear^.Timer < 1833 then
                         begin
-                        DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
+                        DrawTextureRotatedF(SpritesData[sprPortal].texture, MinD(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
                                             x, LongInt(Gear^.Angle) + WorldDy - 16, 4 + Gear^.Tag, 1, 32, 32, 270);
                         end
                     end;
--- a/hedgewars/uIO.pas	Sat Nov 29 01:19:29 2014 +0100
+++ b/hedgewars/uIO.pas	Sat Nov 29 03:13:06 2014 +0100
@@ -426,7 +426,7 @@
     end;
 
 if (headcmd <> nil) and tmpflag and (not CurrentTeam^.hasGone) then
-    TryDo(GameTicks < hiTicks shl 16 + headcmd^.loTime,
+    TryDo(GameTicks < LongWord(hiTicks shl 16) + headcmd^.loTime,
             'oops, queue error. in buffer: ' + headcmd^.cmd +
             ' (' + IntToStr(GameTicks) + ' > ' +
             IntToStr(hiTicks shl 16 + headcmd^.loTime) + ')',
--- a/hedgewars/uLandGenTemplateBased.pas	Sat Nov 29 01:19:29 2014 +0100
+++ b/hedgewars/uLandGenTemplateBased.pas	Sat Nov 29 03:13:06 2014 +0100
@@ -18,7 +18,7 @@
     with Template do
         begin
         pa.Count:= BasePointsCount;
-        for i:= 0 to pred(pa.Count) do
+        for i:= 0 to LongInt(pred(pa.Count)) do
             begin
             pa.ar[i].x:= BasePoints^[i].x + LongInt(GetRandom(BasePoints^[i].w));
             if pa.ar[i].x <> NTPX then
--- a/hedgewars/uUtils.pas	Sat Nov 29 01:19:29 2014 +0100
+++ b/hedgewars/uUtils.pas	Sat Nov 29 03:13:06 2014 +0100
@@ -37,6 +37,7 @@
 function  EnumToStr(const en : TSprite) : shortstring; overload;
 
 function  Min(a, b: LongInt): LongInt; inline;
+function  MinD(a, b: double) : double; inline;
 function  Max(a, b: LongInt): LongInt; inline;
 
 function  IntToStr(n: LongInt): shortstring;
@@ -194,6 +195,14 @@
     Min:= b
 end;
 
+function MinD(a, b: double): double;
+begin
+if a < b then
+    MinD:= a
+else
+    MinD:= b
+end;
+
 function Max(a, b: LongInt): LongInt;
 begin
 if a > b then
--- a/hedgewars/uWorld.pas	Sat Nov 29 01:19:29 2014 +0100
+++ b/hedgewars/uWorld.pas	Sat Nov 29 03:13:06 2014 +0100
@@ -1872,12 +1872,12 @@
         end
     else
         begin
-        if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > rightX - leftX - 100 then
+        if abs(prevPoint.X - WorldDx - hwRound(FollowGear^.X)) > LongInt(rightX) - leftX - 100 then
             begin
-            if (prevPoint.X - WorldDx) * 2 < LongInt(rightX + leftX) then
-                cameraJump:= rightX - leftX
+            if (prevPoint.X - WorldDx) * 2 < LongInt((rightX + leftX)) then
+                cameraJump:= LongInt(rightX) - leftX
                 else
-                cameraJump:= leftX - rightX;
+                cameraJump:= LongInt(leftX) - rightX;
             WorldDx:= WorldDx - cameraJump;
             end;