Error with RawDrawLine (SOLVED)

Started by Akumayo, Tue 16/05/2006 01:02:55

Previous topic - Next topic

Akumayo

I have the following line in my code:

Code: ags
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
"Power is not a means - it is an end."

Gilbert

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.

Akumayo

"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?
"Power is not a means - it is an end."

Gilbert

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);

Akumayo

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!
"Power is not a means - it is an end."

SMF spam blocked by CleanTalk