89 WriteLn(stdout, ' --height <height in pixels>: Set game window height'); |
89 WriteLn(stdout, ' --height <height in pixels>: Set game window height'); |
90 WriteLn(stdout, ' --fullscreen: Start in fullscreen'); |
90 WriteLn(stdout, ' --fullscreen: Start in fullscreen'); |
91 WriteLn(stdout, ' --fullscreen-width <width in pixels>: Set fullscreen width'); |
91 WriteLn(stdout, ' --fullscreen-width <width in pixels>: Set fullscreen width'); |
92 WriteLn(stdout, ' --fullscreen-height <height in pixels>: Set fullscreen height'); |
92 WriteLn(stdout, ' --fullscreen-height <height in pixels>: Set fullscreen height'); |
93 WriteLn(stdout, ' --low-quality: Lowers the game quality'); |
93 WriteLn(stdout, ' --low-quality: Lowers the game quality'); |
|
94 WriteLn(stdout, ' --zoom <percent>: Start with custom zoom level'); |
94 WriteLn(stdout, ''); |
95 WriteLn(stdout, ''); |
95 WriteLn(stdout, 'Audio:'); |
96 WriteLn(stdout, 'Audio:'); |
96 WriteLn(stdout, ' --volume <sound level>: Set volume between 0 and 100'); |
97 WriteLn(stdout, ' --volume <sound level>: Set volume between 0 and 100'); |
97 WriteLn(stdout, ' --nomusic: Disable music'); |
98 WriteLn(stdout, ' --nomusic: Disable music'); |
98 WriteLn(stdout, ' --nosound: Disable sound effects'); |
99 WriteLn(stdout, ' --nosound: Disable sound effects'); |
229 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a string, you passed "'+str+'"!'); |
230 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a string, you passed "'+str+'"!'); |
230 {$ENDIF} |
231 {$ENDIF} |
231 getstringParameter:= str; |
232 getstringParameter:= str; |
232 end; |
233 end; |
233 |
234 |
|
235 procedure setZoom(str:shortstring; var paramIndex:LongInt; var wrongParameter:Boolean); |
|
236 var param: LongInt; |
|
237 begin |
|
238 param:= getLongIntParameter(str, paramIndex, wrongParameter); |
|
239 |
|
240 if param = 100 then |
|
241 exit; |
|
242 UserZoom:= (param/100.0) * cDefaultZoomLevel; |
|
243 |
|
244 if UserZoom < cMaxZoomLevel then |
|
245 UserZoom:= cMaxZoomLevel; |
|
246 if UserZoom > cMinZoomLevel then |
|
247 UserZoom:= cMinZoomLevel; |
|
248 zoom:= UserZoom; |
|
249 ZoomValue:= UserZoom; |
|
250 end; |
|
251 |
234 procedure parseClassicParameter(cmdarray: array of string; size:LongInt; var paramIndex:LongInt); forward; |
252 procedure parseClassicParameter(cmdarray: array of string; size:LongInt; var paramIndex:LongInt); forward; |
235 |
253 |
236 function parseParameter(cmd:string; arg:string; var paramIndex:LongInt): Boolean; |
254 function parseParameter(cmd:string; arg:string; var paramIndex:LongInt): Boolean; |
237 const videoarray: array [0..4] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth'); |
255 const videoarray: array [0..4] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth'); |
238 audioarray: array [0..2] of string = ('--volume','--nomusic','--nosound'); |
256 audioarray: array [0..2] of string = ('--volume','--nomusic','--nosound'); |
239 otherarray: array [0..2] of string = ('--locale','--fullscreen','--showfps'); |
257 otherarray: array [0..2] of string = ('--locale','--fullscreen','--showfps'); |
240 mediaarray: array [0..9] of string = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen'); |
258 mediaarray: array [0..9] of string = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen'); |
241 allarray: array [0..18] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--nodampen','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags'); |
259 allarray: array [0..18] of string = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--nodampen','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags'); |
242 reallyAll: array[0..38] of shortstring = ( |
260 reallyAll: array[0..39] of shortstring = ( |
243 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width', |
261 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width', |
244 '--height', '--frame-interval', '--volume','--nomusic', '--nosound', '--nodampen', |
262 '--height', '--frame-interval', '--volume','--nomusic', '--nosound', '--nodampen', |
245 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick', |
263 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick', |
|
264 '--zoom', |
246 {deprecated} '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything', |
265 {deprecated} '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything', |
247 {internal} '--internal', '--port', '--recorder', '--landpreview', |
266 {internal} '--internal', '--port', '--recorder', '--landpreview', |
248 {misc} '--stats-only', '--gci', '--help','--protocol', '--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags','--lua-test','--no-holiday-silliness'); |
267 {misc} '--stats-only', '--gci', '--help','--protocol', '--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags','--lua-test','--no-holiday-silliness'); |
249 var cmdIndex: byte; |
268 var cmdIndex: byte; |
250 begin |
269 begin |
273 {--altdmg} 14 : cAltDamage := true; |
292 {--altdmg} 14 : cAltDamage := true; |
274 {--low-quality} 15 : cReducedQuality := $FFFFFFFF xor rqLowRes; |
293 {--low-quality} 15 : cReducedQuality := $FFFFFFFF xor rqLowRes; |
275 {--raw-quality} 16 : cReducedQuality := getLongIntParameter(arg, paramIndex, parseParameter); |
294 {--raw-quality} 16 : cReducedQuality := getLongIntParameter(arg, paramIndex, parseParameter); |
276 {--stereo} 17 : setStereoMode ( getLongIntParameter(arg, paramIndex, parseParameter) ); |
295 {--stereo} 17 : setStereoMode ( getLongIntParameter(arg, paramIndex, parseParameter) ); |
277 {--nick} 18 : UserNick := parseNick( getstringParameter(arg, paramIndex, parseParameter) ); |
296 {--nick} 18 : UserNick := parseNick( getstringParameter(arg, paramIndex, parseParameter) ); |
|
297 {--zoom} 19 : setZoom(arg, paramIndex, parseParameter); |
278 {deprecated options} |
298 {deprecated options} |
279 {--depth} 19 : setDepth(paramIndex); |
299 {--depth} 20 : setDepth(paramIndex); |
280 {--set-video} 20 : parseClassicParameter(videoarray,5,paramIndex); |
300 {--set-video} 21 : parseClassicParameter(videoarray,5,paramIndex); |
281 {--set-audio} 21 : parseClassicParameter(audioarray,3,paramIndex); |
301 {--set-audio} 22 : parseClassicParameter(audioarray,3,paramIndex); |
282 {--set-other} 22 : parseClassicParameter(otherarray,3,paramIndex); |
302 {--set-other} 23 : parseClassicParameter(otherarray,3,paramIndex); |
283 {--set-multimedia} 23 : parseClassicParameter(mediaarray,10,paramIndex); |
303 {--set-multimedia} 24 : parseClassicParameter(mediaarray,10,paramIndex); |
284 {--set-everything} 24 : parseClassicParameter(allarray,14,paramIndex); |
304 {--set-everything} 25 : parseClassicParameter(allarray,14,paramIndex); |
285 {"internal" options} |
305 {"internal" options} |
286 {--internal} 25 : {$IFDEF HWLIBRARY}isInternal:= true{$ENDIF}; |
306 {--internal} 26 : {$IFDEF HWLIBRARY}isInternal:= true{$ENDIF}; |
287 {--port} 26 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter ); |
307 {--port} 27 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter ); |
288 {--recorder} 27 : startVideoRecording(paramIndex); |
308 {--recorder} 28 : startVideoRecording(paramIndex); |
289 {--landpreview} 28 : GameType := gmtLandPreview; |
309 {--landpreview} 29 : GameType := gmtLandPreview; |
290 {anything else} |
310 {anything else} |
291 {--stats-only} 29 : statsOnlyGame(); |
311 {--stats-only} 30 : statsOnlyGame(); |
292 {--gci} 30 : GciEasterEgg(); |
312 {--gci} 31 : GciEasterEgg(); |
293 {--help} 31 : DisplayUsage(); |
313 {--help} 32 : DisplayUsage(); |
294 {--protocol} 32 : DisplayProtocol(); |
314 {--protocol} 33 : DisplayProtocol(); |
295 {--no-teamtag} 33 : cTagsMask := cTagsMask and (not htTeamName); |
315 {--no-teamtag} 34 : cTagsMask := cTagsMask and (not htTeamName); |
296 {--no-hogtag} 34 : cTagsMask := cTagsMask and (not htName); |
316 {--no-hogtag} 35 : cTagsMask := cTagsMask and (not htName); |
297 {--no-healthtag} 35 : cTagsMask := cTagsMask and (not htHealth); |
317 {--no-healthtag} 36 : cTagsMask := cTagsMask and (not htHealth); |
298 {--translucent-tags} 36 : cTagsMask := cTagsMask or htTransparent; |
318 {--translucent-tags} 37 : cTagsMask := cTagsMask or htTransparent; |
299 {--lua-test} 37 : begin cTestLua := true; SetSound(false); cScriptName := getstringParameter(arg, paramIndex, parseParameter); WriteLn(stdout, 'Lua test file specified: ' + cScriptName);end; |
319 {--lua-test} 38 : begin cTestLua := true; SetSound(false); cScriptName := getstringParameter(arg, paramIndex, parseParameter); WriteLn(stdout, 'Lua test file specified: ' + cScriptName);end; |
300 {--no-holiday-silliness} 38 : cHolidaySilliness:= false; |
320 {--no-holiday-silliness} 39 : cHolidaySilliness:= false; |
301 else |
321 else |
302 begin |
322 begin |
303 //Assume the first "non parameter" is the demo file, anything else is invalid |
323 //Assume the first "non parameter" is the demo file, anything else is invalid |
304 if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then |
324 if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then |
305 recordFileName := cmd |
325 recordFileName := cmd |