hedgewars/uGearsRender.pas
changeset 14949 8b53cb1c0ada
parent 14924 e28ff0f1aca2
child 14954 37ae92c11a36
--- a/hedgewars/uGearsRender.pas	Tue May 14 19:46:43 2019 +0200
+++ b/hedgewars/uGearsRender.pas	Tue May 14 21:36:50 2019 +0300
@@ -99,6 +99,7 @@
 var  eX, eY, dX, dY: LongInt;
     i, sX, sY, x, y, d: LongInt;
     b: boolean;
+    angle: real;
 begin
     if (X1 = X2) and (Y1 = Y2) then
         begin
@@ -110,6 +111,7 @@
     eY:= 0;
     dX:= X2 - X1;
     dY:= Y2 - Y1;
+    angle:= arctan2(dY, dX) * 180 / PI - 90;
 
     if (dX > 0) then
         sX:= 1
@@ -160,8 +162,8 @@
         if b then
             begin
             inc(roplen);
-            if (roplen mod 4) = 0 then
-                DrawSprite(sprRopeNode, x - 2, y - 2, 0)
+            if (roplen mod cRopeNodeStep) = 0 then
+                DrawSpriteRotatedF(sprRopeNode, x, y, roplen mod cRopeNodeStep, 1, angle);
             end
     end;
     DrawRopeLine:= roplen;