Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 18b9de4

Browse files
committed
Move RGB macros into color.h
1 parent 52bb392 commit 18b9de4

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

include/color.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,19 @@ typedef union Color {
3131
} Color;
3232
#endif
3333

34+
// NOTE: RGB16() is used in SA1 in some places for matching,
35+
// so we can't have one single macro. :(
36+
#define RGB16(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
37+
#define RGB16_REV(r, g, b) (((b) << 10) | ((g) << 5) | (r))
38+
39+
#define RGB_BLACK RGB16_REV(0, 0, 0)
40+
#define RGB_WHITE RGB16_REV(31, 31, 31)
41+
#define RGB_RED RGB16_REV(31, 0, 0)
42+
#define RGB_GREEN RGB16_REV(0, 31, 0)
43+
#define RGB_BLUE RGB16_REV(0, 0, 31)
44+
#define RGB_YELLOW RGB16_REV(31, 31, 0)
45+
#define RGB_MAGENTA RGB16_REV(31, 0, 31)
46+
#define RGB_CYAN RGB16_REV(0, 31, 31)
47+
#define RGB_WHITEALPHA (RGB_WHITE | 0x8000)
48+
3449
#endif // GUARD_COLOR_H

include/gba/defines.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <stddef.h>
66
#include <stdint.h> // for uint16_t
77
#endif
8+
#include "color.h"
89

910
#define TRUE 1
1011
#define FALSE 0
@@ -13,7 +14,6 @@
1314
#define IWRAM_DATA __attribute__((section("iwram_data")))
1415
#define EWRAM_DATA __attribute__((section("ewram_data")))
1516
#else
16-
#include "color.h"
1717
#define IWRAM_DATA
1818
#define EWRAM_DATA
1919
#endif
@@ -161,19 +161,6 @@ typedef uint16_t winreg_t;
161161

162162
#define TOTAL_OBJ_TILE_COUNT 1024
163163

164-
#define RGB16(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
165-
#define RGB16_REV(r, g, b) (((b) << 10) | ((g) << 5) | (r))
166-
167-
#define RGB_BLACK RGB16(0, 0, 0)
168-
#define RGB_WHITE RGB16(31, 31, 31)
169-
#define RGB_RED RGB16(31, 0, 0)
170-
#define RGB_GREEN RGB16(0, 31, 0)
171-
#define RGB_BLUE RGB16(0, 0, 31)
172-
#define RGB_YELLOW RGB16(31, 31, 0)
173-
#define RGB_MAGENTA RGB16(31, 0, 31)
174-
#define RGB_CYAN RGB16(0, 31, 31)
175-
#define RGB_WHITEALPHA (RGB_WHITE | 0x8000)
176-
177164
#define SYSTEM_CLOCK (16 * 1024 * 1024) // System Clock
178165

179166
#endif // GUARD_GBA_DEFINES

src/game/multiplayer/chao_message.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "constants/text.h"
1717
#include "constants/tilemaps.h"
1818

19-
#define CM_BACKGROUND_COLOR RGB16(0, 27, 30)
19+
#define CM_BACKGROUND_COLOR RGB16_REV(0, 27, 30)
2020

2121
typedef struct ChaoMessage {
2222
/* 0x00 */ Background bg;

0 commit comments

Comments
 (0)