hedgewars/HHHandlers.inc
changeset 498 9c8b385dc9a1
parent 435 25820c10c849
child 505 fcba7d7aea0d
equal deleted inserted replaced
497:adf1aee202c6 498:9c8b385dc9a1
    58                           amUFO: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtUFO,          0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
    58                           amUFO: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtUFO,          0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
    59                       amShotgun: begin
    59                       amShotgun: begin
    60                                  PlaySound(sndShotgunReload, false);
    60                                  PlaySound(sndShotgunReload, false);
    61                                  CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
    61                                  CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtShotgunShot,  0, xx * _0_5, yy * _0_5, 0);
    62                                  end;
    62                                  end;
    63                    amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, 0, 0, 0);
    63                    amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
    64                          amSkip: TurnTimeLeft:= 0;
    64                          amSkip: TurnTimeLeft:= 0;
    65                          amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0);
    65                          amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0);
    66                          amMine: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, hwSign(dX) * _0_02, 0, 3000);
    66                          amMine: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, SignAs(_0_02, dX), _0, 3000);
    67                        amDEagle: AddGear(hwRound(X), hwRound(Y), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
    67                        amDEagle: AddGear(hwRound(X), hwRound(Y), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
    68                      amDynamite: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, hwSign(dX) * _0_03, 0, 5000);
    68                      amDynamite: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
    69                   amBaseballBat: AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0)^.Radius:= 20;
    69                   amBaseballBat: AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0)^.Radius:= 20;
    70                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, 0, 0, 0);
    70                     amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, _0, _0, 0);
    71                     amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, 0, 0, 0);
    71                     amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, _0, _0, 0);
    72                     amAirAttack: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 0, 0, 0, 0);
    72                     amAirAttack: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 0, _0, _0, 0);
    73                    amMineStrike: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 1, 0, 0, 0);
    73                    amMineStrike: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 1, _0, _0, 0);
    74                     amBlowTorch: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBlowTorch, 0, hwSign(Gear^.dX) * _0_5, 0, 0);
    74                     amBlowTorch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
    75                        amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, Ammo^[CurSlot, CurAmmo].Pos, 0, 0, 0);
    75                        amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, Ammo^[CurSlot, CurAmmo].Pos, _0, _0, 0);
    76                   end;
    76                   end;
    77         Power:= 0;
    77         Power:= 0;
    78         if CurAmmoGear <> nil then
    78         if CurAmmoGear <> nil then
    79            begin
    79            begin
    80            Message:= Message or gm_Attack;
    80            Message:= Message or gm_Attack;
   151           end;
   151           end;
   152    if ((Gear^.Message and gm_LJump ) <> 0) then
   152    if ((Gear^.Message and gm_LJump ) <> 0) then
   153       begin
   153       begin
   154       Gear^.Message:= 0;
   154       Gear^.Message:= 0;
   155       if not TestCollisionYwithGear(Gear, -1) then
   155       if not TestCollisionYwithGear(Gear, -1) then
   156          if not TestCollisionXwithXYShift(Gear, 0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - 2 else
   156          if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else
   157          if not TestCollisionXwithXYShift(Gear, 0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - 1;
   157          if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1;
   158       if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX))
   158       if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX))
   159          or   TestCollisionYwithGear(Gear, -1)) then
   159          or   TestCollisionYwithGear(Gear, -1)) then
   160          begin
   160          begin
   161          Gear^.dY:= -_0_15;
   161          Gear^.dY:= -_0_15;
   162          Gear^.dX:= hwSign(Gear^.dX) * _0_15;
   162          Gear^.dX:= SignAs(_0_15, Gear^.dX);
   163          Gear^.State:= Gear^.State or gstFalling or gstHHJumping;
   163          Gear^.State:= Gear^.State or gstFalling or gstHHJumping;
   164          exit
   164          exit
   165          end;
   165          end;
   166       end;
   166       end;
   167    if ((Gear^.Message and gm_HJump ) <> 0) then
   167    if ((Gear^.Message and gm_HJump ) <> 0) then
   181    StepTicks:= cHHStepTicks;
   181    StepTicks:= cHHStepTicks;
   182    if PrevdX <> hwSign(Gear^.dX) then exit;
   182    if PrevdX <> hwSign(Gear^.dX) then exit;
   183    PHedgehog(Gear^.Hedgehog)^.visStepPos:= (PHedgehog(Gear^.Hedgehog)^.visStepPos + 1) and 7;
   183    PHedgehog(Gear^.Hedgehog)^.visStepPos:= (PHedgehog(Gear^.Hedgehog)^.visStepPos + 1) and 7;
   184    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
   184    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
   185       begin
   185       begin
   186       if not (TestCollisionXwithXYShift(Gear, 0, -6, hwSign(Gear^.dX))
   186       if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX))
   187          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1;
   187          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   188       if not (TestCollisionXwithXYShift(Gear, 0, -5, hwSign(Gear^.dX))
   188       if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX))
   189          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1;
   189          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   190       if not (TestCollisionXwithXYShift(Gear, 0, -4, hwSign(Gear^.dX))
   190       if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX))
   191          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1;
   191          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   192       if not (TestCollisionXwithXYShift(Gear, 0, -3, hwSign(Gear^.dX))
   192       if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
   193          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1;
   193          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   194       if not (TestCollisionXwithXYShift(Gear, 0, -2, hwSign(Gear^.dX))
   194       if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
   195          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1;
   195          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   196       if not (TestCollisionXwithXYShift(Gear, 0, -1, hwSign(Gear^.dX))
   196       if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
   197          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - 1;
   197          or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1;
   198       end;
   198       end;
   199    if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then Gear^.X:= Gear^.X + hwSign(Gear^.dX);
   199    if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX);
   200 
   200 
   201    SetAllHHToActive;
   201    SetAllHHToActive;
   202 
   202 
   203    if not TestCollisionYwithGear(Gear, 1) then
   203    if not TestCollisionYwithGear(Gear, 1) then
   204    begin
   204    begin
   205    Gear^.Y:= Gear^.Y + 1;
   205    Gear^.Y:= Gear^.Y + _1;
   206    if not TestCollisionYwithGear(Gear, 1) then
   206    if not TestCollisionYwithGear(Gear, 1) then
   207    begin
   207    begin
   208    Gear^.Y:= Gear^.Y + 1;
   208    Gear^.Y:= Gear^.Y + _1;
   209    if not TestCollisionYwithGear(Gear, 1) then
   209    if not TestCollisionYwithGear(Gear, 1) then
   210    begin
   210    begin
   211    Gear^.Y:= Gear^.Y + 1;
   211    Gear^.Y:= Gear^.Y + _1;
   212    if not TestCollisionYwithGear(Gear, 1) then
   212    if not TestCollisionYwithGear(Gear, 1) then
   213    begin
   213    begin
   214    Gear^.Y:= Gear^.Y + 1;
   214    Gear^.Y:= Gear^.Y + _1;
   215    if not TestCollisionYwithGear(Gear, 1) then
   215    if not TestCollisionYwithGear(Gear, 1) then
   216    begin
   216    begin
   217    Gear^.Y:= Gear^.Y + 1;
   217    Gear^.Y:= Gear^.Y + _1;
   218    if not TestCollisionYwithGear(Gear, 1) then
   218    if not TestCollisionYwithGear(Gear, 1) then
   219    begin
   219    begin
   220    Gear^.Y:= Gear^.Y + 1;
   220    Gear^.Y:= Gear^.Y + _1;
   221    if not TestCollisionYwithGear(Gear, 1) then
   221    if not TestCollisionYwithGear(Gear, 1) then
   222       begin
   222       begin
   223       Gear^.Y:= Gear^.Y - 6;
   223       Gear^.Y:= Gear^.Y - _6;
   224       Gear^.dY:= 0;
   224       Gear^.dY:= _0;
   225       Gear^.State:= Gear^.State or gstFalling
   225       Gear^.State:= Gear^.State or gstFalling
   226       end;
   226       end;
   227    end
   227    end
   228    end
   228    end
   229    end
   229    end
   285       ((Gear^.State and gstHHHJump) = 0) then
   285       ((Gear^.State and gstHHHJump) = 0) then
   286       if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   286       if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
   287          begin
   287          begin
   288          Gear^.State:= Gear^.State or gstHHHJump;
   288          Gear^.State:= Gear^.State or gstHHHJump;
   289          Gear^.dY:= -_0_25;
   289          Gear^.dY:= -_0_25;
   290          Gear^.dX:= hwSign(Gear^.dX) * _0_02
   290          Gear^.dX:= SignAs(_0_02, Gear^.dX)
   291          end;
   291          end;
   292    Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   292    Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump);
   293    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
   293    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX);
   294    Gear^.X:= Gear^.X + Gear^.dX;
   294    Gear^.X:= Gear^.X + Gear^.dX;
   295    Gear^.dY:= Gear^.dY + cGravity;
   295    Gear^.dY:= Gear^.dY + cGravity;
   296    if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= 0;
   296    if (Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0;
   297    Gear^.Y:= Gear^.Y + Gear^.dY;
   297    Gear^.Y:= Gear^.Y + Gear^.dY;
   298    if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then
   298    if (not Gear^.dY.isNegative)and TestCollisionYwithGear(Gear, 1) then
   299       begin
   299       begin
   300       CheckHHDamage(Gear);
   300       CheckHHDamage(Gear);
   301       if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55)
   301       if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55)
   302          and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
   302          and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
   303       Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping or gstHHHJump);
   303       Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping or gstHHHJump);
   304       StepTicks:= 300;
   304       StepTicks:= 300;
   305       Gear^.dY:= 0
   305       Gear^.dY:= _0
   306       end;
   306       end;
   307    CheckGearDrowning(Gear);
   307    CheckGearDrowning(Gear);
   308    exit
   308    exit
   309    end ;//else if Gear^.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
   309    end ;//else if Gear^.CollIndex = High(Longword) then AddIntersectorsCR(Gear);
   310 
   310 
   317 procedure doStepHedgehogFree(Gear: PGear);
   317 procedure doStepHedgehogFree(Gear: PGear);
   318 begin
   318 begin
   319 //DeleteCI(Gear);
   319 //DeleteCI(Gear);
   320 if not TestCollisionYwithGear(Gear, 1) then
   320 if not TestCollisionYwithGear(Gear, 1) then
   321    begin
   321    begin
   322    if (Gear^.dY < 0) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= 0;
   322    if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0;
   323    Gear^.State:= Gear^.State or gstFalling or gstMoving;
   323    Gear^.State:= Gear^.State or gstFalling or gstMoving;
   324    Gear^.dY:= Gear^.dY + cGravity
   324    Gear^.dY:= Gear^.dY + cGravity
   325    end else begin
   325    end else begin
   326    CheckHHDamage(Gear);
   326    CheckHHDamage(Gear);
   327    if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55)
   327    if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55)
   328       and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
   328       and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
   329    Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping);
   329    Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping);
   330    if Gear^.dY > 0 then Gear^.dY:= 0;
   330    if Gear^.dY > _0 then Gear^.dY:= _0;
   331    if ((Gear^.State and gstMoving) <> 0) then Gear^.dX:= Gear^.dX * Gear^.Friction
   331    if ((Gear^.State and gstMoving) <> 0) then Gear^.dX:= Gear^.dX * Gear^.Friction
   332    end;
   332    end;
   333 
   333 
   334 if (Gear^.State <> 0) then DeleteCI(Gear);
   334 if (Gear^.State <> 0) then DeleteCI(Gear);
   335 
   335 
   336 if (Gear^.State and gstMoving) <> 0 then
   336 if (Gear^.State and gstMoving) <> 0 then
   337    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
   337    if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
   338       if ((Gear^.State and gstFalling) = 0) then
   338       if ((Gear^.State and gstFalling) = 0) then
   339          if hwAbs(Gear^.dX) > _0_01 then
   339          if hwAbs(Gear^.dX) > _0_01 then
   340             if not TestCollisionXwithXYShift(Gear, hwSign(Gear^.dX) - Gear^.dX, -1, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_96; Gear^.Y:= Gear^.Y - 1 end else
   340             if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_96; Gear^.Y:= Gear^.Y - _1 end else
   341             if not TestCollisionXwithXYShift(Gear, hwSign(Gear^.dX) - Gear^.dX, -2, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_93; Gear^.Y:= Gear^.Y - 2 end else
   341             if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_93; Gear^.Y:= Gear^.Y - _2 end else
   342             if not TestCollisionXwithXYShift(Gear, hwSign(Gear^.dX) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9; Gear^.Y:= Gear^.Y - 3 end else
   342             if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9 ; Gear^.Y:= Gear^.Y - _3 end else
   343             if not TestCollisionXwithXYShift(Gear, hwSign(Gear^.dX) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - 4 end else
   343             if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - _4 end else
   344             if not TestCollisionXwithXYShift(Gear, hwSign(Gear^.dX) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - 5 end else
   344             if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - _5 end else
   345             if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX
   345             if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX
   346                                    else begin
   346                                    else begin
   347                                         Gear^.State:= Gear^.State and not gstMoving;
   347                                         Gear^.State:= Gear^.State and not gstMoving;
   348                                         SetLittle(Gear^.dX)
   348                                         SetLittle(Gear^.dX)
   349                                         end
   349                                         end
   356 if ((Gear^.State and gstFalling) = 0)and
   356 if ((Gear^.State and gstFalling) = 0)and
   357    (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
   357    (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
   358    begin
   358    begin
   359    Gear^.State:= Gear^.State and not gstMoving;
   359    Gear^.State:= Gear^.State and not gstMoving;
   360    SetLittle(Gear^.dX);
   360    SetLittle(Gear^.dX);
   361    Gear^.dY:= 0
   361    Gear^.dY:= _0
   362    end else Gear^.State:= Gear^.State or gstMoving;
   362    end else Gear^.State:= Gear^.State or gstMoving;
   363 
   363 
   364 if (Gear^.State and gstMoving) <> 0 then
   364 if (Gear^.State and gstMoving) <> 0 then
   365    begin
   365    begin
   366    Gear^.X:= Gear^.X + Gear^.dX;
   366    Gear^.X:= Gear^.X + Gear^.dX;
   367    Gear^.Y:= Gear^.Y + Gear^.dY;
   367    Gear^.Y:= Gear^.Y + Gear^.dY;
   368    if (Gear^.dY > 0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then
   368    if (Gear^.dY > _0) and not TestCollisionYwithGear(Gear, 1) and TestCollisionYwithXYShift(Gear, 0, 1, 1) then
   369       begin
   369       begin
   370       CheckHHDamage(Gear);
   370       CheckHHDamage(Gear);
   371       Gear^.dY:= 0;
   371       Gear^.dY:= _0;
   372       Gear^.Y:= Gear^.Y + 1
   372       Gear^.Y:= Gear^.Y + _1
   373       end;
   373       end;
   374    end else
   374    end else
   375    if Gear^.Health = 0 then
   375    if Gear^.Health = 0 then
   376       begin
   376       begin
   377       if AllInactive then
   377       if AllInactive then
   378          begin
   378          begin
   379          doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
   379          doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound);
   380          AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, 0, 0, 0)^.Hedgehog:= Gear^.Hedgehog;
   380          AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
   381          DeleteGear(Gear);
   381          DeleteGear(Gear);
   382          SetAllToActive
   382          SetAllToActive
   383          end;
   383          end;
   384       AllInactive:= false;
   384       AllInactive:= false;
   385       exit
   385       exit