hedgewars/uGearsHandlersMess.pas
changeset 14571 85921db6f7c3
parent 14570 833ab5b359e5
child 14572 5de4d470dafe
equal deleted inserted replaced
14570:833ab5b359e5 14571:85921db6f7c3
   113 procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean);
   113 procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean);
   114 procedure doStepMovingPortal_real(Gear: PGear);
   114 procedure doStepMovingPortal_real(Gear: PGear);
   115 procedure doStepMovingPortal(Gear: PGear);
   115 procedure doStepMovingPortal(Gear: PGear);
   116 procedure doStepPortalShot(newPortal: PGear);
   116 procedure doStepPortalShot(newPortal: PGear);
   117 procedure doStepPiano(Gear: PGear);
   117 procedure doStepPiano(Gear: PGear);
       
   118 procedure doStepPianoWork(Gear: PGear);
   118 procedure doStepSineGunShotWork(Gear: PGear);
   119 procedure doStepSineGunShotWork(Gear: PGear);
   119 procedure doStepSineGunShot(Gear: PGear);
   120 procedure doStepSineGunShot(Gear: PGear);
   120 procedure doStepFlamethrowerWork(Gear: PGear);
   121 procedure doStepFlamethrowerWork(Gear: PGear);
   121 procedure doStepFlamethrower(Gear: PGear);
   122 procedure doStepFlamethrower(Gear: PGear);
   122 procedure doStepLandGunWork(Gear: PGear);
   123 procedure doStepLandGunWork(Gear: PGear);
  5328     newPortal^.State := newPortal^.State and (not gstCollision);
  5329     newPortal^.State := newPortal^.State and (not gstCollision);
  5329     newPortal^.State := newPortal^.State or gstMoving;
  5330     newPortal^.State := newPortal^.State or gstMoving;
  5330     newPortal^.doStep := @doStepMovingPortal;
  5331     newPortal^.doStep := @doStepMovingPortal;
  5331 end;
  5332 end;
  5332 
  5333 
       
  5334 procedure doStepPiano(Gear: PGear);
       
  5335 var valid: boolean;
       
  5336     HHGear: PGear;
       
  5337 begin
       
  5338     AllInactive := false;
       
  5339     valid := true;
       
  5340 
       
  5341     if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then
       
  5342         HHGear := Gear^.Hedgehog^.Gear;
       
  5343 
       
  5344     if (WorldEdge = weBounce) then
       
  5345         if (hwRound(Gear^.X) - Gear^.Radius < leftX) then
       
  5346             valid := false
       
  5347         else if (hwRound(Gear^.X) - Gear^.Radius > rightX) then
       
  5348             valid := false;
       
  5349 
       
  5350     if (not valid) then
       
  5351         begin
       
  5352         if (HHGear <> nil) then
       
  5353             begin
       
  5354             HHGear^.Message := HHGear^.Message and (not gmAttack);
       
  5355             HHGear^.State := HHGear^.State and (not gstAttacking);
       
  5356             HHGear^.State := HHGear^.State or gstChooseTarget;
       
  5357             isCursorVisible := true;
       
  5358             end;
       
  5359         DeleteGear(Gear);
       
  5360         PlaySound(sndDenied);
       
  5361         exit;
       
  5362         end;
       
  5363 
       
  5364     isCursorVisible := false;
       
  5365     if (HHGear <> nil) then
       
  5366         begin
       
  5367         PlaySoundV(sndIncoming, Gear^.Hedgehog^.Team^.voicepack);
       
  5368         // Tuck the hedgehog away until the piano attack is completed
       
  5369         Gear^.Hedgehog^.Unplaced:= true;
       
  5370         HHGear^.X:= _0;
       
  5371         HHGear^.Y:= _0;
       
  5372         end;
       
  5373 
       
  5374     PauseMusic;
       
  5375     Gear^.doStep:= @doStepPianoWork;
       
  5376 end;
  5333 ////////////////////////////////////////////////////////////////////////////////
  5377 ////////////////////////////////////////////////////////////////////////////////
  5334 procedure doStepPiano(Gear: PGear);
  5378 procedure doStepPianoWork(Gear: PGear);
  5335 var
  5379 var
  5336     r0, r1: LongInt;
  5380     r0, r1: LongInt;
  5337     odY: hwFloat;
  5381     odY: hwFloat;
  5338 begin
  5382 begin
  5339     AllInactive := false;
  5383     AllInactive := false;