hedgewars/CCHandlers.inc
changeset 3774 af0e68ca273e
parent 3680 aaf832c6fbd7
child 3776 28849f5a03c9
equal deleted inserted replaced
3773:f552c7b439fa 3774:af0e68ca273e
   287 end;
   287 end;
   288 
   288 
   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 or (ReadyTimeLeft > 0) then exit;
   293 bShowFinger:= false;
   293 bShowFinger:= false;
   294 if not CurrentTeam^.ExtDriven then SendIPC('L');
   294 if not CurrentTeam^.ExtDriven then SendIPC('L');
   295 with CurrentHedgehog^.Gear^ do
   295 with CurrentHedgehog^.Gear^ do
   296     Message:= Message or gm_Left
   296     Message:= Message or gm_Left
   297 end;
   297 end;
   306 end;
   306 end;
   307 
   307 
   308 procedure chRight_p(var s: shortstring);
   308 procedure chRight_p(var s: shortstring);
   309 begin
   309 begin
   310 s:= s; // avoid compiler hint
   310 s:= s; // avoid compiler hint
   311 if CheckNoTeamOrHH or isPaused then exit;
   311 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
   312 bShowFinger:= false;
   312 bShowFinger:= false;
   313 if not CurrentTeam^.ExtDriven then SendIPC('R');
   313 if not CurrentTeam^.ExtDriven then SendIPC('R');
   314 with CurrentHedgehog^.Gear^ do
   314 with CurrentHedgehog^.Gear^ do
   315     Message:= Message or gm_Right
   315     Message:= Message or gm_Right
   316 end;
   316 end;
   325 end;
   325 end;
   326 
   326 
   327 procedure chUp_p(var s: shortstring);
   327 procedure chUp_p(var s: shortstring);
   328 begin
   328 begin
   329 s:= s; // avoid compiler hint
   329 s:= s; // avoid compiler hint
   330 if CheckNoTeamOrHH or isPaused then exit;
   330 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
   331 bShowFinger:= false;
   331 bShowFinger:= false;
   332 if not CurrentTeam^.ExtDriven then SendIPC('U');
   332 if not CurrentTeam^.ExtDriven then SendIPC('U');
   333 with CurrentHedgehog^.Gear^ do
   333 with CurrentHedgehog^.Gear^ do
   334     Message:= Message or gm_Up
   334     Message:= Message or gm_Up
   335 end;
   335 end;
   344 end;
   344 end;
   345 
   345 
   346 procedure chDown_p(var s: shortstring);
   346 procedure chDown_p(var s: shortstring);
   347 begin
   347 begin
   348 s:= s; // avoid compiler hint
   348 s:= s; // avoid compiler hint
   349 if CheckNoTeamOrHH or isPaused then exit;
   349 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
   350 bShowFinger:= false;
   350 bShowFinger:= false;
   351 if not CurrentTeam^.ExtDriven then SendIPC('D');
   351 if not CurrentTeam^.ExtDriven then SendIPC('D');
   352 with CurrentHedgehog^.Gear^ do
   352 with CurrentHedgehog^.Gear^ do
   353     Message:= Message or gm_Down
   353     Message:= Message or gm_Down
   354 end;
   354 end;
   363 end;
   363 end;
   364 
   364 
   365 procedure chPrecise_p(var s: shortstring);
   365 procedure chPrecise_p(var s: shortstring);
   366 begin
   366 begin
   367 s:= s; // avoid compiler hint
   367 s:= s; // avoid compiler hint
   368 if CheckNoTeamOrHH or isPaused then exit;
   368 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
   369 bShowFinger:= false;
   369 bShowFinger:= false;
   370 if not CurrentTeam^.ExtDriven then SendIPC('Z');
   370 if not CurrentTeam^.ExtDriven then SendIPC('Z');
   371 with CurrentHedgehog^.Gear^ do
   371 with CurrentHedgehog^.Gear^ do
   372     Message:= Message or gm_Precise
   372     Message:= Message or gm_Precise
   373 end;
   373 end;
   382 end;
   382 end;
   383 
   383 
   384 procedure chLJump(var s: shortstring);
   384 procedure chLJump(var s: shortstring);
   385 begin
   385 begin
   386 s:= s; // avoid compiler hint
   386 s:= s; // avoid compiler hint
       
   387 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
       
   388 bShowFinger:= false;
       
   389 if not CurrentTeam^.ExtDriven then SendIPC('j');
       
   390 with CurrentHedgehog^.Gear^ do
       
   391     Message:= Message or gm_LJump
       
   392 end;
       
   393 
       
   394 procedure chHJump(var s: shortstring);
       
   395 begin
       
   396 s:= s; // avoid compiler hint
       
   397 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
       
   398 bShowFinger:= false;
       
   399 if not CurrentTeam^.ExtDriven then SendIPC('J');
       
   400 with CurrentHedgehog^.Gear^ do
       
   401     Message:= Message or gm_HJump
       
   402 end;
       
   403 
       
   404 procedure chAttack_p(var s: shortstring);
       
   405 begin
       
   406 s:= s; // avoid compiler hint
   387 if CheckNoTeamOrHH or isPaused then exit;
   407 if CheckNoTeamOrHH or isPaused then exit;
   388 bShowFinger:= false;
   408 if ReadyTimeLeft > 1 then
   389 if not CurrentTeam^.ExtDriven then SendIPC('j');
   409     begin
   390 with CurrentHedgehog^.Gear^ do
   410     ReadyTimeLeft:= 1; // set to 1 millisecond so we still play the sound file
   391     Message:= Message or gm_LJump
   411     if not CurrentTeam^.ExtDriven then SendIPC('A');
   392 end;
   412     exit
   393 
   413     end;
   394 procedure chHJump(var s: shortstring);
       
   395 begin
       
   396 s:= s; // avoid compiler hint
       
   397 if CheckNoTeamOrHH or isPaused then exit;
       
   398 bShowFinger:= false;
       
   399 if not CurrentTeam^.ExtDriven then SendIPC('J');
       
   400 with CurrentHedgehog^.Gear^ do
       
   401     Message:= Message or gm_HJump
       
   402 end;
       
   403 
       
   404 procedure chAttack_p(var s: shortstring);
       
   405 begin
       
   406 s:= s; // avoid compiler hint
       
   407 if CheckNoTeamOrHH or isPaused then exit;
       
   408 bShowFinger:= false;
   414 bShowFinger:= false;
   409 with CurrentHedgehog^.Gear^ do
   415 with CurrentHedgehog^.Gear^ do
   410     begin
   416     begin
   411     {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
   417     {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
   412     if ((State and gstHHDriven) <> 0) then
   418     if ((State and gstHHDriven) <> 0) then
   431 end;
   437 end;
   432 
   438 
   433 procedure chSwitch(var s: shortstring);
   439 procedure chSwitch(var s: shortstring);
   434 begin
   440 begin
   435 s:= s; // avoid compiler hint
   441 s:= s; // avoid compiler hint
   436 if CheckNoTeamOrHH or isPaused then exit;
   442 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
   437 if not CurrentTeam^.ExtDriven then SendIPC('S');
   443 if not CurrentTeam^.ExtDriven then SendIPC('S');
   438 with CurrentHedgehog^.Gear^ do
   444 with CurrentHedgehog^.Gear^ do
   439     Message:= Message or gm_Switch
   445     Message:= Message or gm_Switch
   440 end;
   446 end;
   441 
   447 
   564 
   570 
   565 end;
   571 end;
   566 
   572 
   567 procedure chNewGrave;
   573 procedure chNewGrave;
   568 begin
   574 begin
   569 if CheckNoTeamOrHH or isPaused then exit;
   575 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
   570 
   576 
   571 if not CurrentTeam^.ExtDriven then SendIPC('g');
   577 if not CurrentTeam^.ExtDriven then SendIPC('g');
   572 
   578 
   573 AddGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), gtGrave, 0, _0, _0, 0)
   579 AddGear(hwRound(CurrentHedgehog^.Gear^.X), hwRound(CurrentHedgehog^.Gear^.Y), gtGrave, 0, _0, _0, 0)
   574 end;
   580 end;
   575 
   581 
   576 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   582 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   577 begin
   583 begin
   578 if CheckNoTeamOrHH or isPaused then exit;
   584 if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
   579 if not CurrentTeam^.ExtDriven and bShowAmmoMenu then
   585 if not CurrentTeam^.ExtDriven and bShowAmmoMenu then
   580     begin
   586     begin
   581     bSelected:= true;
   587     bSelected:= true;
   582     exit
   588     exit
   583     end;
   589     end;