24 uses uTypes, uFloat, GLunit; |
24 uses uTypes, uFloat, GLunit; |
25 |
25 |
26 procedure SplitBySpace(var a, b: shortstring); |
26 procedure SplitBySpace(var a, b: shortstring); |
27 procedure SplitByChar(var a, b: ansistring; c: char); |
27 procedure SplitByChar(var a, b: ansistring; c: char); |
28 |
28 |
|
29 {$IFNDEF PAS2C} |
29 function EnumToStr(const en : TGearType) : shortstring; overload; |
30 function EnumToStr(const en : TGearType) : shortstring; overload; |
30 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
31 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
31 function EnumToStr(const en : TSound) : shortstring; overload; |
32 function EnumToStr(const en : TSound) : shortstring; overload; |
32 function EnumToStr(const en : TAmmoType) : shortstring; overload; |
33 function EnumToStr(const en : TAmmoType) : shortstring; overload; |
33 function EnumToStr(const en : THogEffect) : shortstring; overload; |
34 function EnumToStr(const en : THogEffect) : shortstring; overload; |
34 function EnumToStr(const en : TCapGroup) : shortstring; overload; |
35 function EnumToStr(const en : TCapGroup) : shortstring; overload; |
|
36 {$ENDIF} |
35 |
37 |
36 function Min(a, b: LongInt): LongInt; inline; |
38 function Min(a, b: LongInt): LongInt; inline; |
37 function Max(a, b: LongInt): LongInt; inline; |
39 function Max(a, b: LongInt): LongInt; inline; |
38 |
40 |
39 function IntToStr(n: LongInt): shortstring; |
41 function IntToStr(n: LongInt): shortstring; |
40 function FloatToStr(n: hwFloat): shortstring; |
42 function FloatToStr(n: hwFloat): shortstring; |
41 |
43 |
42 function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; |
44 function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; |
43 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; |
45 function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; |
44 function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; |
46 function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; |
45 function DxDy2AttackAngle(const _dY, _dX: extended): LongInt; |
47 function DxDy2AttackAnglef(const _dY, _dX: extended): LongInt; |
46 |
48 |
47 procedure SetLittle(var r: hwFloat); |
49 procedure SetLittle(var r: hwFloat); |
48 |
50 |
49 function Str2PChar(const s: shortstring): PChar; |
51 function Str2PChar(const s: shortstring): PChar; |
50 function DecodeBase64(s: shortstring): shortstring; |
52 function DecodeBase64(s: shortstring): shortstring; |
100 b:= copy(a, i + 1, Length(a) - i); |
102 b:= copy(a, i + 1, Length(a) - i); |
101 setlength(a, Pred(i)); |
103 setlength(a, Pred(i)); |
102 end else b:= ''; |
104 end else b:= ''; |
103 end; |
105 end; |
104 |
106 |
|
107 {$IFNDEF PAS2C} |
105 function EnumToStr(const en : TGearType) : shortstring; overload; |
108 function EnumToStr(const en : TGearType) : shortstring; overload; |
106 begin |
109 begin |
107 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) |
110 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) |
108 end; |
111 end; |
109 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
112 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
196 if _dX.isNegative then |
199 if _dX.isNegative then |
197 dX:= - dX; |
200 dX:= - dX; |
198 DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI) |
201 DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI) |
199 end; |
202 end; |
200 |
203 |
201 function DxDy2AttackAngle(const _dY, _dX: extended): LongInt; inline; |
204 function DxDy2AttackAnglef(const _dY, _dX: extended): LongInt; inline; |
202 begin |
205 begin |
203 DxDy2AttackAngle:= trunc(arctan2(_dY, _dX) * (cMaxAngle/pi)) |
206 DxDy2AttackAnglef:= trunc(arctan2(_dY, _dX) * (cMaxAngle/pi)) |
204 end; |
207 end; |
205 |
208 |
206 |
209 |
207 procedure SetLittle(var r: hwFloat); |
210 procedure SetLittle(var r: hwFloat); |
208 begin |
211 begin |