hedgewars/GSHandlers.inc
changeset 1552 cd907418da91
parent 1551 c747e69f98f3
child 1553 77f326c7f0ef
equal deleted inserted replaced
1551:c747e69f98f3 1552:cd907418da91
   721 cc:= ropeDx + HHGear^.dX;
   721 cc:= ropeDx + HHGear^.dX;
   722 len:= _1 / Distance(cc, cs);
   722 len:= _1 / Distance(cc, cs);
   723 cc:= cc * len;
   723 cc:= cc * len;
   724 cs:= cs * len;
   724 cs:= cs * len;
   725 
   725 
   726 HHGear^.dX:= Gear^.X + cc*Gear^.Elasticity - HHGear^.X;
   726 tx:= HHGear^.X;
   727 HHGear^.dY:= Gear^.Y + cs*Gear^.Elasticity - HHGear^.Y;
   727 ty:= HHGear^.Y;
   728 
   728 
   729 if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Elasticity < Gear^.Friction) then
   729 if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Elasticity < Gear^.Friction) then
   730 	if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx))
   730 	if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx))
   731 			or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity + _0_3;
   731 			or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity + _0_3;
   732 
   732 
   734 	if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx))
   734 	if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx))
   735 			or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity - _0_3;
   735 			or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity - _0_3;
   736 
   736 
   737 HHGear^.X:= Gear^.X + cc*Gear^.Elasticity;
   737 HHGear^.X:= Gear^.X + cc*Gear^.Elasticity;
   738 HHGear^.Y:= Gear^.Y + cs*Gear^.Elasticity;
   738 HHGear^.Y:= Gear^.Y + cs*Gear^.Elasticity;
       
   739 
       
   740 HHGear^.dX:= HHGear^.X - tx;
       
   741 HHGear^.dY:= HHGear^.Y - ty;
   739 
   742 
   740 haveCollision:= false;
   743 haveCollision:= false;
   741 if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
   744 if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
   742 	begin
   745 	begin
   743 	HHGear^.dX:= -_0_6 * HHGear^.dX;
   746 	HHGear^.dX:= -_0_6 * HHGear^.dX;