hedgewars/uGearsHandlersMess.pas
changeset 10895 bce67defd804
parent 10887 efc14052360a
child 10897 8ea636ce120a
equal deleted inserted replaced
10893:b085cf83ab4c 10895:bce67defd804
   435             begin
   435             begin
   436             Gear^.dX := tdY*cElastic*Gear^.Friction;
   436             Gear^.dX := tdY*cElastic*Gear^.Friction;
   437             Gear^.dY := tdX*cElastic
   437             Gear^.dY := tdX*cElastic
   438             end;
   438             end;
   439 
   439 
   440         Gear^.dY.isNegative := not tdY.isNegative;
   440         Gear^.dX.isNegative:= tdX.isNegative;
       
   441         Gear^.dY.isNegative:= tdY.isNegative;
       
   442         if (collV > 0) and (collH > 0) and (not tdX.isNegative) and (not tdY.isNegative) then
       
   443             begin
       
   444             Gear^.dX.isNegative := true;
       
   445             Gear^.dY.isNegative := true
       
   446             end
       
   447         else if (collV > 0) and (collH < 0) and (tdX.isNegative or tdY.isNegative) then
       
   448             begin
       
   449             Gear^.dY.isNegative := not tdY.isNegative;
       
   450             if not tdY.isNegative then Gear^.dX.isNegative := false
       
   451             end
       
   452         else if (collV < 0) and (collH > 0) and (not tdX.isNegative) then
       
   453             begin
       
   454             Gear^.dX.isNegative := true;
       
   455             Gear^.dY.isNegative := false
       
   456             end
       
   457         else if (collV < 0) and (collH < 0) and tdX.isNegative and tdY.isNegative then
       
   458             Gear^.dX.isNegative := false;
       
   459        
   441         isFalling := false;
   460         isFalling := false;
   442         Gear^.AdvBounce := 10;
   461         Gear^.AdvBounce := 10;
   443         end;
   462         end;
   444 
   463 
   445     if Gear^.AdvBounce > 1 then
   464     if Gear^.AdvBounce > 1 then
   461         Gear^.State := Gear^.State and (not gstMoving)
   480         Gear^.State := Gear^.State and (not gstMoving)
   462     else
   481     else
   463         Gear^.State := Gear^.State or gstMoving;
   482         Gear^.State := Gear^.State or gstMoving;
   464 
   483 
   465     if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then
   484     if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then
       
   485         begin
   466         Gear^.State := Gear^.State or gstCollision;
   486         Gear^.State := Gear^.State or gstCollision;
       
   487         AddFileLog('no more bounce for you!');
       
   488         end;
   467 
   489 
   468     if ((xland or land) and lfBouncy <> 0) and (Gear^.Radius >= 3) and
   490     if ((xland or land) and lfBouncy <> 0) and (Gear^.Radius >= 3) and
   469        ((Gear^.dX.QWordValue > _0_15.QWordValue) or (Gear^.dY.QWordValue > _0_15.QWordValue)) then
   491        ((Gear^.dX.QWordValue > _0_15.QWordValue) or (Gear^.dY.QWordValue > _0_15.QWordValue)) then
   470         begin
   492         begin
   471         AddBounceEffectForGear(Gear);
   493         AddBounceEffectForGear(Gear);
  3482 
  3504 
  3483     else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) = 0) then
  3505     else if (TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) = 0) and (TestCollisionXWithGear(Gear, hwSign(Gear^.dX)) = 0) then
  3484         begin
  3506         begin
  3485         StopSoundChan(Gear^.SoundChannel);
  3507         StopSoundChan(Gear^.SoundChannel);
  3486         Gear^.Tag := 1;
  3508         Gear^.Tag := 1;
       
  3509         Gear^.AdvBounce:= 50;
  3487         Gear^.doStep := @doStepDrill
  3510         Gear^.doStep := @doStepDrill
  3488         end;
  3511         end;
  3489 
  3512 
  3490     dec(Gear^.Timer);
  3513     dec(Gear^.Timer);
  3491 end;
  3514 end;