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 begin |
125 begin |
126 parseParameter:= false; |
126 parseParameter:= false; |
127 case cmd of |
127 if cmd = '--locale' then |
128 '--locale' : cLocaleFName := getStringParameter (arg, paramIndex); |
128 cLocaleFName := getStringParameter (arg, paramIndex) |
129 '--width' : cScreenWidth := getLongIntParameter(arg, paramIndex, parseParameter); |
129 else if cmd = '--width' then |
130 '--height' : cScreenHeight := getLongIntParameter(arg, paramIndex, parseParameter); |
130 cScreenWidth := getLongIntParameter(arg, paramIndex, parseParameter) |
131 '--depth' : cBits := getLongIntParameter(arg, paramIndex, parseParameter); |
131 else if cmd = '--height' then |
132 '--time' : cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter); |
132 cScreenHeight := getLongIntParameter(arg, paramIndex, parseParameter) |
133 '--volume' : SetVolume ( getLongIntParameter(arg, paramIndex, parseParameter) ); |
133 else if cmd = '--depth' then |
134 '--nomusic' : SetMusic ( false ); |
134 cBits := getLongIntParameter(arg, paramIndex, parseParameter) |
135 '--nosound' : SetSound ( false ); |
135 else if cmd = '--time' then |
136 '--fullscreen' : cFullScreen := true; |
136 cTimerInterval := getLongIntParameter(arg, paramIndex, parseParameter) |
137 '--showfps' : cShowFPS := true; |
137 else if cmd = '--volume' then |
138 '--altdmg' : cAltDamage := true; |
138 SetVolume ( getLongIntParameter(arg, paramIndex, parseParameter) ) |
139 '--lowquality' : cReducedQuality:= ($FFFFFFFF * getLongIntParameter(arg, paramIndex, parseParameter)) xor rqLowRes; //HACK! |
139 else if cmd = '--nomusic' then |
140 '--set-video' : parseClassicParameter(videoArray,3,paramIndex); |
140 SetMusic ( false ) |
141 '--set-audio' : parseClassicParameter(audioArray,3,paramIndex); |
141 else if cmd = '--nosound' then |
142 '--set-other' : parseClassicParameter(otherArray,3,paramIndex); |
142 SetSound ( false ) |
143 '--set-multimedia' : parseClassicParameter(mediaArray,8,paramIndex); |
143 else if cmd = '--fullscreen' then |
144 '--set-everything' : parseClassicParameter(allArray,12,paramIndex); |
144 cFullScreen := true |
145 '--stats-only' : begin |
145 else if cmd = '--showfps' then |
146 cOnlyStats:= true; |
146 cShowFPS := true |
147 SetSound(false); |
147 else if cmd = '--altdmg' then |
148 SetMusic(false); |
148 cAltDamage := true |
149 cReducedQuality:= $FFFFFFFF xor rqLowRes; |
149 else if cmd = '--lowquality' then |
150 end; |
150 cReducedQuality:= ($FFFFFFFF * getLongIntParameter(arg, paramIndex, parseParameter)) xor rqLowRes //HACK |
151 '--gci' : begin // We had to make up all this saved space some how... \\ |
151 else if cmd = '--set-video' then |
152 WriteLn(stdout, ' '); |
152 parseClassicParameter(videoArray,3,paramIndex) |
153 WriteLn(stdout, ' /\\\\\\\\\\\\ /\\\\\\\\\ /\\\\\\\\\\\ '); |
153 else if cmd = '--set-audio' then |
154 WriteLn(stdout, ' /\\\////////// /\\\//////// \/////\\\/// '); |
154 parseClassicParameter(audioArray,3,paramIndex) |
155 WriteLn(stdout, ' /\\\ /\\\/ \/\\\ '); |
155 else if cmd = '--set-other' then |
156 WriteLn(stdout, ' \/\\\ /\\\\\\\ /\\\ \/\\\ '); |
156 parseClassicParameter(otherArray,3,paramIndex) |
157 WriteLn(stdout, ' \/\\\ \/////\\\ \/\\\ \/\\\ '); |
157 else if cmd = '--set-multimedia' then |
158 WriteLn(stdout, ' \/\\\ \/\\\ \//\\\ \/\\\ '); |
158 parseClassicParameter(mediaArray,8,paramIndex) |
159 WriteLn(stdout, ' \/\\\ \/\\\ \///\\\ \/\\\ '); |
159 else if cmd = '--set-everything' then |
160 WriteLn(stdout, ' \//\\\\\\\\\\\\/ \////\\\\\\\\\ /\\\\\\\\\\\ '); |
160 parseClassicParameter(allArray,12,paramIndex) |
161 WriteLn(stdout, ' \//////////// \///////// \/////////// '); |
161 else if cmd = '--stats-only' then |
162 WriteLn(stdout, ' '); |
162 begin |
163 WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student '); |
163 cOnlyStats:= true; |
164 WriteLn(stdout, ' ASCII Art easter egg idea by @sheepluva '); |
164 SetSound(false); |
165 WriteLn(stdout, ' '); |
165 SetMusic(false); |
166 end; |
166 cReducedQuality:= $FFFFFFFF xor rqLowRes |
167 '--help' : begin |
167 end |
168 DisplayUsage(); |
168 else if cmd = '--gci' then |
169 GameType:= gmtSyntax; |
169 begin // We had to make up all this saved space some how... \\ |
170 end; |
170 WriteLn(stdout, ' '); |
|
171 WriteLn(stdout, ' /\\\\\\\\\\\\ /\\\\\\\\\ /\\\\\\\\\\\ '); |
|
172 WriteLn(stdout, ' /\\\////////// /\\\//////// \/////\\\/// '); |
|
173 WriteLn(stdout, ' /\\\ /\\\/ \/\\\ '); |
|
174 WriteLn(stdout, ' \/\\\ /\\\\\\\ /\\\ \/\\\ '); |
|
175 WriteLn(stdout, ' \/\\\ \/////\\\ \/\\\ \/\\\ '); |
|
176 WriteLn(stdout, ' \/\\\ \/\\\ \//\\\ \/\\\ '); |
|
177 WriteLn(stdout, ' \/\\\ \/\\\ \///\\\ \/\\\ '); |
|
178 WriteLn(stdout, ' \//\\\\\\\\\\\\/ \////\\\\\\\\\ /\\\\\\\\\\\ '); |
|
179 WriteLn(stdout, ' \//////////// \///////// \/////////// '); |
|
180 WriteLn(stdout, ' '); |
|
181 WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student '); |
|
182 WriteLn(stdout, ' ASCII Art easter egg idea by @sheepluva '); |
|
183 WriteLn(stdout, ' ') |
|
184 end |
|
185 else if cmd = '--help' then |
|
186 begin |
|
187 DisplayUsage(); |
|
188 GameType:= gmtSyntax |
|
189 end |
171 else |
190 else |
172 begin |
191 begin |
173 WriteLn(stderr, 'ERROR: '+cmd+' is not a valid argument'); |
192 WriteLn(stderr, 'ERROR: '+cmd+' is not a valid argument'); |
174 parseParameter:= true; |
193 parseParameter:= true |
175 end |
194 end; |
176 end; |
|
177 end; |
195 end; |
178 |
196 |
179 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); |
197 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); |
180 var index, tmpInt: LongInt; |
198 var index, tmpInt: LongInt; |
181 isBool: Boolean; |
199 isBool: Boolean; |