diff options
| author | Tal Hayon <talhayon1@gmail.com> | 2022-01-25 00:52:18 +0200 |
|---|---|---|
| committer | Tal Hayon <talhayon1@gmail.com> | 2022-01-25 00:52:18 +0200 |
| commit | 6a10dfe491ce25bd9d434fab4082f1db3c666d1c (patch) | |
| tree | ab12b2689ea02b500556887cda470d06b909e99f /src/color.c | |
| parent | 97164d57cdbab0455d110cf811d6ae5254ceb871 (diff) | |
Match FindPalette
Diffstat (limited to 'src/color.c')
| -rw-r--r-- | src/color.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/color.c b/src/color.c index 55671ee3..557cda39 100644 --- a/src/color.c +++ b/src/color.c @@ -29,7 +29,20 @@ ASM_FUNC("asm/non_matching/color/sub_0801D000.inc", void sub_0801D000(u32 a1)); ASM_FUNC("asm/non_matching/color/LoadObjPalette.inc", u32 LoadObjPalette(Entity* entity, u32 a2)); -ASM_FUNC("asm/non_matching/color/FindPalette.inc", s32 FindPalette(u32 a1)); +s32 FindPalette(u32 a1) { + u32 index; + Palette* palette; + if (a1 <= 5) + return a1; + + for (index = 6, palette = gPaletteList; index < 0x10; index++) { + if (a1 == palette[index]._2) { + return index; + } + } + + return -1; +} ASM_FUNC("asm/non_matching/color/FindFreeObjPalette.inc", u32 FindFreeObjPalette(u32 a1)); |
