hedgewars/CCHandlers.inc
changeset 3894 9abce5468583
parent 3836 833c0f32e326
child 3928 2560731c860d
equal deleted inserted replaced
3892:60d9709f2d8e 3894:9abce5468583
   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 ReadyTimeLeft:= 1;
   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 gmLeft
   298 end;
   298 end;
   299 
   299 
   300 procedure chLeft_m(var s: shortstring);
   300 procedure chLeft_m(var s: shortstring);
   301 begin
   301 begin
   302 s:= s; // avoid compiler hint
   302 s:= s; // avoid compiler hint
   303 if CheckNoTeamOrHH then exit;
   303 if CheckNoTeamOrHH then exit;
   304 if not CurrentTeam^.ExtDriven then SendIPC('l');
   304 if not CurrentTeam^.ExtDriven then SendIPC('l');
   305 with CurrentHedgehog^.Gear^ do
   305 with CurrentHedgehog^.Gear^ do
   306     Message:= Message and not gm_Left
   306     Message:= Message and not gmLeft
   307 end;
   307 end;
   308 
   308 
   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 ReadyTimeLeft:= 1;
   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 gmRight
   318 end;
   318 end;
   319 
   319 
   320 procedure chRight_m(var s: shortstring);
   320 procedure chRight_m(var s: shortstring);
   321 begin
   321 begin
   322 s:= s; // avoid compiler hint
   322 s:= s; // avoid compiler hint
   323 if CheckNoTeamOrHH then exit;
   323 if CheckNoTeamOrHH then exit;
   324 if not CurrentTeam^.ExtDriven then SendIPC('r');
   324 if not CurrentTeam^.ExtDriven then SendIPC('r');
   325 with CurrentHedgehog^.Gear^ do
   325 with CurrentHedgehog^.Gear^ do
   326     Message:= Message and not gm_Right
   326     Message:= Message and not gmRight
   327 end;
   327 end;
   328 
   328 
   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 ReadyTimeLeft:= 1;
   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 gmUp
   338 end;
   338 end;
   339 
   339 
   340 procedure chUp_m(var s: shortstring);
   340 procedure chUp_m(var s: shortstring);
   341 begin
   341 begin
   342 s:= s; // avoid compiler hint
   342 s:= s; // avoid compiler hint
   343 if CheckNoTeamOrHH then exit;
   343 if CheckNoTeamOrHH then exit;
   344 if not CurrentTeam^.ExtDriven then SendIPC('u');
   344 if not CurrentTeam^.ExtDriven then SendIPC('u');
   345 with CurrentHedgehog^.Gear^ do
   345 with CurrentHedgehog^.Gear^ do
   346     Message:= Message and not gm_Up
   346     Message:= Message and not gmUp
   347 end;
   347 end;
   348 
   348 
   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 ReadyTimeLeft:= 1;
   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 gmDown
   358 end;
   358 end;
   359 
   359 
   360 procedure chDown_m(var s: shortstring);
   360 procedure chDown_m(var s: shortstring);
   361 begin
   361 begin
   362 s:= s; // avoid compiler hint
   362 s:= s; // avoid compiler hint
   363 if CheckNoTeamOrHH then exit;
   363 if CheckNoTeamOrHH then exit;
   364 if not CurrentTeam^.ExtDriven then SendIPC('d');
   364 if not CurrentTeam^.ExtDriven then SendIPC('d');
   365 with CurrentHedgehog^.Gear^ do
   365 with CurrentHedgehog^.Gear^ do
   366     Message:= Message and not gm_Down
   366     Message:= Message and not gmDown
   367 end;
   367 end;
   368 
   368 
   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 ReadyTimeLeft:= 1;
   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 gmPrecise
   378 end;
   378 end;
   379 
   379 
   380 procedure chPrecise_m(var s: shortstring);
   380 procedure chPrecise_m(var s: shortstring);
   381 begin
   381 begin
   382 s:= s; // avoid compiler hint
   382 s:= s; // avoid compiler hint
   383 if CheckNoTeamOrHH then exit;
   383 if CheckNoTeamOrHH then exit;
   384 if not CurrentTeam^.ExtDriven then SendIPC('z');
   384 if not CurrentTeam^.ExtDriven then SendIPC('z');
   385 with CurrentHedgehog^.Gear^ do
   385 with CurrentHedgehog^.Gear^ do
   386     Message:= Message and not gm_Precise
   386     Message:= Message and not gmPrecise
   387 end;
   387 end;
   388 
   388 
   389 procedure chLJump(var s: shortstring);
   389 procedure chLJump(var s: shortstring);
   390 begin
   390 begin
   391 s:= s; // avoid compiler hint
   391 s:= s; // avoid compiler hint
   392 if CheckNoTeamOrHH or isPaused then exit;
   392 if CheckNoTeamOrHH or isPaused then exit;
   393 if not CurrentTeam^.ExtDriven then SendIPC('j');
   393 if not CurrentTeam^.ExtDriven then SendIPC('j');
   394 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   394 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   395 bShowFinger:= false;
   395 bShowFinger:= false;
   396 with CurrentHedgehog^.Gear^ do
   396 with CurrentHedgehog^.Gear^ do
   397     Message:= Message or gm_LJump
   397     Message:= Message or gmLJump
   398 end;
   398 end;
   399 
   399 
   400 procedure chHJump(var s: shortstring);
   400 procedure chHJump(var s: shortstring);
   401 begin
   401 begin
   402 s:= s; // avoid compiler hint
   402 s:= s; // avoid compiler hint
   403 if CheckNoTeamOrHH or isPaused then exit;
   403 if CheckNoTeamOrHH or isPaused then exit;
   404 if not CurrentTeam^.ExtDriven then SendIPC('J');
   404 if not CurrentTeam^.ExtDriven then SendIPC('J');
   405 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   405 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   406 bShowFinger:= false;
   406 bShowFinger:= false;
   407 with CurrentHedgehog^.Gear^ do
   407 with CurrentHedgehog^.Gear^ do
   408     Message:= Message or gm_HJump
   408     Message:= Message or gmHJump
   409 end;
   409 end;
   410 
   410 
   411 procedure chAttack_p(var s: shortstring);
   411 procedure chAttack_p(var s: shortstring);
   412 begin
   412 begin
   413 s:= s; // avoid compiler hint
   413 s:= s; // avoid compiler hint
   419     {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
   419     {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
   420     if ((State and gstHHDriven) <> 0) then
   420     if ((State and gstHHDriven) <> 0) then
   421         begin
   421         begin
   422         FollowGear:= CurrentHedgehog^.Gear;
   422         FollowGear:= CurrentHedgehog^.Gear;
   423         if not CurrentTeam^.ExtDriven then SendIPC('A');
   423         if not CurrentTeam^.ExtDriven then SendIPC('A');
   424         Message:= Message or gm_Attack
   424         Message:= Message or gmAttack
   425         end
   425         end
   426     end
   426     end
   427 end;
   427 end;
   428 
   428 
   429 procedure chAttack_m(var s: shortstring);
   429 procedure chAttack_m(var s: shortstring);
   431 s:= s; // avoid compiler hint
   431 s:= s; // avoid compiler hint
   432 if CheckNoTeamOrHH then exit;
   432 if CheckNoTeamOrHH then exit;
   433 with CurrentHedgehog^.Gear^ do
   433 with CurrentHedgehog^.Gear^ do
   434     begin
   434     begin
   435     if not CurrentTeam^.ExtDriven and
   435     if not CurrentTeam^.ExtDriven and
   436         ((Message and gm_Attack) <> 0) then SendIPC('a');
   436         ((Message and gmAttack) <> 0) then SendIPC('a');
   437     Message:= Message and not gm_Attack
   437     Message:= Message and not gmAttack
   438     end
   438     end
   439 end;
   439 end;
   440 
   440 
   441 procedure chSwitch(var s: shortstring);
   441 procedure chSwitch(var s: shortstring);
   442 begin
   442 begin
   444 if CheckNoTeamOrHH or isPaused then exit;
   444 if CheckNoTeamOrHH or isPaused then exit;
   445 if not CurrentTeam^.ExtDriven then SendIPC('S');
   445 if not CurrentTeam^.ExtDriven then SendIPC('S');
   446 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   446 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   447 bShowFinger:= false;
   447 bShowFinger:= false;
   448 with CurrentHedgehog^.Gear^ do
   448 with CurrentHedgehog^.Gear^ do
   449     Message:= Message or gm_Switch
   449     Message:= Message or gmSwitch
   450 end;
   450 end;
   451 
   451 
   452 procedure chNextTurn(var s: shortstring);
   452 procedure chNextTurn(var s: shortstring);
   453 begin
   453 begin
   454     s:= s; // avoid compiler hint
   454     s:= s; // avoid compiler hint
   491 if not CurrentTeam^.ExtDriven then SendIPC(s);
   491 if not CurrentTeam^.ExtDriven then SendIPC(s);
   492 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   492 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   493 bShowFinger:= false;
   493 bShowFinger:= false;
   494 with CurrentHedgehog^.Gear^ do
   494 with CurrentHedgehog^.Gear^ do
   495     begin
   495     begin
   496     Message:= Message or gm_Timer;
   496     Message:= Message or gmTimer;
   497     MsgParam:= byte(s[1]) - ord('0')
   497     MsgParam:= byte(s[1]) - ord('0')
   498     end
   498     end
   499 end;
   499 end;
   500 
   500 
   501 procedure chSlot(var s: shortstring);
   501 procedure chSlot(var s: shortstring);
   507 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
   507 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
   508 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   508 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1;
   509 bShowFinger:= false;
   509 bShowFinger:= false;
   510 with CurrentHedgehog^.Gear^ do
   510 with CurrentHedgehog^.Gear^ do
   511     begin
   511     begin
   512     Message:= Message or gm_Slot;
   512     Message:= Message or gmSlot;
   513     MsgParam:= slot
   513     MsgParam:= slot
   514     end
   514     end
   515 end;
   515 end;
   516 
   516 
   517 procedure chSetWeapon(var s: shortstring);
   517 procedure chSetWeapon(var s: shortstring);
   522 
   522 
   523     if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
   523     if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
   524 
   524 
   525     with CurrentHedgehog^.Gear^ do
   525     with CurrentHedgehog^.Gear^ do
   526     begin
   526     begin
   527         Message:= Message or gm_Weapon;
   527         Message:= Message or gmWeapon;
   528         MsgParam:= byte(s[1]);
   528         MsgParam:= byte(s[1]);
   529     end;
   529     end;
   530 end;
   530 end;
   531 
   531 
   532 procedure chTaunt(var s: shortstring);
   532 procedure chTaunt(var s: shortstring);
   537 
   537 
   538 if not CurrentTeam^.ExtDriven then SendIPC('t' + s);
   538 if not CurrentTeam^.ExtDriven then SendIPC('t' + s);
   539 
   539 
   540 with CurrentHedgehog^.Gear^ do
   540 with CurrentHedgehog^.Gear^ do
   541     begin
   541     begin
   542     Message:= Message or gm_Animate;
   542     Message:= Message or gmAnimate;
   543     MsgParam:= byte(s[1])
   543     MsgParam:= byte(s[1])
   544     end
   544     end
   545 end;
   545 end;
   546 
   546 
   547 procedure chHogSay(var s: shortstring);
   547 procedure chHogSay(var s: shortstring);
   622             TargetPoint.Y:= putY
   622             TargetPoint.Y:= putY
   623             end;
   623             end;
   624         {$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF}
   624         {$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF}
   625         State:= State and not gstHHChooseTarget;
   625         State:= State and not gstHHChooseTarget;
   626         if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then
   626         if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then
   627             Message:= Message or gm_Attack;
   627             Message:= Message or gmAttack;
   628         end
   628         end
   629     else
   629     else
   630         if CurrentTeam^.ExtDriven then
   630         if CurrentTeam^.ExtDriven then
   631             OutError('got /put while not being in choose target mode', false)
   631             OutError('got /put while not being in choose target mode', false)
   632 end;
   632 end;