hedgewars/GSHandlers.inc
changeset 3584 7c05f2e0a8b5
parent 3583 13818670ad9e
child 3585 39570d86de57
equal deleted inserted replaced
3583:13818670ad9e 3584:7c05f2e0a8b5
  1151     ////
  1151     ////
  1152 
  1152 
  1153 
  1153 
  1154     haveDivided := false;
  1154     haveDivided := false;
  1155     // check whether rope needs dividing
  1155     // check whether rope needs dividing
  1156     len := _1 / Distance(ropeDx, ropeDy);
       
  1157     // old rope pos
       
  1158     nx := ropeDx * len;
       
  1159     ny := ropeDy * len;
       
  1160 
  1156 
  1161     len := Gear^.Elasticity - _5;
  1157     len := Gear^.Elasticity - _5;
  1162     while len > _3 do
  1158     while len > _3 do
  1163     begin
  1159     begin
  1164         lx := hwRound(Gear^.X + mdX * len);
  1160         lx := hwRound(Gear^.X + mdX * len);
  1165         ly := hwRound(Gear^.Y + mdY * len);
  1161         ly := hwRound(Gear^.Y + mdY * len);
  1166         if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0
  1162         if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0
  1167            ) then
  1163            ) then
  1168         begin
  1164         begin
       
  1165             // calculate those the first time we have to divide the rope
       
  1166             if not haveDivided then
       
  1167             begin
       
  1168             ny := _1 / Distance(ropeDx, ropeDy);
       
  1169             // old rope pos
       
  1170             nx := ropeDx * ny;
       
  1171             ny := ropeDy * ny;
       
  1172             end;
       
  1173 
  1169             with RopePoints.ar[RopePoints.Count] do
  1174             with RopePoints.ar[RopePoints.Count] do
  1170             begin
  1175             begin
  1171                 X := Gear^.X;
  1176                 X := Gear^.X;
  1172                 Y := Gear^.Y;
  1177                 Y := Gear^.Y;
  1173                 if RopePoints.Count = 0 then RopePoints.HookAngle := DxDy2Angle(Gear^.dY, Gear^.dX);
  1178                 if RopePoints.Count = 0 then RopePoints.HookAngle := DxDy2Angle(Gear^.dY, Gear^.dX);