equal
deleted
inserted
replaced
848 len:= _1 / Distance(ropeDx, ropeDy); // old rope pos |
848 len:= _1 / Distance(ropeDx, ropeDy); // old rope pos |
849 nx:= ropeDx * len; |
849 nx:= ropeDx * len; |
850 ny:= ropeDy * len; |
850 ny:= ropeDy * len; |
851 |
851 |
852 len:= Gear^.Elasticity - _0_3x70; |
852 len:= Gear^.Elasticity - _0_3x70; |
853 while len > _0_3 do |
853 while len > _3 do |
854 begin |
854 begin |
855 lx:= hwRound(Gear^.X + mdX * len); |
855 lx:= hwRound(Gear^.X + mdX * len); |
856 ly:= hwRound(Gear^.Y + mdY * len); |
856 ly:= hwRound(Gear^.Y + mdY * len); |
857 if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then |
857 if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then |
858 begin |
858 begin |
862 Y:= Gear^.Y; |
862 Y:= Gear^.Y; |
863 if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle(Gear^.dY, Gear^.dX); |
863 if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle(Gear^.dY, Gear^.dX); |
864 b:= (nx * HHGear^.dY) > (ny * HHGear^.dX); |
864 b:= (nx * HHGear^.dY) > (ny * HHGear^.dX); |
865 dLen:= len |
865 dLen:= len |
866 end; |
866 end; |
|
867 with RopePoints.rounded[RopePoints.Count] do |
|
868 begin |
|
869 X:= hwRound(Gear^.X); |
|
870 Y:= hwRound(Gear^.Y); |
|
871 end; |
|
872 |
867 Gear^.X:= Gear^.X + nx * len; |
873 Gear^.X:= Gear^.X + nx * len; |
868 Gear^.Y:= Gear^.Y + ny * len; |
874 Gear^.Y:= Gear^.Y + ny * len; |
869 inc(RopePoints.Count); |
875 inc(RopePoints.Count); |
870 TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true); |
876 TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true); |
871 Gear^.Elasticity:= Gear^.Elasticity - len; |
877 Gear^.Elasticity:= Gear^.Elasticity - len; |