Add memcpy16_tile8_with_palette_offset function and update affine_background_init to use it
This commit is contained in:
@@ -120,4 +120,9 @@ void tte_erase_rect_wrapper(Rect rect);
|
|||||||
*/
|
*/
|
||||||
void update_text_rect_to_right_align_num(Rect* rect, int num, int overflow_direction);
|
void update_text_rect_to_right_align_num(Rect* rect, int num, int overflow_direction);
|
||||||
|
|
||||||
|
/*Copies 16 bit data from src to dst, applying a palette offset to the data.
|
||||||
|
* This is intended solely for use with tile8/8bpp data for dst and src.
|
||||||
|
*/
|
||||||
|
void memcpy16_tile8_with_palette_offset(void* dst, const void* src, uint hwcount, u8 palette_offset);
|
||||||
|
|
||||||
#endif //GRAPHIC_UTILS_H
|
#endif //GRAPHIC_UTILS_H
|
||||||
@@ -8,14 +8,7 @@ AFF_SRC_EX asx = {32<<8, 64<<8, 120, 80, 0x0100, 0x0100, 0};
|
|||||||
|
|
||||||
void affine_background_init()
|
void affine_background_init()
|
||||||
{
|
{
|
||||||
unsigned int correctedTiles[affine_background_gfxTilesLen / 4];
|
memcpy16_tile8_with_palette_offset(&tile8_mem[AFFINE_BG_CBB], affine_background_gfxTiles, affine_background_gfxTilesLen/2, AFFINE_BG_PB);
|
||||||
|
|
||||||
for (int i = 0; i < affine_background_gfxTilesLen / 4; i++)
|
|
||||||
{
|
|
||||||
correctedTiles[i] = affine_background_gfxTiles[i] | 0xF0F0F0F0;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy16(&tile8_mem[AFFINE_BG_CBB], correctedTiles, affine_background_gfxTilesLen/2);
|
|
||||||
GRIT_CPY(&se_mem[AFFINE_BG_SBB], affine_background_gfxMap);
|
GRIT_CPY(&se_mem[AFFINE_BG_SBB], affine_background_gfxMap);
|
||||||
memcpy16(&pal_bg_mem[AFFINE_BG_PB], affine_background_gfxPal, AFFINE_BG_PAL_LEN);
|
memcpy16(&pal_bg_mem[AFFINE_BG_PB], affine_background_gfxPal, AFFINE_BG_PAL_LEN);
|
||||||
|
|
||||||
|
|||||||
@@ -168,3 +168,14 @@ void update_text_rect_to_right_align_num(Rect* rect, int num, int overflow_direc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void memcpy16_tile8_with_palette_offset(void* dst, const void* src, uint hwcount, u8 palette_offset)
|
||||||
|
{
|
||||||
|
u16* dst16 = (u16*)dst;
|
||||||
|
const u16* src16 = (const u16*)src;
|
||||||
|
|
||||||
|
for (int i = 0; i < hwcount; i++)
|
||||||
|
{
|
||||||
|
// Copying u8 data twice across u16 data
|
||||||
|
dst16[i] = src16[i] + (((palette_offset) << 8) | (palette_offset));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user