120 const videoArray: Array [1..3] of String = ('--width','--height','--depth'); |
120 const videoArray: Array [1..3] of String = ('--width','--height','--depth'); |
121 const audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound'); |
121 const audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound'); |
122 const otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps'); |
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'); |
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'); |
124 const allArray: Array [1..12] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--time','--lowquality'); |
|
125 const reallyAll: array[0..19] of shortstring = ( |
|
126 '--locale', '--width', '--height', '--depth', '--time' |
|
127 , '--volume', '--nomusic', '--nosound', '--fullscreen', '--showfps' |
|
128 , '--altdmg', '--lowquality', '--set-video', '--set-audio', '--set-other' |
|
129 , '--set-multimedia', '--set-everything', '--stats-only', '--gci', '--help'); |
|
130 var cmdIndex: byte; |
125 begin |
131 begin |
126 parseParameter:= false; |
132 parseParameter:= false; |
127 case cmd of |
133 cmdIndex:= 0; |
128 '--locale' : cLocaleFName := getStringParameter (arg, paramIndex); |
134 while (cmdIndex <= High(reallyAll)) and (cmd <> reallyAll[cmdIndex]) do inc(cmdIndex); |
129 '--width' : cScreenWidth := getLongIntParameter(arg, paramIndex, parseParameter); |
135 case cmdIndex of |
130 '--height' : cScreenHeight := getLongIntParameter(arg, paramIndex, parseParameter); |
136 {--locale} 0 : cLocaleFName := getStringParameter (arg, paramIndex); |
131 '--depth' : cBits := getLongIntParameter(arg, paramIndex, parseParameter); |
137 {--width} 1 : cScreenWidth := getLongIntParameter(arg, paramIndex, parseParameter); |
132 '--time' : cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter); |
138 {--height} 2 : cScreenHeight := getLongIntParameter(arg, paramIndex, parseParameter); |
133 '--volume' : SetVolume ( getLongIntParameter(arg, paramIndex, parseParameter) ); |
139 {--depth} 3 : cBits := getLongIntParameter(arg, paramIndex, parseParameter); |
134 '--nomusic' : SetMusic ( false ); |
140 {--time} 4 : cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter); |
135 '--nosound' : SetSound ( false ); |
141 {--volume} 5 : SetVolume ( getLongIntParameter(arg, paramIndex, parseParameter) ); |
136 '--fullscreen' : cFullScreen := true; |
142 {--nomusic} 6 : SetMusic ( false ); |
137 '--showfps' : cShowFPS := true; |
143 {--nosound} 7 : SetSound ( false ); |
138 '--altdmg' : cAltDamage := true; |
144 {--fullscreen} 8 : cFullScreen := true; |
139 '--lowquality' : cReducedQuality:= ($FFFFFFFF * getLongIntParameter(arg, paramIndex, parseParameter)) xor rqLowRes; //HACK! |
145 {--showfps} 9 : cShowFPS := true; |
140 '--set-video' : parseClassicParameter(videoArray,3,paramIndex); |
146 {--altdmg} 10 : cAltDamage := true; |
141 '--set-audio' : parseClassicParameter(audioArray,3,paramIndex); |
147 {--lowquality} 11 : cReducedQuality:= ($FFFFFFFF * getLongIntParameter(arg, paramIndex, parseParameter)) xor rqLowRes; //HACK! |
142 '--set-other' : parseClassicParameter(otherArray,3,paramIndex); |
148 {--set-video} 12 : parseClassicParameter(videoArray,3,paramIndex); |
143 '--set-multimedia' : parseClassicParameter(mediaArray,8,paramIndex); |
149 {--set-audio} 13 : parseClassicParameter(audioArray,3,paramIndex); |
144 '--set-everything' : parseClassicParameter(allArray,12,paramIndex); |
150 {--set-other} 14 : parseClassicParameter(otherArray,3,paramIndex); |
145 '--stats-only' : begin |
151 {--set-multimedia} 15 : parseClassicParameter(mediaArray,8,paramIndex); |
146 cOnlyStats:= true; |
152 {--set-everything} 16 : parseClassicParameter(allArray,12,paramIndex); |
147 SetSound(false); |
153 {--stats-only} 17 : begin |
148 SetMusic(false); |
154 cOnlyStats:= true; |
149 cReducedQuality:= $FFFFFFFF xor rqLowRes; |
155 SetSound(false); |
150 end; |
156 SetMusic(false); |
151 '--gci' : begin // We had to make up all this saved space some how... \\ |
157 cReducedQuality:= $FFFFFFFF xor rqLowRes; |
152 WriteLn(stdout, ' '); |
158 end; |
153 WriteLn(stdout, ' /\\\\\\\\\\\\ /\\\\\\\\\ /\\\\\\\\\\\ '); |
159 {--gci} 18 : begin // We had to make up all this saved space some how... \\ |
154 WriteLn(stdout, ' /\\\////////// /\\\//////// \/////\\\/// '); |
160 WriteLn(stdout, ' '); |
155 WriteLn(stdout, ' /\\\ /\\\/ \/\\\ '); |
161 WriteLn(stdout, ' /\\\\\\\\\\\\ /\\\\\\\\\ /\\\\\\\\\\\ '); |
156 WriteLn(stdout, ' \/\\\ /\\\\\\\ /\\\ \/\\\ '); |
162 WriteLn(stdout, ' /\\\////////// /\\\//////// \/////\\\/// '); |
157 WriteLn(stdout, ' \/\\\ \/////\\\ \/\\\ \/\\\ '); |
163 WriteLn(stdout, ' /\\\ /\\\/ \/\\\ '); |
158 WriteLn(stdout, ' \/\\\ \/\\\ \//\\\ \/\\\ '); |
164 WriteLn(stdout, ' \/\\\ /\\\\\\\ /\\\ \/\\\ '); |
159 WriteLn(stdout, ' \/\\\ \/\\\ \///\\\ \/\\\ '); |
165 WriteLn(stdout, ' \/\\\ \/////\\\ \/\\\ \/\\\ '); |
160 WriteLn(stdout, ' \//\\\\\\\\\\\\/ \////\\\\\\\\\ /\\\\\\\\\\\ '); |
166 WriteLn(stdout, ' \/\\\ \/\\\ \//\\\ \/\\\ '); |
161 WriteLn(stdout, ' \//////////// \///////// \/////////// '); |
167 WriteLn(stdout, ' \/\\\ \/\\\ \///\\\ \/\\\ '); |
162 WriteLn(stdout, ' '); |
168 WriteLn(stdout, ' \//\\\\\\\\\\\\/ \////\\\\\\\\\ /\\\\\\\\\\\ '); |
163 WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student '); |
169 WriteLn(stdout, ' \//////////// \///////// \/////////// '); |
164 WriteLn(stdout, ' ASCII Art easter egg idea by @sheepluva '); |
170 WriteLn(stdout, ' '); |
165 WriteLn(stdout, ' '); |
171 WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student '); |
166 end; |
172 WriteLn(stdout, ' ASCII Art easter egg idea by @sheepluva '); |
167 '--help' : begin |
173 WriteLn(stdout, ' '); |
168 DisplayUsage(); |
174 end; |
169 GameType:= gmtSyntax; |
175 {--help} 19 : begin |
170 end; |
176 DisplayUsage(); |
|
177 GameType:= gmtSyntax; |
|
178 end; |
171 else |
179 else |
172 begin |
180 begin |
173 WriteLn(stderr, 'ERROR: '+cmd+' is not a valid argument'); |
181 WriteLn(stderr, 'ERROR: '+cmd+' is not a valid argument'); |
174 parseParameter:= true; |
182 parseParameter:= true; |
175 end |
183 end |