hedgewars/uUtils.pas
changeset 9295 f8819c3dde54
parent 9080 9b42757d7e71
child 9300 e5dafb5843c6
equal deleted inserted replaced
9293:873022596d15 9295:f8819c3dde54
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uUtils;
    21 unit uUtils;
    22 
    22 
    23 interface
    23 interface
    24 uses uTypes, uFloat, GLunit;
    24 uses uTypes, uFloat;
    25 
    25 
    26 procedure SplitBySpace(var a, b: shortstring);
    26 procedure SplitBySpace(var a, b: shortstring);
    27 procedure SplitByChar(var a, b: shortstring; c: char);
    27 procedure SplitByChar(var a, b: shortstring; c: char);
    28 procedure SplitByChar(var a, b: ansistring; c: char);
    28 procedure SplitByChar(var a, b: ansistring; c: char);
    29 
    29 
    39 
    39 
    40 function  IntToStr(n: LongInt): shortstring;
    40 function  IntToStr(n: LongInt): shortstring;
    41 function  StrToInt(s: shortstring): LongInt;
    41 function  StrToInt(s: shortstring): LongInt;
    42 function  FloatToStr(n: hwFloat): shortstring;
    42 function  FloatToStr(n: hwFloat): shortstring;
    43 
    43 
    44 function  DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; inline;
    44 function  DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
    45 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
    45 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
    46 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
    46 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
    47 function  DxDy2AttackAnglef(const _dY, _dX: extended): LongInt;
    47 function  DxDy2AttackAnglef(const _dY, _dX: extended): LongInt;
    48 
    48 
    49 procedure SetLittle(var r: hwFloat);
    49 procedure SetLittle(var r: hwFloat);
   198 begin
   198 begin
   199 FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue))
   199 FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue))
   200 end;
   200 end;
   201 
   201 
   202 
   202 
   203 function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; inline;
   203 function DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
   204 var dY, dX: Extended;
   204 var dY, dX: Extended;
   205 begin
   205 begin
   206 dY:= hwFloat2Float(_dY);
   206 dY:= hwFloat2Float(_dY);
   207 dX:= hwFloat2Float(_dX);
   207 dX:= hwFloat2Float(_dX);
   208 DxDy2Angle:= arctan2(dY, dX) * 180 / pi
   208 DxDy2Angle:= arctan2(dY, dX) * 180 / pi