#108438 - djmcbell - Wed Nov 08, 2006 8:42 pm
Sorry for yet another pointless topic that will probably be answered inside 30 seconds.
Basically, using the moveSprite function from Patatersoft, code below -
I've added the updateOAM and updateOAM_SUB myself, just to quickly make sure that it works here. And there's a swiWaitForVBlank() in the main code, just after our moveSprite is called. Code for updateOAM and updateOAM_SUB below, but pretty much standard -
Right, I know this is actually moving the sprites as I want, but unfortunately it seems to be resetting the sprite in the process. Looking in Dualis' OAM tells me the sprites are in the correct places, but it's basically reset the tile - blanked the sprite, the size is back to 8x8 (I assume this is the default) and whatnot. So what I'm basically looking for is something to move the sprite without affecting the rest of attributes 0 and 1, which is what this seems to be doing.
Thanks in advance for the advice and for putting up with my unfamiliarity with how the DS works (I did get quite used to the GBA though - must just be that I'm using code I'm unfamiliar with).[/code]
Basically, using the moveSprite function from Patatersoft, code below -
Code: |
//Move a Sprite
void moveSprite(SpriteEntry * spriteEntry, u16 x, u16 y) { spriteEntry->attribute[1] &= 0xFE00; spriteEntry->attribute[1] |= (x & 0x01FF); spriteEntry->attribute[0] &= 0xFF00; spriteEntry->attribute[0] |= (y & 0x00FF); updateOAM(spriteEntry); updateOAM_SUB(spriteEntry); } |
I've added the updateOAM and updateOAM_SUB myself, just to quickly make sure that it works here. And there's a swiWaitForVBlank() in the main code, just after our moveSprite is called. Code for updateOAM and updateOAM_SUB below, but pretty much standard -
Code: |
//Update the OAM - OAM_SUB
void updateOAM(SpriteEntry * spriteEntry) { DC_FlushAll(); dmaCopy(spriteEntry, OAM, 128 * sizeof(SpriteEntry)); } //Update the OAM - OAM_SUB void updateOAM_SUB(SpriteEntry * spriteEntry) { DC_FlushAll(); dmaCopy(spriteEntry, OAM_SUB, 128 * sizeof(SpriteEntry)); } |
Right, I know this is actually moving the sprites as I want, but unfortunately it seems to be resetting the sprite in the process. Looking in Dualis' OAM tells me the sprites are in the correct places, but it's basically reset the tile - blanked the sprite, the size is back to 8x8 (I assume this is the default) and whatnot. So what I'm basically looking for is something to move the sprite without affecting the rest of attributes 0 and 1, which is what this seems to be doing.
Thanks in advance for the advice and for putting up with my unfamiliarity with how the DS works (I did get quite used to the GBA though - must just be that I'm using code I'm unfamiliar with).[/code]