hedgewars/ArgParsers.inc
author Guillaume Englert
Tue, 11 Oct 2011 10:44:27 -0400
changeset 6125 663e05d9cf66
parent 5441 39962b855540
child 6426 2d44f6561e72
permissions -rw-r--r--
another crystal, spray and landtex tweaks.
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
5130
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    19
procedure playReplayFileWithParameters(); forward;
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    20
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    21
procedure internalSetGameTypeLandPreviewFromParameters();
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    22
begin
5130
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    23
    if ParamStr(3) = '--stats-only' then
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    24
        playReplayFileWithParameters()
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    25
    else
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    26
        begin
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    27
        val(ParamStr(2), ipcPort);
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    28
        GameType:= gmtLandPreview;
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    29
        if ParamStr(3) <> 'landpreview' then
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    30
            GameType:= gmtSyntax
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
    31
        end
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    32
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    33
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    34
procedure internalStartGameWithParameters();
4004
b1c2c2f6fc5e update branch with latest head, most likely breaking water color in stereo mode
koda
parents: 3858
diff changeset
    35
var tmp: LongInt;
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    36
begin
5239
f34f391a223b Bit more reusability
nemo
parents: 5238
diff changeset
    37
    UserPathPrefix:= ParamStr(1);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    38
    val(ParamStr(2), cScreenWidth);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    39
    val(ParamStr(3), cScreenHeight);
3709
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    40
    val(ParamStr(4), cBits);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    41
    val(ParamStr(5), ipcPort);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    42
    cFullScreen:= ParamStr(6) = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    43
    isSoundEnabled:= ParamStr(7) = '1';
3709
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    44
    isMusicEnabled:= ParamStr(8) = '1';
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    45
    val(ParamStr(9), cInitVolume);
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    46
    val(ParamStr(10), cTimerInterval);
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    47
    PathPrefix:= ParamStr(11);
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    48
    cShowFPS:= ParamStr(12) = '1';
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    49
    cAltDamage:= ParamStr(13) = '1';
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    50
    UserNick:= DecodeBase64(ParamStr(14));
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    51
    val(ParamStr(15), cReducedQuality);
4004
b1c2c2f6fc5e update branch with latest head, most likely breaking water color in stereo mode
koda
parents: 3858
diff changeset
    52
    val(ParamStr(16), tmp);
5441
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    53
    cGrayScale:= false;
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    54
    if (tmp > 9) and (tmp < 16) then 
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    55
        begin
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    56
        cGrayScale:= true;
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    57
        cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-9)))
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    58
        end
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    59
    else if tmp <= 9 then cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)))
39962b855540 Add grayscale option for 3d, helps with colour clashing
nemo
parents: 5239
diff changeset
    60
    else cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)));
4004
b1c2c2f6fc5e update branch with latest head, most likely breaking water color in stereo mode
koda
parents: 3858
diff changeset
    61
    cLocaleFName:= ParamStr(17);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    62
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    63
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    64
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
    65
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    66
    cScreenWidth:= screenWidth;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    67
    cScreenHeight:= screenHeight;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    68
    cBits:= bitsStr
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 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
    72
var screenWidthAsInt, screenHeightAsInt, bitsStrAsInt: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    73
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    74
    val(screenWidthParam, screenWidthAsInt);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    75
    val(screenHeightParam, screenHeightAsInt);
3709
c7849b74748d clean and reorder arguments passed to engine
koda
parents: 3708
diff changeset
    76
    val(bitsParam, bitsStrAsInt);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    77
    setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt)
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    78
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    79
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    80
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
    81
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    82
    cLocaleFName:= languageFile;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    83
    cFullScreen:= fullScreen
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    84
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    85
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    86
procedure setShowFPS(showFPS: boolean);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    87
begin
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    88
    cShowFPS:= showFPS
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    89
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    90
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    91
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
    92
var fullScreen, showFPS: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    93
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    94
    fullScreen:= fullScreenParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    95
    showFPS:= showFPSParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    96
    setOtherOptions(languageFileParam,fullScreen);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
    97
    setShowFPS(showFPS)
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    98
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
    99
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   100
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
   101
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   102
    cInitVolume:= initialVolume;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   103
    isMusicEnabled:= musicEnabled;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   104
    isSoundEnabled:= soundEnabled
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   105
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   106
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   107
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
   108
var initialVolumeAsInt: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   109
    musicEnabled, soundEnabled: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   110
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   111
    val(initialVolumeParam, initialVolumeAsInt);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   112
    musicEnabled:= musicEnabledParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   113
    soundEnabled:= soundEnabledParam = '1';
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   114
    setAudio(initialVolumeAsInt,musicEnabled, soundEnabled)
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   115
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   116
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   117
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
   118
                                             initialVolumeParam, musicEnabledParam, soundEnabledParam: string;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   119
                                             languageFileParam, fullScreenParam: string);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   120
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   121
    setVideoWithParameters(screenWidthParam,screenHeightParam, bitsParam);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   122
    setAudioWithParameters(initialVolumeParam,musicEnabledParam,soundEnabledParam);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   123
    setOtherOptions(languageFileParam,fullScreenParam = '1')
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   124
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   125
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   126
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
   127
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   128
    cAltDamage:= altDamage;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   129
    cTimerInterval:= timeIterval;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   130
    if (reducedQuality) then        //HACK
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   131
        cReducedQuality:= $FFFFFFFF xor rqLowRes
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   132
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   133
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   134
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
   135
                                      initialVolumeParam:string; musicEnabledParam:string; soundEnabledParam:string;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   136
                                      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
   137
                                      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
   138
var showFPS, altDamage, reducedQuality: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   139
    timeIterval: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   140
begin
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   141
    setMultimediaOptionsWithParameters(screenWidthParam,screenHeightParam, bitsParam,
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   142
                                       initialVolumeParam,musicEnabledParam,soundEnabledParam,
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   143
                                       languageFileParam,fullScreenParam);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   144
    showFPS := showFPSParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   145
    setShowFPS(showFPS);
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   146
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   147
    altDamage:= altDamageParam = '1';
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   148
    val(timeItervalParam, timeIterval);
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   149
    reducedQuality:= reducedQualityParam = '1';
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   150
    setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality);
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   151
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   152
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   153
procedure playReplayFileWithParameters();
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   154
var paramIndex: LongInt;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   155
    wrongParameter: boolean;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   156
begin
5239
f34f391a223b Bit more reusability
nemo
parents: 5238
diff changeset
   157
    UserPathPrefix:= ParamStr(1);
5238
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5130
diff changeset
   158
    PathPrefix:= ParamStr(2);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5130
diff changeset
   159
    recordFileName:= ParamStr(3);
46ddaf14509d Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents: 5130
diff changeset
   160
    paramIndex:= 4;
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   161
    wrongParameter:= false;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   162
    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
   163
        begin
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   164
        if ParamStr(paramIndex) = '--set-video'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   165
//--set-video [screen width] [screen height] [color dept]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   166
            begin
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   167
            if(ParamCount-paramIndex < 3) then
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   168
                begin
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   169
                wrongParameter:= true;
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   170
                GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   171
                end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   172
            setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   173
            paramIndex:= paramIndex + 4
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   174
            end
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   175
        else
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   176
//--set-audio [volume] [enable music] [enable sounds]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   177
            if ParamStr(paramIndex) = '--set-audio'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   178
                begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   179
                if(ParamCount-paramIndex < 3) then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   180
                    begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   181
                    wrongParameter := true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   182
                    GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   183
                    end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   184
                setAudioWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   185
                paramIndex:= paramIndex + 4
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   186
                end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   187
            else
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   188
// --set-other [language file] [full screen] [show FPS]
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   189
                if ParamStr(paramIndex) = '--set-other'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   190
                    begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   191
                    if(ParamCount-paramIndex < 3) then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   192
                        begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   193
                        wrongParameter:= true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   194
                        GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   195
                        end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   196
                    setOtherOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   197
                    paramIndex:= paramIndex + 4
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   198
                    end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   199
                else
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   200
//--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
   201
                    if ParamStr(paramIndex) = '--set-multimedia'  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
                        if ParamCount-paramIndex < 8  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   204
                            begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   205
                            wrongParameter:= true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   206
                            GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   207
                            end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   208
                        setMultimediaOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   209
                                                           ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   210
                                                           ParamStr(paramIndex+7),ParamStr(paramIndex+8));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   211
                        paramIndex:= paramIndex + 9
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   212
                        end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   213
                    else
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   214
//--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
   215
                        if ParamStr(paramIndex) = '--set-everything'  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   216
                            begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   217
                            if ParamCount-paramIndex < 12  then
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   218
                                begin
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   219
                                wrongParameter:= true;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   220
                                GameType:= gmtSyntax
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   221
                                end;
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   222
                            setAllOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   223
                                                        ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   224
                                                        ParamStr(paramIndex+7),ParamStr(paramIndex+8),ParamStr(paramIndex+9),
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   225
                                                        ParamStr(paramIndex+10),ParamStr(paramIndex+11),ParamStr(paramIndex+12));
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   226
                            paramIndex:= paramIndex + 13
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   227
                            end
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   228
                        else
5130
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   229
                            if ParamStr(paramIndex) = '--stats-only'  then
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   230
                                begin
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   231
                                cOnlyStats:= true;
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   232
                                isSoundEnabled:= false;
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   233
                                isMusicEnabled:= false;
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   234
                                cReducedQuality:= $FFFFFFFF xor rqLowRes; // HACK
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   235
                                paramIndex:= paramIndex + 1
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   236
                                end
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   237
                            else
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   238
                                begin
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   239
                                wrongParameter:= true;
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   240
                                GameType:= gmtSyntax
3602ede67ec5 Add a parameter for game simulation with no gui/sound enabled, just to get statistics
unc0rr
parents: 4976
diff changeset
   241
                                end
3858
e40e5dfe9d5b clean up koda's indenting :-p
nemo
parents: 3709
diff changeset
   242
    end
3678
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   243
end;
00428183300f patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff changeset
   244