equal
deleted
inserted
replaced
59 function endian(independent: LongWord): LongWord; inline; |
59 function endian(independent: LongWord): LongWord; inline; |
60 |
60 |
61 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
61 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
62 |
62 |
63 procedure AddFileLog(s: shortstring); |
63 procedure AddFileLog(s: shortstring); |
|
64 procedure AddFileLogRaw(s: pchar); cdecl; |
64 |
65 |
65 function CheckNoTeamOrHH: boolean; inline; |
66 function CheckNoTeamOrHH: boolean; inline; |
66 |
67 |
67 function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; |
68 function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; |
68 function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; |
69 function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; |
79 implementation |
80 implementation |
80 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; |
81 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; |
81 |
82 |
82 {$IFDEF DEBUGFILE} |
83 {$IFDEF DEBUGFILE} |
83 var f: textfile; |
84 var f: textfile; |
|
85 {$IFDEF USE_VIDEO_RECORDING} |
|
86 logMutex: TRTLCriticalSection; // mutex for debug file |
|
87 {$ENDIF} |
84 {$ENDIF} |
88 {$ENDIF} |
85 var CharArray: array[byte] of Char; |
89 var CharArray: array[byte] of Char; |
86 |
90 |
87 procedure SplitBySpace(var a,b: shortstring); |
91 procedure SplitBySpace(var a,b: shortstring); |
88 begin |
92 begin |
289 |
293 |
290 procedure AddFileLog(s: shortstring); |
294 procedure AddFileLog(s: shortstring); |
291 begin |
295 begin |
292 s:= s; |
296 s:= s; |
293 {$IFDEF DEBUGFILE} |
297 {$IFDEF DEBUGFILE} |
|
298 {$IFDEF USE_VIDEO_RECORDING} |
|
299 EnterCriticalSection(logMutex); |
|
300 {$ENDIF} |
294 writeln(f, inttostr(GameTicks) + ': ' + s); |
301 writeln(f, inttostr(GameTicks) + ': ' + s); |
295 flush(f) |
302 flush(f); |
296 {$ENDIF} |
303 {$IFDEF USE_VIDEO_RECORDING} |
297 end; |
304 LeaveCriticalSection(logMutex); |
298 |
305 {$ENDIF} |
|
306 {$ENDIF} |
|
307 end; |
|
308 |
|
309 procedure AddFileLogRaw(s: pchar); cdecl; |
|
310 begin |
|
311 s:= s; |
|
312 {$IFDEF DEBUGFILE} |
|
313 {$IFDEF USE_VIDEO_RECORDING} |
|
314 EnterCriticalSection(logMutex); |
|
315 {$ENDIF} |
|
316 write(f, s); |
|
317 flush(f); |
|
318 {$IFDEF USE_VIDEO_RECORDING} |
|
319 LeaveCriticalSection(logMutex); |
|
320 {$ENDIF} |
|
321 {$ENDIF} |
|
322 end; |
299 |
323 |
300 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
324 function CheckCJKFont(s: ansistring; font: THWFont): THWFont; |
301 var l, i : LongInt; |
325 var l, i : LongInt; |
302 u: WideChar; |
326 u: WideChar; |
303 tmpstr: array[0..256] of WideChar; |
327 tmpstr: array[0..256] of WideChar; |
383 {$IFNDEF MOBILE}var i: LongInt;{$ENDIF} |
407 {$IFNDEF MOBILE}var i: LongInt;{$ENDIF} |
384 {$ENDIF} |
408 {$ENDIF} |
385 begin |
409 begin |
386 {$IFDEF DEBUGFILE} |
410 {$IFDEF DEBUGFILE} |
387 if isGame then |
411 if isGame then |
388 logfileBase:= 'game' |
412 begin |
|
413 if GameType = gmtRecord then |
|
414 logfileBase:= 'rec' |
|
415 else |
|
416 logfileBase:= 'game'; |
|
417 end |
389 else |
418 else |
390 logfileBase:= 'preview'; |
419 logfileBase:= 'preview'; |
|
420 {$IFDEF USE_VIDEO_RECORDING} |
|
421 InitCriticalSection(logMutex); |
|
422 {$ENDIF} |
391 {$I-} |
423 {$I-} |
392 {$IFDEF MOBILE} |
424 {$IFDEF MOBILE} |
393 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} |
425 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} |
394 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
426 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
395 Rewrite(f); |
427 Rewrite(f); |
422 |
454 |
423 {$IFDEF DEBUGFILE} |
455 {$IFDEF DEBUGFILE} |
424 writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); |
456 writeln(f, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft)); |
425 flush(f); |
457 flush(f); |
426 close(f); |
458 close(f); |
|
459 {$IFDEF USE_VIDEO_RECORDING} |
|
460 DoneCriticalSection(logMutex); |
|
461 {$ENDIF} |
427 {$ENDIF} |
462 {$ENDIF} |
428 end; |
463 end; |
429 |
464 |
430 end. |
465 end. |