Move RGB macros into color.h

This commit is contained in:
JaceCear committed 2026-03-26 20:28:59 +01:00
1 parent 52bb392d59
commit 18b9de4bbb
3 files changed
+17 -15

No files matched your search

+15
View File
@@ -31,4 +31,19 @@ typedef union Color {
} Color;
#endif
// NOTE: RGB16() is used in SA1 in some places for matching,
// so we can't have one single macro. :(
#define RGB16(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
#define RGB16_REV(r, g, b) (((b) << 10) | ((g) << 5) | (r))
#define RGB_BLACK RGB16_REV(0, 0, 0)
#define RGB_WHITE RGB16_REV(31, 31, 31)
#define RGB_RED RGB16_REV(31, 0, 0)
#define RGB_GREEN RGB16_REV(0, 31, 0)
#define RGB_BLUE RGB16_REV(0, 0, 31)
#define RGB_YELLOW RGB16_REV(31, 31, 0)
#define RGB_MAGENTA RGB16_REV(31, 0, 31)
#define RGB_CYAN RGB16_REV(0, 31, 31)
#define RGB_WHITEALPHA (RGB_WHITE | 0x8000)
#endif // GUARD_COLOR_H
+1 -14
View File
@@ -5,6 +5,7 @@
#include <stddef.h>
#include <stdint.h> // for uint16_t
#endif
#include "color.h"
#define TRUE 1
#define FALSE 0
@@ -13,7 +14,6 @@
#define IWRAM_DATA __attribute__((section("iwram_data")))
#define EWRAM_DATA __attribute__((section("ewram_data")))
#else
#include "color.h"
#define IWRAM_DATA
#define EWRAM_DATA
#endif
@@ -161,19 +161,6 @@ typedef uint16_t winreg_t;
#define TOTAL_OBJ_TILE_COUNT 1024
#define RGB16(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
#define RGB16_REV(r, g, b) (((b) << 10) | ((g) << 5) | (r))
#define RGB_BLACK RGB16(0, 0, 0)
#define RGB_WHITE RGB16(31, 31, 31)
#define RGB_RED RGB16(31, 0, 0)
#define RGB_GREEN RGB16(0, 31, 0)
#define RGB_BLUE RGB16(0, 0, 31)
#define RGB_YELLOW RGB16(31, 31, 0)
#define RGB_MAGENTA RGB16(31, 0, 31)
#define RGB_CYAN RGB16(0, 31, 31)
#define RGB_WHITEALPHA (RGB_WHITE | 0x8000)
#define SYSTEM_CLOCK (16 * 1024 * 1024) // System Clock
#endif // GUARD_GBA_DEFINES
+1 -1
View File
@@ -16,7 +16,7 @@
#include "constants/text.h"
#include "constants/tilemaps.h"
#define CM_BACKGROUND_COLOR RGB16(0, 27, 30)
#define CM_BACKGROUND_COLOR RGB16_REV(0, 27, 30)
typedef struct ChaoMessage {
/* 0x00 */ Background bg;