23 interface |
23 interface |
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: shortstring; c: char); |
27 procedure SplitByChar(var a, b: shortstring; c: char); |
|
28 |
|
29 {$IFNDEF PAS2C} |
28 procedure SplitByChar(var a, b: ansistring; c: char); |
30 procedure SplitByChar(var a, b: ansistring; c: char); |
29 |
31 {$ENDIF} |
30 {$IFNDEF PAS2C} |
32 |
|
33 //{$IFNDEF PAS2C} |
31 function EnumToStr(const en : TGearType) : shortstring; overload; |
34 function EnumToStr(const en : TGearType) : shortstring; overload; |
32 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
35 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
33 function EnumToStr(const en : TSound) : shortstring; overload; |
36 function EnumToStr(const en : TSound) : shortstring; overload; |
34 function EnumToStr(const en : TAmmoType) : shortstring; overload; |
37 function EnumToStr(const en : TAmmoType) : shortstring; overload; |
35 function EnumToStr(const en : THogEffect) : shortstring; overload; |
38 function EnumToStr(const en : THogEffect) : shortstring; overload; |
36 function EnumToStr(const en : TCapGroup) : shortstring; overload; |
39 function EnumToStr(const en : TCapGroup) : shortstring; overload; |
37 {$ENDIF} |
40 //{$ENDIF} |
38 |
41 |
39 function Min(a, b: LongInt): LongInt; inline; |
42 function Min(a, b: LongInt): LongInt; inline; |
40 function Max(a, b: LongInt): LongInt; inline; |
43 function Max(a, b: LongInt): LongInt; inline; |
41 |
44 |
42 function IntToStr(n: LongInt): shortstring; |
45 function IntToStr(n: LongInt): shortstring; |
103 for t:= 1 to Pred(i) do |
106 for t:= 1 to Pred(i) do |
104 if (a[t] >= 'A')and(a[t] <= 'Z') then |
107 if (a[t] >= 'A')and(a[t] <= 'Z') then |
105 Inc(a[t], 32); |
108 Inc(a[t], 32); |
106 b:= copy(a, i + 1, Length(a) - i); |
109 b:= copy(a, i + 1, Length(a) - i); |
107 a[0]:= char(Pred(i)) |
110 a[0]:= char(Pred(i)) |
|
111 {$IFDEF PAS2C} |
|
112 a[i] := 0; |
|
113 {$ENDIF} |
108 end |
114 end |
109 else |
115 else |
110 b:= ''; |
116 b:= ''; |
111 end; |
117 end; |
112 |
118 |
|
119 {$IFNDEF PAS2C} |
113 procedure SplitByChar(var a, b: ansistring; c: char); |
120 procedure SplitByChar(var a, b: ansistring; c: char); |
114 var i: LongInt; |
121 var i: LongInt; |
115 begin |
122 begin |
116 i:= Pos(c, a); |
123 i:= Pos(c, a); |
117 if i > 0 then |
124 if i > 0 then |
118 begin |
125 begin |
119 b:= copy(a, i + 1, Length(a) - i); |
126 b:= copy(a, i + 1, Length(a) - i); |
120 setlength(a, Pred(i)); |
127 setlength(a, Pred(i)); |
121 end else b:= ''; |
128 end else b:= ''; |
122 end; |
129 end; { SplitByChar } |
123 |
130 {$ENDIF} |
124 {$IFNDEF PAS2C} |
131 |
|
132 //{$IFNDEF PAS2C} |
125 function EnumToStr(const en : TGearType) : shortstring; overload; |
133 function EnumToStr(const en : TGearType) : shortstring; overload; |
126 begin |
134 begin |
127 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) |
135 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) |
128 end; |
136 end; |
129 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
137 function EnumToStr(const en : TVisualGearType) : shortstring; overload; |
269 DecodeBase64[0]:= char(t - 1) |
277 DecodeBase64[0]:= char(t - 1) |
270 end; |
278 end; |
271 |
279 |
272 |
280 |
273 function Str2PChar(const s: shortstring): PChar; |
281 function Str2PChar(const s: shortstring): PChar; |
274 begin |
282 var i :Integer ; |
275 CharArray:= s; |
283 begin |
|
284 for i:= 1 to Length(s) do |
|
285 begin |
|
286 CharArray[i - 1] := s[i]; |
|
287 end; |
276 CharArray[Length(s)]:= #0; |
288 CharArray[Length(s)]:= #0; |
277 Str2PChar:= @CharArray |
289 Str2PChar:= @(CharArray[0]); |
278 end; |
290 end; |
279 |
291 |
280 |
292 |
281 function endian(independent: LongWord): LongWord; inline; |
293 function endian(independent: LongWord): LongWord; inline; |
282 begin |
294 begin |
291 end; |
303 end; |
292 |
304 |
293 |
305 |
294 procedure AddFileLog(s: shortstring); |
306 procedure AddFileLog(s: shortstring); |
295 begin |
307 begin |
296 s:= s; |
308 // s:= s; |
297 {$IFDEF DEBUGFILE} |
309 {$IFNDEF WEBGL} |
|
310 {$IFDEF DEBUGFILE} |
|
311 |
298 {$IFDEF USE_VIDEO_RECORDING} |
312 {$IFDEF USE_VIDEO_RECORDING} |
299 EnterCriticalSection(logMutex); |
313 EnterCriticalSection(logMutex); |
300 {$ENDIF} |
314 {$ENDIF} |
301 writeln(f, inttostr(GameTicks) + ': ' + s); |
315 writeln(f, inttostr(GameTicks) + ': ' + s); |
302 flush(f); |
316 flush(f); |
|
317 |
303 {$IFDEF USE_VIDEO_RECORDING} |
318 {$IFDEF USE_VIDEO_RECORDING} |
304 LeaveCriticalSection(logMutex); |
319 LeaveCriticalSection(logMutex); |
|
320 {$ENDIF} |
|
321 |
305 {$ENDIF} |
322 {$ENDIF} |
306 {$ENDIF} |
323 {$ENDIF} |
307 end; |
324 end; |
308 |
325 |
309 procedure AddFileLogRaw(s: pchar); cdecl; |
326 procedure AddFileLogRaw(s: pchar); cdecl; |