rope: tiny optimisation
authorsheepluva
Tue, 29 Jun 2010 05:22:25 +0200
changeset 3583 13818670ad9e
parent 3582 4debed8656d7
child 3584 7c05f2e0a8b5
rope: tiny optimisation
hedgewars/GSHandlers.inc
hedgewars/uFloat.pas
--- a/hedgewars/GSHandlers.inc	Mon Jun 28 21:52:00 2010 +0200
+++ b/hedgewars/GSHandlers.inc	Tue Jun 29 05:22:25 2010 +0200
@@ -1238,14 +1238,15 @@
         HHGear^.dY := SignAs(hwAbs(HHGear^.dY) + _0_2, HHGear^.dY)
     end;
 
-    len := Distance(HHGear^.dX, HHGear^.dY);
-    if len > _0_8 then
+    len := hwSqr(HHGear^.dX) + hwSqr(HHGear^.dY);
+    if len > _0_64 then
     begin
-        len := _0_8 / len;
+        len := _0_8 / hwSqrt(len);
         HHGear^.dX := HHGear^.dX * len;
         HHGear^.dY := HHGear^.dY * len;
     end;
 
+
     if (Gear^.Message and gm_Attack) <> 0 then
         if (Gear^.State and gsttmpFlag) <> 0 then
             with PHedgehog(Gear^.Hedgehog)^ do
--- a/hedgewars/uFloat.pas	Mon Jun 28 21:52:00 2010 +0200
+++ b/hedgewars/uFloat.pas	Tue Jun 29 05:22:25 2010 +0200
@@ -98,6 +98,7 @@
             _0_5: hwFloat = (isNegative: false; QWordValue:  2147483648);
            _0_55: hwFloat = (isNegative: false; QWordValue:  2362232012);
             _0_6: hwFloat = (isNegative: false; QWordValue:  2576980377);
+           _0_64: hwFloat = (isNegative: false; QWordValue:  2748779064);
             _0_7: hwFloat = (isNegative: false; QWordValue:  3006477107);
             _0_8: hwFloat = (isNegative: false; QWordValue:  3435973837);
            _0_84: hwFloat = (isNegative: false; QWordValue:  3607772528);