534 WriteLnToConsole('Preview sent, disconnect'); |
534 WriteLnToConsole('Preview sent, disconnect'); |
535 freeEverything(false); |
535 freeEverything(false); |
536 end; |
536 end; |
537 |
537 |
538 {$IFNDEF HWLIBRARY} |
538 {$IFNDEF HWLIBRARY} |
|
539 /////////////////////////////////////////////////////////////////////////////// |
|
540 procedure DisplayUsage; |
|
541 var i: LongInt; |
|
542 begin |
|
543 WriteLn(stdout, 'Wrong argument format: correct configurations is'); |
|
544 WriteLn(stdout, ''); |
|
545 WriteLn(stdout, ' hwengine [path to user hedgewars folder] <path to global data folder> <path to replay file> [options]'); |
|
546 WriteLn(stdout, ''); |
|
547 WriteLn(stdout, 'where [options] must be specified either as:'); |
|
548 WriteLn(stdout, ' --set-video [screen width] [screen height] [color dept]'); |
|
549 WriteLn(stdout, ' --set-audio [volume] [enable music] [enable sounds]'); |
|
550 WriteLn(stdout, ' --set-other [language file] [full screen] [show FPS]'); |
|
551 WriteLn(stdout, ' --set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]'); |
|
552 WriteLn(stdout, ' --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]'); |
|
553 WriteLn(stdout, ' --stats-only'); |
|
554 WriteLn(stdout, ''); |
|
555 WriteLn(stdout, 'Read documentation online at http://code.google.com/p/hedgewars/wiki/CommandLineOptions for more information'); |
|
556 WriteLn(stdout, ''); |
|
557 Write(stdout, 'PARSED COMMAND: '); |
|
558 |
|
559 for i:=0 to ParamCount do |
|
560 Write(stdout, ParamStr(i) + ' '); |
|
561 |
|
562 WriteLn(stdout, ''); |
|
563 end; |
539 |
564 |
540 /////////////////////////////////////////////////////////////////////////////// |
565 /////////////////////////////////////////////////////////////////////////////// |
541 {$INCLUDE "ArgParsers.inc"} |
566 {$INCLUDE "ArgParsers.inc"} |
542 |
567 |
543 procedure GetParams; |
568 procedure GetParams; |
544 var tmpInt: LongInt; |
569 var startIndex : LongInt; |
545 begin |
570 begin |
546 if (ParamCount < 3) then |
571 if (ParamCount < 2) then |
547 begin |
572 GameType:= gmtSyntax |
548 DisplayUsage(); |
|
549 GameType:= gmtSyntax; |
|
550 end |
|
551 else |
573 else |
552 if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then |
574 if (ParamCount >= 2) then |
|
575 begin |
|
576 UserPathPrefix:= ParamStr(1); |
|
577 PathPrefix:= ParamStr(2) |
|
578 end; |
|
579 if (ParamCount >= 3) then |
|
580 recordFileName:= ParamStr(3); |
|
581 if (ParamCount = 2) or |
|
582 ((ParamCount >= 3) and (Copy(recordFileName,1,2) = '--')) then |
|
583 begin |
|
584 recordFileName := PathPrefix; |
|
585 PathPrefix := UserPathPrefix; |
|
586 startIndex := 3; |
|
587 WriteLn(stdout,'defaulting UserPathPrefix') |
|
588 end |
|
589 else |
|
590 startIndex := 4; |
|
591 if (ParamCount = startIndex) and |
|
592 (ParamStr(startIndex) = 'landpreview') then |
553 begin |
593 begin |
554 ipcPort:= StrToInt(ParamStr(2)); |
594 ipcPort:= StrToInt(ParamStr(2)); |
555 GameType:= gmtLandPreview; |
595 GameType:= gmtLandPreview; |
556 end |
596 end |
557 else |
597 else |
558 begin |
598 begin |
559 if (ParamCount = 3) and (ParamStr(3) = '--stats-only') then |
599 if (ParamCount = startIndex) and |
560 playReplayFileWithParameters() |
600 (ParamStr(startIndex) = '--stats-only') then |
|
601 playReplayFileWithParameters(startIndex) |
561 else |
602 else |
562 if ParamCount = cDefaultParamNum then |
603 if ParamCount = cDefaultParamNum then |
563 internalStartGameWithParameters() |
604 internalStartGameWithParameters() |
564 {$IFDEF USE_VIDEO_RECORDING} |
605 {$IFDEF USE_VIDEO_RECORDING} |
565 else if ParamCount = cVideorecParamNum then |
606 else if ParamCount = cVideorecParamNum then |
566 internalStartVideoRecordingWithParameters() |
607 internalStartVideoRecordingWithParameters() |
567 {$ENDIF} |
608 {$ENDIF} |
568 else |
609 else |
569 playReplayFileWithParameters(); |
610 playReplayFileWithParameters(startIndex); |
570 end |
611 end |
571 end; |
612 end; |
572 |
613 |
573 /////////////////////////////////////////////////////////////////////////////// |
614 /////////////////////////////////////////////////////////////////////////////// |
574 /////////////////////////////////// m a i n /////////////////////////////////// |
615 /////////////////////////////////// m a i n /////////////////////////////////// |