Consistency
authornemo
Fri, 17 Aug 2012 10:28:42 -0400
changeset 7547 6e9c5feb88eb
parent 7546 b50556f2a0e8
child 7548 c7a21fc530de
Consistency
hedgewars/uGearsRender.pas
hedgewars/uUtils.pas
--- a/hedgewars/uGearsRender.pas	Fri Aug 17 07:49:54 2012 -0400
+++ b/hedgewars/uGearsRender.pas	Fri Aug 17 10:28:42 2012 -0400
@@ -376,26 +376,26 @@
                         hAngle:= 0;
                         i:= -1
                         end;
-                if ((Gear^.State and gstWinner) = 0) then
-                    begin
-                    DrawHedgehog(ox, oy,
-                            i,
-                            1,
-                            0,
-                            DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
-                    with HH^ do
-                        if (HatTex <> nil) then
-                            begin
-                            DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
-                                i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
-                            if HatTex^.w > 64 then
+                    if ((Gear^.State and gstWinner) = 0) then
+                        begin
+                        DrawHedgehog(ox, oy,
+                                i,
+                                1,
+                                0,
+                                DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
+                        with HH^ do
+                            if (HatTex <> nil) then
                                 begin
-                                Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
-                                DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
+                                DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
                                     i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
-                                Tint($FF, $FF, $FF, $FF)
+                                if HatTex^.w > 64 then
+                                    begin
+                                    Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
+                                    DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
+                                        i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
+                                    Tint($FF, $FF, $FF, $FF)
+                                    end
                                 end
-                            end
                     end;
                     DrawAltWeapon(Gear, ox, oy);
                     defaultPos:= false
--- a/hedgewars/uUtils.pas	Fri Aug 17 07:49:54 2012 -0400
+++ b/hedgewars/uUtils.pas	Fri Aug 17 10:28:42 2012 -0400
@@ -185,12 +185,8 @@
 function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat;
 var dY, dX: Extended;
 begin
-dY:= _dY.QWordValue / $100000000;
-if _dY.isNegative then
-    dY:= - dY;
-dX:= _dX.QWordValue / $100000000;
-if _dX.isNegative then
-    dX:= - dX;
+dY:= hwFloat2Float(_dY);
+dX:= hwFloat2Float(_dX);
 DxDy2Angle:= arctan2(dY, dX) * 180 / pi
 end;
 
@@ -198,12 +194,8 @@
 const _16divPI: Extended = 16/pi;
 var dY, dX: Extended;
 begin
-dY:= _dY.QWordValue / $100000000;
-if _dY.isNegative then
-    dY:= - dY;
-dX:= _dX.QWordValue / $100000000;
-if _dX.isNegative then
-    dX:= - dX;
+dY:= hwFloat2Float(_dY);
+dX:= hwFloat2Float(_dX);
 DxDy2Angle32:= trunc(arctan2(dY, dX) * _16divPI) and $1f
 end;
 
@@ -211,12 +203,8 @@
 const MaxAngleDivPI: Extended = cMaxAngle/pi;
 var dY, dX: Extended;
 begin
-dY:= _dY.QWordValue / $100000000;
-if _dY.isNegative then
-    dY:= - dY;
-dX:= _dX.QWordValue / $100000000;
-if _dX.isNegative then
-    dX:= - dX;
+dY:= hwFloat2Float(_dY);
+dX:= hwFloat2Float(_dX);
 DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI)
 end;