30 {$ENDIF} |
30 {$ENDIF} |
31 |
31 |
32 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound, |
32 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound, |
33 uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, sysutils; |
33 uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions, sysutils; |
34 |
34 |
35 type arrayofpchar = array[0..9] of PChar; |
|
36 var isTerminated: boolean = false; |
35 var isTerminated: boolean = false; |
37 alsoShutdownFrontend: boolean = false; |
36 alsoShutdownFrontend: boolean = false; |
38 |
37 |
39 {$IFDEF HWLIBRARY} |
38 {$IFDEF HWLIBRARY} |
|
39 type arrayofpchar = array[0..9] of PChar; |
|
40 |
40 procedure initEverything(complete:boolean); |
41 procedure initEverything(complete:boolean); |
41 procedure freeEverything(complete:boolean); |
42 procedure freeEverything(complete:boolean); |
42 |
43 |
43 implementation |
44 implementation |
44 {$ELSE} |
45 {$ELSE} |
415 procedure DisplayUsage; |
416 procedure DisplayUsage; |
416 var i: LongInt; |
417 var i: LongInt; |
417 begin |
418 begin |
418 WriteLn('Wrong argument format: correct configurations is'); |
419 WriteLn('Wrong argument format: correct configurations is'); |
419 WriteLn(); |
420 WriteLn(); |
420 WriteLn(' hwengine <path to data folder> <path to replay file> [option]'); |
421 WriteLn(' hwengine <path to data folder> <path to replay file> [options]'); |
421 WriteLn(); |
422 WriteLn(); |
422 WriteLn('where [option] must be specified either as'); |
423 WriteLn('where [options] must be specified either as:'); |
423 WriteLn(' --set-video [screen width] [screen height] [color dept]'); |
424 WriteLn(' --set-video [screen width] [screen height] [color dept]'); |
424 WriteLn(' --set-audio [volume] [enable music] [enable sounds]'); |
425 WriteLn(' --set-audio [volume] [enable music] [enable sounds]'); |
425 WriteLn(' --set-other [language file] [full screen] [show FPS]'); |
426 WriteLn(' --set-other [language file] [full screen] [show FPS]'); |
426 WriteLn(' --set-multimedia [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]'); |
427 WriteLn(' --set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]'); |
427 WriteLn(' --set-everything [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]'); |
428 WriteLn(' --set-everything [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]'); |
428 WriteLn(); |
429 WriteLn(); |
429 WriteLn('Read documentation online at http://www.hedgewars.org/node/1465 for more information'); |
430 WriteLn('Read documentation online at http://code.google.com/p/hedgewars/wiki/CommandLineOptions for more information'); |
430 Write('parsed command: '); |
431 WriteLn(); |
|
432 Write('PARSED COMMAND: '); |
431 for i:=0 to ParamCount do |
433 for i:=0 to ParamCount do |
432 Write(ParamStr(i) + ' '); |
434 Write(ParamStr(i) + ' '); |
433 WriteLn(); |
435 WriteLn(); |
434 end; |
436 end; |
435 |
437 |
436 //////////////////// |
438 //////////////////// |
|
439 {$INCLUDE "ArgParsers.inc"} |
|
440 |
437 procedure GetParams; |
441 procedure GetParams; |
438 begin |
442 begin |
439 case ParamCount of |
443 if (ParamCount < 2) then |
440 18: begin |
444 GameType:= gmtSyntax |
441 val(ParamStr(2), cScreenWidth); |
445 else |
442 val(ParamStr(3), cScreenHeight); |
446 if (ParamCount = 3) then |
443 cBitsStr:= ParamStr(4); |
447 internalSetGameTypeLandPreviewFromParameters() |
444 val(cBitsStr, cBits); |
448 else |
445 val(ParamStr(5), ipcPort); |
449 if (ParamCount = 18) then |
446 cFullScreen:= ParamStr(6) = '1'; |
450 internalStartGameWithParameters() |
447 isSoundEnabled:= ParamStr(7) = '1'; |
|
448 //cVSyncInUse:= ParamStr(8) = '1'; //merged with rqFlags |
|
449 //cWeaponTooltips:= ParamStr(9) = '1'; //merged with rqFlags |
|
450 cLocaleFName:= ParamStr(10); |
|
451 val(ParamStr(11), cInitVolume); |
|
452 val(ParamStr(12), cTimerInterval); |
|
453 PathPrefix:= ParamStr(13); |
|
454 cShowFPS:= ParamStr(14) = '1'; |
|
455 cAltDamage:= ParamStr(15) = '1'; |
|
456 UserNick:= DecodeBase64(ParamStr(16)); |
|
457 isMusicEnabled:= ParamStr(17) = '1'; |
|
458 |
|
459 if (ParamStr(18) = '1') then //HACK - always disable rqLowRes as it's a game breaker |
|
460 cReducedQuality:= $FFFFFFFF xor rqLowRes |
|
461 else |
451 else |
462 val(ParamStr(18), cReducedQuality); |
452 playReplayFileWithParameters(); |
463 |
|
464 if (ParamStr(8) = '0') then //HACK - ifcVSyncInUse not true, disable it |
|
465 cReducedQuality:= cReducedQuality xor rqDesyncVBlank; |
|
466 if (ParamStr(9) = '0') then //HACK - if cWeaponTooltips not true, disable it |
|
467 cReducedQuality:= cReducedQuality xor rqTooltipsOff; |
|
468 end; |
|
469 3: begin |
|
470 val(ParamStr(2), ipcPort); |
|
471 GameType:= gmtLandPreview; |
|
472 if ParamStr(3) <> 'landpreview' then |
|
473 OutError(errmsgShouldntRun, true); |
|
474 end; |
|
475 2: begin |
|
476 PathPrefix:= ParamStr(1); |
|
477 recordFileName:= ParamStr(2); |
|
478 end; |
|
479 6: begin |
|
480 PathPrefix:= ParamStr(1); |
|
481 recordFileName:= ParamStr(2); |
|
482 |
|
483 if ParamStr(3) = '--set-video' then |
|
484 begin |
|
485 val(ParamStr(4), cScreenWidth); |
|
486 val(ParamStr(5), cScreenHeight); |
|
487 cBitsStr:= ParamStr(6); |
|
488 val(cBitsStr, cBits); |
|
489 end |
|
490 else |
|
491 begin |
|
492 if ParamStr(3) = '--set-audio' then |
|
493 begin |
|
494 val(ParamStr(4), cInitVolume); |
|
495 isMusicEnabled:= ParamStr(5) = '1'; |
|
496 isSoundEnabled:= ParamStr(6) = '1'; |
|
497 end |
|
498 else |
|
499 begin |
|
500 if ParamStr(3) = '--set-other' then |
|
501 begin |
|
502 cLocaleFName:= ParamStr(4); |
|
503 cFullScreen:= ParamStr(5) = '1'; |
|
504 cShowFPS:= ParamStr(6) = '1'; |
|
505 end |
|
506 else GameType:= gmtSyntax; |
|
507 end |
|
508 end; |
|
509 end; |
|
510 11: begin |
|
511 PathPrefix:= ParamStr(1); |
|
512 recordFileName:= ParamStr(2); |
|
513 |
|
514 if ParamStr(3) = '--set-multimedia' then |
|
515 begin |
|
516 val(ParamStr(4), cScreenWidth); |
|
517 val(ParamStr(5), cScreenHeight); |
|
518 cBitsStr:= ParamStr(6); |
|
519 val(cBitsStr, cBits); |
|
520 val(ParamStr(7), cInitVolume); |
|
521 isMusicEnabled:= ParamStr(8) = '1'; |
|
522 isSoundEnabled:= ParamStr(9) = '1'; |
|
523 cLocaleFName:= ParamStr(10); |
|
524 cFullScreen:= ParamStr(11) = '1'; |
|
525 end |
|
526 else GameType:= gmtSyntax; |
|
527 end; |
|
528 15: begin |
|
529 PathPrefix:= ParamStr(1); |
|
530 recordFileName:= ParamStr(2); |
|
531 if ParamStr(3) = '--set-everything' then |
|
532 begin |
|
533 val(ParamStr(4), cScreenWidth); |
|
534 val(ParamStr(5), cScreenHeight); |
|
535 cBitsStr:= ParamStr(6); |
|
536 val(cBitsStr, cBits); |
|
537 val(ParamStr(7), cInitVolume); |
|
538 isMusicEnabled:= ParamStr(8) = '1'; |
|
539 isSoundEnabled:= ParamStr(9) = '1'; |
|
540 cLocaleFName:= ParamStr(10); |
|
541 cFullScreen:= ParamStr(11) = '1'; |
|
542 cAltDamage:= ParamStr(12) = '1'; |
|
543 cShowFPS:= ParamStr(13) = '1'; |
|
544 val(ParamStr(14), cTimerInterval); |
|
545 if (ParamStr(15) = '1') then //HACK |
|
546 cReducedQuality:= $FFFFFFFF xor rqLowRes |
|
547 else |
|
548 val(ParamStr(15), cReducedQuality); |
|
549 end |
|
550 else GameType:= gmtSyntax; |
|
551 end; |
|
552 else GameType:= gmtSyntax; |
|
553 end; |
|
554 end; |
453 end; |
555 |
454 |
556 //////////////////////////////////////////////////////////////////////////////// |
455 //////////////////////////////////////////////////////////////////////////////// |
557 /////////////////////////////// m a i n //////////////////////////////////////// |
456 /////////////////////////////// m a i n //////////////////////////////////////// |
558 //////////////////////////////////////////////////////////////////////////////// |
457 //////////////////////////////////////////////////////////////////////////////// |