hedgewars/uMisc.pas
changeset 775 23c253aae336
parent 771 86fbe8753a7c
child 780 f45b0e513dfd
equal deleted inserted replaced
774:c2d6476e741f 775:23c253aae336
   102 procedure OutError(Msg: String; isFatalError: boolean);
   102 procedure OutError(Msg: String; isFatalError: boolean);
   103 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   103 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   104 procedure SDLTry(Assert: boolean; isFatal: boolean);
   104 procedure SDLTry(Assert: boolean; isFatal: boolean);
   105 function IntToStr(n: LongInt): shortstring;
   105 function IntToStr(n: LongInt): shortstring;
   106 function FloatToStr(n: hwFloat): shortstring;
   106 function FloatToStr(n: hwFloat): shortstring;
       
   107 function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat;
   107 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
   108 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
   108 function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
   109 function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
   109 procedure AdjustColor(var Color: Longword);
   110 procedure AdjustColor(var Color: Longword);
   110 {$IFDEF DEBUGFILE}
   111 {$IFDEF DEBUGFILE}
   111 procedure AddFileLog(s: shortstring);
   112 procedure AddFileLog(s: shortstring);
   179 function FloatToStr(n: hwFloat): shortstring;
   180 function FloatToStr(n: hwFloat): shortstring;
   180 begin
   181 begin
   181 FloatToStr:= cstr(n)
   182 FloatToStr:= cstr(n)
   182 end;
   183 end;
   183 
   184 
       
   185 function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat;
       
   186 var dY, dX: Extended;
       
   187 begin
       
   188 dY:= _dY.QWordValue / $100000000;
       
   189 if _dY.isNegative then dY:= - dY;
       
   190 dX:= _dX.QWordValue / $100000000;
       
   191 if _dX.isNegative then dX:= - dX;
       
   192 DxDy2Angle:= arctan2(dY, dX) * 180 / pi
       
   193 end;
       
   194 
   184 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
   195 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
   185 const _16divPI: Extended = 16/pi;
   196 const _16divPI: Extended = 16/pi;
   186 var dY, dX: Extended;
   197 var dY, dX: Extended;
   187 begin
   198 begin
   188 dY:= _dY.QWordValue / $100000000;
   199 dY:= _dY.QWordValue / $100000000;