Page 1 of 1

Sub Engine issue with oamGfxPtrToOffset()

Posted: Thu Aug 27, 2009 5:02 pm
by Sylus101
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 <=.