+static void DrawArcExt(int from_x, int from_y, int to_x2, int to_y2,
+ int element, boolean change_level)
+{
+ int to_x = to_x2 - (to_x2 > from_x ? +1 : -1);
+ int to_y = to_y2 - (to_y2 > from_y ? +1 : -1);
+ int len_x = ABS(to_x - from_x);
+ int len_y = ABS(to_y - from_y);
+ int radius, x, y;
+
+ radius = (int)(sqrt((float)(len_x * len_x + len_y * len_y)) + 0.5);
+
+ /* not optimal (some points get drawn twice) but simple,
+ and fast enough for the few points we are drawing */
+
+ for (x=0; x<=radius; x++)
+ {
+ int sx, sy, lx, ly;
+
+ y = (int)(sqrt((float)(radius * radius - x * x)) + 0.5);
+
+ sx = from_x + x * (from_x < to_x2 ? +1 : -1);
+ sy = from_y + y * (from_y < to_y2 ? +1 : -1);
+ lx = sx + level_xpos;
+ ly = sy + level_ypos;
+
+ if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
+ DrawLineElement(sx, sy, element, change_level);
+ }
+
+ for (y=0; y<=radius; y++)
+ {
+ int sx, sy, lx, ly;
+
+ x = (int)(sqrt((float)(radius * radius - y * y)) + 0.5);
+
+ sx = from_x + x * (from_x < to_x2 ? +1 : -1);
+ sy = from_y + y * (from_y < to_y2 ? +1 : -1);
+ lx = sx + level_xpos;
+ ly = sy + level_ypos;
+
+ if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
+ DrawLineElement(sx, sy, element, change_level);
+ }
+}
+
+static void DrawArc(int from_x, int from_y, int to_x, int to_y,
+ int element, boolean change_level)
+{
+ int to_x2 = to_x + (to_x < from_x ? -1 : +1);
+ int to_y2 = to_y + (to_y > from_y ? +1 : -1);
+
+ DrawArcExt(from_x, from_y, to_x2, to_y2, element, change_level);
+}
+
+#if 0
+static void DrawCircle(int from_x, int from_y, int to_x, int to_y,
+ int element, boolean change_level)
+{
+ int to_x2 = to_x + (to_x < from_x ? -1 : +1);
+ int to_y2 = to_y + (to_y > from_y ? +1 : -1);
+ int mirror_to_x2 = from_x - (to_x2 - from_x);
+ int mirror_to_y2 = from_y - (to_y2 - from_y);
+
+ DrawArcExt(from_x, from_y, to_x2, to_y2, element, change_level);
+ DrawArcExt(from_x, from_y, mirror_to_x2, to_y2, element, change_level);
+ DrawArcExt(from_x, from_y, to_x2, mirror_to_y2, element, change_level);
+ DrawArcExt(from_x, from_y, mirror_to_x2, mirror_to_y2, element,change_level);
+}
+#endif
+