# HG changeset patch # User unc0rr # Date 1208868043 0 # Node ID beecc5c5c71c1d1efbe4032a75378d00d34c7374 # Parent 8842c71d16bf93bbe9000c33337a06dd3da9a645 - Fix braindead shotgun shot arithmetics - Small optimizations in hwFloat diff -r 8842c71d16bf -r beecc5c5c71c hedgewars/uFloat.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; diff -r 8842c71d16bf -r beecc5c5c71c hedgewars/uGears.pas --- 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