summaryrefslogtreecommitdiff
path: root/src/bg_palette_buffer.c
diff options
context:
space:
mode:
authornullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com>2018-11-18 16:23:57 +0800
committernullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com>2018-11-20 15:04:00 +0800
commitf4ef62bb4134498a4b4a9c4d61b99bda24c98680 (patch)
treebb184e0d7efe635414d277c9f442d844fd5468b4 /src/bg_palette_buffer.c
parent961ab7ccaf4d175189cd42fcddca1336f3d91bad (diff)
Renamed primary heap variables and partial cleanup m4a.s
Diffstat (limited to 'src/bg_palette_buffer.c')
-rw-r--r--src/bg_palette_buffer.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/bg_palette_buffer.c b/src/bg_palette_buffer.c
index 5e078a0..6301bfa 100644
--- a/src/bg_palette_buffer.c
+++ b/src/bg_palette_buffer.c
@@ -1,7 +1,10 @@
#include "global.h"
-extern u16 gBGPaletteBuffer[512];
-extern bool8 gBGPaletteUsed[32];
+#define BG_PALETTE_BUFFER_SIZE 512
+#define BG_PALETTE_BUFFER_CHUNK_SIZE 16
+
+extern u16 gBGPaletteBuffer[BG_PALETTE_BUFFER_SIZE];
+extern bool8 gBGPaletteUsed[BG_PALETTE_BUFFER_SIZE / BG_PALETTE_BUFFER_CHUNK_SIZE];
extern void CpuCopy(void* src, void* dest, u32 size);
@@ -55,13 +58,13 @@ void SetBGPaletteBufferColorRGB(s32 index, u8 *RGBArray, s32 a3, u8 *a4)
void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray)
{
- gBGPaletteUsed[index / 16] = TRUE;
+ gBGPaletteUsed[index / BG_PALETTE_BUFFER_CHUNK_SIZE] = TRUE;
gBGPaletteBuffer[index] = (colorArray[2] >> 3) << 10 | (colorArray[1] >> 3) << 5 | colorArray[0] >> 3;
}
void SetBGPaletteBufferColor(s32 index, u16 *color)
{
- gBGPaletteUsed[index / 16] = TRUE;
+ gBGPaletteUsed[index / BG_PALETTE_BUFFER_CHUNK_SIZE] = TRUE;
gBGPaletteBuffer[index] = *color;
}
@@ -98,5 +101,5 @@ void TransferBGPaletteBuffer(void)
dest += 16;
paletteBufferIndex += 16;
}
- while ( paletteBufferIndex < 512 );
-} \ No newline at end of file
+ while ( paletteBufferIndex < BG_PALETTE_BUFFER_SIZE );
+}