Originally Posted by
Gleeok
Oh, I missed that he posted a link to the script in the OP. Whoops.
But yes, my first suspicion was that the arguments being passed were unintentional. ..and yeah, it does look like you are passing negative numbers in reverse order.
Still might be a corner-case bug though if you want to trace the values that draw an entire screen sized rect.
I suspect that most users overlook that the degree values must be logical values between 0 and 360. I thought that it would clamp to 359.9999, but the docs say 0->360.
I could fix this with an overload in std.zh.
Something like this, perhaps?
Code:
void Arc
(int layer, int x, int y, int radius, int startangle, int endangle, int color, float scale,
int rx, int ry, int rangle, bool closed, bool fill, int opacity )
{
startangle = WrapDegrees(startangle); endangle = WarpDegrees(endangle);
if ( startangle > endangle )
{
Screen->Arc(layer, x, y, radius, endangle, startangle, color, scale, rx, ry, rangle, closed, fill, opacity);
}
else
{
Screen->Arc(layer, x, y, radius, startangle, endangle, color, scale, rx, ry, rangle, closed, fill, opacity);
}
}
Here is a potentially useful debug function for Arc():
Code:
//The same as above, but with logging option.
void Arc
(int layer, int x, int y, int radius, int startangle, int endangle, int color, float scale,
int rx, int ry, int rangle, bool closed, bool fill, int opacity, bool debug)
{
if ( debug )
{
if ( startangle > 360 )
{
int s[]="Value supplied to startangle is outside the legal range of 0 to 360. The value provided was: ";
TraceNL(); TraceS(s); Trace(startangle); TraceNL();
}
if ( endangle > 360 )
{
int s[]="Value supplied to endangle is outside the legal range of 0 to 360e. The value provided was: ";
TraceNL(); TraceS(s); Trace(endangle); TraceNL();
}
if ( startangle < 0 )
{
int s[]="Value supplied to startangle is outside the legal range of 0 to 360. The value provided was: ";
TraceNL(); TraceS(s); Trace(startangle); TraceNL();
}
if ( endangle < 0 )
{
int s[]="Value supplied to endangle is outside the legal range of 0 to 360. The value provided was: ";
TraceNL(); TraceS(s); Trace(endangle); TraceNL();
}
}
startangle = WrapDegrees(startangle); endangle = WarpDegrees(endangle);
if ( startangle > endangle )
{
if ( debug )
{
int s[]="The angles provided to Arc() are in the reverse order!"; TraceNL(); TraceS(s); TraceNL();
}
Screen->Arc(layer, x, y, radius, endangle, startangle, color, scale, rx, ry, rangle, closed, fill, opacity);
}
else
{
Screen->Arc(layer, x, y, radius, startangle, endangle, color, scale, rx, ry, rangle, closed, fill, opacity);
}
}
Now, that will slow ZC to a crawl if called every frame (and there are errors to log).