hedgewars/CCHandlers.inc
changeset 3796 4ab6d6f78312
parent 3776 28849f5a03c9
child 3797 e097914ac0e2
equal deleted inserted replaced
3794:dc359b2ab872 3796:4ab6d6f78312
   289 procedure chLeft_p(var s: shortstring);
   289 procedure chLeft_p(var s: shortstring);
   290 begin
   290 begin
   291 s:= s; // avoid compiler hint
   291 s:= s; // avoid compiler hint
   292 if CheckNoTeamOrHH or isPaused then exit;
   292 if CheckNoTeamOrHH or isPaused then exit;
   293 if not CurrentTeam^.ExtDriven then SendIPC('L');
   293 if not CurrentTeam^.ExtDriven then SendIPC('L');
   294 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   294 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   295 bShowFinger:= false;
   295 bShowFinger:= false;
   296 with CurrentHedgehog^.Gear^ do
   296 with CurrentHedgehog^.Gear^ do
   297     Message:= Message or gm_Left
   297     Message:= Message or gm_Left
   298 end;
   298 end;
   299 
   299 
   309 procedure chRight_p(var s: shortstring);
   309 procedure chRight_p(var s: shortstring);
   310 begin
   310 begin
   311 s:= s; // avoid compiler hint
   311 s:= s; // avoid compiler hint
   312 if CheckNoTeamOrHH or isPaused then exit;
   312 if CheckNoTeamOrHH or isPaused then exit;
   313 if not CurrentTeam^.ExtDriven then SendIPC('R');
   313 if not CurrentTeam^.ExtDriven then SendIPC('R');
   314 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   314 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   315 bShowFinger:= false;
   315 bShowFinger:= false;
   316 with CurrentHedgehog^.Gear^ do
   316 with CurrentHedgehog^.Gear^ do
   317     Message:= Message or gm_Right
   317     Message:= Message or gm_Right
   318 end;
   318 end;
   319 
   319 
   329 procedure chUp_p(var s: shortstring);
   329 procedure chUp_p(var s: shortstring);
   330 begin
   330 begin
   331 s:= s; // avoid compiler hint
   331 s:= s; // avoid compiler hint
   332 if CheckNoTeamOrHH or isPaused then exit;
   332 if CheckNoTeamOrHH or isPaused then exit;
   333 if not CurrentTeam^.ExtDriven then SendIPC('U');
   333 if not CurrentTeam^.ExtDriven then SendIPC('U');
   334 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   334 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   335 bShowFinger:= false;
   335 bShowFinger:= false;
   336 with CurrentHedgehog^.Gear^ do
   336 with CurrentHedgehog^.Gear^ do
   337     Message:= Message or gm_Up
   337     Message:= Message or gm_Up
   338 end;
   338 end;
   339 
   339 
   349 procedure chDown_p(var s: shortstring);
   349 procedure chDown_p(var s: shortstring);
   350 begin
   350 begin
   351 s:= s; // avoid compiler hint
   351 s:= s; // avoid compiler hint
   352 if CheckNoTeamOrHH or isPaused then exit;
   352 if CheckNoTeamOrHH or isPaused then exit;
   353 if not CurrentTeam^.ExtDriven then SendIPC('D');
   353 if not CurrentTeam^.ExtDriven then SendIPC('D');
   354 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   354 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   355 bShowFinger:= false;
   355 bShowFinger:= false;
   356 with CurrentHedgehog^.Gear^ do
   356 with CurrentHedgehog^.Gear^ do
   357     Message:= Message or gm_Down
   357     Message:= Message or gm_Down
   358 end;
   358 end;
   359 
   359 
   369 procedure chPrecise_p(var s: shortstring);
   369 procedure chPrecise_p(var s: shortstring);
   370 begin
   370 begin
   371 s:= s; // avoid compiler hint
   371 s:= s; // avoid compiler hint
   372 if CheckNoTeamOrHH or isPaused then exit;
   372 if CheckNoTeamOrHH or isPaused then exit;
   373 if not CurrentTeam^.ExtDriven then SendIPC('Z');
   373 if not CurrentTeam^.ExtDriven then SendIPC('Z');
   374 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   374 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   375 bShowFinger:= false;
   375 bShowFinger:= false;
   376 with CurrentHedgehog^.Gear^ do
   376 with CurrentHedgehog^.Gear^ do
   377     Message:= Message or gm_Precise
   377     Message:= Message or gm_Precise
   378 end;
   378 end;
   379 
   379 
   446 procedure chSwitch(var s: shortstring);
   446 procedure chSwitch(var s: shortstring);
   447 begin
   447 begin
   448 s:= s; // avoid compiler hint
   448 s:= s; // avoid compiler hint
   449 if CheckNoTeamOrHH or isPaused then exit;
   449 if CheckNoTeamOrHH or isPaused then exit;
   450 if not CurrentTeam^.ExtDriven then SendIPC('S');
   450 if not CurrentTeam^.ExtDriven then SendIPC('S');
   451 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   451 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   452 bShowFinger:= false;
   452 bShowFinger:= false;
   453 with CurrentHedgehog^.Gear^ do
   453 with CurrentHedgehog^.Gear^ do
   454     Message:= Message or gm_Switch
   454     Message:= Message or gm_Switch
   455 end;
   455 end;
   456 
   456 
   492 procedure chTimer(var s: shortstring);
   492 procedure chTimer(var s: shortstring);
   493 begin
   493 begin
   494 if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit;
   494 if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit;
   495 
   495 
   496 if not CurrentTeam^.ExtDriven then SendIPC(s);
   496 if not CurrentTeam^.ExtDriven then SendIPC(s);
   497 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   497 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   498 bShowFinger:= false;
   498 bShowFinger:= false;
   499 with CurrentHedgehog^.Gear^ do
   499 with CurrentHedgehog^.Gear^ do
   500     begin
   500     begin
   501     Message:= Message or gm_Timer;
   501     Message:= Message or gm_Timer;
   502     MsgParam:= byte(s[1]) - ord('0')
   502     MsgParam:= byte(s[1]) - ord('0')
   508 begin
   508 begin
   509 if (s[0] <> #1) or CheckNoTeamOrHH then exit;
   509 if (s[0] <> #1) or CheckNoTeamOrHH then exit;
   510 slot:= byte(s[1]) - 49;
   510 slot:= byte(s[1]) - 49;
   511 if slot > cMaxSlotIndex then exit;
   511 if slot > cMaxSlotIndex then exit;
   512 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
   512 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
   513 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   513 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   514 bShowFinger:= false;
   514 bShowFinger:= false;
   515 with CurrentHedgehog^.Gear^ do
   515 with CurrentHedgehog^.Gear^ do
   516     begin
   516     begin
   517     Message:= Message or gm_Slot;
   517     Message:= Message or gm_Slot;
   518     MsgParam:= slot
   518     MsgParam:= slot
   583 
   583 
   584 procedure chNewGrave;
   584 procedure chNewGrave;
   585 begin
   585 begin
   586 if CheckNoTeamOrHH or isPaused then exit;
   586 if CheckNoTeamOrHH or isPaused then exit;
   587 
   587 
   588 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   588 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   589 
   589 
   590 if not CurrentTeam^.ExtDriven then SendIPC('g');
   590 if not CurrentTeam^.ExtDriven then SendIPC('g');
   591 
   591 
   592 AddGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), gtGrave, 0, _0, _0, 0)
   592 AddGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), gtGrave, 0, _0, _0, 0)
   593 end;
   593 end;
   594 
   594 
   595 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   595 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   596 begin
   596 begin
   597 if CheckNoTeamOrHH or isPaused then exit;
   597 if CheckNoTeamOrHH or isPaused then exit;
   598 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   598 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   599 bShowFinger:= false;
   599 bShowFinger:= false;
   600 if not CurrentTeam^.ExtDriven and bShowAmmoMenu then
   600 if not CurrentTeam^.ExtDriven and bShowAmmoMenu then
   601     begin
   601     begin
   602     bSelected:= true;
   602     bSelected:= true;
   603     exit
   603     exit
   798 end;
   798 end;
   799 
   799 
   800 procedure chPause(var s: shortstring);
   800 procedure chPause(var s: shortstring);
   801 begin
   801 begin
   802 s:= s; // avoid compiler hint
   802 s:= s; // avoid compiler hint
   803 if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
   803 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   804 if gameType <> gmtNet then
   804 if gameType <> gmtNet then
   805     isPaused:= not isPaused;
   805     isPaused:= not isPaused;
   806 SDL_ShowCursor(ord(isPaused))
   806 SDL_ShowCursor(ord(isPaused))
   807 end;
   807 end;
   808 
   808