04-23-2020, 01:38 AM
I found a document that mentions sprite flipping is supported by the NGPC in VRAM at bits 6 and 7 at offset 0x8801.
I looked over library.c to see how the sprite functions are modifying VRAM and have successfully added this function:
Of course, this has to be added to library.h:
This successfully flips a tile on X, Y or both. It only works on the 1 tile specified and does not affect other tiles in a chain. It appears that flipping a chain would require flipping each tile in the chain and changing X and/or Y positions on each as needed. It would probably not be too difficult to come up with a function to manage flipping at the chain level.
I looked over library.c to see how the sprite functions are modifying VRAM and have successfully added this function:
Code:
void SetSpriteFlip(u8 SpriteNo, bool XFlip, bool YFlip)
{
u8 * theSprite = SPRITE_RAM;
theSprite += (SpriteNo * 4);
switch (XFlip)
{
case 1:
*(theSprite+1) ^= 128;
break;
default:
break;
}
switch (YFlip)
{
case 1:
*(theSprite+1) ^= 64;
break;
default:
break;
}
}
Of course, this has to be added to library.h:
Code:
void SetSpriteFlip(u8 SpriteNo, bool XFlip, bool YFlip);
This successfully flips a tile on X, Y or both. It only works on the 1 tile specified and does not affect other tiles in a chain. It appears that flipping a chain would require flipping each tile in the chain and changing X and/or Y positions on each as needed. It would probably not be too difficult to come up with a function to manage flipping at the chain level.