diff --git a/asm/code_80BF13C.s b/asm/code_80BF13C.s deleted file mode 100644 index 1bb8a373..00000000 --- a/asm/code_80BF13C.s +++ /dev/null @@ -1,1592 +0,0 @@ - .INCLUDE "macro.inc" - - .SYNTAX UNIFIED - - THUMB_FUNC_START sub_80C34D0 -sub_80C34D0: @ 0x080C34D0 - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, r9 - mov r5, r8 - push {r5, r6, r7} - sub sp, #0x10 - adds r4, r0, #0 - adds r7, r1, #0 - lsls r2, r2, #0x10 - lsrs r2, r2, #0x10 - str r2, [sp] - lsls r3, r3, #0x10 - lsrs r3, r3, #0x10 - mov sl, r3 - movs r2, #0 - cmp r2, r7 - bge _080C357E - movs r0, #0x1f - mov r1, sl - ands r1, r0 - str r1, [sp, #4] - movs r3, #0 - str r3, [sp, #8] - mov r8, r4 - ldr r1, [sp] - mov r9, r1 - mov r3, r9 - ands r3, r0 - mov r9, r3 -_080C350A: - subs r6, r7, r2 - mov r0, r9 - muls r0, r6, r0 - ldr r1, [sp, #8] - adds r0, r0, r1 - adds r1, r7, #0 - str r2, [sp, #0xc] - bl __divsi3 - adds r4, r0, #0 - movs r3, #0x1f - ands r4, r3 - ldr r0, [sp] - movs r1, #0xf8 - lsls r1, r1, #2 - ands r0, r1 - muls r0, r6, r0 - mov r1, sl - movs r3, #0xf8 - lsls r3, r3, #2 - ands r1, r3 - ldr r2, [sp, #0xc] - muls r1, r2, r1 - adds r0, r0, r1 - adds r1, r7, #0 - bl __divsi3 - movs r1, #0xf8 - lsls r1, r1, #2 - ands r0, r1 - adds r4, r4, r0 - movs r5, #0xf8 - lsls r5, r5, #7 - ldr r0, [sp] - ands r0, r5 - muls r0, r6, r0 - mov r1, sl - ands r1, r5 - ldr r2, [sp, #0xc] - muls r1, r2, r1 - adds r0, r0, r1 - adds r1, r7, #0 - bl __divsi3 - ands r0, r5 - adds r4, r4, r0 - mov r3, r8 - strh r4, [r3] - ldr r0, [sp, #8] - ldr r1, [sp, #4] - adds r0, r0, r1 - str r0, [sp, #8] - movs r3, #2 - add r8, r3 - ldr r2, [sp, #0xc] - adds r2, #1 - cmp r2, r7 - blt _080C350A -_080C357E: - add sp, #0x10 - pop {r3, r4, r5} - mov r8, r3 - mov r9, r4 - mov sl, r5 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80C34D0 - - THUMB_FUNC_START sub_80C3590 -sub_80C3590: @ 0x080C3590 - push {r4, r5, r6, lr} - sub sp, #4 - movs r6, #0 - ldr r5, _080C35BC @ 0x06014000 - movs r4, #3 -_080C359A: - str r6, [sp] - mov r0, sp - adds r1, r5, #0 - ldr r2, _080C35C0 @ 0x010000E0 - bl CpuFastSet - movs r0, #0x80 - lsls r0, r0, #3 - adds r5, r5, r0 - subs r4, #1 - cmp r4, #0 - bge _080C359A - add sp, #4 - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_080C35BC: .4byte 0x06014000 -_080C35C0: .4byte 0x010000E0 - - THUMB_FUNC_END sub_80C3590 - - THUMB_FUNC_START sub_80C35C4 -sub_80C35C4: @ 0x080C35C4 - push {lr} - adds r3, r0, #0 - adds r3, #0x29 - movs r2, #0 - movs r1, #1 - strb r1, [r3] - adds r0, #0x2a - strb r2, [r0] - bl sub_80C3590 - ldr r2, _080C35E8 @ gWmHblankStatus - ldrb r1, [r2] - movs r0, #0xfe - ands r0, r1 - strb r0, [r2] - pop {r0} - bx r0 - .align 2, 0 -_080C35E8: .4byte gWmHblankStatus - - THUMB_FUNC_END sub_80C35C4 - - THUMB_FUNC_START sub_80C35EC -sub_80C35EC: @ 0x080C35EC - push {lr} - sub sp, #4 - adds r1, r0, #0 - adds r0, #0x2a - ldrb r0, [r0] - cmp r0, #0 - beq _080C3618 - movs r2, #0 - adds r0, r1, #0 - adds r0, #0x29 - ldrb r0, [r0] - cmp r0, #1 - bne _080C3608 - movs r2, #0x6f -_080C3608: - ldr r3, _080C3620 @ gUnknown_08A3EE28 - movs r0, #0x80 - lsls r0, r0, #6 - str r0, [sp] - movs r0, #1 - movs r1, #0 - bl PutSpriteExt -_080C3618: - add sp, #4 - pop {r0} - bx r0 - .align 2, 0 -_080C3620: .4byte gUnknown_08A3EE28 - - THUMB_FUNC_END sub_80C35EC - - THUMB_FUNC_START StartWmText -StartWmText: @ 0x080C3624 - push {r4, r5, lr} - lsls r0, r0, #0x18 - lsrs r5, r0, #0x18 - ldr r0, _080C3658 @ gUnknown_08A3EE44 - bl Proc_Find - adds r4, r0, #0 - cmp r4, #0 - beq _080C3652 - bl sub_80C3590 - ldr r2, _080C365C @ gWmHblankStatus - ldrb r1, [r2] - movs r0, #0xfe - ands r0, r1 - strb r0, [r2] - adds r0, r4, #0 - adds r0, #0x29 - strb r5, [r0] - adds r1, r4, #0 - adds r1, #0x2a - movs r0, #1 - strb r0, [r1] -_080C3652: - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_080C3658: .4byte gUnknown_08A3EE44 -_080C365C: .4byte gWmHblankStatus - - THUMB_FUNC_END StartWmText - - THUMB_FUNC_START RemoveWmText -RemoveWmText: @ 0x080C3660 - push {lr} - ldr r0, _080C3684 @ gUnknown_08A3EE44 - bl Proc_Find - adds r3, r0, #0 - cmp r3, #0 - beq _080C3680 - ldr r2, _080C3688 @ gWmHblankStatus - ldrb r1, [r2] - movs r0, #0xfe - ands r0, r1 - strb r0, [r2] - adds r1, r3, #0 - adds r1, #0x2a - movs r0, #0 - strb r0, [r1] -_080C3680: - pop {r0} - bx r0 - .align 2, 0 -_080C3684: .4byte gUnknown_08A3EE44 -_080C3688: .4byte gWmHblankStatus - - THUMB_FUNC_END RemoveWmText - - THUMB_FUNC_START sub_80C368C -sub_80C368C: @ 0x080C368C - push {lr} - adds r1, r0, #0 - ldr r0, _080C369C @ gUnknown_08A3EE44 - bl Proc_Start - pop {r1} - bx r1 - .align 2, 0 -_080C369C: .4byte gUnknown_08A3EE44 - - THUMB_FUNC_END sub_80C368C - - THUMB_FUNC_START sub_80C36A0 -sub_80C36A0: @ 0x080C36A0 - push {r4, lr} - adds r4, r0, #0 - bl EndTalk - movs r0, #0x80 - lsls r0, r0, #2 - movs r1, #2 - movs r2, #2 - bl InitSpriteTalk - bl EnablePaletteSync - movs r0, #1 - movs r1, #0xf - adds r2, r4, #0 - bl StartTalkMsg - movs r0, #4 - bl SetTalkPrintDelay - movs r0, #0x20 - bl SetTalkFlag - movs r0, #0x80 - bl SetTalkFlag - movs r0, #4 - bl SetTalkFlag - movs r0, #1 - bl SetTalkFlag - pop {r4} - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80C36A0 - - THUMB_FUNC_START sub_80C36E8 -sub_80C36E8: @ 0x080C36E8 - push {r4, r5, r6, lr} - sub sp, #4 - adds r4, r0, #0 - ldr r0, _080C375C @ gGMData - ldr r1, [r0, #8] - asrs r1, r1, #8 - ldr r6, [r0, #0xc] - asrs r6, r6, #8 - adds r0, r4, #0 - adds r0, #0x2f - movs r5, #0 - ldrsb r5, [r0, r5] - lsls r5, r5, #3 - lsls r0, r1, #6 - subs r0, r0, r1 - movs r1, #0xf0 - lsls r1, r1, #1 - bl __divsi3 - adds r5, r5, r0 - adds r4, #0x30 - ldrb r4, [r4] - lsls r4, r4, #0x18 - asrs r4, r4, #0x18 - lsls r4, r4, #3 - movs r0, #0x2b - muls r0, r6, r0 - movs r1, #0xa0 - lsls r1, r1, #1 - bl __divsi3 - adds r4, r4, r0 - subs r1, r5, #1 - adds r2, r4, #7 - adds r5, #0x1f - ldr r0, _080C3760 @ 0x0000012F - cmp r5, r0 - bhi _080C3754 - movs r0, #0x20 - negs r0, r0 - cmp r2, r0 - blt _080C3754 - cmp r2, #0xbf - bgt _080C3754 - ldr r0, _080C3764 @ 0x000001FF - ands r1, r0 - movs r0, #0xff - ands r2, r0 - ldr r3, _080C3768 @ gObject_8x8 - ldr r0, _080C376C @ 0x000040F6 - str r0, [sp] - movs r0, #0 - bl PutSpriteExt -_080C3754: - add sp, #4 - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_080C375C: .4byte gGMData -_080C3760: .4byte 0x0000012F -_080C3764: .4byte 0x000001FF -_080C3768: .4byte gObject_8x8 -_080C376C: .4byte 0x000040F6 - - THUMB_FUNC_END sub_80C36E8 - - THUMB_FUNC_START sub_80C3770 -sub_80C3770: @ 0x080C3770 - push {r4, r5, r6, lr} - sub sp, #4 - adds r4, r0, #0 - ldr r0, _080C37F4 @ gGMData - bl GetNextUnclearedNode - cmp r0, #0 - blt _080C37EA - lsls r0, r0, #5 - ldr r1, _080C37F8 @ gWMNodeData - adds r0, r0, r1 - movs r2, #0x18 - ldrsh r1, [r0, r2] - movs r2, #0x1a - ldrsh r6, [r0, r2] - adds r0, r4, #0 - adds r0, #0x2f - movs r5, #0 - ldrsb r5, [r0, r5] - lsls r5, r5, #3 - lsls r0, r1, #6 - subs r0, r0, r1 - movs r1, #0xf0 - lsls r1, r1, #1 - bl __divsi3 - adds r5, r5, r0 - adds r0, r4, #0 - adds r0, #0x30 - movs r4, #0 - ldrsb r4, [r0, r4] - lsls r4, r4, #3 - movs r0, #0x2b - muls r0, r6, r0 - movs r1, #0xa0 - lsls r1, r1, #1 - bl __divsi3 - adds r4, r4, r0 - subs r1, r5, #1 - adds r2, r4, #7 - adds r5, #0x1f - ldr r0, _080C37FC @ 0x0000012F - cmp r5, r0 - bhi _080C37EA - movs r0, #0x20 - negs r0, r0 - cmp r2, r0 - blt _080C37EA - cmp r2, #0xbf - bgt _080C37EA - ldr r0, _080C3800 @ 0x000001FF - ands r1, r0 - movs r0, #0xff - ands r2, r0 - ldr r3, _080C3804 @ gObject_8x8 - ldr r0, _080C3808 @ 0x000040F7 - str r0, [sp] - movs r0, #0 - bl PutSpriteExt -_080C37EA: - add sp, #4 - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_080C37F4: .4byte gGMData -_080C37F8: .4byte gWMNodeData -_080C37FC: .4byte 0x0000012F -_080C3800: .4byte 0x000001FF -_080C3804: .4byte gObject_8x8 -_080C3808: .4byte 0x000040F7 - - THUMB_FUNC_END sub_80C3770 - - THUMB_FUNC_START sub_80C380C -sub_80C380C: @ 0x080C380C - push {r4, r5, r6, r7, lr} - sub sp, #8 - adds r7, r0, #0 - ldr r0, _080C38A4 @ gGMData - ldrb r1, [r0, #0x10] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _080C389A - ldr r0, _080C38A8 @ ProcScr_WorldMapMain - bl Proc_Find - ldr r0, [r0, #0x54] - mov r4, sp - adds r4, #6 - movs r1, #0 - add r2, sp, #4 - adds r3, r4, #0 - bl GmMu_GetPosition - add r0, sp, #4 - movs r2, #0 - ldrsh r1, [r0, r2] - movs r0, #0 - ldrsh r6, [r4, r0] - adds r0, r7, #0 - adds r0, #0x2f - movs r5, #0 - ldrsb r5, [r0, r5] - lsls r5, r5, #3 - lsls r0, r1, #6 - subs r0, r0, r1 - movs r1, #0xf0 - lsls r1, r1, #1 - bl __divsi3 - adds r5, r5, r0 - adds r0, r7, #0 - adds r0, #0x30 - movs r4, #0 - ldrsb r4, [r0, r4] - lsls r4, r4, #3 - movs r0, #0x2b - muls r0, r6, r0 - movs r1, #0xa0 - lsls r1, r1, #1 - bl __divsi3 - adds r4, r4, r0 - subs r1, r5, #3 - adds r2, r4, #7 - adds r5, #0x1d - ldr r0, _080C38AC @ 0x0000012F - cmp r5, r0 - bhi _080C389A - movs r0, #0x20 - negs r0, r0 - cmp r2, r0 - blt _080C389A - cmp r2, #0xbf - bgt _080C389A - ldr r0, _080C38B0 @ 0x000001FF - ands r1, r0 - movs r0, #0xff - ands r2, r0 - ldr r3, _080C38B4 @ gObject_8x8 - ldr r0, _080C38B8 @ 0x000090F4 - str r0, [sp] - movs r0, #0 - bl PutSpriteExt -_080C389A: - add sp, #8 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_080C38A4: .4byte gGMData -_080C38A8: .4byte ProcScr_WorldMapMain -_080C38AC: .4byte 0x0000012F -_080C38B0: .4byte 0x000001FF -_080C38B4: .4byte gObject_8x8 -_080C38B8: .4byte 0x000090F4 - - THUMB_FUNC_END sub_80C380C - - THUMB_FUNC_START sub_80C38BC -sub_80C38BC: @ 0x080C38BC - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, r9 - mov r5, r8 - push {r5, r6, r7} - sub sp, #0x20 - str r0, [sp, #0x14] - movs r0, #0 - str r0, [sp, #0x18] - movs r1, #4 - mov r9, r1 - mov r2, sp - adds r2, #0x10 - str r2, [sp, #0x1c] - movs r3, #0x12 - add r3, sp - mov sl, r3 - add r0, sp, #4 - mov r8, r0 -_080C38E2: - ldr r1, _080C3A10 @ gGMData - mov r2, r9 - lsls r0, r2, #2 - adds r0, r0, r1 - ldrb r1, [r0, #0x10] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _080C3956 - ldr r0, _080C3A14 @ ProcScr_WorldMapMain - bl Proc_Find - ldr r0, [r0, #0x54] - mov r1, r9 - ldr r2, [sp, #0x1c] - mov r3, sl - bl GmMu_GetPosition - ldr r3, [sp, #0x1c] - movs r0, #0 - ldrsh r1, [r3, r0] - mov r2, sl - movs r3, #0 - ldrsh r6, [r2, r3] - ldr r0, [sp, #0x14] - adds r0, #0x2f - movs r5, #0 - ldrsb r5, [r0, r5] - lsls r5, r5, #3 - lsls r0, r1, #6 - subs r0, r0, r1 - movs r1, #0xf0 - lsls r1, r1, #1 - bl __divsi3 - adds r5, r5, r0 - ldr r0, [sp, #0x14] - adds r0, #0x30 - movs r4, #0 - ldrsb r4, [r0, r4] - lsls r4, r4, #3 - movs r0, #0x2b - muls r0, r6, r0 - movs r1, #0xa0 - lsls r1, r1, #1 - bl __divsi3 - adds r4, r4, r0 - subs r5, #3 - mov r0, r8 - strh r5, [r0] - adds r4, #7 - strh r4, [r0, #2] - movs r1, #4 - add r8, r1 - ldr r2, [sp, #0x18] - adds r2, #1 - str r2, [sp, #0x18] -_080C3956: - movs r3, #1 - add r9, r3 - mov r0, r9 - cmp r0, #6 - ble _080C38E2 - movs r5, #0 - ldr r1, [sp, #0x18] - subs r1, #1 - mov r8, r1 - cmp r5, r8 - bge _080C39B6 -_080C396C: - adds r6, r5, #1 - ldr r2, [sp, #0x18] - cmp r6, r2 - bge _080C39B0 - lsls r0, r5, #2 - mov r4, sp - adds r4, r4, r0 - adds r4, #4 - lsls r0, r6, #2 - adds r2, r0, #0 - add r2, sp - adds r2, #4 - ldr r3, [sp, #0x18] - subs r5, r3, r6 -_080C3988: - ldrh r0, [r4, #2] - movs r3, #2 - ldrsh r1, [r2, r3] - lsls r3, r0, #0x10 - asrs r0, r3, #0x10 - cmp r1, r0 - bge _080C39A8 - ldrh r7, [r4] - orrs r7, r3 - ldrh r0, [r2] - strh r0, [r4] - ldrh r0, [r2, #2] - strh r0, [r4, #2] - strh r7, [r2] - asrs r0, r7, #0x10 - strh r0, [r2, #2] -_080C39A8: - adds r2, #4 - subs r5, #1 - cmp r5, #0 - bne _080C3988 -_080C39B0: - adds r5, r6, #0 - cmp r5, r8 - blt _080C396C -_080C39B6: - ldr r0, [sp, #0x18] - cmp r0, #0 - ble _080C3A00 - ldr r7, _080C3A18 @ 0x0000012F - add r4, sp, #4 - movs r6, #0x20 - negs r6, r6 - adds r5, r0, #0 -_080C39C6: - ldrh r2, [r4] - adds r0, r2, #0 - adds r0, #0x20 - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - cmp r0, r7 - bhi _080C39F8 - ldrh r3, [r4, #2] - movs r1, #2 - ldrsh r0, [r4, r1] - cmp r0, r6 - blt _080C39F8 - cmp r0, #0xbf - bgt _080C39F8 - ldr r0, _080C3A1C @ 0x000001FF - adds r1, r0, #0 - ands r1, r2 - movs r2, #0xff - ands r2, r3 - ldr r0, _080C3A20 @ 0x000090F5 - str r0, [sp] - movs r0, #0 - ldr r3, _080C3A24 @ gObject_8x8 - bl PutSpriteExt -_080C39F8: - adds r4, #4 - subs r5, #1 - cmp r5, #0 - bne _080C39C6 -_080C3A00: - add sp, #0x20 - pop {r3, r4, r5} - mov r8, r3 - mov r9, r4 - mov sl, r5 - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_080C3A10: .4byte gGMData -_080C3A14: .4byte ProcScr_WorldMapMain -_080C3A18: .4byte 0x0000012F -_080C3A1C: .4byte 0x000001FF -_080C3A20: .4byte 0x000090F5 -_080C3A24: .4byte gObject_8x8 - - THUMB_FUNC_END sub_80C38BC - - THUMB_FUNC_START sub_80C3A28 -sub_80C3A28: @ 0x080C3A28 - push {lr} - ldr r0, _080C3A54 @ ProcScr_WorldMapMain - bl Proc_Find - ldr r0, [r0, #0x50] - adds r0, #0x34 - ldrb r1, [r0] - ldr r2, _080C3A58 @ gPaletteBuffer+0x320 - lsls r1, r1, #1 - ldr r0, _080C3A5C @ gUnknown_08AA1930 - adds r0, r1, r0 - ldrh r0, [r0] - strh r0, [r2, #0x12] - ldr r0, _080C3A60 @ gUnknown_08AA1950 - adds r1, r1, r0 - ldrh r0, [r1] - strh r0, [r2, #0xe] - bl EnablePaletteSync - pop {r0} - bx r0 - .align 2, 0 -_080C3A54: .4byte ProcScr_WorldMapMain -_080C3A58: .4byte gPaletteBuffer+0x320 -_080C3A5C: .4byte gUnknown_08AA1930 -_080C3A60: .4byte gUnknown_08AA1950 - - THUMB_FUNC_END sub_80C3A28 - - THUMB_FUNC_START sub_80C3A64 -sub_80C3A64: @ 0x080C3A64 - push {r4, lr} - adds r4, r0, #0 - bl sub_80C3770 - adds r0, r4, #0 - bl sub_80C38BC - adds r0, r4, #0 - bl sub_80C380C - adds r0, r4, #0 - bl sub_80C36E8 - adds r0, r4, #0 - bl sub_80C3A28 - pop {r4} - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80C3A64 - - THUMB_FUNC_START sub_80C3A8C -sub_80C3A8C: @ 0x080C3A8C - push {r4, lr} - ldr r4, _080C3AAC @ gUnknown_0201B458 - adds r0, r4, #0 - movs r1, #8 - movs r2, #8 - movs r3, #0 - bl TileMap_FillRect - ldr r1, _080C3AB0 @ gUnknown_08AA18AC - ldr r2, _080C3AB4 @ 0x000071E0 - adds r0, r4, #0 - bl CallARM_FillTileRect - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080C3AAC: .4byte gUnknown_0201B458 -_080C3AB0: .4byte gUnknown_08AA18AC -_080C3AB4: .4byte 0x000071E0 - - THUMB_FUNC_END sub_80C3A8C - - THUMB_FUNC_START sub_80C3AB8 -sub_80C3AB8: @ 0x080C3AB8 - push {r4, r5, r6, lr} - adds r5, r0, #0 - ldr r6, _080C3B38 @ gGMData - ldrb r1, [r6] - movs r0, #4 - ands r0, r1 - cmp r0, #0 - beq _080C3B32 - movs r0, #0 - str r0, [r5, #0x34] - movs r0, #0x20 - movs r1, #0x20 - movs r2, #0x30 - movs r3, #0x30 - bl sub_80C089C - adds r1, r5, #0 - adds r1, #0x2a - strb r0, [r1] - ldr r3, _080C3B3C @ gUnknown_08206B70 - movs r2, #0 - ldrsb r2, [r1, r2] - ldrb r4, [r6] - lsls r1, r4, #0x1a - lsrs r1, r1, #0x1e - lsls r0, r1, #2 - adds r0, r0, r1 - adds r2, r2, r0 - adds r2, r2, r3 - ldrb r0, [r2] - movs r1, #3 - ands r1, r0 - lsls r1, r1, #4 - movs r0, #0x31 - negs r0, r0 - ands r0, r4 - orrs r0, r1 - strb r0, [r6] - adds r0, r5, #0 - bl sub_80C3A8C - adds r1, r5, #0 - adds r1, #0x2d - ldr r0, [r6, #8] - asrs r0, r0, #8 - strb r0, [r1] - adds r2, r5, #0 - adds r2, #0x2e - ldr r0, [r6, #0xc] - asrs r0, r0, #8 - strb r0, [r2] - ldrb r0, [r1] - subs r1, #2 - strb r0, [r1] - ldrb r1, [r2] - adds r0, r5, #0 - adds r0, #0x2c - strb r1, [r0] - adds r0, r5, #0 - bl Proc_Break -_080C3B32: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_080C3B38: .4byte gGMData -_080C3B3C: .4byte gUnknown_08206B70 - - THUMB_FUNC_END sub_80C3AB8 - - THUMB_FUNC_START sub_80C3B40 -sub_80C3B40: @ 0x080C3B40 - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - bl sub_80C3A64 - adds r2, r4, #0 - adds r2, #0x2d - ldrb r0, [r2] - adds r5, r4, #0 - adds r5, #0x2b - strb r0, [r5] - adds r1, r4, #0 - adds r1, #0x2e - ldrb r0, [r1] - adds r7, r4, #0 - adds r7, #0x2c - strb r0, [r7] - ldr r6, _080C3BDC @ gGMData - ldr r0, [r6, #8] - asrs r0, r0, #8 - strb r0, [r2] - ldr r0, [r6, #0xc] - asrs r3, r0, #8 - strb r3, [r1] - ldrb r1, [r6] - movs r0, #4 - ands r0, r1 - cmp r0, #0 - beq _080C3BC6 - movs r0, #1 - ldrsb r0, [r6, r0] - cmp r0, #0 - ble _080C3BD4 - ldrb r0, [r2] - ldrb r5, [r5] - cmp r0, r5 - bne _080C3B92 - lsls r0, r3, #0x18 - lsrs r0, r0, #0x18 - ldrb r7, [r7] - cmp r0, r7 - beq _080C3BD4 -_080C3B92: - movs r0, #0x20 - movs r1, #0x20 - movs r2, #0x30 - movs r3, #0x30 - bl sub_80C089C - adds r5, r0, #0 - adds r0, r4, #0 - adds r0, #0x2a - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r5, r0 - beq _080C3BD4 - ldrb r1, [r6] - lsls r1, r1, #0x1a - ldr r3, _080C3BE0 @ gUnknown_08206B70 - lsrs r2, r1, #0x1e - lsls r0, r2, #2 - adds r0, r0, r2 - adds r0, r5, r0 - adds r0, r0, r3 - adds r1, r2, #0 - ldrb r0, [r0] - cmp r1, r0 - beq _080C3BD4 -_080C3BC6: - adds r1, r4, #0 - adds r1, #0x29 - movs r0, #1 - strb r0, [r1] - adds r0, r4, #0 - bl Proc_Break -_080C3BD4: - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_080C3BDC: .4byte gGMData -_080C3BE0: .4byte gUnknown_08206B70 - - THUMB_FUNC_END sub_80C3B40 - - THUMB_FUNC_START sub_80C3BE4 -sub_80C3BE4: @ 0x080C3BE4 - push {r4, r5, r6, r7, lr} - adds r7, r0, #0 - adds r6, r1, #0 - ldr r3, _080C3C14 @ gUnknown_08206B70 - adds r0, #0x2a - movs r2, #0 - ldrsb r2, [r0, r2] - ldr r0, _080C3C18 @ gGMData - ldrb r1, [r0] - lsls r1, r1, #0x1a - lsrs r1, r1, #0x1e - lsls r0, r1, #2 - adds r0, r0, r1 - adds r2, r2, r0 - adds r2, r2, r3 - ldrb r5, [r2] - cmp r5, #1 - beq _080C3C64 - cmp r5, #1 - bgt _080C3C1C - cmp r5, #0 - beq _080C3C26 - b _080C3D0C - .align 2, 0 -_080C3C14: .4byte gUnknown_08206B70 -_080C3C18: .4byte gGMData -_080C3C1C: - cmp r5, #2 - beq _080C3CA4 - cmp r5, #3 - beq _080C3CD4 - b _080C3D0C -_080C3C26: - ldr r4, _080C3C5C @ gBG0TilemapBuffer - adds r0, r4, #0 - movs r1, #8 - movs r2, #8 - movs r3, #0 - bl TileMap_FillRect - movs r0, #0x1c - subs r0, r0, r6 - lsls r0, r0, #1 - ldr r1, _080C3C60 @ gUnknown_0201B430 - adds r0, r0, r1 - adds r1, r4, #0 - adds r2, r6, #0 - movs r3, #8 - bl TileMap_CopyRect - adds r0, r6, #0 - subs r0, #8 - adds r3, r7, #0 - adds r3, #0x2f - strb r0, [r3] - adds r0, r7, #0 - adds r0, #0x30 - strb r5, [r0] - b _080C3D0C - .align 2, 0 -_080C3C5C: .4byte gBG0TilemapBuffer -_080C3C60: .4byte gUnknown_0201B430 -_080C3C64: - ldr r4, _080C3C9C @ gBG0TilemapBuffer+0x02C - adds r0, r4, #0 - movs r1, #8 - movs r2, #8 - movs r3, #0 - bl TileMap_FillRect - ldr r0, _080C3CA0 @ gUnknown_0201B458 - movs r1, #0x1e - subs r1, r1, r6 - lsls r1, r1, #1 - subs r4, #0x2c - adds r1, r1, r4 - adds r2, r6, #0 - movs r3, #8 - bl TileMap_CopyRect - movs r0, #0x1e - subs r0, r0, r6 - adds r3, r7, #0 - adds r3, #0x2f - movs r1, #0 - strb r0, [r3] - adds r0, r7, #0 - adds r0, #0x30 - strb r1, [r0] - b _080C3D0C - .align 2, 0 -_080C3C9C: .4byte gBG0TilemapBuffer+0x02C -_080C3CA0: .4byte gUnknown_0201B458 -_080C3CA4: - ldr r4, _080C3CCC @ gBG0TilemapBuffer+0x300 - adds r0, r4, #0 - movs r1, #8 - movs r2, #8 - movs r3, #0 - bl TileMap_FillRect - movs r0, #0x1c - subs r0, r0, r6 - lsls r0, r0, #1 - ldr r1, _080C3CD0 @ gUnknown_0201B430 - adds r0, r0, r1 - adds r1, r4, #0 - adds r2, r6, #0 - movs r3, #8 - bl TileMap_CopyRect - adds r0, r6, #0 - subs r0, #8 - b _080C3CFE - .align 2, 0 -_080C3CCC: .4byte gBG0TilemapBuffer+0x300 -_080C3CD0: .4byte gUnknown_0201B430 -_080C3CD4: - ldr r4, _080C3D18 @ gBG0TilemapBuffer+0x32C - adds r0, r4, #0 - movs r1, #8 - movs r2, #8 - movs r3, #0 - bl TileMap_FillRect - ldr r0, _080C3D1C @ gUnknown_0201B458 - movs r1, #0xcf - lsls r1, r1, #1 - subs r1, r1, r6 - lsls r1, r1, #1 - ldr r2, _080C3D20 @ 0xFFFFFCD4 - adds r4, r4, r2 - adds r1, r1, r4 - adds r2, r6, #0 - movs r3, #0xc - bl TileMap_CopyRect - movs r0, #0x1e - subs r0, r0, r6 -_080C3CFE: - adds r3, r7, #0 - adds r3, #0x2f - strb r0, [r3] - adds r1, r7, #0 - adds r1, #0x30 - movs r0, #0xc - strb r0, [r1] -_080C3D0C: - movs r0, #1 - bl BG_EnableSyncByMask - pop {r4, r5, r6, r7} - pop {r0} - bx r0 - .align 2, 0 -_080C3D18: .4byte gBG0TilemapBuffer+0x32C -_080C3D1C: .4byte gUnknown_0201B458 -_080C3D20: .4byte 0xFFFFFCD4 - - THUMB_FUNC_END sub_80C3BE4 - - THUMB_FUNC_START sub_80C3D24 -sub_80C3D24: @ 0x080C3D24 - push {r4, lr} - adds r4, r0, #0 - ldr r1, _080C3D58 @ gUnknown_08A3EE6C - ldr r0, [r4, #0x34] - adds r0, r0, r1 - movs r1, #0 - ldrsb r1, [r0, r1] - adds r0, r4, #0 - bl sub_80C3BE4 - adds r0, r4, #0 - bl sub_80C3A64 - ldr r0, [r4, #0x34] - adds r0, #1 - str r0, [r4, #0x34] - cmp r0, #4 - bne _080C3D52 - movs r0, #0 - str r0, [r4, #0x34] - adds r0, r4, #0 - bl Proc_Break -_080C3D52: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080C3D58: .4byte gUnknown_08A3EE6C - - THUMB_FUNC_END sub_80C3D24 - - THUMB_FUNC_START sub_80C3D5C -sub_80C3D5C: @ 0x080C3D5C - push {r4, lr} - adds r4, r0, #0 - ldr r1, _080C3D98 @ gUnknown_08A3EE70 - ldr r0, [r4, #0x34] - adds r0, r0, r1 - movs r1, #0 - ldrsb r1, [r0, r1] - adds r0, r4, #0 - bl sub_80C3BE4 - adds r0, r4, #0 - bl sub_80C3A64 - ldr r0, [r4, #0x34] - adds r0, #1 - str r0, [r4, #0x34] - cmp r0, #4 - bne _080C3D90 - movs r0, #0 - str r0, [r4, #0x34] - adds r1, r4, #0 - adds r1, #0x29 - strb r0, [r1] - adds r0, r4, #0 - bl Proc_Break -_080C3D90: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080C3D98: .4byte gUnknown_08A3EE70 - - THUMB_FUNC_END sub_80C3D5C - - THUMB_FUNC_START sub_80C3D9C -sub_80C3D9C: @ 0x080C3D9C - movs r1, #0 - str r1, [r0, #0x34] - adds r2, r0, #0 - adds r2, #0x29 - strb r1, [r2] - adds r0, #0x2a - strb r1, [r0] - bx lr - - THUMB_FUNC_END sub_80C3D9C - - THUMB_FUNC_START sub_80C3DAC -sub_80C3DAC: @ 0x080C3DAC - push {r4, lr} - sub sp, #4 - adds r4, r0, #0 - ldr r2, _080C3E68 @ gLCDControlBuffer - ldrb r1, [r2, #1] - movs r0, #0x21 - negs r0, r0 - ands r0, r1 - movs r1, #0x41 - negs r1, r1 - ands r0, r1 - movs r1, #0x7f - ands r0, r1 - strb r0, [r2, #1] - adds r2, #0x36 - ldrb r0, [r2] - movs r1, #1 - orrs r0, r1 - movs r1, #2 - orrs r0, r1 - movs r1, #4 - orrs r0, r1 - movs r1, #8 - orrs r0, r1 - movs r1, #0x10 - orrs r0, r1 - movs r1, #0x20 - orrs r0, r1 - strb r0, [r2] - movs r0, #0 - movs r1, #0 - movs r2, #0 - bl BG_SetPosition - movs r0, #1 - movs r1, #0 - movs r2, #0 - bl BG_SetPosition - movs r0, #2 - movs r1, #0 - movs r2, #0 - bl BG_SetPosition - movs r0, #1 - movs r1, #0xe - movs r2, #3 - movs r3, #0 - bl SetBlendConfig - movs r0, #0 - str r0, [sp] - movs r1, #1 - movs r2, #0 - movs r3, #0 - bl SetBlendTargetA - movs r0, #1 - str r0, [sp] - movs r0, #0 - movs r1, #0 - movs r2, #1 - movs r3, #1 - bl SetBlendTargetB - movs r0, #0 - bl SetBlendBackdropA - ldr r0, _080C3E6C @ gUnknown_08AA1280 - ldr r1, _080C3E70 @ 0x06003C00 - bl Decompress - ldr r0, _080C3E74 @ gUnknown_08AA188C - movs r1, #0xe0 - movs r2, #0x20 - bl CopyToPaletteBuffer - ldr r0, _080C3E78 @ gPal_GMapPI_ShopIcons - movs r1, #0xc8 - lsls r1, r1, #2 - movs r2, #0x20 - bl CopyToPaletteBuffer - bl EnablePaletteSync - ldr r0, _080C3E7C @ ProcScr_GmapRader - ldr r1, [r4, #0x14] - bl Proc_Start - add sp, #4 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080C3E68: .4byte gLCDControlBuffer -_080C3E6C: .4byte gUnknown_08AA1280 -_080C3E70: .4byte 0x06003C00 -_080C3E74: .4byte gUnknown_08AA188C -_080C3E78: .4byte gPal_GMapPI_ShopIcons -_080C3E7C: .4byte ProcScr_GmapRader - - THUMB_FUNC_END sub_80C3DAC - - THUMB_FUNC_START sub_80C3E80 -sub_80C3E80: @ 0x080C3E80 - push {lr} - adds r1, r0, #0 - ldr r0, _080C3E90 @ gUnknown_08A3EED4 - bl Proc_Start - pop {r1} - bx r1 - .align 2, 0 -_080C3E90: .4byte gUnknown_08A3EED4 - - THUMB_FUNC_END sub_80C3E80 - - THUMB_FUNC_START sub_80C3E94 -sub_80C3E94: @ 0x080C3E94 - push {lr} - ldr r0, _080C3EB8 @ ProcScr_GmapRader - bl Proc_EndEach - ldr r0, _080C3EBC @ gUnknown_08A3EED4 - bl Proc_EndEach - bl SetDefaultColorEffects - ldr r0, _080C3EC0 @ gBG1TilemapBuffer - movs r1, #0 - bl BG_Fill - movs r0, #2 - bl BG_EnableSyncByMask - pop {r0} - bx r0 - .align 2, 0 -_080C3EB8: .4byte ProcScr_GmapRader -_080C3EBC: .4byte gUnknown_08A3EED4 -_080C3EC0: .4byte gBG1TilemapBuffer - - THUMB_FUNC_END sub_80C3E94 - - THUMB_FUNC_START nullsub_71 -nullsub_71: @ 0x080C3EC4 - bx lr - - THUMB_FUNC_END nullsub_71 - - THUMB_FUNC_START sub_80C3EC8 -sub_80C3EC8: @ 0x080C3EC8 - adds r1, r0, #0 - adds r2, r1, #0 - adds r2, #0x2a - movs r0, #0 - strb r0, [r2] - adds r2, #1 - strb r0, [r2] - subs r0, #1 - str r0, [r1, #0x2c] - bx lr - - THUMB_FUNC_END sub_80C3EC8 - - THUMB_FUNC_START sub_80C3EDC -sub_80C3EDC: @ 0x080C3EDC - push {r4, lr} - adds r4, r0, #0 - bl IsBgmPlaying - adds r1, r4, #0 - adds r1, #0x30 - strb r0, [r1] - lsls r0, r0, #0x18 - cmp r0, #0 - beq _080C3EF6 - bl GetCurrentBgmSong - str r0, [r4, #0x34] -_080C3EF6: - adds r0, r4, #0 - bl StartPrepItemScreen - pop {r4} - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80C3EDC - - THUMB_FUNC_START sub_80C3F04 -sub_80C3F04: @ 0x080C3F04 - push {lr} - adds r1, r0, #0 - adds r0, #0x30 - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #0 - beq _080C3F1E - ldr r0, [r1, #0x34] - movs r1, #1 - movs r2, #0 - bl StartBgmFadeIn -_080C3F1E: - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80C3F04 - - THUMB_FUNC_START sub_80C3F24 -sub_80C3F24: @ 0x080C3F24 - push {lr} - adds r1, r0, #0 - adds r0, #0x29 - ldrb r0, [r0] - cmp r0, #1 - beq _080C3F50 - cmp r0, #1 - bgt _080C3F3A - cmp r0, #0 - beq _080C3F40 - b _080C3F7A -_080C3F3A: - cmp r0, #2 - beq _080C3F60 - b _080C3F7A -_080C3F40: - ldr r0, [r1, #0x2c] - cmp r0, #0 - beq _080C3F70 - adds r0, r1, #0 - movs r1, #1 - bl Proc_Goto - b _080C3F82 -_080C3F50: - ldr r0, [r1, #0x2c] - cmp r0, #0 - beq _080C3F70 - adds r0, r1, #0 - movs r1, #2 - bl Proc_Goto - b _080C3F82 -_080C3F60: - ldr r0, [r1, #0x2c] - cmp r0, #0 - beq _080C3F70 - adds r0, r1, #0 - movs r1, #3 - bl Proc_Goto - b _080C3F82 -_080C3F70: - adds r0, r1, #0 - movs r1, #5 - bl Proc_Goto - b _080C3F82 -_080C3F7A: - adds r0, r1, #0 - movs r1, #5 - bl Proc_Goto -_080C3F82: - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80C3F24 - - THUMB_FUNC_START sub_80C3F88 -sub_80C3F88: @ 0x080C3F88 - push {r4, lr} - adds r4, r0, #0 - ldr r0, [r4, #0x2c] - bl GetUnitFromCharId - ldr r1, _080C3FAC @ gGMData - ldrb r1, [r1, #0x11] - lsls r1, r1, #5 - ldr r2, _080C3FB0 @ gWMNodeData - adds r1, r1, r2 - ldr r1, [r1, #0xc] - adds r2, r4, #0 - bl StartArmoryScreen - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080C3FAC: .4byte gGMData -_080C3FB0: .4byte gWMNodeData - - THUMB_FUNC_END sub_80C3F88 - - THUMB_FUNC_START sub_80C3FB4 -sub_80C3FB4: @ 0x080C3FB4 - push {r4, lr} - adds r4, r0, #0 - ldr r0, [r4, #0x2c] - bl GetUnitFromCharId - ldr r1, _080C3FD8 @ gGMData - ldrb r1, [r1, #0x11] - lsls r1, r1, #5 - ldr r2, _080C3FDC @ gWMNodeData - adds r1, r1, r2 - ldr r1, [r1, #0x10] - adds r2, r4, #0 - bl StartVendorScreen - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080C3FD8: .4byte gGMData -_080C3FDC: .4byte gWMNodeData - - THUMB_FUNC_END sub_80C3FB4 - - THUMB_FUNC_START sub_80C3FE0 -sub_80C3FE0: @ 0x080C3FE0 - push {r4, lr} - adds r4, r0, #0 - ldr r0, [r4, #0x2c] - bl GetUnitFromCharId - ldr r1, _080C4004 @ gGMData - ldrb r1, [r1, #0x11] - lsls r1, r1, #5 - ldr r2, _080C4008 @ gWMNodeData - adds r1, r1, r2 - ldr r1, [r1, #0x14] - adds r2, r4, #0 - bl StartSecretShopScreen - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080C4004: .4byte gGMData -_080C4008: .4byte gWMNodeData - - THUMB_FUNC_END sub_80C3FE0 - - THUMB_FUNC_START sub_80C400C -sub_80C400C: @ 0x080C400C - push {r4, lr} - adds r4, r0, #0 - cmp r1, #0 - beq _080C4020 - ldr r0, _080C401C @ ProcScr_GmapBaseMenu - bl Proc_StartBlocking - b _080C4028 - .align 2, 0 -_080C401C: .4byte ProcScr_GmapBaseMenu -_080C4020: - ldr r0, _080C4034 @ ProcScr_GmapBaseMenu - movs r1, #3 - bl Proc_Start -_080C4028: - adds r1, r0, #0 - adds r1, #0x29 - strb r4, [r1] - pop {r4} - pop {r1} - bx r1 - .align 2, 0 -_080C4034: .4byte ProcScr_GmapBaseMenu - - THUMB_FUNC_END sub_80C400C - - THUMB_FUNC_START sub_80C4038 -sub_80C4038: @ 0x080C4038 - push {lr} - ldr r0, _080C4044 @ ProcScr_GmapBaseMenu - bl Proc_EndEach - pop {r0} - bx r0 - .align 2, 0 -_080C4044: .4byte ProcScr_GmapBaseMenu - - THUMB_FUNC_END sub_80C4038 - - THUMB_FUNC_START sub_80C4048 -sub_80C4048: @ 0x080C4048 - push {lr} - ldr r0, _080C4054 @ ProcScr_GmapBaseMenu - bl Proc_Find - pop {r1} - bx r1 - .align 2, 0 -_080C4054: .4byte ProcScr_GmapBaseMenu - - THUMB_FUNC_END sub_80C4048 - - THUMB_FUNC_START sub_80C4058 -sub_80C4058: @ 0x080C4058 - push {lr} - ldr r0, _080C406C @ ProcScr_GmapBaseMenu - bl Proc_Find - cmp r0, #0 - beq _080C4066 - movs r0, #1 -_080C4066: - pop {r1} - bx r1 - .align 2, 0 -_080C406C: .4byte ProcScr_GmapBaseMenu - - THUMB_FUNC_END sub_80C4058 - - THUMB_FUNC_START sub_80C4070 -sub_80C4070: @ 0x080C4070 - push {lr} - bl sub_80C4048 - cmp r0, #0 - bne _080C407E - movs r0, #0 - b _080C4082 -_080C407E: - adds r0, #0x29 - ldrb r0, [r0] -_080C4082: - pop {r1} - bx r1 - - THUMB_FUNC_END sub_80C4070 - - THUMB_FUNC_START sub_80C4088 -sub_80C4088: @ 0x080C4088 - push {lr} - bl sub_80C4048 - cmp r0, #0 - bne _080C4096 - movs r0, #0 - b _080C4098 -_080C4096: - ldr r0, [r0, #0x2c] -_080C4098: - pop {r1} - bx r1 - - THUMB_FUNC_END sub_80C4088 - - THUMB_FUNC_START sub_80C409C -sub_80C409C: @ 0x080C409C - push {r4, lr} - adds r4, r0, #0 - bl sub_80C4048 - cmp r0, #0 - beq _080C40AA - str r4, [r0, #0x2c] -_080C40AA: - pop {r4} - pop {r0} - bx r0 - - THUMB_FUNC_END sub_80C409C - -.align 2, 0 diff --git a/data/const_data_20688C.s b/data/const_data_20688C.s deleted file mode 100644 index 41049352..00000000 --- a/data/const_data_20688C.s +++ /dev/null @@ -1,18 +0,0 @@ - - .section .rodata - - .global gUnknown_08206B70 -gUnknown_08206B70: @ 0x08206B70 -@ Replacing .incbin "baserom.gba", 0x206B70, 0x2B4 - .4byte 0x00000003 - .4byte 0x01030100 - .4byte 0x02020101 - .4byte 0x03020203 - .4byte 0x03020303 - .4byte 0x70616d47 - .4byte 0x64615220 - .4byte 0x00007265 - .4byte 0x70616d47 - .4byte 0x73614220 - .4byte 0x654d2065 - .4byte 0x0000756e diff --git a/data/data_A3E4D4.s b/data/data_A3E4D4.s index 824b5363..740b7f0e 100644 --- a/data/data_A3E4D4.s +++ b/data/data_A3E4D4.s @@ -1,167 +1,6 @@ .section .data - .global gUnknown_08A3EE28 -gUnknown_08A3EE28: @ 0x08A3EE28 - .incbin "baserom.gba", 0xA3EE28, 0x1C - - .global gUnknown_08A3EE44 -gUnknown_08A3EE44: @ 0x08A3EE44 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C35C4 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C35EC - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - - - .global gUnknown_08A3EE6C -gUnknown_08A3EE6C: @ 0x08A3EE6C - .incbin "baserom.gba", 0x00a3ee6c, 0x4 - - .global gUnknown_08A3EE70 -gUnknown_08A3EE70: @ 0x08A3EE70 - .incbin "baserom.gba", 0xA3EE70, 0x4 - - .global ProcScr_GmapRader -ProcScr_GmapRader: @ 0x08A3EE74 - @ PROC_NAME - .short 0x1, 0x0 - .word 0x8206b84 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_15 - .short 0x15, 0x0 - .word 0x0 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3D9C - @ PROC_LABEL - .short 0xb, 0x0 - .word 0x0 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3AB8 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3D24 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3B40 - @ PROC_REPEAT - .short 0x3, 0x0 - .word sub_80C3D5C - @ PROC_GOTO - .short 0xc, 0x0 - .word 0x0 - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - - - .global gUnknown_08A3EED4 -gUnknown_08A3EED4: @ 0x08A3EED4 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3DAC - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - - - .global ProcScr_GmapBaseMenu -ProcScr_GmapBaseMenu: @ 0x08A3EEEC - @ PROC_NAME - .short 0x1, 0x0 - .word 0x8206b90 - @ PROC_MARK - .short 0xf, 0x8 - .word 0x0 - @ PROC_SET_END_CB - .short 0x4, 0x0 - .word nullsub_71 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3EC8 - @ PROC_LABEL - .short 0xb, 0x0 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3EDC - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3F24 - @ PROC_LABEL - .short 0xb, 0x1 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3F88 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_GOTO - .short 0xc, 0x4 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x2 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3FB4 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_GOTO - .short 0xc, 0x4 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x3 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3FE0 - @ PROC_YIELD - .short 0xe, 0x0 - .word 0x0 - @ PROC_GOTO - .short 0xc, 0x4 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x4 - .word 0x0 - @ PROC_CALL - .short 0x2, 0x0 - .word sub_80C3F04 - @ PROC_GOTO - .short 0xc, 0x0 - .word 0x0 - @ PROC_LABEL - .short 0xb, 0x5 - .word 0x0 - @ PROC_END - .short 0x0, 0x0 - .word 0x0 - .incbin "baserom.gba", 0xA3EEEC + 0xC8, 0x824 - 0xC8 + .incbin "baserom.gba", 0xA3EFB4, 0x75C .global gPal_CharacterEndingMenu gPal_CharacterEndingMenu: @ 0x08A3F710 @@ -1295,12 +1134,12 @@ Pal_WmPlaceDot_Standard: @ 0x08AA11B0 gUnknown_08AA11D0: @ 0x08AA11D0 .incbin "baserom.gba", 0xAA11D0, 0xB0 - .global gUnknown_08AA1280 -gUnknown_08AA1280: @ 0x08AA1280 + .global Img_WorldmapMinimap +Img_WorldmapMinimap: @ 0x08AA1280 .incbin "baserom.gba", 0xAA1280, 0x60C - .global gUnknown_08AA188C -gUnknown_08AA188C: @ 0x08AA188C + .global Pal_WorldmapMinimap +Pal_WorldmapMinimap: @ 0x08AA188C .incbin "baserom.gba", 0xAA188C, 0x20 .global gUnknown_08AA18AC diff --git a/include/prepscreen.h b/include/prepscreen.h index e9e4b895..d7a0ffff 100644 --- a/include/prepscreen.h +++ b/include/prepscreen.h @@ -124,16 +124,6 @@ struct PrepItemSupplyProc { /* 4C */ u16 yOffsetPerPage[9]; }; -// TODO: Move to a common "worldmap.h" -struct GMapBaseMenuProc { - /* 00 */ PROC_HEADER; - /* 29 */ u8 unk_29; - /* 2A */ u8 unk_2a; - /* 2B */ u8 unk_2b; -}; - -struct GMapBaseMenuProc* sub_80C4048(void); - struct PrepItemListProc { /* 00 */ PROC_HEADER; /* 2C */ struct Unit * unit; diff --git a/include/soundwrapper.h b/include/soundwrapper.h index dfd95875..3ebd2761 100644 --- a/include/soundwrapper.h +++ b/include/soundwrapper.h @@ -16,7 +16,7 @@ struct SoundSt { extern struct SoundSt gSoundSt; int GetCurrentBgmSong(void); -// ??? IsBgmPlaying(???); +s8 IsBgmPlaying(void); void Sound_SetBGMVolume(int volume); void Sound_SetSEVolume(int vol); void Sound_FadeOutBGM(int speed); diff --git a/include/variables.h b/include/variables.h index 90db7610..dba67ab0 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1284,9 +1284,9 @@ extern u8 Img_WorldMapPlaceDot[]; extern u16 Pal_WmPlaceDot_Highlight[]; extern u16 Pal_WmPlaceDot_Standard[]; extern u8 gUnknown_08AA11D0[]; // tsa? -// extern ??? gUnknown_08AA1280 -// extern ??? gUnknown_08AA188C -// extern ??? gUnknown_08AA18AC +extern u8 Img_WorldmapMinimap[]; +extern u16 Pal_WorldmapMinimap[]; +extern u8 gUnknown_08AA18AC[]; // extern ??? gUnknown_08AA1930 // extern ??? gUnknown_08AA1950 extern u8 gImg_WorldmapSkirmish[]; // gfx diff --git a/include/worldmap.h b/include/worldmap.h index 31e04f79..17bf4037 100644 --- a/include/worldmap.h +++ b/include/worldmap.h @@ -607,9 +607,9 @@ void Worlmap_WaitGmapSogu(ProcPtr proc); // ??? sub_80B9E64(???); void ResetWorldMapScreen(void); void NULL_080B9F08(void); -void sub_80B9F14(ProcPtr proc); -void sub_80B9F24(ProcPtr proc); -void sub_80B9F34(ProcPtr proc); +void WorldMap_StartArmory(ProcPtr proc); +void WorldMap_StartVendor(ProcPtr proc); +void WorldMap_StartSecretShop(ProcPtr proc); void sub_80B9F44(ProcPtr proc); void sub_80B9F54(ProcPtr unused); void sub_80B9FC0(void); @@ -1189,45 +1189,79 @@ ProcPtr StartGmapAutoMu_Type1(struct Sub80C33D4 *, int, ProcPtr); void EndGmAutoMuFor(int); bool IsGmAutoMuActiveFor(int); +/* worldmap_text.h */ + // ??? sub_80C34D0(???); -// ??? sub_80C3590(???); -// ??? sub_80C35C4(???); -// ??? sub_80C35EC(???); -void StartWmText(int); -void RemoveWmText(void); -void sub_80C368C(ProcPtr); -void sub_80C36A0(int); -// ??? sub_80C36E8(???); -// ??? sub_80C3770(???); -// ??? sub_80C380C(???); -// ??? sub_80C38BC(???); -// ??? sub_80C3A28(???); -// ??? sub_80C3A64(???); -// ??? sub_80C3A8C(???); -// ??? sub_80C3AB8(???); -// ??? sub_80C3B40(???); -// ??? sub_80C3BE4(???); -// ??? sub_80C3D24(???); -// ??? sub_80C3D5C(???); -// ??? sub_80C3D9C(???); -// ??? sub_80C3DAC(???); -void sub_80C3E80(void); -void sub_80C3E94(void); -// ??? nullsub_71(???); -// ??? sub_80C3EC8(???); -// ??? sub_80C3EDC(???); -// ??? sub_80C3F04(???); -// ??? sub_80C3F24(???); -// ??? sub_80C3F88(???); -// ??? sub_80C3FB4(???); -// ??? sub_80C3FE0(???); -void sub_80C400C(int, ProcPtr); -// ??? sub_80C4038(???); -// ??? sub_80C4048(???); -// ??? sub_80C4058(???); -int sub_80C4070(void); -int sub_80C4088(); -void sub_80C409C(int); +// ??? ClearWmTextVram(???); +// ??? WmText_Init(???); +// ??? WmText_Loop_DrawText(???); +void ShowWmText(u8); +void HideWmText(void); +ProcPtr StartWmTextHandler(ProcPtr); +void StartWmTextMsg(int); + +/* worldmap_radar.h */ + +struct GMapRadarProc +{ + /* 00 */ PROC_HEADER; + /* 29 */ s8 unk_29; + /* 2A */ s8 unk_2a; + /* 2B */ u8 unk_2b; + /* 2C */ u8 unk_2c; + /* 2D */ u8 unk_2d; + /* 2E */ u8 unk_2e; + /* 2F */ s8 unk_2f; + /* 30 */ s8 unk_30; + /* 34 */ int unk_34; +}; + +// ??? WmMinimap_PutCursorIcon(???); +// ??? WmMinimap_PutStoryNodeIcon(???); +// ??? WmMinimap_PutLordIcon(???); +// ??? WmMinimap_PutSkirmishIcons(???); +// ??? WmMinimap_BlinkPalette(???); +// ??? PutWmMinimapSprites(???); +// ??? GMapRadar_80C3A8C(???); +// ??? GMapRadar_80C3AB8(???); +// ??? GMapRadar_80C3B40(???); +// ??? PutWmMinimapGfx(???); +// ??? GMapRadar_SlideIn(???); +// ??? GMapRadar_SlideOut(???); +// ??? GMapRadar_Init(???); +// ??? StartWorldMapMinimapCore(???); +ProcPtr StartWorldmapMinimap(ProcPtr); +void EndWorldmapMinimap(void); + +/* worldmap_basemenu.h */ + +struct GMapBaseMenuProc +{ + /* 00 */ PROC_HEADER; + /* 29 */ u8 kind; + /* 2A */ u8 unk_2a; + /* 2B */ u8 unk_2b; + /* 2C */ int pid; + /* 30 */ s8 wasBgmPlaying; + STRUCT_PAD(0x31, 0x34); + /* 34 */ int bgmSongId; +}; + +// ??? GMapBaseMenu_OnEnd_Null(???); +// ??? GMapBaseMenu_Init(???); +// ??? GMapBaseMenu_StartItemScreen(???); +// ??? GMapBaseMenu_RestoreBgm(???); +// ??? GMapBaseMenu_ShopFromItemScreen(???); +// ??? GMapBaseMenu_StartArmory(???); +// ??? GMapBaseMenu_StartVendor(???); +// ??? GMapBaseMenu_StartSecretShop(???); +ProcPtr StartGMapBaseMenu(int, ProcPtr); +// ??? EndGMapBaseMenu(???); +struct GMapBaseMenuProc * FindGMapBaseMenu(void); +// ??? IsGMapBaseMenuActive(???); +int GetGMapBaseMenuKind(void); +int GetGMapBaseMenuPid(); +void SetGMapBaseMenuPid(int); // extern ??? gFont_0201AFC0 // extern ??? gUnknown_0201AFF0 @@ -1315,12 +1349,12 @@ extern struct ProcCmd ProcScr_WmDotPalAnim[]; // extern ??? Sprite_WmPlaceDot // extern ??? ProcScr_WmPlaceDot // extern ??? ProcScr_GmapAutoMu -// extern ??? gUnknown_08A3EE28 -// extern ??? gUnknown_08A3EE44 +// extern ??? Sprite_WmText +// extern ??? ProcScr_WorldMapTextHandler // extern ??? gUnknown_08A3EE6C // extern ??? gUnknown_08A3EE70 // extern ??? ProcScr_GmapRader -// extern ??? gUnknown_08A3EED4 +// extern ??? ProcScr_WorldmapMinimapWrapper // extern ??? ProcScr_GmapBaseMenu #endif // GUARD_WORLDMAP_H diff --git a/ldscript.txt b/ldscript.txt index f1ef4c00..5514615a 100644 --- a/ldscript.txt +++ b/ldscript.txt @@ -585,7 +585,9 @@ SECTIONS src/worldmap_hb.o(.text); src/worldmap_rm.o(.text); src/worldmap_automu.o(.text); - asm/code_80BF13C.o(.text); + src/worldmap_text.o(.text); + src/worldmap_radar.o(.text); + src/worldmap_basemenu.o(.text); src/ending_credits.o(.text); src/opsubtitle.o(.text); src/titlescreen.o(.text); @@ -843,7 +845,8 @@ SECTIONS . = ALIGN(4); src/worldmap_timemons.o(.rodata); . = ALIGN(4); src/worldmap_rm.o(.rodata); . = ALIGN(4); src/worldmap_automu.o(.rodata); - . = ALIGN(4); data/const_data_20688C.o(.rodata); + . = ALIGN(4); src/worldmap_radar.o(.rodata); + . = ALIGN(4); src/worldmap_basemenu.o(.rodata); . = ALIGN(4); src/ending_credits.o(.rodata); . = ALIGN(4); src/opsubtitle.o(.rodata); . = ALIGN(4); src/classchg-main.o(.rodata); @@ -1175,6 +1178,9 @@ SECTIONS . = ALIGN(4); src/worldmap_timemons.o(.data); . = ALIGN(4); src/worldmap_rm.o(.data); . = ALIGN(4); src/worldmap_automu.o(.data); + . = ALIGN(4); src/worldmap_text.o(.data); + . = ALIGN(4); src/worldmap_radar.o(.data); + . = ALIGN(4); src/worldmap_basemenu.o(.data); . = ALIGN(4); data/data_A3E4D4.o(.data); . = ALIGN(4); src/ending_credits.o(.data); . = ALIGN(4); src/opsubtitle.o(.data); diff --git a/src/eventscr_gmap.c b/src/eventscr_gmap.c index 641812f7..ca0420d5 100644 --- a/src/eventscr_gmap.c +++ b/src/eventscr_gmap.c @@ -1265,7 +1265,7 @@ u8 EventC6_WmDisplayText(struct EventEngineProc * proc) a = EVT_CMD_ARGV(proc->pEventCurrent)[1]; b = EVT_CMD_ARGV(proc->pEventCurrent)[2]; - sub_80C36A0(a | b); + StartWmTextMsg(a | b); if (proc->evStateBits & EV_STATE_0020) { @@ -1283,7 +1283,7 @@ u8 EventC7_(struct EventEngineProc * proc) return EVC_ADVANCE_CONTINUE; } - StartWmText(1); + ShowWmText(1); return EVC_ADVANCE_YIELD; } @@ -1296,7 +1296,7 @@ u8 EventC8_(struct EventEngineProc * proc) return EVC_ADVANCE_CONTINUE; } - StartWmText(0); + ShowWmText(0); return EVC_ADVANCE_YIELD; } @@ -1306,11 +1306,11 @@ u8 EventC9_RemoveWmText(struct EventEngineProc * proc) { if (EVENT_IS_SKIPPING(proc)) { - RemoveWmText(); + HideWmText(); return EVC_ADVANCE_CONTINUE; } - RemoveWmText(); + HideWmText(); return EVC_ADVANCE_YIELD; } diff --git a/src/prep_itemlist.c b/src/prep_itemlist.c index 2426e4ef..ad78d3e6 100644 --- a/src/prep_itemlist.c +++ b/src/prep_itemlist.c @@ -27,7 +27,7 @@ void PrepItemList_Init(struct PrepItemListProc * proc) proc->unk_34 = 0xff; if (gGMData.state.bits.state_0) { - struct GMapBaseMenuProc* pGMapBaseMenuProc = sub_80C4048(); + struct GMapBaseMenuProc* pGMapBaseMenuProc = FindGMapBaseMenu(); if (pGMapBaseMenuProc) { proc->currentPage = pGMapBaseMenuProc->unk_2a; @@ -239,7 +239,7 @@ void PrepItemList_InitGfx(struct PrepItemListProc * proc) void PrepItemList_OnEnd(struct PrepItemListProc * proc) { if (gGMData.state.bits.state_0) { - struct GMapBaseMenuProc* pGMapBaseMenuProc = sub_80C4048(); + struct GMapBaseMenuProc* pGMapBaseMenuProc = FindGMapBaseMenu(); if (pGMapBaseMenuProc) { pGMapBaseMenuProc->unk_2a = proc->currentPage; } diff --git a/src/prep_itemscreen.c b/src/prep_itemscreen.c index b6ae8cf5..d98f07a9 100644 --- a/src/prep_itemscreen.c +++ b/src/prep_itemscreen.c @@ -436,7 +436,7 @@ void sub_8098A74(u16* tm) { ClearText(&gPrepItemScreenTexts[11]); ClearText(&gPrepItemScreenTexts[12]); - switch (sub_80C4070()) { + switch (GetGMapBaseMenuKind()) { case 0: textId = 0x0672; // TODO: msgid "Enter Armory" break; @@ -468,7 +468,7 @@ void sub_8098B48(void) { //! FE8U = 0x08098B68 void sub_8098B68(void) { - switch (sub_80C4070()) { + switch (GetGMapBaseMenuKind()) { case 3: PrepItemDrawPopupBox(136, 81, 9, 6, OAM2_CHR(0x40) + OAM2_LAYER(1) + OAM2_PAL(10)); break; @@ -716,7 +716,7 @@ void sub_8099120(struct PrepItemScreenProc* proc) { if (gKeyStatusPtr->newKeys & A_BUTTON) { if (gGMData.state.bits.state_0) { - switch (sub_80C4070()) { + switch (GetGMapBaseMenuKind()) { case 3: proc->selectedUnitIdx = proc->hoverUnitIdx; @@ -1279,7 +1279,7 @@ void sub_8099E68(struct PrepItemScreenProc * proc) return; } - sub_80C409C(0); + SetGMapBaseMenuPid(0); return; } @@ -1614,7 +1614,7 @@ void sub_809A114(struct PrepItemScreenProc* proc, u8 unk, s8 flag) { idx = ((unk) * 3); th = &gPrepItemTexts[idx % 0xf]; - if (gGMData.state.bits.state_0 && sub_80C4070() == 2) { + if (gGMData.state.bits.state_0 && GetGMapBaseMenuKind() == 2) { isWorldMapMaybe = 1; } else { isWorldMapMaybe = 0; @@ -1703,7 +1703,7 @@ void sub_809A274(struct PrepItemScreenProc* proc) { continue; } - if (((gGMData.state.bits.state_0)) && (sub_80C4070() == 2)) { + if (((gGMData.state.bits.state_0)) && (GetGMapBaseMenuKind() == 2)) { sub_809A230(GetUnitFromPrepList(i), (x + 24) & 0xffff, (y + 4) & 0xff); } else { PutUnitSprite(0, (x + 24), (y + 4) & 0xff, GetUnitFromPrepList(i)); diff --git a/src/prep_itemsupply.c b/src/prep_itemsupply.c index fa41c62f..7f8e43f8 100644 --- a/src/prep_itemsupply.c +++ b/src/prep_itemsupply.c @@ -182,7 +182,7 @@ void PrepItemSupply_Init(struct PrepItemSupplyProc * proc) } if (gGMData.state.bits.state_0) { - struct GMapBaseMenuProc* pGMapBaseMenuProc = sub_80C4048(); + struct GMapBaseMenuProc* pGMapBaseMenuProc = FindGMapBaseMenu(); if (pGMapBaseMenuProc) { proc->currentPage = pGMapBaseMenuProc->unk_2b; } else { @@ -1093,7 +1093,7 @@ void PrepItemSupply_Loop_UnitInvKeyHandler(struct PrepItemSupplyProc * proc) void PrepItemSupply_OnEnd(struct PrepItemSupplyProc * proc) { if (gGMData.state.bits.state_0) { - struct GMapBaseMenuProc* pGMapBaseMenuProc = sub_80C4048(); + struct GMapBaseMenuProc* pGMapBaseMenuProc = FindGMapBaseMenu(); if (pGMapBaseMenuProc) { pGMapBaseMenuProc->unk_2b = proc->currentPage; } diff --git a/src/prepscreen.c b/src/prepscreen.c index c83a275e..b764ce85 100644 --- a/src/prepscreen.c +++ b/src/prepscreen.c @@ -292,13 +292,13 @@ int PrepGetLatestCharId() if (0 == (gGMData.state.bits.state_0)) return gPrepUnitList.latest_pid; else - return sub_80C4088(); + return GetGMapBaseMenuPid(); } void PrepSetLatestCharId(int val) { if (gGMData.state.bits.state_0) - sub_80C409C(val); + SetGMapBaseMenuPid(val); else gPrepUnitList.latest_pid = val; } diff --git a/src/worldmap_basemenu.c b/src/worldmap_basemenu.c new file mode 100644 index 00000000..92ee714d --- /dev/null +++ b/src/worldmap_basemenu.c @@ -0,0 +1,240 @@ +#include "global.h" + +#include "soundwrapper.h" +#include "prepscreen.h" +#include "bmshop.h" + +#include "worldmap.h" + +//! FE8U = 0x080C3EC4 +void GMapBaseMenu_OnEnd_Null(void) +{ + return; +} + +//! FE8U = 0x080C3EC8 +void GMapBaseMenu_Init(struct GMapBaseMenuProc * proc) +{ + proc->unk_2a = 0; + proc->unk_2b = 0; + proc->pid = -1; + return; +} + +//! FE8U = 0x080C3EDC +void GMapBaseMenu_StartItemScreen(struct GMapBaseMenuProc * proc) +{ + proc->wasBgmPlaying = IsBgmPlaying(); + + if (proc->wasBgmPlaying != 0) + { + proc->bgmSongId = GetCurrentBgmSong(); + } + + StartPrepItemScreen(proc); + + return; +} + +//! FE8U = 0x080C3F04 +void GMapBaseMenu_RestoreBgm(struct GMapBaseMenuProc * proc) +{ + if (proc->wasBgmPlaying != 0) + { + StartBgmFadeIn(proc->bgmSongId, 1, 0); + } + + return; +} + +//! FE8U = 0x080C3F24 +void GMapBaseMenu_ShopFromItemScreen(struct GMapBaseMenuProc * proc) +{ + switch (proc->kind) + { + case SHOP_TYPE_ARMORY: + if (proc->pid != 0) + { + Proc_Goto(proc, 1); + return; + } + + Proc_Goto(proc, 5); + + break; + + case SHOP_TYPE_VENDOR: + if (proc->pid != 0) + { + Proc_Goto(proc, 2); + return; + } + + Proc_Goto(proc, 5); + + break; + + case SHOP_TYPE_SECRET_SHOP: + if (proc->pid != 0) + { + Proc_Goto(proc, 3); + return; + } + + Proc_Goto(proc, 5); + + break; + + default: + Proc_Goto(proc, 5); + return; + } + + return; +} + +//! FE8U = 0x080C3F88 +void GMapBaseMenu_StartArmory(struct GMapBaseMenuProc * proc) +{ + StartArmoryScreen(GetUnitFromCharId(proc->pid), gGMData.units[0].location[gWMNodeData].armory, proc); + return; +} + +//! FE8U = 0x080C3FB4 +void GMapBaseMenu_StartVendor(struct GMapBaseMenuProc * proc) +{ + StartVendorScreen(GetUnitFromCharId(proc->pid), gGMData.units[0].location[gWMNodeData].vendor, proc); + return; +} + +//! FE8U = 0x080C3FE0 +void GMapBaseMenu_StartSecretShop(struct GMapBaseMenuProc * proc) +{ + StartSecretShopScreen(GetUnitFromCharId(proc->pid), gGMData.units[0].location[gWMNodeData].secretShop, proc); + return; +} + +// clang-format off + +struct ProcCmd CONST_DATA ProcScr_GmapBaseMenu[] = +{ + PROC_NAME("Gmap Base Menu"), + PROC_MARK(PROC_MARK_8), + + PROC_SET_END_CB(GMapBaseMenu_OnEnd_Null), + + PROC_CALL(GMapBaseMenu_Init), + +PROC_LABEL(0), + PROC_CALL(GMapBaseMenu_StartItemScreen), + PROC_YIELD, + + PROC_CALL(GMapBaseMenu_ShopFromItemScreen), + + // fallthrough + +PROC_LABEL(1), + PROC_CALL(GMapBaseMenu_StartArmory), + PROC_YIELD, + + PROC_GOTO(4), + +PROC_LABEL(2), + PROC_CALL(GMapBaseMenu_StartVendor), + PROC_YIELD, + + PROC_GOTO(4), + +PROC_LABEL(3), + PROC_CALL(GMapBaseMenu_StartSecretShop), + PROC_YIELD, + + PROC_GOTO(4), + +PROC_LABEL(4), + PROC_CALL(GMapBaseMenu_RestoreBgm), + + PROC_GOTO(0), + +PROC_LABEL(5), + PROC_END, +}; + +// clang-format on + +//! FE8U = 0x080C400C +ProcPtr StartGMapBaseMenu(int kind, ProcPtr parent) +{ + struct GMapBaseMenuProc * proc; + + if (parent != NULL) + { + proc = Proc_StartBlocking(ProcScr_GmapBaseMenu, parent); + } + else + { + proc = Proc_Start(ProcScr_GmapBaseMenu, PROC_TREE_3); + } + + proc->kind = kind; + + // return; BUG +} + +//! FE8U = 0x080C4038 +void EndGMapBaseMenu(void) +{ + Proc_EndEach(ProcScr_GmapBaseMenu); + return; +} + +//! FE8U = 0x080C4048 +struct GMapBaseMenuProc * FindGMapBaseMenu(void) +{ + return Proc_Find(ProcScr_GmapBaseMenu); +} + +//! FE8U = 0x080C4058 +bool IsGMapBaseMenuActive(void) +{ + return Proc_Find(ProcScr_GmapBaseMenu) ? true : false; +} + +//! FE8U = 0x080C4070 +int GetGMapBaseMenuKind(void) +{ + struct GMapBaseMenuProc * proc = FindGMapBaseMenu(); + + if (proc != NULL) + { + return proc->kind; + } + + return 0; +} + +//! FE8U = 0x080C4088 +int GetGMapBaseMenuPid(void) +{ + struct GMapBaseMenuProc * proc = FindGMapBaseMenu(); + + if (proc != NULL) + { + return proc->pid; + } + + return 0; +} + +//! FE8U = 0x080C409C +void SetGMapBaseMenuPid(int pid) +{ + struct GMapBaseMenuProc * proc = FindGMapBaseMenu(); + + if (proc != NULL) + { + proc->pid = pid; + } + + return; +} diff --git a/src/worldmap_main.c b/src/worldmap_main.c index 249d8f96..cfa460ad 100644 --- a/src/worldmap_main.c +++ b/src/worldmap_main.c @@ -19,6 +19,8 @@ #include "savemenu.h" #include "sysutil.h" #include "unitlistscreen.h" +#include "bmshop.h" + #include "worldmap.h" // TODO: In "worldmap_scrollmanage.c", the signature returns a ProcPtr instead of s8/bool @@ -79,7 +81,7 @@ void WorldMap_Destruct(struct WorldMapMainProc * proc) SetBlendConfig(3, 0, 0, 0x10); sub_80BF15C(); - sub_80C3E94(); + EndWorldmapMinimap(); gGMData.state.bits.state_6 = 0; gGMData.state.bits.state_7 = 0; @@ -530,7 +532,7 @@ void sub_80B9154(struct WorldMapMainProc * proc) proc->unk_54 = StartGmMu(proc); RefreshGmNodeLinks(&gGMData); - sub_80C368C(proc); + StartWmTextHandler(proc); sub_80B8FEC(proc); sub_80B90CC(proc); @@ -831,7 +833,7 @@ PROC_LABEL(3), PROC_CALL(sub_80B9A34), PROC_WHILE(FadeInExists), PROC_CALL(sub_80BF13C), - PROC_CALL(sub_80C3E80), + PROC_CALL(StartWorldmapMinimap), PROC_SLEEP(1), // fallthrough @@ -844,7 +846,7 @@ PROC_LABEL(4), PROC_LABEL(5), PROC_CALL(sub_80BF15C), - PROC_CALL(sub_80C3E94), + PROC_CALL(EndWorldmapMinimap), PROC_SLEEP(1), PROC_CALL(StartWMGeneralMenu), @@ -852,7 +854,7 @@ PROC_LABEL(5), PROC_LABEL(6), PROC_CALL(sub_80BF15C), - PROC_CALL(sub_80C3E94), + PROC_CALL(EndWorldmapMinimap), PROC_SLEEP(1), PROC_CALL(sub_80B8A7C), PROC_REPEAT(sub_80B8B3C), @@ -935,7 +937,7 @@ PROC_LABEL(13), PROC_LABEL(14), PROC_CALL(sub_80BF15C), - PROC_CALL(sub_80C3E94), + PROC_CALL(EndWorldmapMinimap), // fallthrough @@ -948,7 +950,7 @@ PROC_LABEL(15), PROC_LABEL(16), PROC_CALL(sub_80BF15C), - PROC_CALL(sub_80C3E94), + PROC_CALL(EndWorldmapMinimap), PROC_SLEEP(30), PROC_CALL(sub_80B9A58), PROC_REPEAT(Worldmap_WaitForSkirmishAnim), @@ -969,7 +971,7 @@ PROC_LABEL(17), PROC_LABEL(18), PROC_CALL(sub_80BF15C), - PROC_CALL(sub_80C3E94), + PROC_CALL(EndWorldmapMinimap), PROC_SLEEP(1), PROC_CALL(StartWMNodeMenu), PROC_SLEEP(6), @@ -980,7 +982,7 @@ PROC_LABEL(19), PROC_CALL_ARG(NewFadeOut, 16), PROC_WHILE(FadeOutExists), PROC_CALL(sub_80B9810), - PROC_CALL(sub_80B9F14), + PROC_CALL(WorldMap_StartArmory), PROC_YIELD, PROC_CALL(sub_80B9154), @@ -990,7 +992,7 @@ PROC_LABEL(20), PROC_CALL_ARG(NewFadeOut, 16), PROC_WHILE(FadeOutExists), PROC_CALL(sub_80B9810), - PROC_CALL(sub_80B9F24), + PROC_CALL(WorldMap_StartVendor), PROC_YIELD, PROC_CALL(sub_80B9154), @@ -1000,7 +1002,7 @@ PROC_LABEL(21), PROC_CALL_ARG(NewFadeOut, 16), PROC_WHILE(FadeOutExists), PROC_CALL(sub_80B9810), - PROC_CALL(sub_80B9F34), + PROC_CALL(WorldMap_StartSecretShop), PROC_YIELD, PROC_CALL(sub_80B9154), @@ -1412,7 +1414,7 @@ void sub_80B9AB0(void) Sound_FadeOutBGM(4); SetDispEnable(0, 0, 0, 0, 0); sub_80B895C(); - RemoveWmText(); + HideWmText(); EndWMFaceCtrl(); return; } @@ -1488,7 +1490,7 @@ void sub_80B9BA4(struct WorldMapMainProc * proc) } sub_80B895C(); - RemoveWmText(); + HideWmText(); EndWMFaceCtrl(); EndGmMuEntry(); EndGmapRM(); @@ -1535,7 +1537,7 @@ void WorldMap_WaitForChapterIntroEvents(ProcPtr proc) SetDispEnable(0, 0, 0, 0, 0); sub_80B895C(); - RemoveWmText(); + HideWmText(); EndWMFaceCtrl(); EndGmMuEntry(); EndGmapRM(); @@ -1646,7 +1648,7 @@ void sub_80B9E64(void) s16 y; sub_80B895C(); - RemoveWmText(); + HideWmText(); EndWMFaceCtrl(); *&x = (gGMData.xCamera); @@ -1681,30 +1683,30 @@ void NULL_080B9F08(void) } //! FE8U = 0x080B9F14 -void sub_80B9F14(ProcPtr proc) +void WorldMap_StartArmory(ProcPtr proc) { - sub_80C400C(0, proc); + StartGMapBaseMenu(SHOP_TYPE_ARMORY, proc); return; } //! FE8U = 0x080B9F24 -void sub_80B9F24(ProcPtr proc) +void WorldMap_StartVendor(ProcPtr proc) { - sub_80C400C(1, proc); + StartGMapBaseMenu(SHOP_TYPE_VENDOR, proc); return; } //! FE8U = 0x080B9F34 -void sub_80B9F34(ProcPtr proc) +void WorldMap_StartSecretShop(ProcPtr proc) { - sub_80C400C(2, proc); + StartGMapBaseMenu(SHOP_TYPE_SECRET_SHOP, proc); return; } //! FE8U = 0x080B9F44 void sub_80B9F44(ProcPtr proc) { - sub_80C400C(3, proc); + StartGMapBaseMenu(3, proc); return; } diff --git a/src/worldmap_radar.c b/src/worldmap_radar.c new file mode 100644 index 00000000..a198aae1 --- /dev/null +++ b/src/worldmap_radar.c @@ -0,0 +1,479 @@ +#include "global.h" + +#include "ctc.h" +#include "hardware.h" +#include "bmlib.h" + +#include "worldmap.h" + +//! FE8U = 0x080C36E8 +void WmMinimap_PutCursorIcon(struct GMapRadarProc * proc) +{ + int xTmp; + int yTmp; + int xOam1; + int yOam0; + + int x = gGMData.ix >> 8; + int y = gGMData.iy >> 8; + + xTmp = proc->unk_2f * 8 + ((x * 0x3f) / 0x1e0); + yTmp = proc->unk_30 * 8 + ((y * 0x2b) / 0x140); + + xOam1 = xTmp - 1; + yOam0 = yTmp + 7; + + if ((xTmp >= -0x1f) && (xTmp < 0x111) && (yOam0 >= -0x20) && (yOam0 < 0xc0)) + { + PutSpriteExt(0, OAM1_X(xOam1), OAM0_Y(yOam0), gObject_8x8, OAM2_CHR(0xF6) + OAM2_PAL(4)); + } + + return; +} + +//! FE8U = 0x080C3770 +void WmMinimap_PutStoryNodeIcon(struct GMapRadarProc * proc) +{ + int x; + int y; + int xTmp; + int yTmp; + int xOam1; + int yOam0; + + int nodeId = GetNextUnclearedNode(&gGMData); + + if (nodeId < 0) + { + return; + } + + x = nodeId[gWMNodeData].x; + y = nodeId[gWMNodeData].y; + + xTmp = proc->unk_2f * 8 + (x * 0x3f / 0x1e0); + yTmp = proc->unk_30 * 8 + ((y * 0x2b) / 0x140); + + xOam1 = xTmp - 1; + yOam0 = yTmp + 7; + + if ((xTmp >= -0x1f) && (xTmp < 0x111) && (yOam0 >= -0x20) && (yOam0 < 0xc0)) + { + PutSpriteExt(0, OAM1_X(xOam1), OAM0_Y(yOam0), gObject_8x8, OAM2_CHR(0xF7) + OAM2_PAL(4)); + } + + return; +} + +//! FE8U = 0x080C380C +void WmMinimap_PutLordIcon(struct GMapRadarProc * proc) +{ + int xTmp; + int yTmp; + int x; + int y; + int xOam1; + int yOam0; + s16 xPos; + s16 yPos; + + if (!(gGMData.units[0].state & 1)) + { + return; + } + + GmMu_GetPosition(GM_MAIN->unk_54, 0, &xPos, &yPos); + + x = *&xPos; + y = *&yPos; + + xTmp = proc->unk_2f * 8 + (x * 0x3f / 0x1e0); + yTmp = proc->unk_30 * 8 + (y * 0x2b / 0x140); + + xOam1 = xTmp - 3; + yOam0 = yTmp + 7; + + if ((xTmp >= -0x1d) && (xTmp < 0x113) && (yOam0 >= -0x20) && (yOam0 < 0xc0)) + { + PutSpriteExt(0, OAM1_X(xOam1), OAM0_Y(yOam0), gObject_8x8, OAM2_CHR(0xF4) + OAM2_PAL(9)); + } + + return; +} + +//! FE8U = 0x080C38BC +void WmMinimap_PutSkirmishIcons(struct GMapRadarProc * proc) +{ + int i; + int j; + int r9; + s16 sl; + struct Vec2 coords[3]; + s16 sp_1c; + + int r8 = 0; + int sp_18 = 0; + + for (r9 = 4; r9 < 7; r9++) + { + int x; + int y; + int x2; + int y2; + + if (!(gGMData.units[r9].state & 1)) + { + continue; + } + + GmMu_GetPosition(GM_MAIN->unk_54, r9, &sp_1c, &sl); + + x = sp_1c; + y = sl; + + x2 = proc->unk_2f * 8 + (x * 0x3f / 0x1e0); + y2 = proc->unk_30 * 8 + (y * 0x2b / 0x140); + + coords[r8].x = x2 - 3; + coords[r8].y = y2 + 7; + r8++; + sp_18++; + } + + for (i = 0; i < sp_18 - 1; i++) + { + for (j = i + 1; j < sp_18; j++) + { + if (coords[j].y < coords[i].y) + { + struct Vec2 coord; + coord.x = coords[i].x; + coord.y = coords[i].y; + + coords[i].x = coords[j].x; + coords[i].y = coords[j].y; + + coords[j].x = coord.x; + coords[j].y = coord.y; + } + } + } + + for (i = 0; i < sp_18; i++) + { + if ((coords[i].x >= -0x20) && (coords[i].x < 0x110) && (coords[i].y >= -0x20) && (coords[i].y < 0xc0)) + { + PutSpriteExt(0, OAM1_X(coords[i].x), OAM0_Y(coords[i].y), gObject_8x8, OAM2_CHR(0xF5) + OAM2_PAL(9)); + } + } + + return; +} + +extern u16 gUnknown_08AA1930[]; +extern u16 gUnknown_08AA1950[]; + +//! FE8U = 0x080C3A28 +void WmMinimap_BlinkPalette(struct GMapRadarProc * proc) +{ + int colorIdx = GM_MAIN->unk_50->unk_34; + + u16 * pal = PAL_OBJ(9); + + pal[9] = *(gUnknown_08AA1930 + colorIdx); + pal[7] = *(gUnknown_08AA1950 + colorIdx); + + EnablePaletteSync(); + + return; +} + +//! FE8U = 0x080C3A64 +void PutWmMinimapSprites(struct GMapRadarProc * proc) +{ + WmMinimap_PutStoryNodeIcon(proc); + WmMinimap_PutSkirmishIcons(proc); + WmMinimap_PutLordIcon(proc); + WmMinimap_PutCursorIcon(proc); + + WmMinimap_BlinkPalette(proc); + + return; +} + +extern u16 gUnknown_0201B458[]; + +//! FE8U = 0x080C3A8C +void GMapRadar_80C3A8C(struct GMapRadarProc * unused) +{ + TileMap_FillRect(gUnknown_0201B458, 8, 8, 0); + CallARM_FillTileRect(gUnknown_0201B458, gUnknown_08AA18AC, 0x000071E0); + return; +} + +// clang-format off + +u8 const gUnknown_08206B70[] = +{ + 3, 0, 0, 0, 0, 1, 3, 1, 1, 1, + 2, 2, 3, 2, 2, 3, 3, 3, 2, 3, +}; + +// clang-format on + +//! FE8U = 0x080C3AB8 +void GMapRadar_80C3AB8(struct GMapRadarProc * proc) +{ + int state; + + if ((gGMData.state.bits.state_2) != 0) + { + proc->unk_34 = 0; + proc->unk_2a = sub_80C089C(0x20, 0x20, 0x30, 0x30); + + state = ((gUnknown_08206B70[proc->unk_2a + (gGMData.state.bits.state_4_5) * 5] & 3) << 4); + gGMData.state.bits.state_4_5 = 0; + gGMData.state.raw |= state; + + GMapRadar_80C3A8C(proc); + + *&proc->unk_2d = gGMData.ix >> 8; + *&proc->unk_2e = gGMData.iy >> 8; + + proc->unk_2b = proc->unk_2d; + proc->unk_2c = proc->unk_2e; + + Proc_Break(proc); + } + + return; +} + +//! FE8U = 0x080C3B40 +void GMapRadar_80C3B40(struct GMapRadarProc * proc) +{ + int var; + + PutWmMinimapSprites(proc); + + proc->unk_2b = proc->unk_2d; + proc->unk_2c = proc->unk_2e; + + proc->unk_2d = gGMData.ix >> 8; + proc->unk_2e = gGMData.iy >> 8; + + if ((gGMData.state.bits.state_2) != 0) + { + if ((s8)gGMData.unk01 < 1) + { + return; + } + + if ((proc->unk_2d == proc->unk_2b) && (proc->unk_2e == proc->unk_2c)) + { + return; + } + + var = sub_80C089C(0x20, 0x20, 0x30, 0x30); + + if (var == proc->unk_2a) + { + return; + } + + if (gGMData.state.bits.state_4_5 == gUnknown_08206B70[var + gGMData.state.bits.state_4_5 * 5]) + { + return; + } + } + + proc->unk_29 = 1; + Proc_Break(proc); + + return; +} + +extern u16 gUnknown_0201B430[]; +extern u16 gUnknown_0201B458[]; + +//! FE8U = 0x080C3BE4 +void PutWmMinimapGfx(struct GMapRadarProc * proc, int b) +{ + switch (gUnknown_08206B70[proc->unk_2a + gGMData.state.bits.state_4_5 * 5]) + { + case 0: + TileMap_FillRect(gBG0TilemapBuffer, 8, 8, 0); + TileMap_CopyRect(gUnknown_0201B430 + (0x1c - b), gBG0TilemapBuffer, b, 8); + proc->unk_2f = b - 8; + proc->unk_30 = 0; + + break; + + case 1: + TileMap_FillRect(gBG0TilemapBuffer + 0x16, 8, 8, 0); + TileMap_CopyRect(gUnknown_0201B458, gBG0TilemapBuffer + (0x1e - b), b, 8); + proc->unk_2f = 30 - b; + proc->unk_30 = 0; + + break; + + case 2: + TileMap_FillRect(gBG0TilemapBuffer + 0x180, 8, 8, 0); + TileMap_CopyRect(gUnknown_0201B430 + (0x1c - b), gBG0TilemapBuffer + 0x180, b, 8); + proc->unk_2f = b - 8; + proc->unk_30 = 12; + + break; + + case 3: + TileMap_FillRect(gBG0TilemapBuffer + 0x196, 8, 8, 0); + TileMap_CopyRect(gUnknown_0201B458, gBG0TilemapBuffer + (0x19e - b), b, 12); + proc->unk_2f = 30 - b; + proc->unk_30 = 12; + + break; + } + + BG_EnableSyncByMask(BG0_SYNC_BIT); + + return; +} + +s8 CONST_DATA gUnknown_08A3EE6C[] = +{ + 1, 2, 5, 8, +}; + +//! FE8U = 0x080C3D24 +void GMapRadar_SlideIn(struct GMapRadarProc * proc) +{ + PutWmMinimapGfx(proc, gUnknown_08A3EE6C[proc->unk_34]); + PutWmMinimapSprites(proc); + + proc->unk_34++; + + if (proc->unk_34 == 4) + { + proc->unk_34 = 0; + Proc_Break(proc); + } + + return; +} + +s8 CONST_DATA gUnknown_08A3EE70[] = +{ + 5, 2, 1, 0, +}; + +//! FE8U = 0x080C3D5C +void GMapRadar_SlideOut(struct GMapRadarProc * proc) +{ + PutWmMinimapGfx(proc, gUnknown_08A3EE70[proc->unk_34]); + PutWmMinimapSprites(proc); + + proc->unk_34++; + + if (proc->unk_34 == 4) + { + proc->unk_34 = 0; + proc->unk_29 = 0; + Proc_Break(proc); + } + + return; +} + +//! FE8U = 0x080C3D9C +void GMapRadar_Init(struct GMapRadarProc * proc) +{ + proc->unk_34 = 0; + proc->unk_29 = 0; + proc->unk_2a = 0; + return; +} + +// clang-format off + +struct ProcCmd CONST_DATA ProcScr_GmapRader[] = +{ + PROC_NAME("Gmap Rader"), + PROC_MARK(PROC_MARK_8), + + PROC_15, + PROC_YIELD, + + PROC_CALL(GMapRadar_Init), + +PROC_LABEL(0), + PROC_REPEAT(GMapRadar_80C3AB8), + PROC_REPEAT(GMapRadar_SlideIn), + PROC_REPEAT(GMapRadar_80C3B40), + PROC_REPEAT(GMapRadar_SlideOut), + + PROC_GOTO(0), + + PROC_END, +}; + +// clang-format on + +//! FE8U = 0x080C3DAC +void StartWorldMapMinimapCore(struct Proc * proc) +{ + SetWinEnable(0, 0, 0); + SetWOutLayers(1, 1, 1, 1, 1); + gLCDControlBuffer.wincnt.wout_enableBlend = 1; + + BG_SetPosition(BG_0, 0, 0); + BG_SetPosition(BG_1, 0, 0); + BG_SetPosition(BG_2, 0, 0); + + SetBlendAlpha(14, 3); + + SetBlendTargetA(0, 1, 0, 0, 0); + SetBlendTargetB(0, 0, 1, 1, 1); + SetBlendBackdropA(0); + + Decompress(Img_WorldmapMinimap, (void *)0x06003C00); + + ApplyPalette(Pal_WorldmapMinimap, 7); + ApplyPalette(gPal_GMapPI_ShopIcons, 0x19); + EnablePaletteSync(); + + Proc_Start(ProcScr_GmapRader, proc->proc_parent); + + return; +} + +// clang-format off + +struct ProcCmd CONST_DATA ProcScr_WorldmapMinimapWrapper[] = +{ + PROC_MARK(PROC_MARK_8), + PROC_CALL(StartWorldMapMinimapCore), + + PROC_END, +}; + +// clang-format on + +//! FE8U = 0x080C3E80 +ProcPtr StartWorldmapMinimap(ProcPtr parent) +{ + return Proc_Start(ProcScr_WorldmapMinimapWrapper, parent); +} + +//! FE8U = 0x080C3E94 +void EndWorldmapMinimap(void) +{ + Proc_EndEach(ProcScr_GmapRader); + Proc_EndEach(ProcScr_WorldmapMinimapWrapper); + + SetDefaultColorEffects(); + + BG_Fill(gBG1TilemapBuffer, 0); + BG_EnableSyncByMask(BG1_SYNC_BIT); + + return; +} diff --git a/src/worldmap_text.c b/src/worldmap_text.c new file mode 100644 index 00000000..e8aaa826 --- /dev/null +++ b/src/worldmap_text.c @@ -0,0 +1,164 @@ +#include "global.h" + +#include "ctc.h" +#include "scene.h" +#include "hardware.h" + +#include "worldmap.h" + +//! FE8U = 0x080C34D0 +void sub_80C34D0(u16 * dstPal, int b, u16 colorA, u16 colorB) +{ + int i; + + for (i = 0; i < b; i++) + { + int color = (b - i); + + dstPal[i] = (((color * (colorA & RED_MASK) + i * (colorB & RED_MASK)) / b) & RED_MASK) + + (((color * (colorA & GREEN_MASK) + i * (colorB & GREEN_MASK)) / b) & GREEN_MASK) + + (((color * (colorA & BLUE_MASK) + i * (colorB & BLUE_MASK)) / b) & BLUE_MASK); + } + + return; +} + +//! FE8U = 0x080C3590 +void ClearWmTextVram(void) +{ + int i; + + for (i = 0; i < 4; i++) + { + CpuFastFill(0, (void *)(0x06014000 + i * 0x400), 0x380); + } + + return; +} + +struct GMapTextProc +{ + /* 00 */ PROC_HEADER; + /* 29 */ u8 drawAtBottom; + /* 2A */ u8 visible; +}; + +//! FE8U = 0x080C35C4 +void WmText_Init(struct GMapTextProc * proc) +{ + proc->drawAtBottom = 1; + proc->visible = 0; + + ClearWmTextVram(); + + gWmHblankStatus &= ~1; + + return; +} + +// clang-format off + +u16 CONST_DATA Sprite_WmText[] = +{ + 4, + OAM0_SHAPE_64x32 + OAM0_Y(8), OAM1_SIZE_64x32 + OAM1_X(8), OAM2_CHR(0x200), + OAM0_SHAPE_64x32 + OAM0_Y(8), OAM1_SIZE_64x32 + OAM1_X(72), OAM2_CHR(0x208), + OAM0_SHAPE_64x32 + OAM0_Y(8), OAM1_SIZE_64x32 + OAM1_X(136), OAM2_CHR(0x210), + OAM0_SHAPE_32x32 + OAM0_Y(8), OAM1_SIZE_32x32 + OAM1_X(200), OAM2_CHR(0x218), +}; + +// clang-format on + +//! FE8U = 0x080C35EC +void WmText_Loop_DrawText(struct GMapTextProc * proc) +{ + int y; + + if (proc->visible == 0) + { + return; + } + + y = 0; + + if (proc->drawAtBottom == 1) + { + y = 111; + } + + PutSpriteExt(1, 0, y, Sprite_WmText, OAM2_PAL(2)); + + return; +} + +// clang-format off + +struct ProcCmd CONST_DATA ProcScr_WorldMapTextHandler[] = +{ + PROC_MARK(PROC_MARK_8), + + PROC_CALL(WmText_Init), + PROC_YIELD, + + PROC_REPEAT(WmText_Loop_DrawText), + + PROC_END, +}; + +// clang-format on + +//! FE8U = 0x080C3624 +void ShowWmText(u8 atBottom) +{ + struct GMapTextProc * proc = Proc_Find(ProcScr_WorldMapTextHandler); + + if (proc != NULL) + { + ClearWmTextVram(); + gWmHblankStatus &= ~1; + proc->drawAtBottom = atBottom; + proc->visible = 1; + } + + return; +} + +//! FE8U = 0x0800CDC8 +void HideWmText(void) +{ + struct GMapTextProc * proc = Proc_Find(ProcScr_WorldMapTextHandler); + + if (proc != NULL) + { + gWmHblankStatus &= ~1; + proc->visible = 0; + } + + return; +} + +//! FE8U = 0x080C368C +ProcPtr StartWmTextHandler(ProcPtr parent) +{ + return Proc_Start(ProcScr_WorldMapTextHandler, parent); +} + +//! FE8U = 0x080C36A0 +void StartWmTextMsg(int textId) +{ + EndTalk(); + + InitSpriteTalk(0x200, 2, 2); + EnablePaletteSync(); + + StartTalkMsg(1, 15, textId); + + SetTalkPrintDelay(4); + + SetTalkFlag(TALK_FLAG_SPRITE); + SetTalkFlag(TALK_FLAG_7); + SetTalkFlag(TALK_FLAG_NOSKIP); + SetTalkFlag(TALK_FLAG_INSTANTSHIFT); + + return; +}