6 procedure initModule; |
6 procedure initModule; |
7 procedure freeModule; |
7 procedure freeModule; |
8 |
8 |
9 implementation |
9 implementation |
10 uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom; |
10 uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom; |
|
11 |
|
12 procedure chGenCmd(var s: shortstring); |
|
13 begin |
|
14 AddFileLog('uhoh'); |
|
15 case s[1] of |
|
16 'R': if ReadyTimeLeft > 1 then |
|
17 begin |
|
18 ReadyTimeLeft:= 1; |
|
19 if not CurrentTeam^.ExtDriven then SendIPC('c'+s); |
|
20 end |
|
21 end |
|
22 end; |
11 |
23 |
12 procedure chQuit(var s: shortstring); |
24 procedure chQuit(var s: shortstring); |
13 const prevGState: TGameState = gsConfirm; |
25 const prevGState: TGameState = gsConfirm; |
14 begin |
26 begin |
15 s:= s; // avoid compiler hint |
27 s:= s; // avoid compiler hint |
150 procedure chLeft_p(var s: shortstring); |
162 procedure chLeft_p(var s: shortstring); |
151 begin |
163 begin |
152 s:= s; // avoid compiler hint |
164 s:= s; // avoid compiler hint |
153 if CheckNoTeamOrHH or isPaused then exit; |
165 if CheckNoTeamOrHH or isPaused then exit; |
154 if not CurrentTeam^.ExtDriven then SendIPC('L'); |
166 if not CurrentTeam^.ExtDriven then SendIPC('L'); |
155 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
156 bShowFinger:= false; |
167 bShowFinger:= false; |
157 with CurrentHedgehog^.Gear^ do |
168 with CurrentHedgehog^.Gear^ do |
158 Message:= Message or (gmLeft and InputMask) |
169 Message:= Message or (gmLeft and InputMask) |
159 end; |
170 end; |
160 |
171 |
170 procedure chRight_p(var s: shortstring); |
181 procedure chRight_p(var s: shortstring); |
171 begin |
182 begin |
172 s:= s; // avoid compiler hint |
183 s:= s; // avoid compiler hint |
173 if CheckNoTeamOrHH or isPaused then exit; |
184 if CheckNoTeamOrHH or isPaused then exit; |
174 if not CurrentTeam^.ExtDriven then SendIPC('R'); |
185 if not CurrentTeam^.ExtDriven then SendIPC('R'); |
175 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
176 bShowFinger:= false; |
186 bShowFinger:= false; |
177 with CurrentHedgehog^.Gear^ do |
187 with CurrentHedgehog^.Gear^ do |
178 Message:= Message or (gmRight and InputMask) |
188 Message:= Message or (gmRight and InputMask) |
179 end; |
189 end; |
180 |
190 |
190 procedure chUp_p(var s: shortstring); |
200 procedure chUp_p(var s: shortstring); |
191 begin |
201 begin |
192 s:= s; // avoid compiler hint |
202 s:= s; // avoid compiler hint |
193 if CheckNoTeamOrHH or isPaused then exit; |
203 if CheckNoTeamOrHH or isPaused then exit; |
194 if not CurrentTeam^.ExtDriven then SendIPC('U'); |
204 if not CurrentTeam^.ExtDriven then SendIPC('U'); |
195 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
196 bShowFinger:= false; |
205 bShowFinger:= false; |
197 with CurrentHedgehog^.Gear^ do |
206 with CurrentHedgehog^.Gear^ do |
198 Message:= Message or (gmUp and InputMask) |
207 Message:= Message or (gmUp and InputMask) |
199 end; |
208 end; |
200 |
209 |
210 procedure chDown_p(var s: shortstring); |
219 procedure chDown_p(var s: shortstring); |
211 begin |
220 begin |
212 s:= s; // avoid compiler hint |
221 s:= s; // avoid compiler hint |
213 if CheckNoTeamOrHH or isPaused then exit; |
222 if CheckNoTeamOrHH or isPaused then exit; |
214 if not CurrentTeam^.ExtDriven then SendIPC('D'); |
223 if not CurrentTeam^.ExtDriven then SendIPC('D'); |
215 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
216 bShowFinger:= false; |
224 bShowFinger:= false; |
217 with CurrentHedgehog^.Gear^ do |
225 with CurrentHedgehog^.Gear^ do |
218 Message:= Message or (gmDown and InputMask) |
226 Message:= Message or (gmDown and InputMask) |
219 end; |
227 end; |
220 |
228 |
230 procedure chPrecise_p(var s: shortstring); |
238 procedure chPrecise_p(var s: shortstring); |
231 begin |
239 begin |
232 s:= s; // avoid compiler hint |
240 s:= s; // avoid compiler hint |
233 if CheckNoTeamOrHH or isPaused then exit; |
241 if CheckNoTeamOrHH or isPaused then exit; |
234 if not CurrentTeam^.ExtDriven then SendIPC('Z'); |
242 if not CurrentTeam^.ExtDriven then SendIPC('Z'); |
235 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
236 bShowFinger:= false; |
243 bShowFinger:= false; |
237 with CurrentHedgehog^.Gear^ do |
244 with CurrentHedgehog^.Gear^ do |
238 Message:= Message or (gmPrecise and InputMask); |
245 Message:= Message or (gmPrecise and InputMask); |
239 end; |
246 end; |
240 |
247 |
250 procedure chLJump(var s: shortstring); |
257 procedure chLJump(var s: shortstring); |
251 begin |
258 begin |
252 s:= s; // avoid compiler hint |
259 s:= s; // avoid compiler hint |
253 if CheckNoTeamOrHH or isPaused then exit; |
260 if CheckNoTeamOrHH or isPaused then exit; |
254 if not CurrentTeam^.ExtDriven then SendIPC('j'); |
261 if not CurrentTeam^.ExtDriven then SendIPC('j'); |
255 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
256 bShowFinger:= false; |
262 bShowFinger:= false; |
257 with CurrentHedgehog^.Gear^ do |
263 with CurrentHedgehog^.Gear^ do |
258 Message:= Message or (gmLJump and InputMask) |
264 Message:= Message or (gmLJump and InputMask) |
259 end; |
265 end; |
260 |
266 |
261 procedure chHJump(var s: shortstring); |
267 procedure chHJump(var s: shortstring); |
262 begin |
268 begin |
263 s:= s; // avoid compiler hint |
269 s:= s; // avoid compiler hint |
264 if CheckNoTeamOrHH or isPaused then exit; |
270 if CheckNoTeamOrHH or isPaused then exit; |
265 if not CurrentTeam^.ExtDriven then SendIPC('J'); |
271 if not CurrentTeam^.ExtDriven then SendIPC('J'); |
266 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
267 bShowFinger:= false; |
272 bShowFinger:= false; |
268 with CurrentHedgehog^.Gear^ do |
273 with CurrentHedgehog^.Gear^ do |
269 Message:= Message or (gmHJump and InputMask) |
274 Message:= Message or (gmHJump and InputMask) |
270 end; |
275 end; |
271 |
276 |
272 procedure chAttack_p(var s: shortstring); |
277 procedure chAttack_p(var s: shortstring); |
273 begin |
278 begin |
274 s:= s; // avoid compiler hint |
279 s:= s; // avoid compiler hint |
275 if CheckNoTeamOrHH or isPaused then exit; |
280 if CheckNoTeamOrHH or isPaused then exit; |
276 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
277 bShowFinger:= false; |
281 bShowFinger:= false; |
278 with CurrentHedgehog^.Gear^ do |
282 with CurrentHedgehog^.Gear^ do |
279 begin |
283 begin |
280 {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF} |
284 {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF} |
281 if ((State and gstHHDriven) <> 0) then |
285 if ((State and gstHHDriven) <> 0) then |
302 procedure chSwitch(var s: shortstring); |
306 procedure chSwitch(var s: shortstring); |
303 begin |
307 begin |
304 s:= s; // avoid compiler hint |
308 s:= s; // avoid compiler hint |
305 if CheckNoTeamOrHH or isPaused then exit; |
309 if CheckNoTeamOrHH or isPaused then exit; |
306 if not CurrentTeam^.ExtDriven then SendIPC('S'); |
310 if not CurrentTeam^.ExtDriven then SendIPC('S'); |
307 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
308 bShowFinger:= false; |
311 bShowFinger:= false; |
309 with CurrentHedgehog^.Gear^ do |
312 with CurrentHedgehog^.Gear^ do |
310 Message:= Message or (gmSwitch and InputMask) |
313 Message:= Message or (gmSwitch and InputMask) |
311 end; |
314 end; |
312 |
315 |
324 procedure chTimer(var s: shortstring); |
327 procedure chTimer(var s: shortstring); |
325 begin |
328 begin |
326 if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit; |
329 if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit; |
327 |
330 |
328 if not CurrentTeam^.ExtDriven then SendIPC(s); |
331 if not CurrentTeam^.ExtDriven then SendIPC(s); |
329 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
330 bShowFinger:= false; |
332 bShowFinger:= false; |
331 with CurrentHedgehog^.Gear^ do |
333 with CurrentHedgehog^.Gear^ do |
332 begin |
334 begin |
333 Message:= Message or (gmTimer and InputMask); |
335 Message:= Message or (gmTimer and InputMask); |
334 MsgParam:= byte(s[1]) - ord('0') |
336 MsgParam:= byte(s[1]) - ord('0') |
340 begin |
342 begin |
341 if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
343 if (s[0] <> #1) or CheckNoTeamOrHH then exit; |
342 slot:= byte(s[1]) - 49; |
344 slot:= byte(s[1]) - 49; |
343 if slot > cMaxSlotIndex then exit; |
345 if slot > cMaxSlotIndex then exit; |
344 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
346 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79)); |
345 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
346 bShowFinger:= false; |
347 bShowFinger:= false; |
347 with CurrentHedgehog^.Gear^ do |
348 with CurrentHedgehog^.Gear^ do |
348 begin |
349 begin |
349 Message:= Message or (gmSlot and InputMask); |
350 Message:= Message or (gmSlot and InputMask); |
350 MsgParam:= slot |
351 MsgParam:= slot |
436 if bShowAmmoMenu then bShowAmmoMenu:= false |
437 if bShowAmmoMenu then bShowAmmoMenu:= false |
437 else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or |
438 else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or |
438 ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or |
439 ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or |
439 ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
440 ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true |
440 end; |
441 end; |
441 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1 |
|
442 end |
442 end |
443 end; |
443 end; |
444 |
444 |
445 procedure chVol_p(var s: shortstring); |
445 procedure chVol_p(var s: shortstring); |
446 begin |
446 begin |
463 end; |
463 end; |
464 |
464 |
465 procedure chPause(var s: shortstring); |
465 procedure chPause(var s: shortstring); |
466 begin |
466 begin |
467 s:= s; // avoid compiler hint |
467 s:= s; // avoid compiler hint |
468 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
469 if gameType <> gmtNet then |
468 if gameType <> gmtNet then |
470 isPaused:= not isPaused; |
469 isPaused:= not isPaused; |
471 SDL_ShowCursor(ord(isPaused)) |
470 SDL_ShowCursor(ord(isPaused)) |
472 end; |
471 end; |
473 |
472 |
527 RegisterVariable('nextturn', vtCommand, @chNextTurn , false); |
526 RegisterVariable('nextturn', vtCommand, @chNextTurn , false); |
528 RegisterVariable('-attack' , vtCommand, @chAttack_m , false); |
527 RegisterVariable('-attack' , vtCommand, @chAttack_m , false); |
529 RegisterVariable('slot' , vtCommand, @chSlot , false); |
528 RegisterVariable('slot' , vtCommand, @chSlot , false); |
530 RegisterVariable('setweap' , vtCommand, @chSetWeapon , false); |
529 RegisterVariable('setweap' , vtCommand, @chSetWeapon , false); |
531 //////// End top by freq analysis |
530 //////// End top by freq analysis |
|
531 RegisterVariable('gencmd' , vtCommand, @chGenCmd , false); |
532 RegisterVariable('flag' , vtCommand, @chFlag , false); |
532 RegisterVariable('flag' , vtCommand, @chFlag , false); |
533 RegisterVariable('script' , vtCommand, @chScript , false); |
533 RegisterVariable('script' , vtCommand, @chScript , false); |
534 RegisterVariable('proto' , vtCommand, @chCheckProto , true ); |
534 RegisterVariable('proto' , vtCommand, @chCheckProto , true ); |
535 RegisterVariable('spectate', vtBoolean, @fastUntilLag , false); |
535 RegisterVariable('spectate', vtBoolean, @fastUntilLag , false); |
536 RegisterVariable('capture' , vtCommand, @chCapture , true ); |
536 RegisterVariable('capture' , vtCommand, @chCapture , true ); |