diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/animtiles.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/animtiles.cpp b/src/animtiles.cpp index 4213e6a..53a204b 100644 --- a/src/animtiles.cpp +++ b/src/animtiles.cpp @@ -51,3 +51,20 @@ void DoTiles(void* self) { void DestroyTiles(void *self) { FreeFile(&fh); } + + +extern "C" void CopyAnimTile(u8 *target, int tileNum, u8 *source, int frameNum) { + int tileRow = tileNum >> 5; // divided by 32 + int tileColumn = tileNum & 31; // modulus by 32 + + u8 *baseRow = target + (tileRow * 2 * 32 * 1024); + u8 *baseTile = baseRow + (tileColumn * 32 * 4 * 2); + + u8 *sourceRow = source + (frameNum * 2 * 32 * 32); + + for (int i = 0; i < 8; i++) { + memcpy(baseTile, sourceRow, 32*4*2); + baseTile += (2 * 4 * 1024); + sourceRow += (2 * 32 * 4); + } +} |