diff --git a/asm/field_map_obj.s b/asm/field_map_obj.s index 2475b649b..f34bde8ad 100644 --- a/asm/field_map_obj.s +++ b/asm/field_map_obj.s @@ -5,59 +5,6 @@ .text - thumb_func_start npc_load_two_palettes__no_record -@ void npc_load_two_palettes__no_record(u16 tag, u8 slot) -npc_load_two_palettes__no_record: @ 808E9C8 - push {r4-r6,lr} - lsls r0, 16 - lsrs r4, r0, 16 - lsls r1, 24 - lsrs r5, r1, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl pal_patch_for_npc - movs r3, 0 - ldr r1, =gUnknown_0850BD00 - ldrh r0, [r1] - ldr r2, =0x000011ff - cmp r0, r2 - beq _0808EA30 - ldr r0, =gUnknown_084975C4 - adds r5, r0 - adds r6, r2, 0 -_0808E9EC: - lsls r2, r3, 3 - adds r0, r2, r1 - ldrh r0, [r0] - cmp r0, r4 - bne _0808EA20 - adds r1, 0x4 - adds r1, r2, r1 - ldr r0, =gUnknown_020375B4 - ldrb r0, [r0] - ldr r1, [r1] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - ldrb r1, [r5] - bl pal_patch_for_npc - b _0808EA30 - .pool -_0808EA20: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r0, r3, 3 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r6 - bne _0808E9EC -_0808EA30: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end npc_load_two_palettes__no_record - thumb_func_start npc_load_two_palettes__and_record @ void npc_load_two_palettes__and_record(u16 tag, u8 slot) npc_load_two_palettes__and_record: @ 808EA38 diff --git a/include/data3.h b/include/data3.h index 1f082e3fb..5318d44ec 100644 --- a/include/data3.h +++ b/include/data3.h @@ -5,6 +5,13 @@ #ifndef POKEEMERALD_DATA3_H #define POKEEMERALD_DATA3_H +struct PairedPalettes { + u16 tag; + const u16 *data; +}; + extern const struct SpritePalette gUnknown_0850BBC8[]; +extern const struct PairedPalettes gUnknown_0850BD00[15]; +extern u8 gUnknown_084975C4[0x10]; #endif //POKEEMERALD_DATA3_H diff --git a/src/field_map_obj.c b/src/field_map_obj.c index 0614a82d7..fae9b12d8 100644 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -23,6 +23,9 @@ // Static RAM declarations +extern u8 gUnknown_020375B4; +extern u16 gUnknown_020375B6; + // Static ROM declarations static void sub_808D450(void); @@ -1177,3 +1180,18 @@ static u8 FindFieldObjectPaletteIndexByTag(u16 tag) } return 0xff; } + +void npc_load_two_palettes__no_record(u16 tag, u8 slot) +{ + u8 i; + + pal_patch_for_npc(tag, slot); + for (i = 0; gUnknown_0850BD00[i].tag != 0x11ff; i ++) + { + if (gUnknown_0850BD00[i].tag == tag) + { + pal_patch_for_npc(gUnknown_0850BD00[i].data[gUnknown_020375B4], gUnknown_084975C4[slot]); + return; + } + } +}