hedgewars/uUtils.pas
branchspacecampaign
changeset 9308 4bddcc1a1450
parent 9300 e5dafb5843c6
child 9377 48ab6dea8d2f
equal deleted inserted replaced
9296:5cc010e79431 9308:4bddcc1a1450
    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
   503         end;
   503         end;
   504     Rewrite(f);
   504     Rewrite(f);
   505 {$I+}
   505 {$I+}
   506 {$ENDIF}
   506 {$ENDIF}
   507 
   507 
       
   508     //mobile stuff
       
   509     mobileRecord.getScreenDPI:= @getScreenDPI; //TODO: define external function.
       
   510 {$IFDEF IPHONEOS}
       
   511     mobileRecord.PerformRumble:= @AudioServicesPlaySystemSound;
       
   512     mobileRecord.GameLoading:= @startLoadingIndicator;
       
   513     mobileRecord.GameLoaded:= @stopLoadingIndicator;
       
   514     mobileRecord.SaveLoadingEnded:= @saveFinishedSynching;
       
   515 {$ELSE}
       
   516     mobileRecord.PerformRumble:= nil;
       
   517     mobileRecord.GameLoading:= nil;
       
   518     mobileRecord.GameLoaded:= nil;
       
   519     mobileRecord.SaveLoadingEnded:= nil;
       
   520 {$ENDIF}
       
   521 
   508 end;
   522 end;
   509 
   523 
   510 procedure freeModule;
   524 procedure freeModule;
   511 begin
   525 begin
   512 {$IFDEF DEBUGFILE}
   526 {$IFDEF DEBUGFILE}