User Tag List

Results 1 to 10 of 10

Thread: Weird Bug With Screen->Arc Drawing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,960
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.4%
    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.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  2. #2
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,764
    Level
    21
    vBActivity - Bars
    Lv. Percent
    69.66%
    Quote Originally Posted by Gleeok View Post
    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).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social