hedgewars/uUtils.pas
changeset 5151 cbadb9fa52fc
parent 5130 3602ede67ec5
child 5239 f34f391a223b
equal deleted inserted replaced
5150:63ad8a648afd 5151:cbadb9fa52fc
    40 function  FloatToStr(n: hwFloat): shortstring;
    40 function  FloatToStr(n: hwFloat): shortstring;
    41 
    41 
    42 function  DxDy2Angle(const _dY, _dX: hwFloat): GLfloat;
    42 function  DxDy2Angle(const _dY, _dX: hwFloat): GLfloat;
    43 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
    43 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
    44 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
    44 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
       
    45 function  DxDy2AttackAngle(const _dY, _dX: extended): LongInt;
    45 
    46 
    46 procedure SetLittle(var r: hwFloat);
    47 procedure SetLittle(var r: hwFloat);
    47 
    48 
    48 function  Str2PChar(const s: shortstring): PChar;
    49 function  Str2PChar(const s: shortstring): PChar;
    49 function  DecodeBase64(s: shortstring): shortstring;
    50 function  DecodeBase64(s: shortstring): shortstring;
   178 dY:= _dY.QWordValue / $100000000;
   179 dY:= _dY.QWordValue / $100000000;
   179 if _dY.isNegative then dY:= - dY;
   180 if _dY.isNegative then dY:= - dY;
   180 dX:= _dX.QWordValue / $100000000;
   181 dX:= _dX.QWordValue / $100000000;
   181 if _dX.isNegative then dX:= - dX;
   182 if _dX.isNegative then dX:= - dX;
   182 DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI)
   183 DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI)
       
   184 end;
       
   185 
       
   186 function DxDy2AttackAngle(const _dY, _dX: extended): LongInt; inline;
       
   187 begin
       
   188 DxDy2AttackAngle:= trunc(arctan2(_dY, _dX) * (cMaxAngle/pi))
   183 end;
   189 end;
   184 
   190 
   185 
   191 
   186 procedure SetLittle(var r: hwFloat);
   192 procedure SetLittle(var r: hwFloat);
   187 begin
   193 begin