hedgewars/ArgParsers.inc
author Zorg <zorgiepoo@gmail.com>
Sat, 02 Apr 2011 12:50:07 -0400
changeset 5080 2e29c1e1c9cd
parent 4976 088d40d8aba2
child 5130 3602ede67ec5
permissions -rw-r--r--
I forgot to add this file.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     1
(*
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     2
 * Hedgewars, a free turn based strategy game
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     3
 * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     4
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     8
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    12
 * GNU General Public License for more details.
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    13
 *
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    14
 * You should have received a copy of the GNU General Public License
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    15
 * along with this program; if not, write to the Free Software
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
088d40d8aba2 Happy 2011 :)
koda
parents: 4004
diff changeset
    17
 *)
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    18
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    19
procedure internalSetGameTypeLandPreviewFromParameters();
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    20
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    21
    val(ParamStr(2), ipcPort);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    22
    GameType:= gmtLandPreview;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    23
    if ParamStr(3) <> 'landpreview' then
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    24
        GameType:= gmtSyntax
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    25
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    26
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    27
procedure internalStartGameWithParameters();
4004
b1c2c2f6fc5e update branch with latest head, most likely breaking water color in stereo mode
koda
parents: 3858
diff changeset
    28
var tmp: LongInt;
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    29
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    30
    val(ParamStr(2), cScreenWidth);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    31
    val(ParamStr(3), cScreenHeight);
3709
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    32
    val(ParamStr(4), cBits);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    33
    val(ParamStr(5), ipcPort);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    34
    cFullScreen:= ParamStr(6) = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    35
    isSoundEnabled:= ParamStr(7) = '1';
3709
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    36
    isMusicEnabled:= ParamStr(8) = '1';
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    37
    val(ParamStr(9), cInitVolume);
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    38
    val(ParamStr(10), cTimerInterval);
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    39
    PathPrefix:= ParamStr(11);
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    40
    cShowFPS:= ParamStr(12) = '1';
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    41
    cAltDamage:= ParamStr(13) = '1';
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    42
    UserNick:= DecodeBase64(ParamStr(14));
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    43
    val(ParamStr(15), cReducedQuality);
4004
b1c2c2f6fc5e update branch with latest head, most likely breaking water color in stereo mode
koda
parents: 3858
diff changeset
    44
    val(ParamStr(16), tmp);
b1c2c2f6fc5e update branch with latest head, most likely breaking water color in stereo mode
koda
parents: 3858
diff changeset
    45
    cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)));
b1c2c2f6fc5e update branch with latest head, most likely breaking water color in stereo mode
koda
parents: 3858
diff changeset
    46
    cLocaleFName:= ParamStr(17);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    47
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    48
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    49
procedure setVideo(screenWidth: LongInt; screenHeight: LongInt; bitsStr: LongInt);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    50
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    51
    cScreenWidth:= screenWidth;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    52
    cScreenHeight:= screenHeight;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    53
    cBits:= bitsStr
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    54
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    55
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    56
procedure setVideoWithParameters(screenWidthParam: string; screenHeightParam: string; bitsParam: string);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    57
var screenWidthAsInt, screenHeightAsInt, bitsStrAsInt: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    58
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    59
    val(screenWidthParam, screenWidthAsInt);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    60
    val(screenHeightParam, screenHeightAsInt);
3709
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    61
    val(bitsParam, bitsStrAsInt);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    62
    setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt)
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    63
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    64
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    65
procedure setOtherOptions(languageFile: string; fullScreen: boolean);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    66
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    67
    cLocaleFName:= languageFile;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    68
    cFullScreen:= fullScreen
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    69
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    70
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    71
procedure setShowFPS(showFPS: boolean);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    72
begin
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    73
    cShowFPS:= showFPS
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    74
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    75
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    76
procedure setOtherOptionsWithParameters(languageFileParam: string; fullScreenParam: string; showFPSParam: string);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    77
var fullScreen, showFPS: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    78
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    79
    fullScreen:= fullScreenParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    80
    showFPS:= showFPSParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    81
    setOtherOptions(languageFileParam,fullScreen);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    82
    setShowFPS(showFPS)
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    83
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    84
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    85
procedure setAudio(initialVolume: LongInt; musicEnabled: boolean; soundEnabled: boolean);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    86
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    87
    cInitVolume:= initialVolume;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    88
    isMusicEnabled:= musicEnabled;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    89
    isSoundEnabled:= soundEnabled
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    90
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    91
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    92
procedure setAudioWithParameters(initialVolumeParam: string; musicEnabledParam: string; soundEnabledParam: string);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    93
var initialVolumeAsInt: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    94
    musicEnabled, soundEnabled: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    95
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    96
    val(initialVolumeParam, initialVolumeAsInt);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    97
    musicEnabled:= musicEnabledParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    98
    soundEnabled:= soundEnabledParam = '1';
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    99
    setAudio(initialVolumeAsInt,musicEnabled, soundEnabled)
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   100
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   101
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   102
procedure setMultimediaOptionsWithParameters(screenWidthParam, screenHeightParam, bitsParam: string;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   103
                                             initialVolumeParam, musicEnabledParam, soundEnabledParam: string;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   104
                                             languageFileParam, fullScreenParam: string);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   105
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   106
    setVideoWithParameters(screenWidthParam,screenHeightParam, bitsParam);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   107
    setAudioWithParameters(initialVolumeParam,musicEnabledParam,soundEnabledParam);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   108
    setOtherOptions(languageFileParam,fullScreenParam = '1')
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   109
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   110
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   111
procedure setAltDamageTimerValueAndQuality(altDamage: boolean; timeIterval: LongInt; reducedQuality: boolean);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   112
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   113
    cAltDamage:= altDamage;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   114
    cTimerInterval:= timeIterval;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   115
    if (reducedQuality) then        //HACK
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   116
        cReducedQuality:= $FFFFFFFF xor rqLowRes
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   117
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   118
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   119
procedure setAllOptionsWithParameters(screenWidthParam:string; screenHeightParam:string; bitsParam:string;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   120
                                      initialVolumeParam:string; musicEnabledParam:string; soundEnabledParam:string;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   121
                                      languageFileParam:string; fullScreenParam:string; showFPSParam:string;
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   122
                                      altDamageParam:string; timeItervalParam:string; reducedQualityParam: string);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   123
var showFPS, altDamage, reducedQuality: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   124
    timeIterval: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   125
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   126
    setMultimediaOptionsWithParameters(screenWidthParam,screenHeightParam, bitsParam,
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   127
                                       initialVolumeParam,musicEnabledParam,soundEnabledParam,
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   128
                                       languageFileParam,fullScreenParam);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   129
    showFPS := showFPSParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   130
    setShowFPS(showFPS);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   131
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   132
    altDamage:= altDamageParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   133
    val(timeItervalParam, timeIterval);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   134
    reducedQuality:= reducedQualityParam = '1';
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   135
    setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   136
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   137
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   138
procedure playReplayFileWithParameters();
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   139
var paramIndex: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   140
    wrongParameter: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   141
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   142
    PathPrefix:= ParamStr(1);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   143
    recordFileName:= ParamStr(2);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   144
    paramIndex:= 3;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   145
    wrongParameter:= false;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   146
    while (paramIndex <= ParamCount) and not wrongParameter do
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   147
        begin
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   148
        if ParamStr(paramIndex) = '--set-video'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   149
//--set-video [screen width] [screen height] [color dept]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   150
            begin
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   151
            if(ParamCount-paramIndex < 3) then
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   152
                begin
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   153
                wrongParameter:= true;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   154
                GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   155
                end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   156
            setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   157
            paramIndex:= paramIndex + 4
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   158
            end
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   159
        else
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   160
//--set-audio [volume] [enable music] [enable sounds]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   161
            if ParamStr(paramIndex) = '--set-audio'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   162
                begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   163
                if(ParamCount-paramIndex < 3) then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   164
                    begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   165
                    wrongParameter := true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   166
                    GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   167
                    end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   168
                setAudioWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   169
                paramIndex:= paramIndex + 4
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   170
                end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   171
            else
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   172
// --set-other [language file] [full screen] [show FPS]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   173
                if ParamStr(paramIndex) = '--set-other'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   174
                    begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   175
                    if(ParamCount-paramIndex < 3) then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   176
                        begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   177
                        wrongParameter:= true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   178
                        GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   179
                        end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   180
                    setOtherOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   181
                    paramIndex:= paramIndex + 4
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   182
                    end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   183
                else
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   184
//--set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   185
                    if ParamStr(paramIndex) = '--set-multimedia'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   186
                        begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   187
                        if ParamCount-paramIndex < 8  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   188
                            begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   189
                            wrongParameter:= true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   190
                            GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   191
                            end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   192
                        setMultimediaOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   193
                                                           ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   194
                                                           ParamStr(paramIndex+7),ParamStr(paramIndex+8));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   195
                        paramIndex:= paramIndex + 9
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   196
                        end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   197
                    else
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   198
//--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]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   199
                        if ParamStr(paramIndex) = '--set-everything'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   200
                            begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   201
                            if ParamCount-paramIndex < 12  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   202
                                begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   203
                                wrongParameter:= true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   204
                                GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   205
                                end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   206
                            setAllOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   207
                                                        ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   208
                                                        ParamStr(paramIndex+7),ParamStr(paramIndex+8),ParamStr(paramIndex+9),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   209
                                                        ParamStr(paramIndex+10),ParamStr(paramIndex+11),ParamStr(paramIndex+12));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   210
                            paramIndex:= paramIndex + 13
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   211
                            end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   212
                        else
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   213
                            begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   214
                            wrongParameter:= true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   215
                            GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   216
                            end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   217
    end
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   218
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   219