dst += (320 - b->width)/2; would be correct if the copy were modifying dst, but since it isn't, it should be dst += 320/2; to go to the next line of the framebuffer.
Edit: The fact that x and y are never used indicates there is something missing in the logic. I would just do:
Edit: The fact that x and y are never used indicates there is something missing in the logic. I would just do:
Code Select
void CopySprite(BITMAP* b, u32* dst, short x, short y)
{
u16* from = (u16*)b->data;
u16* to = (u16*)dst + x + y * 320;
int j;
for(j = 0; j < b->height; j++)
{
memcpy(to, from, b->width*2);
to += 320;
from += b->width;
}
}