138 cVideoQuality:= StrToInt(ParamStr(paramIndex)); inc(paramIndex); |
138 cVideoQuality:= StrToInt(ParamStr(paramIndex)); inc(paramIndex); |
139 cAudioCodec:= ParamStr(paramIndex); inc(paramIndex); |
139 cAudioCodec:= ParamStr(paramIndex); inc(paramIndex); |
140 {$ENDIF} |
140 {$ENDIF} |
141 end; |
141 end; |
142 |
142 |
143 function getLongIntParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt; |
143 function getLongIntParameter(str:shortstring; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt; |
144 var tmpInt, c: LongInt; |
144 var tmpInt, c: LongInt; |
145 begin |
145 begin |
146 inc(paramIndex); |
146 inc(paramIndex); |
|
147 {$IFDEF PAS2C} |
|
148 val(str, tmpInt); |
|
149 {$ELSE} |
147 val(str, tmpInt, c); |
150 val(str, tmpInt, c); |
148 wrongParameter:= c <> 0; |
151 wrongParameter:= c <> 0; |
149 if wrongParameter then |
152 if wrongParameter then |
150 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a number, you passed "'+str+'"'); |
153 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a number, you passed "'+str+'"'); |
|
154 {$ENDIF} |
151 getLongIntParameter:= tmpInt; |
155 getLongIntParameter:= tmpInt; |
152 end; |
156 end; |
153 |
157 |
154 function getStringParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): String; |
158 function getStringParameter(str:shortstring; var paramIndex:LongInt; var wrongParameter:Boolean): shortstring; |
155 begin |
159 begin |
156 inc(paramIndex); |
160 inc(paramIndex); |
157 wrongParameter:= (str='') or (Copy(str,1,2) = '--'); |
161 wrongParameter:= (str='') or (Copy(str,1,2) = '--'); |
158 if wrongParameter then |
162 if wrongParameter then |
159 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a string, you passed "'+str+'"'); |
163 WriteLn(stderr, 'ERROR: '+ParamStr(paramIndex-1)+' expects a string, you passed "'+str+'"'); |
160 getStringParameter:= str; |
164 getStringParameter:= str; |
161 end; |
165 end; |
162 |
166 |
163 procedure parseClassicParameter(cmdarray: array of String; size:LongInt; var paramIndex:LongInt); forward; |
167 procedure parseClassicParameter(cmdarray: array of shortstring; size:LongInt; var paramIndex:LongInt); forward; |
164 |
168 |
165 function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean; |
169 function parseParameter(cmd:shortstring; arg:shortstring; var paramIndex:LongInt): Boolean; |
166 const videoarray: array [0..4] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth'); |
170 const videoarray: array [0..4] of shortstring = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth'); |
167 audioarray: array [0..2] of String = ('--volume','--nomusic','--nosound'); |
171 audioarray: array [0..2] of shortstring = ('--volume','--nomusic','--nosound'); |
168 otherarray: array [0..2] of String = ('--locale','--fullscreen','--showfps'); |
172 otherarray: array [0..2] of shortstring = ('--locale','--fullscreen','--showfps'); |
169 mediaarray: array [0..9] of String = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen'); |
173 mediaarray: array [0..9] of shortstring = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen'); |
170 allarray: array [0..13] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality'); |
174 allarray: array [0..13] of shortstring = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality'); |
171 reallyAll: array[0..30] of shortstring = ( |
175 reallyAll: array[0..30] of shortstring = ( |
172 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width', |
176 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width', |
173 '--height', '--frame-interval', '--volume','--nomusic', '--nosound', |
177 '--height', '--frame-interval', '--volume','--nomusic', '--nosound', |
174 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick', |
178 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick', |
175 {deprecated} '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything', |
179 {deprecated} '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything', |
231 end; |
235 end; |
232 end; |
236 end; |
233 end; |
237 end; |
234 end; |
238 end; |
235 |
239 |
236 procedure parseClassicParameter(cmdarray: array of String; size:LongInt; var paramIndex:LongInt); |
240 procedure parseClassicParameter(cmdarray: array of shortstring; size:LongInt; var paramIndex:LongInt); |
237 var index, tmpInt: LongInt; |
241 var index, tmpInt: LongInt; |
238 isBool, isValid: Boolean; |
242 isBool, isValid: Boolean; |
239 cmd, arg, newSyntax: String; |
243 cmd, arg, newSyntax: shortstring; |
240 begin |
244 begin |
241 WriteLn(stdout, 'WARNING: you are using a deprecated command, which could be removed in a future version!'); |
245 WriteLn(stdout, 'WARNING: you are using a deprecated command, which could be removed in a future version!'); |
242 WriteLn(stdout, ' Consider updating to the latest syntax, which is much more flexible!'); |
246 WriteLn(stdout, ' Consider updating to the latest syntax, which is much more flexible!'); |
243 WriteLn(stdout, ' Run `hwegine --help` to learn it!'); |
247 WriteLn(stdout, ' Run `hwegine --help` to learn it!'); |
244 WriteLn(stdout, ''); |
248 WriteLn(stdout, ''); |