Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Akumayo on Tue 16/05/2006 01:02:55

Title: Error with RawDrawLine (SOLVED)
Post by: Akumayo on Tue 16/05/2006 01:02:55
I have the following line in my code:

RawDrawLine(FloatToInt(x_origin + x), FloatToInt(y_origin + y), FloatToInt(x_origin + x), FloatToInt(y_origin + y));

x_origin, y_origin, x, and y are all defined as float values.Ã,  Now, when I run my game, I get an error off of this line:

Quote---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occured in ACWIN.EXE at EIP = 0x0043B7F9 ; program pointer is -42, ACI version 2.71.894, gtags (0,1)

AGS cannot continue, this exception was fatal. Please note down the numbers above, remember what you were doing at the time and notify CJ on the Tech forum.

in Global script (line 16)
from Global script (line 33)


Most versions of Windows allow you to press Ctrl+C now to copy this entire message to the clipboard for easy reporting.
---------------------------
OKÃ,  Ã, 
---------------------------

Line 33 calls the function that contains line 16, which is the offensive code quoted up top.

Does anyone see the problem?

-Thanks in advance, Akumayo
Title: Re: Error with RawDrawLine
Post by: Gilbert on Tue 16/05/2006 02:24:28
Add the following line before the rawdraw line:

Display("%d %d", FloatToInt(x_origin + x), FloatToInt(y_origin + y));

And check if they're by any chance set to out-of-bound disastrous values.
Title: Re: Error with RawDrawLine
Post by: Akumayo on Tue 16/05/2006 02:47:17
"157 91"

Those don't sound too bad do they?

Can you draw outside the screen anyhow?  It is possible for the variables to get out of hand.  Would a check to see if they're on-screen before drawing fix it maybe?
Title: Re: Error with RawDrawLine
Post by: Gilbert on Tue 16/05/2006 03:08:28
Hmmm I am not quite sure about the problem, maybe try reducing the line to be a shorter one and see if the problem still persists, like for example:

int xx=FloatToInt(x_origin + x);
int yy=FloatToInt(y_origin + y);
RawDrawLine(xx,yy,xx,yy);
Title: Re: Error with RawDrawLine
Post by: Akumayo on Tue 16/05/2006 23:29:15
Well, I believe I found the problem.  I was calling the RawDraw from the game_start script, and the game didn't seem to like that at all.  I know now not to call it there.  Thank you for your help anyhow!