- Fix braindead shotgun shot arithmetics
authorunc0rr
Tue, 22 Apr 2008 12:40:43 +0000
changeset 856 beecc5c5c71c
parent 855 8842c71d16bf
child 857 43912f139db1
- Fix braindead shotgun shot arithmetics - Small optimizations in hwFloat
hedgewars/uFloat.pas
hedgewars/uGears.pas
--- a/hedgewars/uFloat.pas	Mon Apr 21 18:43:07 2008 +0000
+++ b/hedgewars/uFloat.pas	Tue Apr 22 12:40:43 2008 +0000
@@ -313,12 +313,12 @@
 
 function DistanceI(const dx, dy: LongInt): hwFloat;
 begin
-DistanceI:= Distance(int2hwFloat(dx), int2hwFloat(dy))
+DistanceI:= hwSqrt(int2hwFloat(sqr(dx) + sqr(dy)))
 end;
 
 function SignAs(const num, signum: hwFloat): hwFloat;
 begin
-SignAs:= num;
+SignAs.QWordValue:= num.QWordValue;
 SignAs.isNegative:= signum.isNegative
 end;
 
--- a/hedgewars/uGears.pas	Mon Apr 21 18:43:07 2008 +0000
+++ b/hedgewars/uGears.pas	Tue Apr 22 12:40:43 2008 +0000
@@ -864,8 +864,9 @@
                           uStats.HedgehogDamaged(t, dmg)
                           end;
                        DeleteCI(t);
-                       t^.dX:= t^.dX + hwAbs(Gear^.dX * dmg * _0_01) + SignAs(cHHKick, Gear^.dX);
+                       t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
                        t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
+writelntoconsole('after ('+floattostr(t^.dx)+','+floattostr(t^.dy)+')');
                        t^.State:= t^.State or gstMoving;
                        t^.Active:= true;
                        FollowGear:= t