diff --git a/asm/code_803E724.s b/asm/code_803E724.s index 7f9895d45..e43d76df4 100644 --- a/asm/code_803E724.s +++ b/asm/code_803E724.s @@ -7,111 +7,6 @@ - thumb_func_start sub_803EA10 -sub_803EA10: - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - ldr r0, _0803EACC - ldr r0, [r0] - ldr r4, [r0, 0x4] - ldr r1, _0803EAD0 - ldr r0, _0803EAD4 - ldr r2, [r0] - ldr r0, _0803EAD8 - ldr r3, [r0] - movs r0, 0xBE - lsls r0, 1 - adds r3, r0 - movs r0, 0 - bl SetBGPaletteBufferColorRGB - adds r4, 0x4 - movs r6, 0x1 - movs r5, 0x9F -_0803EA3A: - ldr r1, _0803EAD4 - mov r8, r1 - ldr r2, [r1] - ldr r7, _0803EAD8 - ldr r3, [r7] - movs r0, 0xBE - lsls r0, 1 - adds r3, r0 - adds r0, r6, 0 - adds r1, r4, 0 - bl SetBGPaletteBufferColorRGB - adds r4, 0x4 - adds r6, 0x1 - subs r5, 0x1 - cmp r5, 0 - bne _0803EA3A - ldr r3, [r7] - ldr r1, _0803EADC - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0803EA72 - ldr r2, _0803EAE0 - adds r0, r3, r2 - ldr r0, [r0] - cmp r0, 0x3 - bne _0803EA8C -_0803EA72: - ldr r1, _0803EAE4 - mov r2, r8 - ldr r0, [r2] - str r0, [sp] - movs r2, 0xBE - lsls r2, 1 - adds r0, r3, r2 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r2, 0xA0 - movs r3, 0x20 - bl sub_8004AF0 -_0803EA8C: - adds r6, 0x20 - ldr r4, _0803EAE8 - movs r5, 0x20 -_0803EA92: - ldr r7, _0803EAD4 - ldr r2, [r7] - ldr r0, _0803EAD8 - ldr r3, [r0] - movs r0, 0xBE - lsls r0, 1 - adds r3, r0 - adds r0, r6, 0 - adds r1, r4, 0 - bl SetBGPaletteBufferColorRGB - adds r4, 0x4 - adds r6, 0x1 - subs r5, 0x1 - cmp r5, 0 - bne _0803EA92 - ldr r1, _0803EAEC - ldr r2, [r7] - movs r0, 0xF8 - movs r3, 0 - bl SetBGPaletteBufferColorRGB - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0803EACC: .4byte gDungeonPaletteFile -_0803EAD0: .4byte gUnknown_80F62AC -_0803EAD4: .4byte gUnknown_202EDC8 -_0803EAD8: .4byte gDungeon -_0803EADC: .4byte 0x00018215 -_0803EAE0: .4byte 0x0001c06c -_0803EAE4: .4byte gUnknown_202EE8C -_0803EAE8: .4byte gUnknown_202ECA4 -_0803EAEC: .4byte gUnknown_202D058 - thumb_func_end sub_803EA10 thumb_func_start sub_803EAF0 sub_803EAF0: diff --git a/src/code_803E724.c b/src/code_803E724.c index ec283870e..000db2df5 100644 --- a/src/code_803E724.c +++ b/src/code_803E724.c @@ -71,7 +71,7 @@ void sub_803E874(bool8 r10, s32 r9) } } -void sub_803E9D0(void) +void BgColorCallNullsub4(void) { s32 i, index, count; const u8 *colorArray; @@ -85,3 +85,35 @@ void sub_803E9D0(void) index++; } } + +void sub_803EA10(void) +{ + s32 i, index, count; + const u8 *colorArray; + + colorArray = gDungeonPaletteFile->unk4; + SetBGPaletteBufferColorRGB(0, gUnknown_80F62AC, gUnknown_202EDC8, (void *) &gDungeon->unk17C); + colorArray += 4; + index = 1; + count = 159; + for (i = 0; i < count; i++) { + SetBGPaletteBufferColorRGB(index, colorArray, gUnknown_202EDC8, (void *) &gDungeon->unk17C); + colorArray += 4; + index++; + } + + if (gDungeon->unk181e8.unk18215 == 0 || gDungeon->unk1C06C == 3) { + sub_8004AF0(TRUE, gUnknown_202EE8C, 0xA0, 0x20, gUnknown_202EDC8, (void *) &gDungeon->unk17C); + } + + index += 32; + colorArray = gUnknown_202ECA4; + count = 32; + for (i = 0; i < count; i++) { + SetBGPaletteBufferColorRGB(index, colorArray, gUnknown_202EDC8, (void *) &gDungeon->unk17C); + colorArray += 4; + index++; + } + + SetBGPaletteBufferColorRGB(248, gUnknown_202D058, gUnknown_202EDC8, NULL); +} diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c index e9621b758..f7281b5bd 100644 --- a/src/code_8057824_1.c +++ b/src/code_8057824_1.c @@ -333,7 +333,7 @@ extern s32 GetCameraXPos(); extern s32 GetCameraYPos(); extern void sub_803F878(u32, s32); extern void SetupBossFightHP(Entity *, u32, u32); -extern void sub_803E9D0(void); +extern void BgColorCallNullsub4(void); extern void DeoxysScreenFlash(void); extern void sub_8085EB0(); @@ -3987,7 +3987,7 @@ void sub_808C0CC(void) { gUnknown_202EDC8 = 0x1f; SetDungeonBGColorRGB(0,0,0,1,1); - sub_803E9D0(); + BgColorCallNullsub4(); sub_803E46C(0x46); gDungeon->unk7 = 0; LugiaScreenFlash(); @@ -4109,7 +4109,7 @@ void sub_808C360(void) { gUnknown_202EDC8 = 0x1f; SetDungeonBGColorRGB(0,0,0,1,1); - sub_803E9D0(); + BgColorCallNullsub4(); sub_803E46C(0x46); gDungeon->unk7 = 0; KyogreScreenFlash(); @@ -4196,7 +4196,7 @@ void sub_808C550(void) { gUnknown_202EDC8 = 0x1f; SetDungeonBGColorRGB(0,0,0,1,1); - sub_803E9D0(); + BgColorCallNullsub4(); sub_803E46C(0x46); gDungeon->unk7 = 0; DeoxysScreenFlash(); diff --git a/src/code_80869E4.c b/src/code_80869E4.c index 6c974b629..a44b50a52 100644 --- a/src/code_80869E4.c +++ b/src/code_80869E4.c @@ -20,7 +20,7 @@ EWRAM_DATA unkStruct_202F3D0 gUnknown_202F3D0 = {0}; extern u32 gUnknown_8107314[]; s8 sub_8002984(s8, u8); -extern void sub_803E9D0(void); +extern void BgColorCallNullsub4(void); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern void PlaySoundEffect(u32); extern void DisplayDungeonDialogue(const u8 *); @@ -347,7 +347,7 @@ void sub_8086794(void) for (i = 0; i < 200; i++) { SetDungeonBGColorRGB(0, 0, 0, 1, 0); - sub_803E9D0(); + BgColorCallNullsub4(); sub_803E46C(70); if ((i & 3) == 0) {