14 * You should have received a copy of the GNU General Public License |
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 |
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 |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 *) |
17 *) |
18 |
18 |
19 |
19 procedure GciEasterEgg; |
20 procedure internalStartGameWithParameters(); |
20 begin |
21 var tmp: LongInt; |
21 WriteLn(stdout, ' '); |
22 begin |
22 WriteLn(stdout, ' /\\\\\\\\\\\\ /\\\\\\\\\ /\\\\\\\\\\\ '); |
23 UserPathPrefix:= ParamStr(1); |
23 WriteLn(stdout, ' /\\\////////// /\\\//////// \/////\\\/// '); |
24 cScreenWidth:= StrToInt(ParamStr(2)); |
24 WriteLn(stdout, ' /\\\ /\\\/ \/\\\ '); |
25 cScreenHeight:= StrToInt(ParamStr(3)); |
25 WriteLn(stdout, ' \/\\\ /\\\\\\\ /\\\ \/\\\ '); |
26 cBits:= StrToInt(ParamStr(4)); |
26 WriteLn(stdout, ' \/\\\ \/////\\\ \/\\\ \/\\\ '); |
27 ipcPort:= StrToInt(ParamStr(5)); |
27 WriteLn(stdout, ' \/\\\ \/\\\ \//\\\ \/\\\ '); |
28 cFullScreen:= ParamStr(6) = '1'; |
28 WriteLn(stdout, ' \/\\\ \/\\\ \///\\\ \/\\\ '); |
29 SetSound(ParamStr(7) = '1'); |
29 WriteLn(stdout, ' \/\\\\\\\\\\\\\/ \////\\\\\\\\\ /\\\\\\\\\\\ '); |
30 SetMusic(ParamStr(8) = '1'); |
30 WriteLn(stdout, ' \///////////// \///////// \/////////// '); |
31 SetVolume(StrToInt(ParamStr(9))); |
31 WriteLn(stdout, ' '); |
32 cTimerInterval:= StrToInt(ParamStr(10)); |
32 WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student '); |
33 PathPrefix:= ParamStr(11); |
33 WriteLn(stdout, ' ASCII Art easter egg idea by @sheepluva '); |
34 cShowFPS:= ParamStr(12) = '1'; |
34 WriteLn(stdout, ' '); |
35 cAltDamage:= ParamStr(13) = '1'; |
35 end; |
36 UserNick:= DecodeBase64(ParamStr(14)); |
36 |
37 cReducedQuality:= StrToInt(ParamStr(15)); |
37 procedure DisplayUsage; |
38 tmp:= StrToInt(ParamStr(16)); |
38 begin |
|
39 WriteLn(stdout, 'Usage: hwengine <path to replay file> [options]'); |
|
40 WriteLn(stdout, ''); |
|
41 WriteLn(stdout, 'where [options] can be any of the following:'); |
|
42 WriteLn(stdout, ' --prefix [path to folder]'); |
|
43 WriteLn(stdout, ' --user-prefix [path to folder]'); |
|
44 WriteLn(stdout, ' --locale [name of language file]'); |
|
45 WriteLn(stdout, ' --nick [string]'); |
|
46 WriteLn(stdout, ' --width [screen width in pixels]'); |
|
47 WriteLn(stdout, ' --height [screen height in pixels]'); |
|
48 WriteLn(stdout, ' --volume [sound level]'); |
|
49 WriteLn(stdout, ' --frame-interval [milliseconds]'); |
|
50 Writeln(stdout, ' --stereo [value]'); |
|
51 WriteLn(stdout, ' --raw-quality [flags]'); |
|
52 WriteLn(stdout, ' --low-quality'); |
|
53 WriteLn(stdout, ' --nomusic'); |
|
54 WriteLn(stdout, ' --nosound'); |
|
55 WriteLn(stdout, ' --fullscreen'); |
|
56 WriteLn(stdout, ' --showfps'); |
|
57 WriteLn(stdout, ' --altdmg'); |
|
58 WriteLn(stdout, ' --stats-only'); |
|
59 WriteLn(stdout, ' --help'); |
|
60 WriteLn(stdout, ''); |
|
61 WriteLn(stdout, 'For more detailed help and examples go to:'); |
|
62 WriteLn(stdout, 'http://code.google.com/p/hedgewars/wiki/CommandLineOptions'); |
|
63 GameType:= gmtSyntax; |
|
64 end; |
|
65 |
|
66 procedure setDepth(var paramIndex: LongInt); |
|
67 begin |
|
68 WriteLn(stdout, 'WARNING: --depth is a deprecated command, which could be removed in a future version!'); |
|
69 WriteLn(stdout, ' This option no longer does anything, please consider removing it'); |
|
70 WriteLn(stdout, ''); |
|
71 inc(ParamIndex); |
|
72 end; |
|
73 |
|
74 procedure statsOnlyGame; |
|
75 begin |
|
76 cOnlyStats:= true; |
|
77 cReducedQuality:= $FFFFFFFF xor rqLowRes; |
|
78 SetSound(false); |
|
79 SetMusic(false); |
|
80 SetVolume(0); |
|
81 end; |
|
82 |
|
83 procedure setIpcPort(port: LongInt; var wrongParameter:Boolean); |
|
84 begin |
|
85 if isInternal then |
|
86 ipcPort := port |
|
87 else |
|
88 begin |
|
89 WriteLn(stderr, 'ERROR: use of --port is not allowed'); |
|
90 wrongParameter := true; |
|
91 end |
|
92 end; |
|
93 |
|
94 function parseNick(nick: String): String; |
|
95 begin |
|
96 if isInternal then |
|
97 parseNick:= DecodeBase64(nick) |
|
98 else |
|
99 parseNick:= nick; |
|
100 end; |
|
101 |
|
102 procedure setStereoMode(tmp: LongInt); |
|
103 begin |
39 GrayScale:= false; |
104 GrayScale:= false; |
40 if (tmp > 9) and (tmp < 16) then |
105 {$IFDEF USE_S3D_RENDERING} |
41 begin |
106 if (tmp > 9) and (tmp < 16) then |
|
107 begin |
|
108 // set the gray anaglyph rendering |
42 GrayScale:= true; |
109 GrayScale:= true; |
43 cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-9))) |
110 cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-9))) |
44 end |
111 end |
45 else if tmp <= 9 then |
112 else if tmp <= 9 then |
|
113 // set the fullcolor anaglyph |
46 cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp))) |
114 cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp))) |
47 else |
115 else |
|
116 // any other mode |
48 cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6))); |
117 cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6))); |
49 cLocaleFName:= ParamStr(17); |
118 {$ELSE} |
50 end; |
119 cStereoMode:= smNone; |
51 |
120 {$ENDIF} |
|
121 end; |
|
122 |
|
123 procedure startVideoRecording(var paramIndex: LongInt); |
|
124 begin |
52 {$IFDEF USE_VIDEO_RECORDING} |
125 {$IFDEF USE_VIDEO_RECORDING} |
53 procedure internalStartVideoRecordingWithParameters(); |
|
54 begin |
|
55 internalStartGameWithParameters(); |
|
56 GameType:= gmtRecord; |
126 GameType:= gmtRecord; |
57 cVideoFramerateNum:= StrToInt(ParamStr(18)); |
127 inc(paramIndex); |
58 cVideoFramerateDen:= StrToInt(ParamStr(19)); |
128 cVideoFramerateNum:= StrToInt(ParamStr(paramIndex)); inc(paramIndex); |
59 RecPrefix:= ParamStr(20); |
129 cVideoFramerateDen:= StrToInt(ParamStr(paramIndex)); inc(paramIndex); |
60 cAVFormat:= ParamStr(21); |
130 RecPrefix:= ParamStr(paramIndex); inc(paramIndex); |
61 cVideoCodec:= ParamStr(22); |
131 cAVFormat:= ParamStr(paramIndex); inc(paramIndex); |
62 cVideoQuality:= StrToInt(ParamStr(23)); |
132 cVideoCodec:= ParamStr(paramIndex); inc(paramIndex); |
63 cAudioCodec:= ParamStr(24); |
133 cVideoQuality:= StrToInt(ParamStr(paramIndex)); inc(paramIndex); |
64 end; |
134 cAudioCodec:= ParamStr(paramIndex); inc(paramIndex); |
65 {$ENDIF} |
135 {$ENDIF} |
66 |
136 end; |
67 procedure setVideo(screenWidth: LongInt; screenHeight: LongInt; bitsStr: LongInt); |
137 |
68 begin |
138 function getLongIntParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt; |
69 cScreenWidth:= screenWidth; |
139 var tmpInt, c: LongInt; |
70 cScreenHeight:= screenHeight; |
140 begin |
71 cBits:= bitsStr |
141 inc(paramIndex); |
72 end; |
142 val(str, tmpInt, c); |
73 |
143 wrongParameter:= c <> 0; |
74 procedure setVideoWithParameters(screenWidthParam: string; screenHeightParam: string; bitsParam: string); |
144 if wrongParameter then |
75 var screenWidthAsInt, screenHeightAsInt, bitsStrAsInt, c: LongInt; |
145 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a number, you passed "'+str+'"'); |
76 begin |
146 getLongIntParameter:= tmpInt; |
77 val(screenWidthParam, screenWidthAsInt, c); |
147 end; |
78 val(screenHeightParam, screenHeightAsInt, c); |
148 |
79 val(bitsParam, bitsStrAsInt, c); |
149 function getStringParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): String; |
80 setVideo(screenWidthAsInt,screenHeightAsInt,bitsStrAsInt) |
150 begin |
81 end; |
151 inc(paramIndex); |
82 |
152 wrongParameter:= (str='') or (Copy(str,1,2) = '--'); |
83 procedure setOtherOptions(languageFile: string; fullScreen: boolean); |
153 if wrongParameter then |
84 begin |
154 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a string, you passed "'+str+'"'); |
85 cLocaleFName:= languageFile; |
155 getStringParameter:= str; |
86 cFullScreen:= fullScreen |
156 end; |
87 end; |
157 |
88 |
158 |
89 procedure setShowFPS(showFPS: boolean); |
159 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); Forward; |
90 begin |
160 |
91 cShowFPS:= showFPS |
161 function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean; |
92 end; |
162 const videoArray: Array [1..3] of String = ('--width','--height','--depth'); |
93 |
163 audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound'); |
94 procedure setOtherOptionsWithParameters(languageFileParam: string; fullScreenParam: string; showFPSParam: string); |
164 otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps'); |
95 var fullScreen, showFPS: boolean; |
165 mediaArray: Array [1..8] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen'); |
96 begin |
166 allArray: Array [1..12] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality'); |
97 fullScreen:= fullScreenParam = '1'; |
167 reallyAll: array[0..28] of shortstring = ( |
98 showFPS:= showFPSParam = '1'; |
168 '--prefix', '--user-prefix', '--locale', '--width', '--height', '--frame-interval', '--volume','--nomusic', '--nosound', |
99 setOtherOptions(languageFileParam,fullScreen); |
169 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick', |
100 setShowFPS(showFPS) |
170 {deprecated} '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything', |
101 end; |
171 {internal} '--internal', '--port', '--recorder', '--landpreview', |
102 |
172 {misc} '--stats-only', '--gci', '--help'); |
103 procedure setAudio(initialVolume: LongInt; musicEnabled: boolean; soundEnabled: boolean); |
173 var cmdIndex: byte; |
104 begin |
174 begin |
105 SetVolume(initialVolume); |
175 parseParameter:= false; |
106 SetMusic(musicEnabled); |
176 cmdIndex:= 0; |
107 SetSound(soundEnabled); |
177 |
108 end; |
178 //NOTE: Any update to the list of parameters must be reflected in the case statement below, the reallyAll array above, |
109 |
179 // the the DisplayUsage() procedure, the HWForm::getDemoArguments() function, and the online wiki |
110 procedure setAudioWithParameters(initialVolumeParam: string; musicEnabledParam: string; soundEnabledParam: string); |
180 |
111 var initialVolumeAsInt, c: LongInt; |
181 while (cmdIndex <= High(reallyAll)) and (cmd <> reallyAll[cmdIndex]) do inc(cmdIndex); |
112 musicEnabled, soundEnabled: boolean; |
182 case cmdIndex of |
113 begin |
183 {--prefix} 0 : PathPrefix := getStringParameter (arg, paramIndex, parseParameter); |
114 val(initialVolumeParam, initialVolumeAsInt, c); |
184 {--user-prefix} 1 : UserPathPrefix := getStringParameter (arg, paramIndex, parseParameter); |
115 musicEnabled:= musicEnabledParam = '1'; |
185 {--locale} 2 : cLocaleFName := getStringParameter (arg, paramIndex, parseParameter); |
116 soundEnabled:= soundEnabledParam = '1'; |
186 {--width} 3 : cScreenWidth := getLongIntParameter(arg, paramIndex, parseParameter); |
117 setAudio(initialVolumeAsInt,musicEnabled, soundEnabled) |
187 {--height} 4 : cScreenHeight := getLongIntParameter(arg, paramIndex, parseParameter); |
118 end; |
188 {--frame-interval} 5 : cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter); |
119 |
189 {--volume} 6 : SetVolume ( getLongIntParameter(arg, paramIndex, parseParameter) ); |
120 procedure setMultimediaOptionsWithParameters(screenWidthParam, screenHeightParam, bitsParam: string; |
190 {--nomusic} 7 : SetMusic ( false ); |
121 initialVolumeParam, musicEnabledParam, soundEnabledParam: string; |
191 {--nosound} 8 : SetSound ( false ); |
122 languageFileParam, fullScreenParam: string); |
192 {--fullscreen} 9 : cFullScreen := true; |
123 begin |
193 {--showfps} 10 : cShowFPS := true; |
124 setVideoWithParameters(screenWidthParam,screenHeightParam, bitsParam); |
194 {--altdmg} 11 : cAltDamage := true; |
125 setAudioWithParameters(initialVolumeParam,musicEnabledParam,soundEnabledParam); |
195 {--low-quality} 12 : cReducedQuality:= $FFFFFFFF xor rqLowRes; |
126 setOtherOptions(languageFileParam,fullScreenParam = '1') |
196 {--raw-quality} 13 : cReducedQuality:= getLongIntParameter(arg, paramIndex, parseParameter); |
127 end; |
197 {--stereo} 14 : setStereoMode ( getLongIntParameter(arg, paramIndex, parseParameter) ); |
128 |
198 {--nick} 15 : UserNick := parseNick( getStringParameter(arg, paramIndex, parseParameter) ); |
129 procedure setAltDamageTimerValueAndQuality(altDamage: boolean; timeIterval: LongInt; reducedQuality: boolean); |
199 {deprecated options} |
130 begin |
200 {--depth} 16 : setDepth(paramIndex); |
131 cAltDamage:= altDamage; |
201 {--set-video} 17 : parseClassicParameter(videoArray,3,paramIndex); |
132 cTimerInterval:= timeIterval; |
202 {--set-audio} 18 : parseClassicParameter(audioArray,3,paramIndex); |
133 if (reducedQuality) then //HACK |
203 {--set-other} 19 : parseClassicParameter(otherArray,3,paramIndex); |
134 cReducedQuality:= $FFFFFFFF xor rqLowRes |
204 {--set-multimedia} 20 : parseClassicParameter(mediaArray,8,paramIndex); |
135 end; |
205 {--set-everything} 21 : parseClassicParameter(allArray,12,paramIndex); |
136 |
206 {"internal" options} |
137 procedure setAllOptionsWithParameters(screenWidthParam:string; screenHeightParam:string; bitsParam:string; |
207 {--internal} 22 : {note it, but do nothing}; |
138 initialVolumeParam:string; musicEnabledParam:string; soundEnabledParam:string; |
208 {--port} 23 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter ); |
139 languageFileParam:string; fullScreenParam:string; showFPSParam:string; |
209 {--recorder} 24 : startVideoRecording(paramIndex); |
140 altDamageParam:string; timeItervalParam:string; reducedQualityParam: string); |
210 {--landpreview} 25 : GameType := gmtLandPreview; |
141 var showFPS, altDamage, reducedQuality: boolean; |
211 {anything else} |
142 timeIterval, c: LongInt; |
212 {--stats-only} 26 : statsOnlyGame(); |
143 begin |
213 {--gci} 27 : GciEasterEgg(); |
144 setMultimediaOptionsWithParameters(screenWidthParam,screenHeightParam, bitsParam, |
214 {--help} 28 : DisplayUsage(); |
145 initialVolumeParam,musicEnabledParam,soundEnabledParam, |
215 else |
146 languageFileParam,fullScreenParam); |
216 begin |
147 showFPS := showFPSParam = '1'; |
217 //Asusme the first "non parameter" is the replay file, anything else is invalid |
148 setShowFPS(showFPS); |
218 if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then |
149 |
219 recordFileName := cmd |
150 altDamage:= altDamageParam = '1'; |
220 else |
151 val(timeItervalParam, timeIterval, c); |
221 begin |
152 reducedQuality:= reducedQualityParam = '1'; |
222 WriteLn(stderr, '"'+cmd+'" is not a valid option'); |
153 setAltDamageTimerValueAndQuality(altDamage,timeIterval,reducedQuality); |
223 parseParameter:= true; |
154 end; |
224 end; |
155 |
225 end; |
156 procedure playReplayFileWithParameters(); |
226 end; |
|
227 end; |
|
228 |
|
229 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); |
|
230 var index, tmpInt: LongInt; |
|
231 isBool, isValid: Boolean; |
|
232 cmd, arg, newSyntax: String; |
|
233 begin |
|
234 WriteLn(stdout, 'WARNING: you are using a deprecated command, which could be removed in a future version!'); |
|
235 WriteLn(stdout, ' Consider updating to the latest syntax, which is much more flexible!'); |
|
236 WriteLn(stdout, ' Run `hwegine --help` to learn it!'); |
|
237 WriteLn(stdout, ''); |
|
238 |
|
239 index:= 0; |
|
240 tmpInt:= 1; |
|
241 while (index < size) do |
|
242 begin |
|
243 inc(paramIndex); |
|
244 cmd:= cmdArray[index]; |
|
245 arg:= ParamStr(paramIndex); |
|
246 isValid:= (cmd<>'--depth'); |
|
247 |
|
248 // check if the parameter is a boolean one |
|
249 isBool:= (cmd = '--nomusic') or (cmd = '--nosound') or (cmd = '--fullscreen') or (cmd = '--showfps') or (cmd = '--altdmg'); |
|
250 if isBool and (arg='0') then |
|
251 isValid:= false; |
|
252 if (cmd='--nomusic') or (cmd='--nosound') then |
|
253 isValid:= not isValid; |
|
254 |
|
255 if isValid then |
|
256 begin |
|
257 parseParameter(cmd, arg, tmpInt); |
|
258 newSyntax += cmd + ' '; |
|
259 if not isBool then |
|
260 newSyntax += arg + ' '; |
|
261 end; |
|
262 inc(index); |
|
263 end; |
|
264 |
|
265 WriteLn(stdout, 'Attempted to automatically convert to the new syntax:'); |
|
266 WriteLn(stdout, newSyntax); |
|
267 WriteLn(stdout, ''); |
|
268 end; |
|
269 |
|
270 procedure parseCommandLine{$IFDEF HWLIBRARY}(argc: LongInt; argv: PPChar){$ENDIF}; |
157 var paramIndex: LongInt; |
271 var paramIndex: LongInt; |
|
272 paramTotal: LongInt; |
158 wrongParameter: boolean; |
273 wrongParameter: boolean; |
159 begin |
274 begin |
160 UserPathPrefix:= ParamStr(1); |
275 paramIndex:= 1; |
161 PathPrefix:= ParamStr(2); |
276 paramTotal:={$IFDEF HWLIBRARY}argc{$ELSE}ParamCount{$ENDIF}; |
162 recordFileName:= ParamStr(3); |
|
163 paramIndex:= 4; |
|
164 wrongParameter:= false; |
277 wrongParameter:= false; |
165 while (paramIndex <= ParamCount) and (not wrongParameter) do |
278 while (paramIndex <= paramTotal) do |
166 begin |
279 begin |
167 if ParamStr(paramIndex) = '--set-video' then |
280 {$IFDEF HWLIBRARY} |
168 //--set-video [screen width] [screen height] [color dept] |
281 wrongParameter:= parseParameter( argv[paramIndex], argv[paramIndex+1], paramIndex); |
169 begin |
282 {$ELSE} |
170 if(ParamCount-paramIndex < 3) then |
283 wrongParameter:= parseParameter( ParamStr(paramIndex), ParamStr(paramIndex+1), paramIndex); |
171 begin |
284 {$ENDIF} |
172 wrongParameter:= true; |
285 inc(paramIndex); |
173 GameType:= gmtSyntax |
286 end; |
174 end; |
287 if wrongParameter = true then |
175 setVideoWithParameters(ParamStr(paramIndex+1), ParamStr(paramIndex+2), ParamStr(paramIndex+3)); |
288 GameType:= gmtSyntax; |
176 paramIndex:= paramIndex + 4 |
289 end; |
177 end |
290 |
178 else |
291 {$IFNDEF HWLIBRARY} |
179 //--set-audio [volume] [enable music] [enable sounds] |
292 procedure GetParams; |
180 if ParamStr(paramIndex) = '--set-audio' then |
293 //var tmpInt: LongInt; |
181 begin |
294 begin |
182 if(ParamCount-paramIndex < 3) then |
295 (* |
183 begin |
296 tmpInt:=0; |
184 wrongParameter := true; |
297 while (tmpInt <= ParamCount) do |
185 GameType:= gmtSyntax |
298 begin |
186 end; |
299 WriteLn(stdout, inttostr(tmpInt) + ': ' + ParamStr(tmpInt)); |
187 setAudioWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3)); |
300 inc(tmpInt); |
188 paramIndex:= paramIndex + 4 |
301 end; |
189 end |
302 *) |
190 else |
303 |
191 // --set-other [language file] [full screen] [show FPS] |
304 isInternal:= (ParamStr(1) = '--internal'); |
192 if ParamStr(paramIndex) = '--set-other' then |
305 |
193 begin |
306 UserPathPrefix := '.'; |
194 if(ParamCount-paramIndex < 3) then |
307 PathPrefix := cDefaultPathPrefix; |
195 begin |
308 recordFileName := ''; |
196 wrongParameter:= true; |
309 parseCommandLine(); |
197 GameType:= gmtSyntax |
310 |
198 end; |
311 if (isInternal) and (ParamCount<=1) then |
199 setOtherOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2), ParamStr(paramIndex+3)); |
312 begin |
200 paramIndex:= paramIndex + 4 |
313 WriteLn(stderr, '--internal should not be manually used'); |
201 end |
314 GameType := gmtSyntax; |
202 else |
315 end; |
203 //--set-multimedia [screen width] [screen height] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] |
316 |
204 if ParamStr(paramIndex) = '--set-multimedia' then |
317 if (not isInternal) and (recordFileName = '') then |
205 begin |
318 begin |
206 if ParamCount-paramIndex < 8 then |
319 WriteLn(stderr, 'You must specify a replay file'); |
207 begin |
320 GameType := gmtSyntax; |
208 wrongParameter:= true; |
321 end |
209 GameType:= gmtSyntax |
322 else if (recordFileName <> '') then |
210 end; |
323 WriteLn(stdout, 'Attempting to play demo file "' + recordFilename + '"'); |
211 setMultimediaOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3), |
324 |
212 ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6), |
325 if (GameType = gmtSyntax) then |
213 ParamStr(paramIndex+7),ParamStr(paramIndex+8)); |
326 WriteLn(stderr, 'Please use --help to see possible arguments and their usage'); |
214 paramIndex:= paramIndex + 9 |
327 |
215 end |
328 (* |
216 else |
329 WriteLn(stdout,'PathPrefix: ' + PathPrefix); |
217 //--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] |
330 WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix); |
218 if ParamStr(paramIndex) = '--set-everything' then |
331 *) |
219 begin |
332 end; |
220 if ParamCount-paramIndex < 12 then |
333 {$ENDIF} |
221 begin |
334 |
222 wrongParameter:= true; |
|
223 GameType:= gmtSyntax |
|
224 end; |
|
225 setAllOptionsWithParameters(ParamStr(paramIndex+1),ParamStr(paramIndex+2),ParamStr(paramIndex+3), |
|
226 ParamStr(paramIndex+4),ParamStr(paramIndex+5),ParamStr(paramIndex+6), |
|
227 ParamStr(paramIndex+7),ParamStr(paramIndex+8),ParamStr(paramIndex+9), |
|
228 ParamStr(paramIndex+10),ParamStr(paramIndex+11),ParamStr(paramIndex+12)); |
|
229 paramIndex:= paramIndex + 13 |
|
230 end |
|
231 else |
|
232 if ParamStr(paramIndex) = '--stats-only' then |
|
233 begin |
|
234 cOnlyStats:= true; |
|
235 SetSound(false); |
|
236 SetMusic(false); |
|
237 cReducedQuality:= $FFFFFFFF xor rqLowRes; // HACK |
|
238 paramIndex:= paramIndex + 1 |
|
239 end |
|
240 else |
|
241 begin |
|
242 wrongParameter:= true; |
|
243 GameType:= gmtSyntax |
|
244 end |
|
245 end |
|
246 end; |
|
247 |
|