hedgewars/GSHandlers.inc
changeset 5150 63ad8a648afd
parent 5139 090a8b8d1083
child 5151 cbadb9fa52fc
equal deleted inserted replaced
5148:73b3b4b8359c 5150:63ad8a648afd
  1547         len := _0_8 / hwSqrt(len);
  1547         len := _0_8 / hwSqrt(len);
  1548         HHGear^.dX := HHGear^.dX * len;
  1548         HHGear^.dX := HHGear^.dX * len;
  1549         HHGear^.dY := HHGear^.dY * len;
  1549         HHGear^.dY := HHGear^.dY * len;
  1550         end;
  1550         end;
  1551 
  1551 
  1552     haveCollision:= ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) and ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and $FF00) <> 0);
  1552     haveCollision:= ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) and ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)]) <> 0);
  1553 
  1553 
  1554     if not haveCollision then
  1554     if not haveCollision then
  1555         begin
  1555         begin
  1556         // backup gear location
  1556         // backup gear location
  1557         tx:= Gear^.X;
  1557         tx:= Gear^.X;
  1562             // set gear location to the remote end of the rope, the attachment point
  1562             // set gear location to the remote end of the rope, the attachment point
  1563             Gear^.X:= RopePoints.ar[0].X;
  1563             Gear^.X:= RopePoints.ar[0].X;
  1564             Gear^.Y:= RopePoints.ar[0].Y;
  1564             Gear^.Y:= RopePoints.ar[0].Y;
  1565             end;
  1565             end;
  1566 
  1566 
  1567         CheckCollisionWithLand(Gear);
  1567         CheckCollision(Gear);
  1568         // if we haven't found any collision yet then check the otheer side too
  1568         // if we haven't found any collision yet then check the otheer side too
  1569         if (Gear^.State and gstCollision) = 0 then
  1569         if (Gear^.State and gstCollision) = 0 then
  1570             begin
  1570             begin
  1571             Gear^.dX.isNegative:= not Gear^.dX.isNegative;
  1571             Gear^.dX.isNegative:= not Gear^.dX.isNegative;
  1572             Gear^.dY.isNegative:= not Gear^.dY.isNegative;
  1572             Gear^.dY.isNegative:= not Gear^.dY.isNegative;
  1573             CheckCollisionWithLand(Gear);
  1573             CheckCollision(Gear);
  1574             Gear^.dX.isNegative:= not Gear^.dX.isNegative;
  1574             Gear^.dX.isNegative:= not Gear^.dX.isNegative;
  1575             Gear^.dY.isNegative:= not Gear^.dY.isNegative;
  1575             Gear^.dY.isNegative:= not Gear^.dY.isNegative;
  1576             end;
  1576             end;
  1577 
  1577 
  1578         haveCollision:= (Gear^.State and gstCollision) <> 0;
  1578         haveCollision:= (Gear^.State and gstCollision) <> 0;
  1676             ty := ty + Gear^.dY + Gear^.dY;
  1676             ty := ty + Gear^.dY + Gear^.dY;
  1677             tt := tt - _2;
  1677             tt := tt - _2;
  1678             end;
  1678             end;
  1679         end;
  1679         end;
  1680 
  1680 
  1681     CheckCollisionWithLand(Gear);
  1681     CheckCollision(Gear);
  1682 
  1682 
  1683     if (Gear^.State and gstCollision) <> 0 then
  1683     if (Gear^.State and gstCollision) <> 0 then
  1684         if Gear^.Elasticity < _10 then
  1684         if Gear^.Elasticity < _10 then
  1685             Gear^.Elasticity := _10000
  1685             Gear^.Elasticity := _10000
  1686     else
  1686     else