hedgewars/GSHandlers.inc
changeset 1361 afdcf39c6bea
parent 1343 7a47a80b20ad
child 1367 e1aaa1a4901f
equal deleted inserted replaced
1360:d3e285281c26 1361:afdcf39c6bea
   647 cc:= Gear^.dX + HHGear^.dX;
   647 cc:= Gear^.dX + HHGear^.dX;
   648 len:= _1 / Distance(cc, cs);
   648 len:= _1 / Distance(cc, cs);
   649 cc:= cc * len; // rope vector plus hedgehog direction vector normalized
   649 cc:= cc * len; // rope vector plus hedgehog direction vector normalized
   650 cs:= cs * len;
   650 cs:= cs * len;
   651 
   651 
   652 nx:= hwAbs(cs) * hwSign(HHGear^.dX) * 7; // hedgehog direction normalized with length 7
   652 nx:= SignAs(cs, HHGear^.dX) * 7; // hedgehog direction normalized with length 7
   653 ny:= hwAbs(cc) * hwSign(HHGear^.dY) * 7;
   653 ny:= SignAs(cc, HHGear^.dY) * 7;
   654 
   654 
   655 flCheck:= not flCheck;
   655 flCheck:= not flCheck;
   656 if flCheck then  // check whether rope needs dividing
   656 if flCheck then  // check whether rope needs dividing
   657    begin
   657    begin
   658    len:= Gear^.Elasticity - _20;
   658    len:= Gear^.Elasticity - _20;
   678            TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true);
   678            TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true);
   679            Gear^.Elasticity:= Gear^.Elasticity - len;
   679            Gear^.Elasticity:= Gear^.Elasticity - len;
   680            Gear^.Friction:= Gear^.Friction - len;
   680            Gear^.Friction:= Gear^.Friction - len;
   681            break
   681            break
   682            end;
   682            end;
   683          len:= len - _0_2
   683          len:= len - _0_5
   684          end;
   684          end;
   685    end else
   685    end else
   686    if RopePoints.Count > 0 then // check whether the last dividing point could be removed
   686    if RopePoints.Count > 0 then // check whether the last dividing point could be removed
   687       begin
   687       begin
   688       tx:= RopePoints.ar[Pred(RopePoints.Count)].X;
   688       tx:= RopePoints.ar[Pred(RopePoints.Count)].X;