From 9be6a31dce70336989263400b8db336ab9b301c7 Mon Sep 17 00:00:00 2001 From: cellos51 Date: Thu, 7 Aug 2025 23:31:23 -0400 Subject: [PATCH] Use tonc defines for getting colors --- source/affine_background.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/affine_background.c b/source/affine_background.c index da09b7f..c530bb8 100644 --- a/source/affine_background.c +++ b/source/affine_background.c @@ -49,9 +49,9 @@ void affine_background_set_color(COLOR color) memcpy16(&old_color, &pal_bg_mem[AFFINE_BG_PB] + i, 1); // Copy the color from the background palette int r, g, b; - r = (old_color >> 10) & 0b11111; // Extract red component - g = (old_color >> 5) & 0b11111; // Extract green component - b = old_color & 0b11111; // Extract blue component + r = (old_color & RED_MASK) >> RED_SHIFT; // Extract red component + g = (old_color & GREEN_MASK) >> GREEN_SHIFT; // Extract green component + b = (old_color & BLUE_MASK) >> BLUE_SHIFT; // Extract blue component int brightness = (r + g + b) / 3; // Calculate brightness