hedgewars/uUtils.pas
changeset 4385 f679ffa2dc8c
parent 4380 b78638b36b89
child 4398 36d7e4b6ca81
equal deleted inserted replaced
4384:615a3e7bd850 4385:f679ffa2dc8c
    38 procedure AddFileLog(s: shortstring);
    38 procedure AddFileLog(s: shortstring);
    39 {$ENDIF}
    39 {$ENDIF}
    40 
    40 
    41 procedure initModule;
    41 procedure initModule;
    42 procedure freeModule;
    42 procedure freeModule;
       
    43 
       
    44 function  GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
       
    45 function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
    43 
    46 
    44 implementation
    47 implementation
    45 uses typinfo, Math, uConsts, uVariables, SysUtils;
    48 uses typinfo, Math, uConsts, uVariables, SysUtils;
    46 
    49 
    47 var
    50 var
   261 exit(font);
   264 exit(font);
   262 (* two more to check. pascal WideChar is only 16 bit though
   265 (* two more to check. pascal WideChar is only 16 bit though
   263        ((#$20000 <= u) and (u >= #$2A6DF)) or // CJK Unified Ideographs Extension B
   266        ((#$20000 <= u) and (u >= #$2A6DF)) or // CJK Unified Ideographs Extension B
   264        ((#$2F800 <= u) and (u >= #$2FA1F)))   // CJK Compatibility Ideographs Supplement *)
   267        ((#$2F800 <= u) and (u >= #$2FA1F)))   // CJK Compatibility Ideographs Supplement *)
   265 end;
   268 end;
       
   269 
       
   270 
       
   271 function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
       
   272 begin
       
   273     if (Ammoz[at].ejectX <> 0) or (Ammoz[at].ejectY <> 0) then
       
   274         GetLaunchX:= sign(dir) * (8 + hwRound(AngleSin(angle) * Ammoz[at].ejectX) + hwRound(AngleCos(angle) * Ammoz[at].ejectY))
       
   275     else
       
   276         GetLaunchX:= 0
       
   277 end;
       
   278 
       
   279 function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
       
   280 begin
       
   281     if (Ammoz[at].ejectX <> 0) or (Ammoz[at].ejectY <> 0) then
       
   282         GetLaunchY:= hwRound(AngleSin(angle) * Ammoz[at].ejectY) - hwRound(AngleCos(angle) * Ammoz[at].ejectX) - 2
       
   283     else
       
   284         GetLaunchY:= 0
       
   285 end;
       
   286 
   266 
   287 
   267 procedure initModule;
   288 procedure initModule;
   268 {$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF}
   289 {$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF}
   269 begin
   290 begin
   270 {$IFDEF DEBUGFILE}
   291 {$IFDEF DEBUGFILE}