author | Joe Doyle (Ginto8) <ginto8@gmail.com> |
Sat, 01 Dec 2012 15:56:19 -0500 | |
changeset 8174 | df02c2ad4a2c |
parent 8167 | 96635d815141 |
child 8209 | 780e156f19ea |
permissions | -rw-r--r-- |
4976 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
6700 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
4976 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
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 |
|
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
20 |
procedure internalStartGameWithParameters(); |
4004
b1c2c2f6fc5e
update branch with latest head, most likely breaking water color in stereo mode
koda
parents:
3858
diff
changeset
|
21 |
var tmp: LongInt; |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
22 |
begin |
5239 | 23 |
UserPathPrefix:= ParamStr(1); |
7151 | 24 |
cScreenWidth:= StrToInt(ParamStr(2)); |
25 |
cScreenHeight:= StrToInt(ParamStr(3)); |
|
26 |
cBits:= StrToInt(ParamStr(4)); |
|
27 |
ipcPort:= StrToInt(ParamStr(5)); |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
28 |
cFullScreen:= ParamStr(6) = '1'; |
7021
0c75512a8920
adjust the scope of a few uSound variables and functions
koda
parents:
6982
diff
changeset
|
29 |
SetSound(ParamStr(7) = '1'); |
0c75512a8920
adjust the scope of a few uSound variables and functions
koda
parents:
6982
diff
changeset
|
30 |
SetMusic(ParamStr(8) = '1'); |
7151 | 31 |
SetVolume(StrToInt(ParamStr(9))); |
32 |
cTimerInterval:= StrToInt(ParamStr(10)); |
|
3709 | 33 |
PathPrefix:= ParamStr(11); |
34 |
cShowFPS:= ParamStr(12) = '1'; |
|
35 |
cAltDamage:= ParamStr(13) = '1'; |
|
36 |
UserNick:= DecodeBase64(ParamStr(14)); |
|
7151 | 37 |
cReducedQuality:= StrToInt(ParamStr(15)); |
38 |
tmp:= StrToInt(ParamStr(16)); |
|
6982 | 39 |
GrayScale:= false; |
5441
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5239
diff
changeset
|
40 |
if (tmp > 9) and (tmp < 16) then |
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5239
diff
changeset
|
41 |
begin |
6982 | 42 |
GrayScale:= true; |
5441
39962b855540
Add grayscale option for 3d, helps with colour clashing
nemo
parents:
5239
diff
changeset
|
43 |
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
|
44 |
end |
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6426
diff
changeset
|
45 |
else if tmp <= 9 then |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6426
diff
changeset
|
46 |
cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp))) |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6426
diff
changeset
|
47 |
else |
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6426
diff
changeset
|
48 |
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
|
49 |
cLocaleFName:= ParamStr(17); |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
50 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
51 |
|
7198
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
52 |
{$IFDEF USE_VIDEO_RECORDING} |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
53 |
procedure internalStartVideoRecordingWithParameters(); |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
54 |
begin |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
55 |
internalStartGameWithParameters(); |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
56 |
GameType:= gmtRecord; |
7376
48b79b3ca592
rework saving of camera positions so there is no need to know framerate during prerecording.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
57 |
cVideoFramerateNum:= StrToInt(ParamStr(18)); |
48b79b3ca592
rework saving of camera positions so there is no need to know framerate during prerecording.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
58 |
cVideoFramerateDen:= StrToInt(ParamStr(19)); |
7306
3cff5c769509
Here they come - thumbnails.
Stepan777 <stepik-777@mail.ru>
parents:
7235
diff
changeset
|
59 |
RecPrefix:= ParamStr(20); |
7198
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
60 |
cAVFormat:= ParamStr(21); |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
61 |
cVideoCodec:= ParamStr(22); |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
62 |
cVideoQuality:= StrToInt(ParamStr(23)); |
7376
48b79b3ca592
rework saving of camera positions so there is no need to know framerate during prerecording.
Stepan777 <stepik-777@mail.ru>
parents:
7306
diff
changeset
|
63 |
cAudioCodec:= ParamStr(24); |
7198
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
64 |
end; |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
65 |
{$ENDIF} |
5debd5fe526e
1. Add IFDEFs for video recording
Stepan777 <stepik-777@mail.ru>
parents:
7180
diff
changeset
|
66 |
|
8150 | 67 |
procedure DisplayUsage; |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
68 |
begin |
8150 | 69 |
WriteLn(stdout, 'Usage:'); |
70 |
WriteLn(stdout, ''); |
|
8167
96635d815141
Make user folder default to global folder in hwengine
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8150
diff
changeset
|
71 |
WriteLn(stdout, ' hwengine [path to user hedgewars folder] <path to global data folder> <path to replay file> [options]'); |
8150 | 72 |
WriteLn(stdout, ''); |
73 |
WriteLn(stdout, 'where [options] are any of the following:'); |
|
74 |
WriteLn(stdout, ' --locale [path to language file]'); |
|
75 |
WriteLn(stdout, ' --width [screen width in pixels]'); |
|
76 |
WriteLn(stdout, ' --height [screen height in pixels]'); |
|
77 |
WriteLn(stdout, ' --depth [color depth]'); |
|
78 |
WriteLn(stdout, ' --volume [sound level]'); |
|
79 |
WriteLn(stdout, ' --time [number of seconds]'); |
|
80 |
WriteLn(stdout, ' --nomusic'); |
|
81 |
WriteLn(stdout, ' --nosound'); |
|
82 |
WriteLn(stdout, ' --fullscreen'); |
|
83 |
WriteLn(stdout, ' --showfps'); |
|
84 |
WriteLn(stdout, ' --altdmg'); |
|
85 |
WriteLn(stdout, ' --lowquality'); |
|
86 |
WriteLn(stdout, ' --stats-only'); |
|
87 |
WriteLn(stdout, ' --help'); |
|
88 |
WriteLn(stdout, ''); |
|
89 |
WriteLn(stdout, 'Deprecated options:'); |
|
90 |
WriteLn(stdout, ' --set-video [screen width] [screen height] [color dept]'); |
|
91 |
WriteLn(stdout, ' --set-audio [volume] [enable music] [enable sounds]'); |
|
92 |
WriteLn(stdout, ' --set-other [language file] [full screen] [show FPS]'); |
|
93 |
WriteLn(stdout, ' --set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]'); |
|
94 |
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]'); |
|
95 |
WriteLn(stdout, ''); |
|
96 |
WriteLn(stdout, 'For a more detailed help and examples go to:'); |
|
97 |
WriteLn(stdout, 'http://code.google.com/p/hedgewars/wiki/CommandLineOptions'); |
|
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 |
|
8150 | 100 |
function getLongIntParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt; |
101 |
var tmpInt, c: LongInt; |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
102 |
begin |
8150 | 103 |
paramIndex:= paramIndex + 1; |
104 |
val(str, tmpInt, c); |
|
105 |
wrongParameter:= c <> 0; |
|
106 |
if wrongParameter then |
|
107 |
WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a number, you passed "'+str+'"'); |
|
108 |
getLongIntParameter:= tmpInt; |
|
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 |
|
8150 | 111 |
function getStringParameter(str:String; var paramIndex:LongInt): String; |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
112 |
begin |
8150 | 113 |
paramIndex:= paramIndex + 1; |
114 |
getStringParameter:= str; |
|
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 |
|
8150 | 117 |
procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); Forward; |
118 |
||
119 |
function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean; |
|
120 |
const videoArray: Array [1..3] of String = ('--width','--height','--depth'); |
|
121 |
const audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound'); |
|
122 |
const otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps'); |
|
123 |
const mediaArray: Array [1..8] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen'); |
|
124 |
const allArray: Array [1..12] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--time','--lowquality'); |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
125 |
begin |
8150 | 126 |
parseParameter:= false; |
8174
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
127 |
if cmd = '--locale' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
128 |
cLocaleFName := getStringParameter (arg, paramIndex) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
129 |
else if cmd = '--width' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
130 |
cScreenWidth := getLongIntParameter(arg, paramIndex, parseParameter) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
131 |
else if cmd = '--height' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
132 |
cScreenHeight := getLongIntParameter(arg, paramIndex, parseParameter) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
133 |
else if cmd = '--depth' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
134 |
cBits := getLongIntParameter(arg, paramIndex, parseParameter) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
135 |
else if cmd = '--time' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
136 |
cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
137 |
else if cmd = '--volume' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
138 |
SetVolume ( getLongIntParameter(arg, paramIndex, parseParameter) ) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
139 |
else if cmd = '--nomusic' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
140 |
SetMusic ( false ) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
141 |
else if cmd = '--nosound' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
142 |
SetSound ( false ) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
143 |
else if cmd = '--fullscreen' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
144 |
cFullScreen := true |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
145 |
else if cmd = '--showfps' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
146 |
cShowFPS := true |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
147 |
else if cmd = '--altdmg' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
148 |
cAltDamage := true |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
149 |
else if cmd = '--lowquality' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
150 |
cReducedQuality:= ($FFFFFFFF * getLongIntParameter(arg, paramIndex, parseParameter)) xor rqLowRes //HACK |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
151 |
else if cmd = '--set-video' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
152 |
parseClassicParameter(videoArray,3,paramIndex) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
153 |
else if cmd = '--set-audio' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
154 |
parseClassicParameter(audioArray,3,paramIndex) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
155 |
else if cmd = '--set-other' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
156 |
parseClassicParameter(otherArray,3,paramIndex) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
157 |
else if cmd = '--set-multimedia' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
158 |
parseClassicParameter(mediaArray,8,paramIndex) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
159 |
else if cmd = '--set-everything' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
160 |
parseClassicParameter(allArray,12,paramIndex) |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
161 |
else if cmd = '--stats-only' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
162 |
begin |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
163 |
cOnlyStats:= true; |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
164 |
SetSound(false); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
165 |
SetMusic(false); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
166 |
cReducedQuality:= $FFFFFFFF xor rqLowRes |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
167 |
end |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
168 |
else if cmd = '--gci' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
169 |
begin // We had to make up all this saved space some how... \\ |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
170 |
WriteLn(stdout, ' '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
171 |
WriteLn(stdout, ' /\\\\\\\\\\\\ /\\\\\\\\\ /\\\\\\\\\\\ '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
172 |
WriteLn(stdout, ' /\\\////////// /\\\//////// \/////\\\/// '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
173 |
WriteLn(stdout, ' /\\\ /\\\/ \/\\\ '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
174 |
WriteLn(stdout, ' \/\\\ /\\\\\\\ /\\\ \/\\\ '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
175 |
WriteLn(stdout, ' \/\\\ \/////\\\ \/\\\ \/\\\ '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
176 |
WriteLn(stdout, ' \/\\\ \/\\\ \//\\\ \/\\\ '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
177 |
WriteLn(stdout, ' \/\\\ \/\\\ \///\\\ \/\\\ '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
178 |
WriteLn(stdout, ' \//\\\\\\\\\\\\/ \////\\\\\\\\\ /\\\\\\\\\\\ '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
179 |
WriteLn(stdout, ' \//////////// \///////// \/////////// '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
180 |
WriteLn(stdout, ' '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
181 |
WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
182 |
WriteLn(stdout, ' ASCII Art easter egg idea by @sheepluva '); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
183 |
WriteLn(stdout, ' ') |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
184 |
end |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
185 |
else if cmd = '--help' then |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
186 |
begin |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
187 |
DisplayUsage(); |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
188 |
GameType:= gmtSyntax |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
189 |
end |
8150 | 190 |
else |
191 |
begin |
|
192 |
WriteLn(stderr, 'ERROR: '+cmd+' is not a valid argument'); |
|
8174
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
193 |
parseParameter:= true |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
194 |
end; |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
195 |
end; |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
196 |
|
8150 | 197 |
procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); |
198 |
var index, tmpInt: LongInt; |
|
199 |
isBool: Boolean; |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
200 |
begin |
8150 | 201 |
index:= 0; |
202 |
tmpInt:= 1; |
|
203 |
while (index < size) do |
|
204 |
begin |
|
205 |
paramIndex:= paramIndex+1; |
|
8174
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
206 |
isBool:= not ((cmdArray[index] = '--nomusic') or |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
207 |
(cmdArray[index] = '--nosound') or |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
208 |
(cmdArray[index] = '--fullscreen') or |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
209 |
(cmdArray[index] = '--showfps') or |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
210 |
(cmdArray[index] = '--altdmg') or |
df02c2ad4a2c
Fix more errors. It compiles!
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8167
diff
changeset
|
211 |
(cmdArray[index] = '--lowquality')); |
8150 | 212 |
if (not isBool) or ((ParamStr(paramIndex)='1') and (cmdArray[index]<>'--nomusic') and (cmdArray[index]<>'--nosound')) then |
213 |
parseParameter(cmdArray[index], ParamStr(paramIndex), tmpInt); |
|
214 |
//if isBool then |
|
215 |
// paramIndex:= paramIndex+1; |
|
216 |
index:= index+1; |
|
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 |
|
8167
96635d815141
Make user folder default to global folder in hwengine
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8150
diff
changeset
|
220 |
procedure playReplayFileWithParameters(paramIndex: LongInt); |
96635d815141
Make user folder default to global folder in hwengine
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents:
8150
diff
changeset
|
221 |
var wrongParameter: boolean; |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
222 |
begin |
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
223 |
wrongParameter:= false; |
8150 | 224 |
while (paramIndex <= ParamCount) do |
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
225 |
begin |
8150 | 226 |
if parseParameter( ParamStr(paramIndex), ParamStr(paramIndex+1), paramIndex) then |
227 |
wrongParameter:= true; |
|
228 |
paramIndex:= paramIndex+1; |
|
229 |
end; |
|
230 |
if wrongParameter = true then |
|
231 |
begin |
|
232 |
WriteLn(stderr, 'Please use --help to see possible arguments and their usage'); |
|
233 |
GameType:= gmtSyntax; |
|
234 |
end |
|
3678
00428183300f
patch by lucass (polished by me) - command line parsing is now much more flexible
koda
parents:
diff
changeset
|
235 |
end; |