hedgewars/uMisc.pas
changeset 775 23c253aae336
parent 771 86fbe8753a7c
child 780 f45b0e513dfd
--- a/hedgewars/uMisc.pas	Mon Jan 28 17:51:18 2008 +0000
+++ b/hedgewars/uMisc.pas	Mon Jan 28 18:22:35 2008 +0000
@@ -104,6 +104,7 @@
 procedure SDLTry(Assert: boolean; isFatal: boolean);
 function IntToStr(n: LongInt): shortstring;
 function FloatToStr(n: hwFloat): shortstring;
+function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat;
 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
 function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
 procedure AdjustColor(var Color: Longword);
@@ -181,6 +182,16 @@
 FloatToStr:= cstr(n)
 end;
 
+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;
+DxDy2Angle:= arctan2(dY, dX) * 180 / pi
+end;
+
 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
 const _16divPI: Extended = 16/pi;
 var dY, dX: Extended;