hedgewars/ArgParsers.pas
changeset 13971 48796bef9e69
parent 13724 6cdb12449be7
child 14619 62dea281e4d5
equal deleted inserted replaced
13970:a1895019bb94 13971:48796bef9e69
   107     WriteLn(stdout, '  --showfps: Show frames per second');
   107     WriteLn(stdout, '  --showfps: Show frames per second');
   108     WriteLn(stdout, '');
   108     WriteLn(stdout, '');
   109     WriteLn(stdout, 'Miscellaneous:');
   109     WriteLn(stdout, 'Miscellaneous:');
   110     WriteLn(stdout, '  --nick <name>: Set user nickname');
   110     WriteLn(stdout, '  --nick <name>: Set user nickname');
   111     WriteLn(stdout, '  --help: Show a list of command-line options and exit');
   111     WriteLn(stdout, '  --help: Show a list of command-line options and exit');
       
   112     WriteLn(stdout, '  --protocol: Display protocol number and exit');
   112     WriteLn(stdout, '');
   113     WriteLn(stdout, '');
   113     Writeln(stdout, 'Advanced options:');
   114     Writeln(stdout, 'Advanced options:');
   114     Writeln(stdout, '  --stereo <value>: Set stereoscopic rendering (1 to 14)');
   115     Writeln(stdout, '  --stereo <value>: Set stereoscopic rendering (1 to 14)');
   115     WriteLn(stdout, '  --frame-interval <milliseconds>: Set minimum interval (in ms) between each frame. Eg, 40 would make the game run at most 25 fps');
   116     WriteLn(stdout, '  --frame-interval <milliseconds>: Set minimum interval (in ms) between each frame. Eg, 40 would make the game run at most 25 fps');
   116     WriteLn(stdout, '  --raw-quality <flags>: Manually specify the reduced quality flags');
   117     WriteLn(stdout, '  --raw-quality <flags>: Manually specify the reduced quality flags');
   117     WriteLn(stdout, '  --stats-only: Write the round information to console without launching the game, useful for statistics only');
   118     WriteLn(stdout, '  --stats-only: Write the round information to console without launching the game, useful for statistics only');
   118     WriteLn(stdout, '  --lua-test <path to script>: Run a Lua test script');
   119     WriteLn(stdout, '  --lua-test <path to script>: Run a Lua test script');
       
   120     GameType:= gmtSyntaxHelp;
       
   121     helpCommandUsed:= true;
       
   122 end;
       
   123 
       
   124 procedure DisplayProtocol;
       
   125 begin
       
   126     WriteLn(stdout, IntToStr(cNetProtoVersion));
   119     GameType:= gmtSyntaxHelp;
   127     GameType:= gmtSyntaxHelp;
   120     helpCommandUsed:= true;
   128     helpCommandUsed:= true;
   121 end;
   129 end;
   122 
   130 
   123 procedure setDepth(var paramIndex: LongInt);
   131 procedure setDepth(var paramIndex: LongInt);
   229 const videoarray: array [0..4] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth');
   237 const videoarray: array [0..4] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth');
   230       audioarray: array [0..2] of string = ('--volume','--nomusic','--nosound');
   238       audioarray: array [0..2] of string = ('--volume','--nomusic','--nosound');
   231       otherarray: array [0..2] of string = ('--locale','--fullscreen','--showfps');
   239       otherarray: array [0..2] of string = ('--locale','--fullscreen','--showfps');
   232       mediaarray: array [0..9] of string = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen');
   240       mediaarray: array [0..9] of string = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen');
   233       allarray: array [0..18] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--nodampen','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags');
   241       allarray: array [0..18] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--nodampen','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags');
   234       reallyAll: array[0..36] of shortstring = (
   242       reallyAll: array[0..37] of shortstring = (
   235                 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width',
   243                 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width',
   236                 '--height', '--frame-interval', '--volume','--nomusic', '--nosound', '--nodampen',
   244                 '--height', '--frame-interval', '--volume','--nomusic', '--nosound', '--nodampen',
   237                 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
   245                 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
   238   {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
   246   {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
   239   {internal}    '--internal', '--port', '--recorder', '--landpreview',
   247   {internal}    '--internal', '--port', '--recorder', '--landpreview',
   240   {misc}        '--stats-only', '--gci', '--help','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags','--lua-test');
   248   {misc}        '--stats-only', '--gci', '--help','--protocol', '--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags','--lua-test');
   241 var cmdIndex: byte;
   249 var cmdIndex: byte;
   242 begin
   250 begin
   243     parseParameter:= false;
   251     parseParameter:= false;
   244     cmdIndex:= 0;
   252     cmdIndex:= 0;
   245 
   253 
   281         {--landpreview}         28 : GameType := gmtLandPreview;
   289         {--landpreview}         28 : GameType := gmtLandPreview;
   282         {anything else}
   290         {anything else}
   283         {--stats-only}          29 : statsOnlyGame();
   291         {--stats-only}          29 : statsOnlyGame();
   284         {--gci}                 30 : GciEasterEgg();
   292         {--gci}                 30 : GciEasterEgg();
   285         {--help}                31 : DisplayUsage();
   293         {--help}                31 : DisplayUsage();
   286         {--no-teamtag}          32 : cTagsMask := cTagsMask and (not htTeamName);
   294         {--protocol}            32 : DisplayProtocol();
   287         {--no-hogtag}           33 : cTagsMask := cTagsMask and (not htName);
   295         {--no-teamtag}          33 : cTagsMask := cTagsMask and (not htTeamName);
   288         {--no-healthtag}        34 : cTagsMask := cTagsMask and (not htHealth);
   296         {--no-hogtag}           34 : cTagsMask := cTagsMask and (not htName);
   289         {--translucent-tags}    35 : cTagsMask := cTagsMask or htTransparent;
   297         {--no-healthtag}        35 : cTagsMask := cTagsMask and (not htHealth);
   290         {--lua-test}            36 : begin cTestLua := true; SetSound(false); cScriptName := getstringParameter(arg, paramIndex, parseParameter); WriteLn(stdout, 'Lua test file specified: ' + cScriptName);end;
   298         {--translucent-tags}    36 : cTagsMask := cTagsMask or htTransparent;
       
   299         {--lua-test}            37 : begin cTestLua := true; SetSound(false); cScriptName := getstringParameter(arg, paramIndex, parseParameter); WriteLn(stdout, 'Lua test file specified: ' + cScriptName);end;
   291     else
   300     else
   292         begin
   301         begin
   293         //Assume the first "non parameter" is the demo file, anything else is invalid
   302         //Assume the first "non parameter" is the demo file, anything else is invalid
   294         if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then
   303         if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then
   295             recordFileName := cmd
   304             recordFileName := cmd