equal
deleted
inserted
replaced
63 function CheckNoTeamOrHH: boolean; inline; |
63 function CheckNoTeamOrHH: boolean; inline; |
64 |
64 |
65 function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; |
65 function GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt; |
66 function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; |
66 function GetLaunchY(at: TAmmoType; angle: LongInt): LongInt; |
67 |
67 |
68 procedure initModule; |
68 procedure initModule(isGame: boolean); |
69 procedure freeModule; |
69 procedure freeModule; |
70 |
70 |
71 |
71 |
72 implementation |
72 implementation |
73 uses typinfo, Math, uConsts, uVariables, SysUtils; |
73 uses {$IFNDEF PAS2C}typinfo, {$ENDIF}Math, uConsts, uVariables, SysUtils; |
74 |
74 |
75 {$IFDEF DEBUGFILE} |
75 {$IFDEF DEBUGFILE} |
76 var f: textfile; |
76 var f: textfile; |
77 {$ENDIF} |
77 {$ENDIF} |
|
78 var CharArray: array[byte] of Char; |
78 |
79 |
79 // should this include "strtolower()" for the split string? |
80 // should this include "strtolower()" for the split string? |
80 procedure SplitBySpace(var a, b: shortstring); |
81 procedure SplitBySpace(var a, b: shortstring); |
81 var i, t: LongInt; |
82 var i, t: LongInt; |
82 begin |
83 begin |
85 begin |
86 begin |
86 for t:= 1 to Pred(i) do |
87 for t:= 1 to Pred(i) do |
87 if (a[t] >= 'A')and(a[t] <= 'Z') then |
88 if (a[t] >= 'A')and(a[t] <= 'Z') then |
88 Inc(a[t], 32); |
89 Inc(a[t], 32); |
89 b:= copy(a, i + 1, Length(a) - i); |
90 b:= copy(a, i + 1, Length(a) - i); |
90 byte(a[0]):= Pred(i) |
91 a[0]:= char(Pred(i)) |
91 end |
92 end |
92 else |
93 else |
93 b:= ''; |
94 b:= ''; |
94 end; |
95 end; |
95 |
96 |
234 begin |
235 begin |
235 t:= Pos(s[i], table); |
236 t:= Pos(s[i], table); |
236 if s[i] = '=' then |
237 if s[i] = '=' then |
237 inc(c); |
238 inc(c); |
238 if t > 0 then |
239 if t > 0 then |
239 byte(s[i]):= t - 1 |
240 s[i]:= char(t - 1) |
240 else |
241 else |
241 byte(s[i]):= 0 |
242 s[i]:= #0 |
242 end; |
243 end; |
243 |
244 |
244 i:= 1; |
245 i:= 1; |
245 t:= 1; |
246 t:= 1; |
246 while i <= length(s) do |
247 while i <= length(s) do |
253 end; |
254 end; |
254 |
255 |
255 if c < 3 then |
256 if c < 3 then |
256 t:= t - c; |
257 t:= t - c; |
257 |
258 |
258 byte(DecodeBase64[0]):= t - 1 |
259 DecodeBase64[0]:= char(t - 1) |
259 end; |
260 end; |
260 |
261 |
261 |
262 |
262 var CharArray: array[byte] of Char; |
|
263 function Str2PChar(const s: shortstring): PChar; |
263 function Str2PChar(const s: shortstring): PChar; |
264 begin |
264 begin |
265 CharArray:= s; |
265 CharArray:= s; |
266 CharArray[Length(s)]:= #0; |
266 CharArray[Length(s)]:= #0; |
267 Str2PChar:= @CharArray |
267 Str2PChar:= @CharArray |
357 function CheckNoTeamOrHH: boolean; |
357 function CheckNoTeamOrHH: boolean; |
358 begin |
358 begin |
359 CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); |
359 CheckNoTeamOrHH:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil); |
360 end; |
360 end; |
361 |
361 |
362 procedure initModule; |
362 procedure initModule(isGame: boolean); |
363 {$IFDEF DEBUGFILE}{$IFNDEF MOBILE}var i: LongInt;{$ENDIF}{$ENDIF} |
|
364 begin |
|
365 {$IFDEF DEBUGFILE} |
363 {$IFDEF DEBUGFILE} |
|
364 var logfileBase: shortstring; |
|
365 {$IFNDEF MOBILE}var i: LongInt;{$ENDIF} |
|
366 {$ENDIF} |
|
367 begin |
|
368 {$IFDEF DEBUGFILE} |
|
369 if isGame then |
|
370 logfileBase:= 'game' |
|
371 else |
|
372 logfileBase:= 'preview'; |
366 {$I-} |
373 {$I-} |
367 {$IFDEF MOBILE} |
374 {$IFDEF MOBILE} |
368 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + cLogfileBase + '.log'); {$ENDIF} |
375 {$IFDEF IPHONEOS} Assign(f,'../Documents/hw-' + logfileBase + '.log'); {$ENDIF} |
369 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + cLogfileBase + '.log'); {$ENDIF} |
376 {$IFDEF ANDROID} Assign(f,pathPrefix + '/' + logfileBase + '.log'); {$ENDIF} |
370 Rewrite(f); |
377 Rewrite(f); |
371 {$ELSE} |
378 {$ELSE} |
372 if (UserPathPrefix <> '') then |
379 if (UserPathPrefix <> '') then |
373 begin |
380 begin |
374 i:= 0; |
381 i:= 0; |
375 while(i < 7) do |
382 while(i < 7) do |
376 begin |
383 begin |
377 assign(f, UserPathPrefix + '/Logs/' + cLogfileBase + inttostr(i) + '.log'); |
384 assign(f, UserPathPrefix + '/Logs/' + logfileBase + inttostr(i) + '.log'); |
378 rewrite(f); |
385 rewrite(f); |
379 if IOResult = 0 then |
386 if IOResult = 0 then |
380 break; |
387 break; |
381 inc(i) |
388 inc(i) |
382 end; |
389 end; |