hedgewars/uMisc.pas
changeset 107 b08ce0293a51
parent 100 f324a18698fe
child 108 08f1fe6f21f8
equal deleted inserted replaced
106:98cb6606bf67 107:b08ce0293a51
    95 
    95 
    96     InitStepsFlags: Longword = 0;
    96     InitStepsFlags: Longword = 0;
    97 
    97 
    98     AttackBar: integer = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
    98     AttackBar: integer = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
    99 
    99 
   100 function Sign(r: real): integer;
   100 function Sign(r: Double): integer;
   101 function Min(a, b: integer): integer;
   101 function Min(a, b: integer): integer;
   102 function Max(a, b: integer): integer;
   102 function Max(a, b: integer): integer;
   103 procedure OutError(Msg: String; const isFatalError: boolean=false);
   103 procedure OutError(Msg: String; const isFatalError: boolean=false);
   104 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   104 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
   105 procedure SDLTry(Assert: boolean; isFatal: boolean);
   105 procedure SDLTry(Assert: boolean; isFatal: boolean);
   106 function IntToStr(n: integer): shortstring;
   106 function IntToStr(n: integer): shortstring;
   107 function FloatToStr(n: real): shortstring;
   107 function FloatToStr(n: Double): shortstring;
   108 function DxDy2Angle32(const _dY, _dX: Extended): integer;
   108 function DxDy2Angle32(const _dY, _dX: Extended): integer;
   109 function DxDy2AttackAngle(const _dY, _dX: Extended): integer;
   109 function DxDy2AttackAngle(const _dY, _dX: Extended): integer;
   110 procedure AdjustColor(var Color: Longword);
   110 procedure AdjustColor(var Color: Longword);
   111 {$IFDEF DEBUGFILE}
   111 {$IFDEF DEBUGFILE}
   112 procedure AddFileLog(s: shortstring);
   112 procedure AddFileLog(s: shortstring);
   113 function RectToStr(Rect: TSDL_Rect): shortstring;
   113 function RectToStr(Rect: TSDL_Rect): shortstring;
   114 {$ENDIF}
   114 {$ENDIF}
   115 {$IFNDEF FPC}
   115 {$IFNDEF FPC}
   116 function arctan2(const Y, X: real): real;
   116 function arctan2(const Y, X: Double): Double;
   117 {$ENDIF}
   117 {$ENDIF}
   118 
   118 
   119 var CursorPoint: TPoint;
   119 var CursorPoint: TPoint;
   120     TargetPoint: TPoint = (X: NoPointX; Y: 0);
   120     TargetPoint: TPoint = (X: NoPointX; Y: 0);
   121 
   121 
   124 {$IFDEF DEBUGFILE}
   124 {$IFDEF DEBUGFILE}
   125 var f: textfile;
   125 var f: textfile;
   126 {$ENDIF}
   126 {$ENDIF}
   127 
   127 
   128 
   128 
   129 function Sign(r: real): integer;
   129 function Sign(r: Double): integer;
   130 begin
   130 begin
   131 if r < 0 then Result:= -1 else Result:= 1
   131 if r < 0 then Result:= -1 else Result:= 1
   132 end;
   132 end;
   133 
   133 
   134 function Min(a, b: integer): integer;
   134 function Min(a, b: integer): integer;
   171 function IntToStr(n: integer): shortstring;
   171 function IntToStr(n: integer): shortstring;
   172 begin
   172 begin
   173 str(n, Result)
   173 str(n, Result)
   174 end;
   174 end;
   175 
   175 
   176 function FloatToStr(n: real): shortstring;
   176 function FloatToStr(n: Double): shortstring;
   177 begin
   177 begin
   178 str(n:5:5, Result)
   178 str(n:5:5, Result)
   179 end;
   179 end;
   180 
   180 
   181 {$IFNDEF FPC}
   181 {$IFNDEF FPC}
   182 function arctan2(const Y, X: real): real;
   182 function arctan2(const Y, X: Double): Double;
   183 asm
   183 asm
   184         fld     Y
   184         fld     Y
   185         fld     X
   185         fld     X
   186         fpatan
   186         fpatan
   187         fwait
   187         fwait