212 {$IFDEF HWLIBRARY} |
212 {$IFDEF HWLIBRARY} |
213 cBits:= 32; |
213 cBits:= 32; |
214 cFullScreen:= false; |
214 cFullScreen:= false; |
215 cTimerInterval:= 8; |
215 cTimerInterval:= 8; |
216 PathPrefix:= 'Data'; |
216 PathPrefix:= 'Data'; |
|
217 UserPathPrefix:= 'Data'; |
217 cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF}; |
218 cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF}; |
218 val(gameArgs[0], ipcPort); |
219 val(gameArgs[0], ipcPort); |
219 val(gameArgs[1], cScreenWidth); |
220 val(gameArgs[1], cScreenWidth); |
220 val(gameArgs[2], cScreenHeight); |
221 val(gameArgs[2], cScreenHeight); |
221 val(gameArgs[3], cReducedQuality); |
222 val(gameArgs[3], cReducedQuality); |
232 cLogfileBase:= 'game'; |
233 cLogfileBase:= 'game'; |
233 initEverything(true); |
234 initEverything(true); |
234 |
235 |
235 WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); |
236 WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); |
236 AddFileLog('Prefix: "' + PathPrefix +'"'); |
237 AddFileLog('Prefix: "' + PathPrefix +'"'); |
|
238 AddFileLog('UserPrefix: "' + UserPathPrefix +'"'); |
237 for i:= 0 to ParamCount do |
239 for i:= 0 to ParamCount do |
238 AddFileLog(inttostr(i) + ': ' + ParamStr(i)); |
240 AddFileLog(inttostr(i) + ': ' + ParamStr(i)); |
|
241 |
|
242 for p:= Succ(Low(TPathType)) to High(TPathType) do |
|
243 if p <> ptMapCurrent then UserPathz[p]:= UserPathPrefix + '/' + Pathz[p]; |
239 |
244 |
240 for p:= Succ(Low(TPathType)) to High(TPathType) do |
245 for p:= Succ(Low(TPathType)) to High(TPathType) do |
241 if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]; |
246 if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]; |
242 |
247 |
243 WriteToConsole('Init SDL... '); |
248 WriteToConsole('Init SDL... '); |
261 |
266 |
262 ControllerInit(); // has to happen before InitKbdKeyTable to map keys |
267 ControllerInit(); // has to happen before InitKbdKeyTable to map keys |
263 InitKbdKeyTable(); |
268 InitKbdKeyTable(); |
264 AddProgress(); |
269 AddProgress(); |
265 |
270 |
|
271 LoadLocale(UserPathz[ptLocale] + '/en.txt'); // Do an initial load with english |
266 LoadLocale(Pathz[ptLocale] + '/en.txt'); // Do an initial load with english |
272 LoadLocale(Pathz[ptLocale] + '/en.txt'); // Do an initial load with english |
267 if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5) |
273 if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5) |
268 else cLocale := Copy(cLocaleFName,1,2); |
274 else cLocale := Copy(cLocaleFName,1,2); |
269 if cLocaleFName <> 'en.txt' then |
275 if cLocaleFName <> 'en.txt' then |
270 begin |
276 begin |
271 // Try two letter locale first before trying specific locale overrides |
277 // Try two letter locale first before trying specific locale overrides |
272 if (Length(cLocale) > 2) and (Copy(cLocale,1,2) <> 'en') then |
278 if (Length(cLocale) > 2) and (Copy(cLocale,1,2) <> 'en') then |
273 LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt'); |
279 begin |
274 LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName); |
280 LoadLocale(UserPathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt'); |
|
281 LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt') |
|
282 end; |
|
283 LoadLocale(UserPathz[ptLocale] + '/' + cLocaleFName); |
|
284 LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName) |
275 end |
285 end |
276 else cLocale := 'en'; |
286 else cLocale := 'en'; |
277 |
287 |
278 WriteLnToConsole(msgGettingConfig); |
288 WriteLnToConsole(msgGettingConfig); |
279 |
289 |
428 procedure DisplayUsage; |
438 procedure DisplayUsage; |
429 var i: LongInt; |
439 var i: LongInt; |
430 begin |
440 begin |
431 WriteLn('Wrong argument format: correct configurations is'); |
441 WriteLn('Wrong argument format: correct configurations is'); |
432 WriteLn(); |
442 WriteLn(); |
433 WriteLn(' hwengine <path to data folder> <path to replay file> [options]'); |
443 WriteLn(' hwengine <path to user hedgewars folder> <path to global data folder> <path to replay file> [options]'); |
434 WriteLn(); |
444 WriteLn(); |
435 WriteLn('where [options] must be specified either as:'); |
445 WriteLn('where [options] must be specified either as:'); |
436 WriteLn(' --set-video [screen width] [screen height] [color dept]'); |
446 WriteLn(' --set-video [screen width] [screen height] [color dept]'); |
437 WriteLn(' --set-audio [volume] [enable music] [enable sounds]'); |
447 WriteLn(' --set-audio [volume] [enable music] [enable sounds]'); |
438 WriteLn(' --set-other [language file] [full screen] [show FPS]'); |
448 WriteLn(' --set-other [language file] [full screen] [show FPS]'); |
451 //////////////////// |
461 //////////////////// |
452 {$INCLUDE "ArgParsers.inc"} |
462 {$INCLUDE "ArgParsers.inc"} |
453 |
463 |
454 procedure GetParams; |
464 procedure GetParams; |
455 begin |
465 begin |
456 if (ParamCount < 2) then |
466 if (ParamCount < 3) then |
457 GameType:= gmtSyntax |
467 GameType:= gmtSyntax |
458 else |
468 else |
459 if (ParamCount = 3) then |
469 if (ParamCount = 3) and ((ParamStr(3) = '--stats-only') or (ParamStr(3) = 'landpreview')) then |
460 internalSetGameTypeLandPreviewFromParameters() |
470 internalSetGameTypeLandPreviewFromParameters() |
461 else |
471 else |
462 if (ParamCount = cDefaultParamNum) then |
472 if (ParamCount = cDefaultParamNum) then |
463 internalStartGameWithParameters() |
473 internalStartGameWithParameters() |
464 else |
474 else |