hedgewars/uMisc.pas
changeset 208 a049157d673a
parent 196 993cf173218b
child 281 5b483aa9f2ab
equal deleted inserted replaced
207:287077789132 208:a049157d673a
    98 procedure AdjustColor(var Color: Longword);
    98 procedure AdjustColor(var Color: Longword);
    99 {$IFDEF DEBUGFILE}
    99 {$IFDEF DEBUGFILE}
   100 procedure AddFileLog(s: shortstring);
   100 procedure AddFileLog(s: shortstring);
   101 function RectToStr(Rect: TSDL_Rect): shortstring;
   101 function RectToStr(Rect: TSDL_Rect): shortstring;
   102 {$ENDIF}
   102 {$ENDIF}
       
   103 procedure SetKB(n: Longword);
       
   104 procedure SendKB;
   103 
   105 
   104 var CursorPoint: TPoint;
   106 var CursorPoint: TPoint;
   105     TargetPoint: TPoint = (X: NoPointX; Y: 0);
   107     TargetPoint: TPoint = (X: NoPointX; Y: 0);
   106 
   108 
   107 implementation
   109 implementation
   108 uses uConsole, uStore, uIO{$IFDEF FPC}, Math{$ENDIF};
   110 uses uConsole, uStore, uIO{$IFDEF FPC}, Math{$ENDIF};
       
   111 var KBnum: Longword = 0;
   109 {$IFDEF DEBUGFILE}
   112 {$IFDEF DEBUGFILE}
   110 var f: textfile;
   113 var f: textfile;
   111 {$ENDIF}
   114 {$ENDIF}
   112 
   115 
   113 function hwSign(r: Double): integer;
   116 function hwSign(r: Double): integer;
   182 const MaxAngleDivPI: Extended = cMaxAngle/pi;
   185 const MaxAngleDivPI: Extended = cMaxAngle/pi;
   183 begin
   186 begin
   184 Result:= trunc(arctan2(_dY, _dX) * MaxAngleDivPI) mod cMaxAngle
   187 Result:= trunc(arctan2(_dY, _dX) * MaxAngleDivPI) mod cMaxAngle
   185 end;
   188 end;
   186 
   189 
       
   190 procedure SetKB(n: Longword);
       
   191 begin
       
   192 KBnum:= n
       
   193 end;
       
   194 
       
   195 procedure SendKB;
       
   196 var s: shortstring;
       
   197 begin
       
   198 if KBnum <> 0 then
       
   199    begin
       
   200    s:= 'K' + inttostr(KBnum);
       
   201    SendIPCRaw(@s, Length(s) + 1)
       
   202    end
       
   203 end;
       
   204 
   187 {$IFDEF DEBUGFILE}
   205 {$IFDEF DEBUGFILE}
   188 procedure AddFileLog(s: shortstring);
   206 procedure AddFileLog(s: shortstring);
   189 begin
   207 begin
   190 writeln(f, GameTicks: 6, ': ', s);
   208 writeln(f, GameTicks: 6, ': ', s);
   191 flush(f)
   209 flush(f)