hedgewars/uMisc.pas
changeset 108 08f1fe6f21f8
parent 107 b08ce0293a51
child 143 3dacbd83209b
equal deleted inserted replaced
107:b08ce0293a51 108:08f1fe6f21f8
    69     cWhiteColor   : Cardinal = $FFFFFF;
    69     cWhiteColor   : Cardinal = $FFFFFF;
    70     cConsoleSplitterColor : Cardinal = $FF0000;
    70     cConsoleSplitterColor : Cardinal = $FF0000;
    71     cColorNearBlack       : Cardinal = 16;
    71     cColorNearBlack       : Cardinal = 16;
    72     cExplosionBorderColor : LongWord = $808080;
    72     cExplosionBorderColor : LongWord = $808080;
    73 
    73 
    74     cDrownSpeed   : Real = 0.06;
    74     cDrownSpeed   : Double = 0.06;
    75     cMaxWindSpeed : Real = 0.0005;
    75     cMaxWindSpeed : Double = 0.0005;
    76     cWindSpeed    : Real = 0.0001;
    76     cWindSpeed    : Double = 0.0001;
    77     cGravity      : Real = 0.0005;
    77     cGravity      : Double = 0.0005;
    78 
    78 
    79     cShowFPS      : boolean = true;
    79     cShowFPS      : boolean = true;
    80     cFullScreen   : boolean = true;
    80     cFullScreen   : boolean = true;
    81     cLocaleFName  : shortstring = 'en.txt';
    81     cLocaleFName  : shortstring = 'en.txt';
    82     cSeed         : shortstring = '';
    82     cSeed         : shortstring = '';
    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: Double): integer;
   100 function hwSign(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);
   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}
       
   116 function arctan2(const Y, X: Double): Double;
       
   117 {$ENDIF}
       
   118 
   115 
   119 var CursorPoint: TPoint;
   116 var CursorPoint: TPoint;
   120     TargetPoint: TPoint = (X: NoPointX; Y: 0);
   117     TargetPoint: TPoint = (X: NoPointX; Y: 0);
   121 
   118 
   122 implementation
   119 implementation
   124 {$IFDEF DEBUGFILE}
   121 {$IFDEF DEBUGFILE}
   125 var f: textfile;
   122 var f: textfile;
   126 {$ENDIF}
   123 {$ENDIF}
   127 
   124 
   128 
   125 
   129 function Sign(r: Double): integer;
   126 function hwSign(r: Double): integer;
   130 begin
   127 begin
   131 if r < 0 then Result:= -1 else Result:= 1
   128 if r < 0 then Result:= -1 else Result:= 1
   132 end;
   129 end;
   133 
   130 
   134 function Min(a, b: integer): integer;
   131 function Min(a, b: integer): integer;
   211 begin
   208 begin
   212 Result:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')'
   209 Result:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')'
   213 end;
   210 end;
   214 
   211 
   215 initialization
   212 initialization
   216 assignfile(f, 'debug.txt');
   213 AssignFile(f, 'debug.txt');
   217 rewrite(f);
   214 rewrite(f);
   218 
   215 
   219 finalization
   216 finalization
   220 writeln(f, '-= halt at ',GameTicks,' ticks =-');
   217 writeln(f, '-= halt at ',GameTicks,' ticks =-');
   221 Flush(f);
   218 Flush(f);