94 end |
94 end |
95 end; |
95 end; |
96 |
96 |
97 |
97 |
98 procedure DrawRopeLine(X1, Y1, X2, Y2: Real; LayerIndex: Longword; var linesLength, ropeLength: Real); |
98 procedure DrawRopeLine(X1, Y1, X2, Y2: Real; LayerIndex: Longword; var linesLength, ropeLength: Real); |
99 var dX, dY, angle, length: Real; |
99 var dX, dY, angle, lineLength: Real; |
100 FrameIndex: LongWord; |
100 FrameIndex: LongWord; |
101 begin |
101 begin |
102 if (X1 = X2) and (Y1 = Y2) then |
102 if (X1 = X2) and (Y1 = Y2) then |
103 exit; |
103 exit; |
104 |
104 |
105 dX:= X2 - X1; |
105 dX:= X2 - X1; |
106 dY:= Y2 - Y1; |
106 dY:= Y2 - Y1; |
107 length:= sqrt(sqr(dX) + sqr(dY)); |
107 lineLength:= sqrt(sqr(dX) + sqr(dY)); |
108 angle:= arctan2(dY, dX) * 180 / PI - 90; |
108 angle:= arctan2(dY, dX) * 180 / PI - 90; |
109 |
109 |
110 dX:= dX / length; |
110 dX:= dX / lineLength; |
111 dY:= dY / length; |
111 dY:= dY / lineLength; |
112 |
112 |
113 while (ropeLength - linesLength) <= length do |
113 while (ropeLength - linesLength) <= lineLength do |
114 begin |
114 begin |
115 FrameIndex:= round(ropeLength / cRopeNodeStep); |
115 FrameIndex:= round(ropeLength / cRopeNodeStep); |
116 if (FrameIndex mod cRopeLayers) = LayerIndex then |
116 if (FrameIndex mod cRopeLayers) = LayerIndex then |
117 DrawSpriteRotatedFReal(sprRopeNode, |
117 DrawSpriteRotatedFReal(sprRopeNode, |
118 X1 + (ropeLength - linesLength) * dX, |
118 X1 + (ropeLength - linesLength) * dX, |
119 Y1 + (ropeLength - linesLength) * dY, |
119 Y1 + (ropeLength - linesLength) * dY, |
120 FrameIndex, 1, angle); |
120 FrameIndex, 1, angle); |
121 ropeLength:= ropeLength + cRopeNodeStep; |
121 ropeLength:= ropeLength + cRopeNodeStep; |
122 end; |
122 end; |
123 linesLength:= linesLength + length |
123 linesLength:= linesLength + lineLength |
124 end; |
124 end; |
125 |
125 |
126 procedure DrawRopeLayer(Gear: PGear; LayerIndex: LongWord); |
126 procedure DrawRopeLayer(Gear: PGear; LayerIndex: LongWord); |
127 var i: LongInt; |
127 var i: LongInt; |
128 linesLength, ropeLength: Real; |
128 linesLength, ropeLength: Real; |