hedgewars/uGearsHandlersRope.pas
changeset 8469 018da0724a93
parent 8468 71159aa7172f
child 8680 5fe344cc8610
equal deleted inserted replaced
8465:9114b50fed82 8469:018da0724a93
   163     tx := HHGear^.X;
   163     tx := HHGear^.X;
   164     ty := HHGear^.Y;
   164     ty := HHGear^.Y;
   165 
   165 
   166     if ((Gear^.Message and gmDown) <> 0) and (Gear^.Elasticity < Gear^.Friction) then
   166     if ((Gear^.Message and gmDown) <> 0) and (Gear^.Elasticity < Gear^.Friction) then
   167         if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx))
   167         if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx))
   168         or (TestCollisionYwithGear(HHGear, hwSign(ropeDy)) <> 0)) then
   168         or ((ropeDy.QWordValue <> 0) and TestCollisionYwithXYShift(HHGear, 0, 1, hwSign(ropeDy)))) then
   169             Gear^.Elasticity := Gear^.Elasticity + _1_2;
   169             Gear^.Elasticity := Gear^.Elasticity + _1_2;
   170 
   170 
   171     if ((Gear^.Message and gmUp) <> 0) and (Gear^.Elasticity > _30) then
   171     if ((Gear^.Message and gmUp) <> 0) and (Gear^.Elasticity > _30) then
   172         if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx))
   172         if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx))
   173         or (TestCollisionYwithGear(HHGear, -hwSign(ropeDy)) <> 0)) then
   173         or ((ropeDy.QWordValue <> 0) and TestCollisionYwithXYShift(HHGear, 0, 1, -hwSign(ropeDy)))) then
   174             Gear^.Elasticity := Gear^.Elasticity - _1_2;
   174             Gear^.Elasticity := Gear^.Elasticity - _1_2;
   175 
   175 
   176     HHGear^.X := Gear^.X + mdX * Gear^.Elasticity;
   176     HHGear^.X := Gear^.X + mdX * Gear^.Elasticity;
   177     HHGear^.Y := Gear^.Y + mdY * Gear^.Elasticity;
   177     HHGear^.Y := Gear^.Y + mdY * Gear^.Elasticity;
   178 
   178 
   262     if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
   262     if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
   263         begin
   263         begin
   264         HHGear^.dX := -_0_6 * HHGear^.dX;
   264         HHGear^.dX := -_0_6 * HHGear^.dX;
   265         haveCollision := true
   265         haveCollision := true
   266         end;
   266         end;
   267     if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) <> 0 then
   267     if TestCollisionYwithXYShift(HHGear, 0, 1, hwSign(HHGear^.dY)) then
   268         begin
   268         begin
   269         HHGear^.dY := -_0_6 * HHGear^.dY;
   269         HHGear^.dY := -_0_6 * HHGear^.dY;
   270         haveCollision := true
   270         haveCollision := true
   271         end;
   271         end;
   272 
   272