Sub Engine issue with oamGfxPtrToOffset()

Post Reply
Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Sub Engine issue with oamGfxPtrToOffset()

Post by Sylus101 » Thu Aug 27, 2009 5:02 pm

Current code from svn:

Code: Select all

//---------------------------------------------------------------------------------
unsigned int oamGfxPtrToOffset(const void* offset) {
//---------------------------------------------------------------------------------
	unsigned int temp = (unsigned int)offset;

	if(temp <= (unsigned int)SPRITE_GFX_SUB)
	{
		temp -= (unsigned int)SPRITE_GFX;
		temp >>= oamMain.gfxOffsetStep;
	}
	else
	{
		temp -= (unsigned int)SPRITE_GFX_SUB;
		temp >>= oamSub.gfxOffsetStep;
	}
	

	return temp;
}
The line:

Code: Select all

if(temp <= (unsigned int)SPRITE_GFX_SUB)
causes the first allocated memory for the sub engine to report that it has an index of 32768 instead of 0 as it should be.

I'm gathering there should just be a < instead of a <=.
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests