diff --git a/Makefile b/Makefile index 8f632008b..32cc9df73 100644 --- a/Makefile +++ b/Makefile @@ -141,6 +141,10 @@ else $(C_BUILDDIR)/%.o: c_dep = $(shell $(SCANINC) -I include $(C_SUBDIR)/$*.c) endif +ifeq ($(DINFO),1) +override CFLAGS += -g +endif + $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s diff --git a/asm/pokenav.s b/asm/pokenav.s index 91682a780..40ce730ea 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -20930,9331 +20930,4 @@ _081D156A: .pool thumb_func_end sub_81D1538 - .section .text.after.match.call - - thumb_func_start sub_81D1C44 -sub_81D1C44: @ 81D1C44 - push {r4,lr} - lsls r0, 24 - ldr r4, =gUnknown_0203CF4C - lsrs r0, 21 - adds r0, 0x8 - bl Alloc - str r0, [r4] - cmp r0, 0 - bne _081D1C60 - movs r0, 0 - b _081D1C7A - .pool -_081D1C60: - movs r2, 0 - ldr r4, =gUnknown_0203CF48 - movs r3, 0xFF -_081D1C66: - adds r0, r2, r4 - ldrb r1, [r0] - orrs r1, r3 - strb r1, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x2 - bls _081D1C66 - movs r0, 0x1 -_081D1C7A: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D1C44 - - thumb_func_start sub_81D1C84 -sub_81D1C84: @ 81D1C84 - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r6, =gUnknown_0203CF48 - adds r5, r4, r6 - ldrb r0, [r5] - cmp r0, 0xFF - bne _081D1CEC - cmp r4, 0x2 - bne _081D1CD4 - ldr r0, =gUnknown_086253E8 - ldr r1, [r0, 0x14] - ldr r0, [r0, 0x10] - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, =gMailboxMailOptions - movs r1, 0x4 - bl GetMaxWidthInMenuTable - lsls r0, 24 - ldr r2, =0x00ffffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - mov r0, sp - bl AddWindow - strb r0, [r6, 0x2] - b _081D1CE0 - .pool -_081D1CD4: - lsls r0, r4, 3 - ldr r1, =gUnknown_086253E8 - adds r0, r1 - bl AddWindow - strb r0, [r5] -_081D1CE0: - ldr r0, =gUnknown_0203CF48 - adds r0, r4, r0 - ldrb r0, [r0] - movs r1, 0 - bl SetStandardWindowBorderStyle -_081D1CEC: - ldr r0, =gUnknown_0203CF48 - adds r0, r4, r0 - ldrb r0, [r0] - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D1C84 - - thumb_func_start sub_81D1D04 -sub_81D1D04: @ 81D1D04 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CF48 - adds r4, r0 - ldrb r0, [r4] - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D1D04 - - thumb_func_start sub_81D1D34 -sub_81D1D34: @ 81D1D34 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CF48 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_81D1D34 - - thumb_func_start sub_81D1D44 -sub_81D1D44: @ 81D1D44 - push {r4,r5,lr} - sub sp, 0x34 - adds r3, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r2, 24 - lsrs r5, r2, 24 - movs r0, 0x2 - negs r0, r0 - cmp r3, r0 - beq _081D1DAC - ldr r0, =gSaveBlock1Ptr - lsls r1, r3, 3 - adds r1, r3 - lsls r1, 2 - ldr r0, [r0] - adds r1, r0 - ldr r0, =0x00002cca - adds r1, r0 - add r0, sp, 0x14 - bl StringCopy - add r0, sp, 0x14 - bl sub_81DB52C - add r0, sp, 0x14 - bl StringLength - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x5 - bhi _081D1D8C - add r0, sp, 0x14 - movs r1, 0x1 - bl ConvertInternationalString -_081D1D8C: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - ldr r0, =gUnknown_08625400 - str r0, [sp, 0x8] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0xC] - add r0, sp, 0x14 - str r0, [sp, 0x10] - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0x8 - adds r3, r5, 0 - bl AddTextPrinterParameterized4 -_081D1DAC: - add sp, 0x34 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D1D44 - - thumb_func_start sub_81D1DC0 -sub_81D1DC0: @ 81D1DC0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r5, r0, 0 - movs r3, 0 - ldr r7, =gUnknown_0203CF4C - ldr r0, =gText_Cancel2 - mov r12, r0 - ldr r4, =gMultiuseListMenuTemplate - ldr r1, =gUnknown_0203CF48 - mov r8, r1 - ldr r2, =sub_81D1E7C - mov r9, r2 - ldr r0, =sub_81D1D44 - mov r10, r0 - ldrb r1, [r5, 0x5] - cmp r3, r1 - bcs _081D1E02 - adds r6, r7, 0 - ldr r2, =gUnknown_08625403 -_081D1DEC: - ldr r1, [r6] - lsls r0, r3, 3 - adds r0, r1 - str r2, [r0] - str r3, [r0, 0x4] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - ldrb r0, [r5, 0x5] - cmp r3, r0 - bcc _081D1DEC -_081D1E02: - ldr r2, [r7] - lsls r0, r3, 3 - adds r0, r2 - mov r1, r12 - str r1, [r0] - movs r1, 0x2 - negs r1, r1 - str r1, [r0, 0x4] - str r2, [r4] - ldrb r0, [r5, 0x5] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0xC] - mov r2, r8 - ldrb r0, [r2, 0x1] - strb r0, [r4, 0x10] - strb r1, [r4, 0x11] - movs r0, 0x8 - strb r0, [r4, 0x12] - strb r1, [r4, 0x13] - strh r0, [r4, 0xE] - movs r0, 0x29 - strb r0, [r4, 0x14] - movs r0, 0x31 - strb r0, [r4, 0x15] - mov r0, r9 - str r0, [r4, 0x4] - mov r1, r10 - str r1, [r4, 0x8] - movs r0, 0x1 - strb r0, [r4, 0x17] - movs r0, 0 - strb r0, [r4, 0x16] - ldrh r1, [r5, 0x2] - ldrh r2, [r5] - adds r0, r4, 0 - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D1DC0 - - thumb_func_start sub_81D1E7C -sub_81D1E7C: @ 81D1E7C - push {lr} - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x1 - beq _081D1E8C - movs r0, 0x5 - bl PlaySE -_081D1E8C: - pop {r0} - bx r0 - thumb_func_end sub_81D1E7C - - thumb_func_start sub_81D1E90 -sub_81D1E90: @ 81D1E90 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - ldrb r0, [r4, 0x5] - ldrb r1, [r4, 0x4] - subs r0, r1 - adds r0, 0x1 - str r0, [sp] - movs r0, 0x6E - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r4, 0x2 - str r0, [sp, 0xC] - movs r0, 0x2 - movs r1, 0xC8 - movs r2, 0xC - movs r3, 0x94 - bl AddScrollIndicatorArrowPairParameterized - strb r0, [r4, 0x9] - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81D1E90 - - thumb_func_start sub_81D1EC0 -sub_81D1EC0: @ 81D1EC0 - push {lr} - ldr r0, =gUnknown_0203CF4C - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D1EC0 - - thumb_func_start sub_81D1ED4 -sub_81D1ED4: @ 81D1ED4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r3, r0, 0 - movs r6, 0 - movs r7, 0 -_081D1EE6: - movs r2, 0 - lsls r5, r6, 2 - adds r0, r6, 0x1 - mov r10, r0 - adds r4, r5, 0 -_081D1EF0: - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 2 - adds r0, r4, r0 - adds r0, r3, r0 - adds r1, r0, 0 - adds r1, 0x64 - strh r7, [r1] - adds r0, 0x66 - strh r7, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x9 - bls _081D1EF0 - movs r2, 0 - mov r9, r2 - str r5, [sp] - movs r1, 0x9B - mov r8, r1 - movs r4, 0x5B - mov r12, r4 -_081D1F1C: - lsls r0, r2, 2 - adds r0, r2 - adds r1, r6, r0 - adds r1, r3, r1 - mov r4, r9 - strb r4, [r1] - lsls r0, 2 - ldr r1, [sp] - adds r0, r1, r0 - adds r0, r3, r0 - mov r4, r8 - strh r4, [r0, 0x14] - mov r1, r12 - strh r1, [r0, 0x16] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _081D1F1C - adds r1, r3, r5 - movs r2, 0x96 - lsls r2, 1 - adds r0, r1, r2 - strh r7, [r0] - movs r4, 0x97 - lsls r4, 1 - adds r0, r1, r4 - strh r7, [r0] - mov r1, r10 - lsls r0, r1, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bls _081D1EE6 - movs r2, 0xD5 - lsls r2, 2 - adds r0, r3, r2 - movs r1, 0 - strb r1, [r0] - ldr r4, =0x00000352 - adds r0, r3, r4 - strh r1, [r0] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D1ED4 - - thumb_func_start sub_81D1F84 -sub_81D1F84: @ 81D1F84 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r8, r0 - str r1, [sp] - mov r9, r2 - movs r7, 0 -_081D1F98: - lsls r4, r7, 2 - ldr r1, [sp] - adds r0, r4, r1 - ldrh r1, [r0] - lsls r5, r1, 8 - mov r2, r9 - adds r0, r4, r2 - ldrh r0, [r0] - subs r0, r1 - lsls r0, 8 - movs r1, 0xA - bl __divsi3 - adds r6, r0, 0 - movs r3, 0 - adds r7, 0x1 - mov r10, r7 - mov r12, r4 -_081D1FBC: - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 2 - add r0, r12 - add r0, r8 - asrs r2, r5, 8 - asrs r1, r5, 7 - movs r7, 0x1 - ands r1, r7 - adds r2, r1 - adds r0, 0x64 - strh r2, [r0] - adds r5, r6 - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x8 - bls _081D1FBC - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 2 - adds r0, r4, r0 - add r0, r8 - mov r1, r9 - adds r2, r4, r1 - ldrh r1, [r2] - adds r0, 0x64 - strh r1, [r0] - ldr r7, [sp] - adds r0, r4, r7 - ldrh r1, [r0, 0x2] - lsls r5, r1, 8 - ldrh r0, [r2, 0x2] - subs r0, r1 - lsls r0, 8 - movs r1, 0xA - bl __divsi3 - adds r6, r0, 0 - movs r3, 0 - str r4, [sp, 0x4] - movs r0, 0x1 - mov r12, r0 -_081D2012: - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 2 - ldr r1, [sp, 0x4] - adds r0, r1, r0 - add r0, r8 - asrs r2, r5, 8 - asrs r1, r5, 7 - mov r7, r12 - ands r1, r7 - adds r2, r1 - adds r0, 0x66 - strh r2, [r0] - adds r5, r6 - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x8 - bls _081D2012 - lsls r0, r3, 2 - adds r0, r3 - lsls r0, 2 - adds r0, r4, r0 - add r0, r8 - mov r2, r9 - adds r1, r4, r2 - ldrh r1, [r1, 0x2] - adds r0, 0x66 - strh r1, [r0] - mov r7, r10 - lsls r0, r7, 16 - lsrs r7, r0, 16 - cmp r7, 0x4 - bls _081D1F98 - ldr r1, =0x00000352 - add r1, r8 - movs r0, 0 - strh r0, [r1] - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D1F84 - - thumb_func_start sub_81D2074 -sub_81D2074: @ 81D2074 - push {r4,lr} - adds r1, r0, 0 - ldr r0, =0x00000352 - adds r4, r1, r0 - ldrh r0, [r4] - cmp r0, 0x9 - bls _081D208C - movs r0, 0 - b _081D20A6 - .pool -_081D208C: - adds r0, r1, 0 - bl sub_81D2230 - ldrh r1, [r4] - adds r1, 0x1 - strh r1, [r4] - lsls r1, 16 - lsrs r1, 16 - movs r0, 0xA - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 -_081D20A6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D2074 - - thumb_func_start sub_81D20AC -sub_81D20AC: @ 81D20AC - ldr r1, =0x00000355 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_81D20AC - - thumb_func_start sub_81D20BC -sub_81D20BC: @ 81D20BC - push {r4,r5,lr} - sub sp, 0xC - ldr r1, =0x00000355 - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0 - beq _081D20D4 - cmp r0, 0x1 - beq _081D20E2 - b _081D20FA - .pool -_081D20D4: - bl ScanlineEffect_Clear - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - movs r0, 0x1 - b _081D20FC -_081D20E2: - mov r0, sp - ldr r1, =gUnknown_08625404 - ldm r1!, {r2,r3,r5} - stm r0!, {r2,r3,r5} - ldr r0, [sp] - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - bl ScanlineEffect_SetParams - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_081D20FA: - movs r0, 0 -_081D20FC: - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D20BC - - thumb_func_start sub_81D2108 -sub_81D2108: @ 81D2108 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - adds r6, r0, 0 - movs r1, 0xD5 - lsls r1, 2 - adds r0, r6, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081D21BE - adds r0, r6, 0 - bl sub_81D24A4 - adds r0, r6, 0 - bl sub_81D2634 - movs r7, 0 - ldr r5, =gScanlineEffectRegBuffers - mov r12, r5 - movs r0, 0xF0 - lsls r0, 3 - add r0, r12 - mov r9, r0 - movs r1, 0xA0 - lsls r1, 1 - adds r1, r6, r1 - str r1, [sp] - ldr r5, =0x0000ffff - mov r8, r5 - movs r0, 0xA1 - lsls r0, 1 - adds r0, r6, r0 - str r0, [sp, 0x4] - movs r1, 0x92 - lsls r1, 2 - adds r1, r6, r1 - str r1, [sp, 0x8] - ldr r5, =0x0000024a - adds r5, r6 - mov r10, r5 -_081D215E: - adds r2, r7, 0 - adds r2, 0x37 - lsls r3, r2, 2 - mov r0, r9 - adds r0, r3, r0 - str r0, [sp, 0xC] - add r3, r12 - lsls r4, r7, 2 - ldr r1, [sp] - adds r0, r1, r4 - ldrh r0, [r0] - lsls r0, 8 - ldr r5, [sp, 0x4] - adds r1, r5, r4 - ldrh r1, [r1] - orrs r0, r1 - strh r0, [r3] - mov r1, r8 - ands r0, r1 - ldr r5, [sp, 0xC] - strh r0, [r5] - lsls r2, 1 - adds r2, 0x1 - lsls r2, 1 - mov r0, r9 - adds r3, r2, r0 - add r2, r12 - ldr r1, [sp, 0x8] - adds r0, r1, r4 - ldrh r0, [r0] - lsls r0, 8 - add r4, r10 - ldrh r1, [r4] - orrs r0, r1 - strh r0, [r2] - mov r5, r8 - ands r0, r5 - strh r0, [r3] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x41 - bls _081D215E - movs r0, 0xD5 - lsls r0, 2 - adds r1, r6, r0 - movs r0, 0 - strb r0, [r1] -_081D21BE: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D2108 - - thumb_func_start sub_81D21DC -sub_81D21DC: @ 81D21DC - push {r4,r5,lr} - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _081D21E8 - movs r1, 0 -_081D21E8: - movs r0, 0x1 - lsls r0, r1 - movs r5, 0x1F - bics r5, r0 - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - movs r0, 0x42 - movs r1, 0x9B - bl SetGpuReg - ldr r4, =0x00003879 - movs r0, 0x44 - adds r1, r4, 0 - bl SetGpuReg - movs r0, 0x46 - adds r1, r4, 0 - bl SetGpuReg - ldr r1, =0x00003f3f - movs r0, 0x48 - bl SetGpuReg - movs r0, 0x4A - adds r1, r5, 0 - bl SetGpuReg - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D21DC - - thumb_func_start sub_81D2230 -sub_81D2230: @ 81D2230 - push {r4-r7,lr} - mov r12, r0 - movs r4, 0 - movs r7, 0x96 - lsls r7, 1 - add r7, r12 - ldr r6, =0x00000352 - add r6, r12 - mov r5, r12 - adds r5, 0x64 -_081D2244: - lsls r2, r4, 2 - adds r3, r7, r2 - ldrh r1, [r6] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r2, r0 - adds r2, r5, r2 - ldr r0, [r2] - str r0, [r3] - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x4 - bls _081D2244 - movs r1, 0xD5 - lsls r1, 2 - add r1, r12 - movs r0, 0x1 - strb r0, [r1] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D2230 - - thumb_func_start sub_81D2278 -sub_81D2278: @ 81D2278 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - str r0, [sp] - adds r6, r1, 0 - adds r5, r2, 0 - str r3, [sp, 0x4] - ldr r0, [sp, 0x38] - ldr r7, [sp, 0x3C] - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r0, 0 - str r0, [sp, 0xC] - ldrh r0, [r5, 0x2] - ldrh r1, [r3, 0x2] - cmp r0, r1 - bcs _081D22B2 - adds r2, r0, 0 - mov r10, r2 - ldrh r0, [r3, 0x2] - ldrh r1, [r5] - lsls r4, r1, 10 - ldrh r3, [r3] - str r3, [sp, 0x8] - b _081D22C6 -_081D22B2: - ldrh r0, [r5, 0x2] - ldr r1, [sp, 0x4] - ldrh r1, [r1, 0x2] - mov r10, r1 - ldr r2, [sp, 0x4] - ldrh r1, [r2] - lsls r4, r1, 10 - ldrh r3, [r5] - str r3, [sp, 0x8] - mov r2, r10 -_081D22C6: - subs r0, r2 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - cmp r0, 0 - beq _081D22DE - subs r0, r3, r1 - lsls r0, 10 - mov r1, r8 - bl __divsi3 - str r0, [sp, 0xC] -_081D22DE: - mov r0, r8 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - cmp r7, 0 - bne _081D2328 - mov r0, r10 - subs r0, 0x38 - lsls r0, 2 - adds r6, r0 - movs r5, 0 - mov r3, r9 - lsls r3, 1 - mov r12, r3 - ldr r0, [sp, 0x8] - add r0, r9 - str r0, [sp, 0x10] - cmp r7, r8 - bcs _081D23B6 - movs r7, 0x1 -_081D2308: - adds r2, r3, r6 - asrs r1, r4, 10 - asrs r0, r4, 9 - ands r0, r7 - adds r1, r0 - add r1, r9 - strh r1, [r2] - ldr r1, [sp, 0xC] - adds r4, r1 - adds r6, 0x4 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, r8 - bcc _081D2308 - b _081D23B6 -_081D2328: - ldr r2, [sp, 0xC] - cmp r2, 0 - ble _081D23C0 - mov r0, r10 - subs r0, 0x38 - lsls r0, 2 - adds r7, r0 - movs r5, 0 - mov r3, r9 - lsls r3, 1 - mov r12, r3 - ldr r0, [sp, 0x8] - add r0, r9 - str r0, [sp, 0x10] - cmp r5, r8 - bcs _081D237A - ldr r0, =0x00026bff - cmp r4, r0 - bgt _081D237A - mov r1, r12 - str r1, [sp, 0x14] -_081D2352: - ldr r3, [sp, 0x14] - adds r2, r3, r7 - asrs r1, r4, 10 - asrs r0, r4, 9 - movs r3, 0x1 - ands r0, r3 - adds r1, r0 - add r1, r9 - strh r1, [r2] - ldr r0, [sp, 0xC] - adds r4, r0 - adds r7, 0x4 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, r8 - bcs _081D237A - ldr r1, =0x00026bff - cmp r4, r1 - ble _081D2352 -_081D237A: - mov r2, r10 - adds r1, r2, r5 - ldr r3, [sp] - movs r2, 0xD4 - lsls r2, 2 - adds r0, r3, r2 - strh r1, [r0] - ldrh r0, [r0] - subs r0, 0x38 - lsls r0, 2 - adds r6, r0 - cmp r5, r8 - bcs _081D23B6 - mov r3, r12 - movs r7, 0x1 -_081D2398: - adds r2, r3, r6 - asrs r1, r4, 10 - asrs r0, r4, 9 - ands r0, r7 - adds r1, r0 - add r1, r9 - strh r1, [r2] - ldr r0, [sp, 0xC] - adds r4, r0 - adds r6, 0x4 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, r8 - bcc _081D2398 -_081D23B6: - subs r0, r6, 0x4 - b _081D248C - .pool -_081D23C0: - ldr r1, [sp, 0xC] - cmp r1, 0 - bge _081D2464 - mov r0, r10 - subs r0, 0x38 - lsls r0, 2 - adds r6, r0 - movs r5, 0 - mov r2, r9 - lsls r2, 1 - mov r12, r2 - ldr r3, [sp, 0x8] - add r3, r9 - str r3, [sp, 0x10] - cmp r5, r8 - bcs _081D241E - adds r3, r2, r6 - asrs r1, r4, 10 - asrs r0, r4, 9 - movs r2, 0x1 - ands r0, r2 - adds r1, r0 - add r1, r9 - strh r1, [r3] - b _081D2414 -_081D23F2: - ldr r0, [sp, 0xC] - adds r4, r0 - adds r6, 0x4 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, r8 - bcs _081D241E - mov r1, r12 - adds r3, r1, r6 - asrs r2, r4, 10 - asrs r0, r4, 9 - movs r1, 0x1 - ands r0, r1 - adds r2, r0 - add r2, r9 - strh r2, [r3] -_081D2414: - ldr r0, =0x00026bff - cmp r4, r0 - bgt _081D23F2 - movs r0, 0x9B - strh r0, [r3] -_081D241E: - mov r2, r10 - adds r1, r2, r5 - ldr r3, [sp] - movs r2, 0xD4 - lsls r2, 2 - adds r0, r3, r2 - strh r1, [r0] - ldrh r0, [r0] - subs r0, 0x38 - lsls r0, 2 - adds r7, r0 - cmp r5, r8 - bcs _081D245A - mov r3, r12 - movs r6, 0x1 -_081D243C: - adds r2, r3, r7 - asrs r1, r4, 10 - asrs r0, r4, 9 - ands r0, r6 - adds r1, r0 - add r1, r9 - strh r1, [r2] - ldr r0, [sp, 0xC] - adds r4, r0 - adds r7, 0x4 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, r8 - bcc _081D243C -_081D245A: - subs r0, r7, 0x4 - b _081D248C - .pool -_081D2464: - ldr r1, [sp] - movs r2, 0xD4 - lsls r2, 2 - adds r0, r1, r2 - mov r3, r10 - strh r3, [r0] - mov r0, r10 - subs r0, 0x38 - lsls r0, 2 - adds r6, r0 - adds r7, r0 - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r6, 0x2] - ldr r1, [sp, 0x4] - ldrh r0, [r1] - strh r0, [r7] - movs r0, 0x9B - strh r0, [r7, 0x2] - b _081D2494 -_081D248C: - add r0, r12 - mov r2, sp - ldrh r2, [r2, 0x10] - strh r2, [r0] -_081D2494: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D2278 - - thumb_func_start sub_81D24A4 -sub_81D24A4: @ 81D24A4 - push {r4-r7,lr} - sub sp, 0x8 - adds r4, r0, 0 - movs r0, 0x97 - lsls r0, 1 - adds r2, r4, r0 - movs r3, 0x99 - lsls r3, 1 - adds r1, r4, r3 - ldrh r0, [r2] - ldrh r3, [r1] - cmp r0, r3 - bcs _081D24E0 - adds r7, r0, 0 - movs r0, 0xA0 - lsls r0, 1 - adds r1, r4, r0 - movs r3, 0x96 - lsls r3, 1 - adds r2, r4, r3 - subs r0, 0x10 - adds r3, r4, r0 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r0, r4, 0 - bl sub_81D2278 - b _081D2500 -_081D24E0: - ldrh r7, [r1] - movs r2, 0xA0 - lsls r2, 1 - adds r1, r4, r2 - movs r3, 0x98 - lsls r3, 1 - adds r2, r4, r3 - movs r0, 0x96 - lsls r0, 1 - adds r3, r4, r0 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r4, 0 - bl sub_81D2278 -_081D2500: - movs r1, 0xA0 - lsls r1, 1 - adds r5, r4, r1 - movs r3, 0x98 - lsls r3, 1 - adds r2, r4, r3 - movs r0, 0x9A - lsls r0, 1 - adds r6, r4, r0 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r0, r4, 0 - adds r1, r5, 0 - adds r3, r6, 0 - bl sub_81D2278 - movs r2, 0 - movs r1, 0x9B - lsls r1, 1 - adds r0, r4, r1 - movs r3, 0x9D - lsls r3, 1 - adds r1, r4, r3 - ldrh r0, [r0] - ldrh r1, [r1] - cmp r0, r1 - bhi _081D253C - movs r2, 0x1 -_081D253C: - movs r0, 0x9C - lsls r0, 1 - adds r3, r4, r0 - str r2, [sp] - movs r1, 0x92 - lsls r1, 2 - adds r0, r4, r1 - str r0, [sp, 0x4] - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_81D2278 - movs r2, 0x38 - cmp r2, r7 - bcs _081D257E - adds r6, r5, 0 - movs r3, 0 - movs r0, 0xA1 - lsls r0, 1 - adds r5, r4, r0 -_081D2566: - adds r0, r2, 0 - subs r0, 0x38 - lsls r0, 2 - adds r1, r6, r0 - strh r3, [r1] - adds r0, r5, r0 - strh r3, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, r7 - bcc _081D2566 -_081D257E: - movs r1, 0x97 - lsls r1, 1 - adds r0, r4, r1 - ldrh r2, [r0] - movs r3, 0xD4 - lsls r3, 2 - adds r0, r4, r3 - ldrh r1, [r0] - cmp r2, r1 - bhi _081D25B2 - movs r1, 0xA0 - lsls r1, 1 - adds r3, r4, r1 - movs r5, 0x9B - adds r1, r0, 0 -_081D259C: - adds r0, r2, 0 - subs r0, 0x38 - lsls r0, 2 - adds r0, r3, r0 - strh r5, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldrh r0, [r1] - cmp r2, r0 - bls _081D259C -_081D25B2: - movs r2, 0x9B - lsls r2, 1 - adds r1, r4, r2 - movs r3, 0xD4 - lsls r3, 2 - adds r0, r4, r3 - ldrh r0, [r0] - ldrh r1, [r1] - cmp r0, r1 - bcs _081D25C8 - adds r0, r1, 0 -_081D25C8: - adds r0, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x79 - bhi _081D25F8 - movs r0, 0xA0 - lsls r0, 1 - adds r6, r4, r0 - movs r3, 0 - movs r1, 0xA1 - lsls r1, 1 - adds r5, r4, r1 -_081D25E0: - adds r0, r2, 0 - subs r0, 0x38 - lsls r0, 2 - adds r1, r6, r0 - strh r3, [r1] - adds r0, r5, r0 - strh r3, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x79 - bls _081D25E0 -_081D25F8: - movs r2, 0x38 - movs r3, 0xA0 - lsls r3, 1 - adds r5, r4, r3 - movs r0, 0xA1 - lsls r0, 1 - adds r4, r0 - movs r6, 0x9B -_081D2608: - adds r0, r2, 0 - subs r0, 0x38 - lsls r1, r0, 2 - adds r3, r5, r1 - ldrh r0, [r3] - cmp r0, 0 - bne _081D2620 - adds r0, r4, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _081D2620 - strh r6, [r3] -_081D2620: - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x79 - bls _081D2608 - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D24A4 - - thumb_func_start sub_81D2634 -sub_81D2634: @ 81D2634 - push {r4-r6,lr} - sub sp, 0x8 - adds r4, r0, 0 - movs r0, 0x97 - lsls r0, 1 - adds r2, r4, r0 - movs r3, 0x9F - lsls r3, 1 - adds r1, r4, r3 - ldrh r0, [r2] - ldrh r5, [r1] - cmp r0, r5 - bcs _081D266E - adds r6, r0, 0 - movs r0, 0x92 - lsls r0, 2 - adds r1, r4, r0 - subs r3, 0x12 - adds r2, r4, r3 - movs r5, 0x9E - lsls r5, 1 - adds r3, r4, r5 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r4, 0 - bl sub_81D2278 - b _081D2690 -_081D266E: - ldrh r6, [r1] - movs r0, 0x92 - lsls r0, 2 - adds r1, r4, r0 - movs r3, 0x9E - lsls r3, 1 - adds r2, r4, r3 - movs r5, 0x96 - lsls r5, 1 - adds r3, r4, r5 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r0, r4, 0 - bl sub_81D2278 -_081D2690: - movs r0, 0x92 - lsls r0, 2 - adds r5, r4, r0 - movs r1, 0x9E - lsls r1, 1 - adds r2, r4, r1 - movs r0, 0x9C - lsls r0, 1 - adds r3, r4, r0 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81D2278 - cmp r6, 0x38 - ble _081D26C8 - movs r0, 0 - adds r1, r5, 0 - adds r2, r6, 0 - subs r2, 0x38 -_081D26BC: - strh r0, [r1] - strh r0, [r1, 0x2] - adds r1, 0x4 - subs r2, 0x1 - cmp r2, 0 - bne _081D26BC -_081D26C8: - movs r1, 0x97 - lsls r1, 1 - adds r0, r4, r1 - ldrh r2, [r0] - movs r3, 0xD4 - lsls r3, 2 - adds r0, r4, r3 - ldrh r5, [r0] - cmp r2, r5 - bgt _081D26F6 - movs r3, 0x9B - adds r1, r0, 0 - lsls r0, r2, 2 - movs r5, 0xB5 - lsls r5, 1 - adds r0, r5 - adds r0, r4 -_081D26EA: - strh r3, [r0] - adds r0, 0x4 - adds r2, 0x1 - ldrh r5, [r1] - cmp r2, r5 - ble _081D26EA -_081D26F6: - movs r1, 0x9D - lsls r1, 1 - adds r0, r4, r1 - ldrh r0, [r0] - adds r1, r0, 0x1 - movs r2, 0xD4 - lsls r2, 2 - adds r0, r4, r2 - ldrh r0, [r0] - cmp r0, r1 - bge _081D270E - adds r0, r1, 0 -_081D270E: - adds r2, r0, 0 - cmp r2, 0x79 - bgt _081D272C - movs r1, 0 - lsls r0, r2, 2 - movs r3, 0xB4 - lsls r3, 1 - adds r0, r3 - adds r0, r4 -_081D2720: - strh r1, [r0] - strh r1, [r0, 0x2] - adds r0, 0x4 - adds r2, 0x1 - cmp r2, 0x79 - ble _081D2720 -_081D272C: - movs r3, 0 - movs r5, 0x92 - lsls r5, 2 - adds r1, r4, r5 - movs r2, 0x41 -_081D2736: - ldrh r0, [r1] - ldrh r4, [r1, 0x2] - cmp r0, r4 - bcc _081D2742 - strh r3, [r1, 0x2] - strh r3, [r1] -_081D2742: - adds r1, 0x4 - subs r2, 0x1 - cmp r2, 0 - bge _081D2736 - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81D2634 - - thumb_func_start sub_81D2754 -sub_81D2754: @ 81D2754 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r6, r0, 0 - mov r8, r1 - ldr r1, =gUnknown_08625410 - ldrb r0, [r6] - adds r0, r1 - ldrb r2, [r0] - adds r6, 0x1 - movs r0, 0x9B - mov r3, r8 - strh r0, [r3] - movs r0, 0x5B - subs r0, r2 - strh r0, [r3, 0x2] - movs r7, 0x40 - movs r0, 0 - mov r12, r0 - movs r2, 0x1 - mov r9, r2 - ldr r3, =gSineTable - mov r10, r3 -_081D2786: - adds r0, r7, 0 - adds r0, 0x33 - lsls r0, 24 - lsrs r7, r0, 24 - mov r1, r12 - lsls r0, r1, 24 - movs r2, 0xFF - lsls r2, 24 - adds r0, r2 - lsrs r3, r0, 24 - mov r12, r3 - cmp r0, 0 - bge _081D27A4 - movs r0, 0x4 - mov r12, r0 -_081D27A4: - mov r1, r12 - lsls r0, r1, 24 - asrs r4, r0, 24 - cmp r4, 0x2 - bne _081D27B4 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 -_081D27B4: - ldrb r0, [r6] - ldr r2, =gUnknown_08625410 - adds r0, r2 - ldrb r2, [r0] - adds r6, 0x1 - lsls r0, r4, 2 - mov r1, r8 - adds r3, r0, r1 - adds r0, r7, 0 - adds r0, 0x40 - lsls r0, 1 - add r0, r10 - movs r1, 0 - ldrsh r0, [r0, r1] - muls r0, r2 - asrs r5, r0, 8 - adds r0, r5, 0 - adds r0, 0x9B - strh r0, [r3] - lsls r0, r7, 1 - add r0, r10 - movs r1, 0 - ldrsh r0, [r0, r1] - adds r1, r2, 0 - muls r1, r0 - asrs r1, 8 - movs r0, 0x5B - subs r0, r1 - strh r0, [r3, 0x2] - cmp r4, 0x2 - bgt _081D2800 - cmp r2, 0x20 - bne _081D27FA - cmp r4, 0x2 - beq _081D2800 -_081D27FA: - adds r0, r5, 0 - adds r0, 0x9C - strh r0, [r3] -_081D2800: - mov r0, r9 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - cmp r0, 0x4 - bls _081D2786 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D2754 - - thumb_func_start sub_81D2824 -sub_81D2824: @ 81D2824 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_08625510 - bl InitWindows - bl DeactivateAllTextPrinters - movs r0, 0 - movs r1, 0x1 - movs r2, 0xE0 - bl LoadUserWindowBorderGfx - ldr r0, =gUnknown_0860F074 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r4, 0 -_081D284A: - adds r0, r4, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _081D284A - cmp r5, 0 - bne _081D287C - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0 - movs r2, 0x1 - movs r3, 0xE - bl SetWindowBorderStyle - b _081D288E - .pool -_081D287C: - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0 - movs r2, 0x1 - movs r3, 0xE - bl SetWindowBorderStyle -_081D288E: - movs r0, 0x2 - bl PutWindowTilemap - movs r0, 0x3 - bl PutWindowTilemap - movs r0, 0x2 - movs r1, 0 - movs r2, 0x1 - movs r3, 0xE - bl SetWindowBorderStyle - movs r0, 0x3 - movs r1, 0 - movs r2, 0x1 - movs r3, 0xE - bl SetWindowBorderStyle - bl nullsub_79 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81D2824 - - thumb_func_start nullsub_79 -nullsub_79: @ 81D28C4 - bx lr - thumb_func_end nullsub_79 - - thumb_func_start sub_81D28C8 -sub_81D28C8: @ 81D28C8 - push {r4-r7,lr} - lsls r1, 16 - lsrs r4, r1, 16 - ldr r3, =gMultiuseListMenuTemplate - adds r2, r3, 0 - ldr r1, =gUnknown_08625548 - ldm r1!, {r5-r7} - stm r2!, {r5-r7} - ldm r1!, {r5-r7} - stm r2!, {r5-r7} - strh r4, [r3, 0xC] - str r0, [r3] - cmp r4, 0x5 - bhi _081D28F0 - strh r4, [r3, 0xE] - b _081D28F4 - .pool -_081D28F0: - movs r0, 0x6 - strh r0, [r3, 0xE] -_081D28F4: - ldrb r0, [r3, 0xE] - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81D28C8 - - thumb_func_start sub_81D28FC -sub_81D28FC: @ 81D28FC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - mov r9, r0 - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r5, =gText_BattleMoves2 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x80 - bl GetStringCenterAlignXOffset - adds r4, r0, 0 - lsls r3, r4, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - mov r8, r0 - str r0, [sp, 0x4] - movs r7, 0 - str r7, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - ldr r5, =gText_PPSlash - movs r1, 0x29 - mov r10, r1 - str r1, [sp] - mov r0, r8 - str r0, [sp, 0x4] - str r7, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0x4 - bl AddTextPrinterParameterized - ldr r5, =gText_PowerSlash - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x6A - bl GetStringRightAlignXOffset - adds r4, r0, 0 - lsls r3, r4, 24 - lsrs r3, 24 - movs r1, 0x19 - str r1, [sp] - mov r0, r8 - str r0, [sp, 0x4] - str r7, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - ldr r5, =gText_AccuracySlash - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x6A - bl GetStringRightAlignXOffset - adds r4, r0, 0 - lsls r3, r4, 24 - lsrs r3, 24 - mov r1, r10 - str r1, [sp] - mov r0, r8 - str r0, [sp, 0x4] - str r7, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - movs r0, 0x2 - negs r0, r0 - cmp r9, r0 - bne _081D29C4 - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - b _081D2AB6 - .pool -_081D29C4: - mov r1, r9 - lsls r0, r1, 1 - add r0, r9 - lsls r0, 2 - ldr r1, =gBattleMoves - adds r6, r0, r1 - ldrb r1, [r6, 0x2] - lsls r0, r1, 3 - subs r0, r1 - ldr r1, =gTypeNames - adds r5, r0, r1 - movs r0, 0x19 - str r0, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0x4 - bl AddTextPrinterParameterized - ldr r1, =gText_PPSlash - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0x4 - ldrb r1, [r6, 0x4] - add r0, sp, 0xC - movs r2, 0 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - lsls r3, r4, 24 - lsrs r3, 24 - mov r0, r10 - str r0, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r7, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - add r2, sp, 0xC - bl AddTextPrinterParameterized - ldrb r0, [r6, 0x1] - cmp r0, 0x1 - bhi _081D2A3C - ldr r5, =gText_ThreeDashes - b _081D2A4A - .pool -_081D2A3C: - ldrb r1, [r6, 0x1] - add r0, sp, 0xC - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - add r5, sp, 0xC -_081D2A4A: - movs r0, 0x19 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0x6A - bl AddTextPrinterParameterized - ldrb r0, [r6, 0x3] - cmp r0, 0 - bne _081D2A70 - ldr r5, =gText_ThreeDashes - b _081D2A7E - .pool -_081D2A70: - ldrb r1, [r6, 0x3] - add r0, sp, 0xC - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - add r5, sp, 0xC -_081D2A7E: - movs r0, 0x29 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0x6A - bl AddTextPrinterParameterized - ldr r1, =gMoveDescriptionPointers - mov r0, r9 - subs r0, 0x1 - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - movs r0, 0x41 - str r0, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x7 - adds r2, r5, 0 - movs r3, 0 - bl AddTextPrinterParameterized -_081D2AB6: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D28FC - - thumb_func_start sub_81D2ACC -sub_81D2ACC: @ 81D2ACC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r4, r0, 0 - bl ShowHideHearts - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r5, =gText_ContestMoves2 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x80 - bl GetStringCenterAlignXOffset - lsls r3, r0, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r7, 0xFF - str r7, [sp, 0x4] - movs r6, 0 - str r6, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - ldr r5, =gText_Appeal2 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x5C - bl GetStringRightAlignXOffset - lsls r3, r0, 24 - lsrs r3, 24 - movs r0, 0x19 - mov r8, r0 - str r0, [sp] - str r7, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - ldr r5, =gText_Jam2 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x5C - bl GetStringRightAlignXOffset - lsls r3, r0, 24 - lsrs r3, 24 - movs r0, 0x29 - str r0, [sp] - str r7, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - bne _081D2B6C - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - b _081D2BB8 - .pool -_081D2B6C: - lsls r4, 3 - ldr r0, =gContestMoves - adds r4, r0 - ldr r1, =gContestMoveTypeTextPointers - ldrb r0, [r4, 0x1] - lsls r0, 29 - lsrs r0, 27 - adds r0, r1 - ldr r5, [r0] - mov r0, r8 - str r0, [sp] - str r7, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0x4 - bl AddTextPrinterParameterized - ldr r1, =gContestEffectDescriptionPointers - ldrb r0, [r4] - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - movs r0, 0x41 - str r0, [sp] - str r7, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x7 - adds r2, r5, 0 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram -_081D2BB8: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D2ACC - - thumb_func_start sub_81D2BD0 -sub_81D2BD0: @ 81D2BD0 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x1 - beq _081D2BE2 - movs r0, 0x5 - bl PlaySE -_081D2BE2: - adds r0, r4, 0 - bl sub_81D28FC - adds r0, r4, 0 - bl sub_81D2ACC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81D2BD0 - - thumb_func_start sub_81D2BF4 -sub_81D2BF4: @ 81D2BF4 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - bl GetPlayerTextSpeedDelay - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r1, 0x1 - adds r2, r4, 0 - bl AddTextPrinterParameterized2 - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D2BF4 - - thumb_func_start sub_81D2C3C -sub_81D2C3C: @ 81D2C3C - push {lr} - bl RunTextPrinters - movs r0, 0x3 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_81D2C3C - - thumb_func_start sub_81D2C50 -sub_81D2C50: @ 81D2C50 - push {lr} - ldr r0, =gUnknown_08625540 - movs r1, 0x1 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D2C50 - - thumb_func_start sub_81D2C68 -sub_81D2C68: @ 81D2C68 - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - cmp r0, 0xE - bne _081D2CA8 - cmp r2, 0x2 - beq _081D2C7E - cmp r2, 0x7 - bne _081D2C94 -_081D2C7E: - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r2, 0 - adds r2, r3, 0 - bl GetMonData - b _081D2CCA - .pool -_081D2C94: - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r2, 0 - bl GetMonData - b _081D2CCA - .pool -_081D2CA8: - cmp r2, 0x2 - beq _081D2CB0 - cmp r2, 0x7 - bne _081D2CBE -_081D2CB0: - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - bl GetAndCopyBoxMonDataAt - b _081D2CCA -_081D2CBE: - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - bl GetBoxMonDataAt -_081D2CCA: - pop {r1} - bx r1 - thumb_func_end sub_81D2C68 - - thumb_func_start sub_81D2CD0 -sub_81D2CD0: @ 81D2CD0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 16 - lsrs r6, r2, 16 - movs r0, 0xFC - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x4 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x8 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0 - strb r0, [r5] - adds r5, 0x1 - movs r0, 0x9 - strb r0, [r5] - adds r5, 0x1 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x2D - movs r3, 0 - bl sub_81D2C68 - cmp r0, 0 - beq _081D2D20 - ldr r1, =gText_EggNickname - adds r0, r5, 0 - movs r2, 0 - movs r3, 0xC - bl StringCopyPadded - b _081D2E70 - .pool -_081D2D20: - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x2 - adds r3, r5, 0 - bl sub_81D2C68 - adds r0, r5, 0 - bl StringGetEnd10 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0xB - movs r3, 0 - bl sub_81D2C68 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r4, 0xE - bne _081D2D70 - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x38 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r4, 0 - bl GetMonGender - lsls r0, 24 - lsrs r6, r0, 24 - b _081D2D92 - .pool -_081D2D70: - lsls r0, r4, 24 - lsrs r0, 24 - lsls r1, r6, 24 - lsrs r1, 24 - bl GetBoxedMonPtr - adds r4, r0, 0 - bl GetBoxMonGender - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r4, 0 - bl GetLevelFromBoxMonExp - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 -_081D2D92: - cmp r7, 0x1D - beq _081D2D9A - cmp r7, 0x20 - bne _081D2DB0 -_081D2D9A: - movs r0, 0xB - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r5, 0 - bl StringCompare - cmp r0, 0 - bne _081D2DB0 - movs r6, 0xFF -_081D2DB0: - adds r3, r5, 0 - b _081D2DBA - .pool -_081D2DB8: - adds r3, 0x1 -_081D2DBA: - ldrb r0, [r3] - cmp r0, 0xFF - bne _081D2DB8 - movs r1, 0xFC - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x12 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x3C - strb r0, [r3] - adds r3, 0x1 - cmp r6, 0 - beq _081D2DDE - cmp r6, 0xFE - beq _081D2E02 - movs r0, 0 - b _081D2E24 -_081D2DDE: - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x1 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x4 - strb r0, [r3] - adds r3, 0x1 - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x3 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x5 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xB5 - b _081D2E24 -_081D2E02: - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x1 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x6 - strb r0, [r3] - adds r3, 0x1 - strb r1, [r3] - adds r3, 0x1 - movs r0, 0x3 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x7 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xB6 -_081D2E24: - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xFC - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x4 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x8 - strb r0, [r3] - adds r3, 0x1 - movs r4, 0 - strb r4, [r3] - adds r3, 0x1 - movs r0, 0x9 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xBA - strb r0, [r3] - adds r3, 0x1 - movs r0, 0xF9 - strb r0, [r3] - adds r3, 0x1 - movs r0, 0x5 - strb r0, [r3] - adds r3, 0x1 - adds r0, r3, 0 - mov r1, r8 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r3, r0, 0 - strb r4, [r3] - adds r3, 0x1 - movs r0, 0xFF - strb r0, [r3] - adds r0, r3, 0 -_081D2E70: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81D2CD0 - - thumb_func_start sub_81D2E7C -sub_81D2E7C: @ 81D2E7C - push {r4,lr} - adds r4, r0, 0 - lsls r2, 16 - lsrs r2, 16 - b _081D2E94 -_081D2E86: - strb r3, [r4] - adds r1, 0x1 - adds r4, 0x1 - lsls r0, r2, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 -_081D2E94: - ldrb r3, [r1] - adds r0, r3, 0 - cmp r0, 0xFF - bne _081D2E86 - adds r1, r2, 0 - lsls r0, r1, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 - lsls r1, 16 - cmp r1, 0 - ble _081D2EC2 - movs r3, 0 -_081D2EAE: - strb r3, [r4] - adds r4, 0x1 - adds r1, r2, 0 - lsls r0, r1, 16 - ldr r2, =0xffff0000 - adds r0, r2 - lsrs r2, r0, 16 - lsls r1, 16 - cmp r1, 0 - bgt _081D2EAE -_081D2EC2: - movs r0, 0xFF - strb r0, [r4] - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D2E7C - - thumb_func_start sub_81D2ED4 -sub_81D2ED4: @ 81D2ED4 - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r0, [sp, 0x14] - ldr r1, [sp, 0x18] - ldr r4, [sp, 0x1C] - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - lsrs r0, r1, 16 - lsls r4, 24 - cmp r4, 0 - bne _081D2EFC - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 -_081D2EFC: - cmp r2, r0 - beq _081D2F42 - adds r0, r6, 0 - adds r1, r7, 0 - adds r2, r3, 0 - bl sub_81D2CD0 - movs r0, 0xFC - strb r0, [r5] - movs r0, 0x4 - strb r0, [r5, 0x1] - movs r0, 0x8 - strb r0, [r5, 0x2] - movs r0, 0 - strb r0, [r5, 0x3] - movs r0, 0x9 - strb r0, [r5, 0x4] - cmp r7, 0xE - bne _081D2F2C - adds r0, r5, 0x5 - ldr r1, =gText_InParty - b _081D2F3A - .pool -_081D2F2C: - adds r4, r5, 0x5 - lsls r0, r7, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 -_081D2F3A: - movs r2, 0x8 - bl sub_81D2E7C - b _081D2F72 -_081D2F42: - movs r1, 0 - movs r2, 0 -_081D2F46: - adds r0, r6, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0xB - bls _081D2F46 - adds r1, r6, r1 - movs r0, 0xFF - strb r0, [r1] - movs r1, 0 - movs r2, 0 -_081D2F5E: - adds r0, r5, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x7 - bls _081D2F5E - adds r1, r5, r1 - movs r0, 0xFF - strb r0, [r1] -_081D2F72: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D2ED4 - - thumb_func_start sub_81D2F78 -sub_81D2F78: @ 81D2F78 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - mov r10, r1 - ldr r0, [sp, 0x20] - ldr r1, [sp, 0x24] - ldr r4, [sp, 0x28] - ldr r5, [sp, 0x2C] - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r6, r3, 16 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - lsls r4, 16 - lsrs r0, r4, 16 - lsls r5, 24 - cmp r5, 0 - bne _081D2FB0 - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 -_081D2FB0: - cmp r2, r0 - beq _081D305C - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x16 - movs r3, 0 - bl sub_81D2C68 - mov r1, r9 - lsls r5, r1, 2 - adds r4, r5, r1 - mov r2, r8 - adds r1, r2, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x2F - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x1 - adds r1, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x21 - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x2 - adds r1, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x18 - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x3 - adds r1, r4 - strb r0, [r1] - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x17 - movs r3, 0 - bl sub_81D2C68 - mov r1, r8 - adds r1, 0x4 - adds r1, r4 - strb r0, [r1] - mov r4, r10 - add r4, r9 - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x30 - movs r3, 0 - bl sub_81D2C68 - cmp r0, 0xFF - beq _081D3044 - adds r0, r7, 0 - adds r1, r6, 0 - movs r2, 0x30 - movs r3, 0 - bl sub_81D2C68 - movs r1, 0x1D - bl __udivsi3 - b _081D3046 -_081D3044: - movs r0, 0x9 -_081D3046: - strb r0, [r4] - mov r0, r9 - adds r1, r5, r0 - mov r2, r8 - adds r0, r2, r1 - lsls r1, 2 - adds r1, 0x14 - add r1, r8 - bl sub_81D2754 - b _081D3086 -_081D305C: - movs r2, 0 - mov r0, r9 - lsls r5, r0, 2 - adds r1, r5, r0 - movs r6, 0 - lsls r3, r1, 2 - movs r5, 0x9B - movs r4, 0x5B -_081D306C: - adds r0, r2, r1 - add r0, r8 - strb r6, [r0] - lsls r0, r2, 2 - adds r0, r3 - add r0, r8 - strh r5, [r0, 0x14] - strh r4, [r0, 0x16] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x4 - bls _081D306C -_081D3086: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D2F78 - - thumb_func_start sub_81D3094 -sub_81D3094: @ 81D3094 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - mov r8, r0 - mov r9, r1 - ldr r0, [sp, 0x20] - ldr r1, [sp, 0x24] - ldr r4, [sp, 0x28] - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r5, r3, 16 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - lsrs r0, r1, 16 - lsls r4, 24 - cmp r4, 0 - bne _081D30C4 - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 -_081D30C4: - cmp r2, r0 - beq _081D311A - adds r0, r7, 0 - adds r1, r5, 0 - movs r2, 0x41 - movs r3, 0 - bl sub_81D2C68 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r7, 0 - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0 - bl sub_81D2C68 - adds r6, r0, 0 - adds r0, r7, 0 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl sub_81D2C68 - adds r5, r0, 0 - lsls r0, r4, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - movs r1, 0x1 - str r1, [sp] - mov r1, r8 - adds r2, r4, 0 - adds r3, r5, 0 - bl LoadSpecialPokePic - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl GetFrontSpritePalFromSpeciesAndPersonality - mov r1, r9 - bl LZ77UnCompWram -_081D311A: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3094 - - thumb_func_start sub_81D312C -sub_81D312C: @ 81D312C - push {lr} - adds r1, r0, 0 - ldrh r0, [r1] - adds r0, 0x18 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - ble _081D3140 - movs r0, 0 - strh r0, [r1] -_081D3140: - movs r0, 0 - ldrsh r1, [r1, r0] - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - pop {r1} - bx r1 - thumb_func_end sub_81D312C - - thumb_func_start sub_81D3150 -sub_81D3150: @ 81D3150 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1] - subs r0, 0x18 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x50 - negs r2, r2 - cmp r0, r2 - bge _081D3168 - strh r2, [r1] -_081D3168: - movs r0, 0 - ldrsh r1, [r1, r0] - eors r1, r2 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - pop {r1} - bx r1 - thumb_func_end sub_81D3150 - - thumb_func_start sub_81D3178 -sub_81D3178: @ 81D3178 - push {r4,r5,lr} - adds r5, r1, 0 - bl sub_81D2074 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - bl sub_81D312C - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - cmp r4, 0 - bne _081D319A - cmp r0, 0 - beq _081D319C -_081D319A: - movs r1, 0x1 -_081D319C: - adds r0, r1, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3178 - - thumb_func_start sub_81D31A4 -sub_81D31A4: @ 81D31A4 - push {r4,r5,lr} - adds r5, r1, 0 - bl sub_81D2074 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - bl sub_81D3150 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - cmp r4, 0 - bne _081D31C6 - cmp r0, 0 - beq _081D31C8 -_081D31C6: - movs r1, 0x1 -_081D31C8: - adds r0, r1, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D31A4 - - thumb_func_start sub_81D31D0 -sub_81D31D0: @ 81D31D0 - push {r4-r7,lr} - sub sp, 0x20 - ldr r3, =gUnknown_08625A48 - ldr r4, [r3] - ldr r5, [r3, 0x4] - str r4, [sp, 0x18] - str r5, [sp, 0x1C] - mov r4, sp - ldr r3, =gUnknown_08625A50 - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - ldr r3, =gUnknown_08625A68 - ldr r4, [r3, 0x4] - ldr r3, [r3] - ldr r5, [sp, 0x18] - ldr r6, [sp, 0x1C] - str r5, [r0] - str r6, [r0, 0x4] - mov r0, sp - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - str r3, [r2] - str r4, [r2, 0x4] - add sp, 0x20 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D31D0 - - thumb_func_start sub_81D321C -sub_81D321C: @ 81D321C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x50 - adds r5, r0, 0 - mov r12, r1 - mov r8, r2 - mov r1, sp - ldr r0, =gUnknown_08625A70 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - ldm r0!, {r3,r4} - stm r1!, {r3,r4} - add r3, sp, 0x20 - adds r1, r3, 0 - ldr r0, =gUnknown_08625A90 - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - add r2, sp, 0x38 - adds r1, r2, 0 - ldr r0, =gUnknown_08625AA8 - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - movs r4, 0 -_081D3258: - lsls r0, r4, 3 - add r0, sp - ldr r1, [r0, 0x4] - ldr r0, [r0] - stm r5!, {r0,r1} - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _081D3258 - mov r1, r12 - adds r0, r2, 0 - ldm r0!, {r2,r4,r5} - stm r1!, {r2,r4,r5} - ldm r0!, {r2,r6,r7} - stm r1!, {r2,r6,r7} - movs r4, 0 -_081D327A: - lsls r0, r4, 3 - adds r0, r3, r0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - mov r5, r8 - adds r5, 0x8 - mov r8, r5 - subs r5, 0x8 - stm r5!, {r0,r1} - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _081D327A - add sp, 0x50 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D321C - - thumb_func_start sub_81D32B0 -sub_81D32B0: @ 81D32B0 - push {r4,r5,lr} - ldr r2, =gUnknown_08625AC0 - ldr r4, [r2] - ldr r5, [r2, 0x4] - ldr r2, =gUnknown_08625AC8 - ldr r3, [r2, 0x4] - ldr r2, [r2] - str r4, [r0] - str r5, [r0, 0x4] - str r2, [r1] - str r3, [r1, 0x4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D32B0 - - thumb_func_start sub_81D32D4 -sub_81D32D4: @ 81D32D4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - adds r0, 0x1 - strh r0, [r1, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - ble _081D32F0 - movs r0, 0 - strh r0, [r1, 0x30] - adds r0, r1, 0 - bl sub_81D3408 -_081D32F0: - pop {r0} - bx r0 - thumb_func_end sub_81D32D4 - - thumb_func_start sub_81D32F4 -sub_81D32F4: @ 81D32F4 - push {lr} - adds r2, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081D330C - movs r0, 0 - strh r0, [r2, 0x30] - ldr r0, =sub_81D32D4 - str r0, [r2, 0x1C] -_081D330C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D32F4 - - thumb_func_start sub_81D3314 -sub_81D3314: @ 81D3314 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x36 - ldrsh r0, [r4, r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r3, r1, r0 - cmp r3, 0 - beq _081D3360 - ldrh r1, [r3, 0x24] - ldrh r2, [r3, 0x20] - adds r1, r2 - ldr r2, =gUnknown_08625B2C - movs r5, 0x2E - ldrsh r0, [r4, r5] - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r1, [r3, 0x26] - ldrh r3, [r3, 0x22] - adds r1, r3 - movs r3, 0x2E - ldrsh r0, [r4, r3] - lsls r0, 2 - adds r2, 0x2 - adds r0, r2 - ldrh r0, [r0] - adds r0, r1 - b _081D337E - .pool -_081D3360: - ldr r1, =gUnknown_08625B2C - movs r5, 0x2E - ldrsh r0, [r4, r5] - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0] - adds r0, 0x28 - strh r0, [r4, 0x20] - movs r2, 0x2E - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r1, 0x2 - adds r0, r1 - ldrh r0, [r0] - adds r0, 0x68 -_081D337E: - strh r0, [r4, 0x22] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3314 - - thumb_func_start sub_81D338C -sub_81D338C: @ 81D338C - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r2 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - movs r5, 0 -_081D339E: - lsls r0, r5, 2 - mov r1, r8 - adds r4, r0, r1 - ldr r0, [r4] - cmp r0, 0 - beq _081D33F0 - strh r5, [r0, 0x2E] - ldr r1, [r4] - lsls r0, r5, 4 - adds r0, 0x1 - strh r0, [r1, 0x30] - ldr r0, [r4] - strh r6, [r0, 0x32] - ldr r0, [r4] - strh r5, [r0, 0x34] - cmp r7, 0 - beq _081D33C4 - cmp r6, 0x9 - beq _081D33D0 -_081D33C4: - ldr r1, [r4] - ldr r0, =sub_81D3564 - str r0, [r1, 0x1C] - b _081D33F0 - .pool -_081D33D0: - ldr r0, [r4] - bl sub_81D3314 - ldr r0, [r4] - bl sub_81D35E8 - ldr r2, [r4] - ldr r0, =sub_81D32F4 - str r0, [r2, 0x1C] - adds r2, 0x3E - ldrb r0, [r2] - movs r3, 0x5 - negs r3, r3 - adds r1, r3, 0 - ands r0, r1 - strb r0, [r2] -_081D33F0: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x9 - bls _081D339E - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D338C - - thumb_func_start sub_81D3408 -sub_81D3408: @ 81D3408 - push {r4-r7,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x38] - lsls r0, 24 - lsrs r2, r0, 24 - movs r3, 0 - movs r1, 0x32 - ldrsh r0, [r4, r1] - adds r0, 0x1 - cmp r3, r0 - bge _081D3454 - ldr r5, =gSprites - movs r7, 0x1C - adds r7, r5 - mov r12, r7 - ldr r6, =sub_81D3564 -_081D3428: - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r2, r1, r5 - movs r7, 0x2E - ldrsh r0, [r2, r7] - lsls r0, 4 - adds r0, 0x1 - strh r0, [r2, 0x30] - add r1, r12 - str r6, [r1] - ldrh r0, [r2, 0x38] - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - movs r1, 0x32 - ldrsh r0, [r4, r1] - adds r0, 0x1 - cmp r3, r0 - blt _081D3428 -_081D3454: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3408 - - thumb_func_start sub_81D3464 -sub_81D3464: @ 81D3464 - push {lr} - adds r2, r0, 0 - movs r1, 0 - movs r3, 0 -_081D346C: - lsls r0, r1, 2 - adds r0, r2 - str r3, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x9 - bls _081D346C - pop {r0} - bx r0 - thumb_func_end sub_81D3464 - - thumb_func_start sub_81D3480 -sub_81D3480: @ 81D3480 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - lsls r2, 24 - movs r0, 0 - mov r9, r0 - lsrs r7, r2, 24 - movs r5, 0 - adds r0, r7, 0x1 - cmp r9, r0 - bge _081D34FE -_081D34A2: - ldr r0, =gUnknown_08625B14 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r3, r0, 24 - adds r6, r3, 0 - cmp r3, 0x40 - beq _081D34FE - lsls r0, r5, 2 - mov r1, r8 - adds r4, r0, r1 - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r4] - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r4] - mov r1, r10 - strh r1, [r0, 0x36] - cmp r5, 0 - beq _081D34F0 - subs r0, r4, 0x4 - ldr r0, [r0] - strh r3, [r0, 0x38] - b _081D34F2 - .pool -_081D34F0: - mov r9, r6 -_081D34F2: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r7, 0x1 - cmp r5, r0 - blt _081D34A2 -_081D34FE: - lsls r0, r7, 2 - add r0, r8 - ldr r0, [r0] - mov r1, r9 - strh r1, [r0, 0x38] - adds r0, r7, 0 - movs r1, 0x1 - mov r2, r8 - bl sub_81D338C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D3480 - - thumb_func_start sub_81D3520 -sub_81D3520: @ 81D3520 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 -_081D3526: - cmp r5, 0x9 - bhi _081D3544 - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - cmp r0, 0 - beq _081D3544 - bl DestroySprite - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - b _081D3526 -_081D3544: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81D3520 - - thumb_func_start sub_81D354C -sub_81D354C: @ 81D354C - push {lr} - bl sub_81D3520 - movs r0, 0x68 - bl FreeSpriteTilesByTag - movs r0, 0x68 - bl FreeSpritePaletteByTag - pop {r0} - bx r0 - thumb_func_end sub_81D354C - - thumb_func_start sub_81D3564 -sub_81D3564: @ 81D3564 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _081D3592 - subs r0, r1, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - cmp r0, 0 - bne _081D35DC - adds r0, r4, 0 - movs r1, 0 - bl SeekSpriteAnim - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_081D3592: - adds r0, r4, 0 - bl sub_81D3314 - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081D35DC - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x34 - ldrsh r1, [r4, r0] - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _081D35D8 - cmp r1, 0x9 - bne _081D35D0 - adds r0, r4, 0 - bl sub_81D35E8 - ldr r0, =sub_81D32F4 - b _081D35DA - .pool -_081D35D0: - ldr r0, =sub_81D32D4 - b _081D35DA - .pool -_081D35D8: - ldr r0, =SpriteCallbackDummy -_081D35DA: - str r0, [r4, 0x1C] -_081D35DC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3564 - - thumb_func_start sub_81D35E8 -sub_81D35E8: @ 81D35E8 - push {r4-r7,lr} - adds r6, r0, 0 - ldrh r0, [r6, 0x38] - lsls r0, 24 - lsrs r1, r0, 24 - movs r5, 0 - movs r2, 0x32 - ldrsh r0, [r6, r2] - adds r0, 0x1 - cmp r5, r0 - bge _081D3636 - movs r0, 0x5 - negs r0, r0 - adds r7, r0, 0 -_081D3604: - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r4, 0 - movs r1, 0 - bl SeekSpriteAnim - adds r1, r4, 0 - adds r1, 0x3E - ldrb r0, [r1] - ands r0, r7 - strb r0, [r1] - ldrh r0, [r4, 0x38] - lsls r0, 24 - lsrs r1, r0, 24 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0x32 - ldrsh r0, [r6, r2] - adds r0, 0x1 - cmp r5, r0 - blt _081D3604 -_081D3636: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D35E8 - - thumb_func_start sub_81D3640 -sub_81D3640: @ 81D3640 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - mov r8, r0 - adds r6, r1, 0 - adds r5, r2, 0 - adds r4, r3, 0 - ldr r3, [sp, 0x4C] - ldr r0, [sp, 0x50] - mov r9, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r3, 24 - lsrs r3, 24 - mov r1, r9 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, r4, 4 - orrs r1, r4 - lsls r1, 24 - lsrs r1, 24 - str r3, [sp, 0x28] - bl FillWindowPixelBuffer - add r2, sp, 0xC - ldrh r0, [r5] - ldrh r1, [r6] - subs r0, r1 - strh r0, [r2] - ldrh r0, [r5, 0x2] - ldrh r1, [r6, 0x2] - subs r0, r1 - strh r0, [r2, 0x2] - ldrh r0, [r5, 0x4] - ldrh r1, [r6, 0x4] - subs r0, r1 - strh r0, [r2, 0x4] - ldrh r0, [r5, 0x8] - ldrh r1, [r6, 0x8] - subs r0, r1 - strh r0, [r2, 0x6] - ldrh r0, [r5, 0xA] - ldrh r1, [r6, 0xA] - subs r0, r1 - strh r0, [r2, 0x8] - ldrh r0, [r5, 0x6] - ldrh r1, [r6, 0x6] - subs r0, r1 - strh r0, [r2, 0xA] - add r0, sp, 0x24 - strb r4, [r0] - ldr r3, [sp, 0x28] - strb r3, [r0, 0x1] - mov r1, r9 - strb r1, [r0, 0x2] - movs r7, 0 - mov r10, r0 - movs r0, 0x1 - negs r0, r0 - mov r9, r0 - add r6, sp, 0x18 -_081D36CA: - lsls r0, r7, 4 - subs r0, r7 - lsls r0, 24 - lsrs r5, r0, 24 - mov r1, r10 - str r1, [sp] - mov r0, r9 - str r0, [sp, 0x4] - ldr r1, =gUnknown_08625B54 - lsls r0, r7, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - movs r2, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - lsls r0, r7, 1 - mov r4, sp - adds r4, r0 - adds r4, 0xC - movs r1, 0 - ldrsh r0, [r4, r1] - ldr r1, =gText_Dash - cmp r0, 0 - blt _081D3704 - ldr r1, =gText_UnkCtrlF904 -_081D3704: - adds r0, r6, 0 - bl StringCopy - mov r0, r10 - str r0, [sp] - mov r1, r9 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - movs r2, 0x38 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - movs r0, 0 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081D372C - negs r0, r1 -_081D372C: - movs r4, 0xC - cmp r0, 0x9 - bgt _081D3734 - movs r4, 0x12 -_081D3734: - cmp r1, 0 - bge _081D373A - negs r1, r1 -_081D373A: - adds r0, r6, 0 - movs r2, 0 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r2, r4, 0 - adds r2, 0x38 - mov r1, r10 - str r1, [sp] - mov r0, r9 - str r0, [sp, 0x4] - str r6, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x5 - bls _081D36CA - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3640 - - thumb_func_start sub_81D3784 -sub_81D3784: @ 81D3784 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - mov r8, r0 - adds r5, r1, 0 - adds r4, r2, 0 - adds r6, r3, 0 - ldr r2, [sp, 0x4C] - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, r4, 4 - orrs r1, r4 - lsls r1, 24 - lsrs r1, 24 - str r2, [sp, 0x28] - bl FillWindowPixelBuffer - add r1, sp, 0xC - ldrh r0, [r5] - strh r0, [r1] - ldrh r0, [r5, 0x2] - strh r0, [r1, 0x2] - ldrh r0, [r5, 0x4] - strh r0, [r1, 0x4] - ldrh r0, [r5, 0x8] - strh r0, [r1, 0x6] - ldrh r0, [r5, 0xA] - strh r0, [r1, 0x8] - ldrh r0, [r5, 0x6] - strh r0, [r1, 0xA] - add r0, sp, 0x24 - strb r4, [r0] - strb r6, [r0, 0x1] - ldr r2, [sp, 0x28] - strb r2, [r0, 0x2] - movs r6, 0 - add r1, sp, 0x18 - mov r9, r1 - mov r7, r8 - mov r10, r0 - movs r2, 0x1 - negs r2, r2 - mov r8, r2 -_081D37EE: - lsls r1, r6, 1 - mov r0, sp - adds r0, r1 - adds r0, 0xC - movs r2, 0 - ldrsh r0, [r0, r2] - movs r4, 0x3 - cmp r0, 0x63 - bgt _081D3808 - movs r4, 0x1 - cmp r0, 0x9 - ble _081D3808 - movs r4, 0x2 -_081D3808: - mov r0, sp - adds r0, r1 - adds r0, 0xC - movs r2, 0 - ldrsh r1, [r0, r2] - mov r0, r9 - movs r2, 0 - adds r3, r4, 0 - bl ConvertIntToDecimalStringN - movs r0, 0x4 - subs r0, r4 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 17 - lsrs r4, 16 - lsls r5, r6, 4 - subs r5, r6 - lsls r5, 24 - lsrs r5, 24 - mov r0, r10 - str r0, [sp] - mov r1, r8 - str r1, [sp, 0x4] - ldr r1, =gUnknown_08625B54 - lsls r0, r6, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r4, 0x38 - lsls r4, 24 - lsrs r4, 24 - mov r2, r10 - str r2, [sp] - mov r0, r8 - str r0, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _081D37EE - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3784 - - thumb_func_start sub_81D388C -sub_81D388C: @ 81D388C - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r5] - adds r0, r4, 0 - movs r1, 0x3B - bl GetMonData - strh r0, [r5, 0x2] - adds r0, r4, 0 - movs r1, 0x3C - bl GetMonData - strh r0, [r5, 0x4] - adds r0, r4, 0 - movs r1, 0x3D - bl GetMonData - strh r0, [r5, 0x6] - adds r0, r4, 0 - movs r1, 0x3E - bl GetMonData - strh r0, [r5, 0x8] - adds r0, r4, 0 - movs r1, 0x3F - bl GetMonData - strh r0, [r5, 0xA] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81D388C - - thumb_func_start sub_81D38D4 -sub_81D38D4: @ 81D38D4 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d6d - adds r0, r1 - ldrb r1, [r0] - adds r2, r1, 0x1 - adds r0, r2, 0 - asrs r0, 8 - lsls r0, 8 - subs r0, r2, r0 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D38D4 - - thumb_func_start sub_81D38FC -sub_81D38FC: @ 81D38FC - push {r4,r5,lr} - adds r4, r0, 0 - movs r5, 0x9C - lsls r5, 2 - adds r1, r5, 0 - bl CalcByteArraySum - adds r4, r5 - ldr r1, [r4] - cmp r0, r1 - bne _081D3916 - movs r0, 0x1 - b _081D3918 -_081D3916: - movs r0, 0 -_081D3918: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D38FC - - thumb_func_start sub_81D3920 -sub_81D3920: @ 81D3920 - push {r4-r7,lr} - adds r7, r0, 0 - ldrb r6, [r7] - subs r0, r6, 0x1 - cmp r0, 0x7 - bhi _081D3964 - movs r5, 0 - cmp r5, r6 - bcs _081D394C - adds r4, r7, 0 - adds r4, 0x8 -_081D3936: - adds r0, r4, 0 - bl sub_81D38FC - cmp r0, 0 - beq _081D3964 - movs r0, 0x9D - lsls r0, 2 - adds r4, r0 - adds r5, 0x1 - cmp r5, r6 - bcc _081D3936 -_081D394C: - adds r0, r7, 0 - adds r0, 0x8 - movs r1, 0x9D - lsls r1, 2 - muls r1, r6 - bl CalcByteArraySum - ldr r1, [r7, 0x4] - cmp r0, r1 - bne _081D3964 - movs r0, 0x1 - b _081D3966 -_081D3964: - movs r0, 0 -_081D3966: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81D3920 - - thumb_func_start sub_81D396C -sub_81D396C: @ 81D396C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - subs r0, 0x1 - cmp r0, 0x7 - bhi _081D398E - adds r0, r4, 0 - adds r0, 0x8 - movs r1, 0xEE - lsls r1, 4 - bl CalcByteArraySum - ldr r1, [r4, 0x4] - cmp r0, r1 - bne _081D398E - movs r0, 0x1 - b _081D3990 -_081D398E: - movs r0, 0 -_081D3990: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D396C - - thumb_func_start sub_81D3998 -sub_81D3998: @ 81D3998 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - mov r8, r1 - movs r2, 0x80 - lsls r2, 5 - mov r0, r8 - movs r1, 0 - bl memset - ldrb r0, [r7] - mov r1, r8 - strb r0, [r1] - bl sub_81D38D4 - mov r2, r8 - strb r0, [r2, 0x1] - ldrb r0, [r7] - adds r0, 0x1 - asrs r0, 1 - strb r0, [r2, 0x2] - movs r6, 0 - b _081D3A42 -_081D39C8: - movs r0, 0x1 - ands r0, r6 - cmp r0, 0 - bne _081D3A14 - lsrs r0, r6, 31 - adds r0, r6, r0 - asrs r0, 1 - lsls r4, r0, 4 - subs r4, r0 - lsls r4, 3 - subs r4, r0 - lsls r4, 3 - add r4, r8 - movs r0, 0x9D - lsls r0, 2 - adds r5, r6, 0 - muls r5, r0 - adds r5, r7, r5 - ldrb r0, [r5, 0x8] - strb r0, [r4, 0x8] - movs r1, 0xA7 - lsls r1, 2 - adds r0, r4, r1 - movs r2, 0xAA - lsls r2, 1 - adds r1, r5, r2 - subs r2, 0x30 - bl memcpy - adds r4, 0xC - adds r5, 0xC - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0xA4 - lsls r2, 1 - bl memcpy - b _081D3A40 -_081D3A14: - lsrs r1, r6, 31 - adds r1, r6, r1 - asrs r1, 1 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 3 - subs r0, r1 - lsls r0, 3 - add r0, r8 - movs r1, 0x9D - lsls r1, 2 - muls r1, r6 - adds r1, r7, r1 - ldrb r2, [r1, 0x8] - strb r2, [r0, 0x9] - movs r2, 0xAA - lsls r2, 1 - adds r0, r2 - adds r1, 0xC - subs r2, 0xC - bl memcpy -_081D3A40: - adds r6, 0x1 -_081D3A42: - ldrb r0, [r7] - cmp r6, r0 - blt _081D39C8 - movs r0, 0x1 - ands r0, r6 - cmp r0, 0 - beq _081D3A7E - lsrs r2, r6, 31 - adds r2, r6, r2 - asrs r2, 1 - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 3 - subs r0, r2 - lsls r0, 3 - add r0, r8 - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - ldr r3, =gUnknown_08625B6C - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r2 - lsls r1, 3 - adds r1, r3 - movs r2, 0xA4 - lsls r2, 1 - bl memcpy -_081D3A7E: - mov r0, r8 - adds r0, 0x8 - movs r1, 0xEE - lsls r1, 4 - bl CalcByteArraySum - mov r2, r8 - str r0, [r2, 0x4] - movs r0, 0x1E - mov r1, r8 - bl sub_8153634 - cmp r0, 0x1 - bne _081D3AA4 - movs r0, 0x1 - b _081D3AA6 - .pool -_081D3AA4: - movs r0, 0 -_081D3AA6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81D3998 - - thumb_func_start sub_81D3AB0 -sub_81D3AB0: @ 81D3AB0 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - adds r5, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81D3998 - adds r4, r0, 0 - adds r0, r5, 0 - bl Free - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3AB0 - - thumb_func_start sub_81D3AD8 -sub_81D3AD8: @ 81D3AD8 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r0, 0x1E - bl TryCopySpecialSaveSection - cmp r0, 0x1 - bne _081D3B04 - ldr r2, =0x00000ee8 - adds r0, r5, 0 - adds r1, r4, 0 - bl memcpy - adds r0, r5, 0 - bl sub_81D396C - cmp r0, 0 - beq _081D3B04 - movs r0, 0x1 - b _081D3B06 - .pool -_081D3B04: - movs r0, 0 -_081D3B06: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3AD8 - - thumb_func_start sub_81D3B0C -sub_81D3B0C: @ 81D3B0C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - adds r5, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81D3AD8 - adds r4, r0, 0 - adds r0, r5, 0 - bl Free - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3B0C - - thumb_func_start sub_81D3B34 -sub_81D3B34: @ 81D3B34 - push {r4,r5,lr} - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - adds r4, r0, 0 - bl sub_81D3B0C - adds r5, r0, 0 - adds r0, r4, 0 - bl Free - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D3B34 - - thumb_func_start sub_81D3B54 -sub_81D3B54: @ 81D3B54 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - adds r5, r1, 0 - bl sub_81D41A0 - movs r7, 0x2 - ldr r4, =gShouldAdvanceLinkState -_081D3B64: - bl sub_81D4170 - ldr r0, =gUnknown_030012E2 - ldrh r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081D3B76 - strb r7, [r4] -_081D3B76: - movs r0, 0x1 - adds r1, r6, 0 - adds r2, r5, 0 - movs r3, 0 - bl sub_81D3D70 - adds r1, r0, 0 - ldr r0, =gUnknown_030012E4 - strh r1, [r0] - movs r0, 0x13 - ands r0, r1 - cmp r0, 0x10 - bne _081D3BA0 - movs r4, 0 - b _081D3BC2 - .pool -_081D3BA0: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081D3BAC - movs r4, 0x1 - b _081D3BC2 -_081D3BAC: - movs r0, 0x4 - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _081D3BC0 - strb r0, [r4] - bl VBlankIntrWait - b _081D3B64 -_081D3BC0: - movs r4, 0x2 -_081D3BC2: - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_030012C8 - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet - bl sub_81D41F4 - adds r0, r4, 0 - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3B54 - - thumb_func_start sub_81D3BE8 -sub_81D3BE8: @ 81D3BE8 - push {r4-r6,lr} - sub sp, 0x4 - adds r5, r0, 0 - bl sub_81D41A0 - movs r6, 0x2 - ldr r4, =gShouldAdvanceLinkState -_081D3BF6: - bl sub_81D4170 - ldr r0, =gUnknown_030012E2 - ldrh r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081D3C08 - strb r6, [r4] -_081D3C08: - movs r0, 0 - movs r1, 0 - movs r2, 0 - adds r3, r5, 0 - bl sub_81D3D70 - adds r1, r0, 0 - ldr r0, =gUnknown_030012E4 - strh r1, [r0] - movs r0, 0x13 - ands r0, r1 - cmp r0, 0x10 - bne _081D3C34 - movs r4, 0 - b _081D3C56 - .pool -_081D3C34: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081D3C40 - movs r4, 0x1 - b _081D3C56 -_081D3C40: - movs r0, 0x4 - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _081D3C54 - strb r0, [r4] - bl VBlankIntrWait - b _081D3BF6 -_081D3C54: - movs r4, 0x2 -_081D3C56: - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_030012C8 - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet - bl sub_81D41F4 - adds r0, r4, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3BE8 - - thumb_func_start sub_81D3C7C -sub_81D3C7C: @ 81D3C7C - push {r4,lr} - ldr r4, =0x04000208 - movs r3, 0 - strh r3, [r4] - ldr r2, =0x04000200 - ldrh r1, [r2] - ldr r0, =0x0000ff3f - ands r0, r1 - strh r0, [r2] - movs r0, 0x1 - strh r0, [r4] - ldr r0, =0x04000128 - strh r3, [r0] - subs r0, 0x1A - strh r3, [r0] - ldr r1, =0x04000202 - movs r0, 0xC0 - strh r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3C7C - - thumb_func_start sub_81D3CBC -sub_81D3CBC: @ 81D3CBC - push {r4-r7,lr} - sub sp, 0x4 - ldr r5, =0x04000208 - movs r4, 0 - strh r4, [r5] - ldr r3, =0x04000200 - ldrh r1, [r3] - ldr r0, =0x0000ff3f - ands r0, r1 - strh r0, [r3] - movs r6, 0x1 - strh r6, [r5] - ldr r0, =0x04000134 - strh r4, [r0] - ldr r2, =0x04000128 - movs r1, 0x80 - lsls r1, 6 - adds r0, r1, 0 - strh r0, [r2] - ldrh r0, [r2] - ldr r7, =0x00004003 - adds r1, r7, 0 - orrs r0, r1 - strh r0, [r2] - strh r4, [r5] - ldrh r0, [r3] - movs r1, 0x80 - orrs r0, r1 - strh r0, [r3] - strh r6, [r5] - ldr r1, =gUnknown_030012C8 - ldrb r0, [r1, 0x1] - cmp r0, 0 - bne _081D3D0A - str r0, [sp] - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet -_081D3D0A: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3CBC - - thumb_func_start sub_81D3D34 -sub_81D3D34: @ 81D3D34 - ldr r0, =0x04000134 - movs r3, 0 - strh r3, [r0] - ldr r2, =0x04000128 - movs r1, 0xA0 - lsls r1, 7 - adds r0, r1, 0 - strh r0, [r2] - ldrh r0, [r2] - movs r1, 0x8 - orrs r0, r1 - strh r0, [r2] - ldr r0, =gShouldAdvanceLinkState - strb r3, [r0] - ldr r0, =gUnknown_030012E6 - strh r3, [r0] - ldr r1, =gUnknown_030012E8 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_81D3D34 - - thumb_func_start sub_81D3D70 -sub_81D3D70: @ 81D3D70 - push {r4-r6,lr} - adds r4, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_030012C8 - ldrb r0, [r0, 0x1] - cmp r0, 0x6 - bls _081D3D86 - b _081D3ECC -_081D3D86: - lsls r0, 2 - ldr r1, =_081D3D98 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081D3D98: - .4byte _081D3DB4 - .4byte _081D3DC8 - .4byte _081D3DE8 - .4byte _081D3DFC - .4byte _081D3E74 - .4byte _081D3E84 - .4byte _081D3EBC -_081D3DB4: - bl sub_81D3CBC - ldr r1, =gUnknown_030012C8 - movs r0, 0x1 - strb r0, [r1, 0x2] - strb r0, [r1, 0x1] - b _081D3ECC - .pool -_081D3DC8: - adds r0, r2, 0 - bl sub_81D3EE8 - lsls r0, 16 - cmp r0, 0 - beq _081D3DD8 - bl sub_81D413C -_081D3DD8: - ldr r0, =gShouldAdvanceLinkState - ldrb r0, [r0] - cmp r0, 0x2 - beq _081D3DE2 - b _081D3ECC -_081D3DE2: - b _081D3E04 - .pool -_081D3DE8: - bl sub_81D3D34 - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_81D3F1C - ldr r1, =gUnknown_030012C8 - movs r0, 0x3 - strb r0, [r1, 0x1] -_081D3DFC: - ldr r0, =gShouldAdvanceLinkState - ldrb r0, [r0] - cmp r0, 0x2 - bne _081D3E18 -_081D3E04: - ldr r1, =gUnknown_030012C8 - strb r0, [r1, 0x4] - movs r0, 0x6 - strb r0, [r1, 0x1] - b _081D3ECC - .pool -_081D3E18: - ldr r2, =gUnknown_030012E6 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - ldr r1, =gUnknown_030012E8 - ldr r0, [r1] - adds r3, r0, 0x1 - str r3, [r1] - ldr r1, =gUnknown_030012C8 - ldrb r0, [r1] - cmp r0, 0 - bne _081D3E3C - cmp r3, 0x3C - bls _081D3E3C - movs r0, 0x1 - strb r0, [r1, 0x4] - movs r0, 0x6 - strb r0, [r1, 0x1] -_081D3E3C: - ldr r4, =gUnknown_030012C8 - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - beq _081D3ECC - ldrb r0, [r4] - cmp r0, 0 - beq _081D3E64 - ldrh r0, [r2] - cmp r0, 0x2 - bls _081D3E64 - bl sub_81D413C - movs r0, 0x2 - b _081D3ECA - .pool -_081D3E64: - bl sub_81D413C - ldr r1, =gUnknown_030012C8 - movs r0, 0x2 - strb r0, [r1, 0x2] - b _081D3ECC - .pool -_081D3E74: - bl sub_81D3CBC - ldr r1, =gUnknown_030012C8 - movs r0, 0x5 - strb r0, [r1, 0x1] - b _081D3ECC - .pool -_081D3E84: - ldr r0, =gUnknown_030012C8 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081D3E98 - ldr r0, =gUnknown_030012E6 - ldrh r0, [r0] - cmp r0, 0x2 - bls _081D3E98 - bl sub_81D413C -_081D3E98: - ldr r1, =gUnknown_030012E6 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3C - bls _081D3ECC - ldr r0, =gUnknown_030012C8 - movs r1, 0x1 - strb r1, [r0, 0x4] - movs r1, 0x6 - strb r1, [r0, 0x1] - b _081D3ECC - .pool -_081D3EBC: - ldr r4, =gUnknown_030012C8 - ldrb r0, [r4, 0x2] - cmp r0, 0 - beq _081D3ECC - bl sub_81D3C7C - movs r0, 0 -_081D3ECA: - strb r0, [r4, 0x2] -_081D3ECC: - ldr r2, =gUnknown_030012C8 - ldrb r0, [r2, 0x2] - ldrb r1, [r2, 0x4] - lsls r1, 2 - orrs r0, r1 - ldrb r1, [r2, 0x3] - lsls r1, 4 - orrs r0, r1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3D70 - - thumb_func_start sub_81D3EE8 -sub_81D3EE8: @ 81D3EE8 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =0x04000128 - ldr r0, [r0] - movs r1, 0xC - ands r0, r1 - cmp r0, 0x8 - bne _081D3F0C - cmp r2, 0 - beq _081D3F0C - ldr r1, =gUnknown_030012C8 - movs r0, 0x1 - b _081D3F10 - .pool -_081D3F0C: - ldr r1, =gUnknown_030012C8 - movs r0, 0 -_081D3F10: - strb r0, [r1] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D3EE8 - - thumb_func_start sub_81D3F1C -sub_81D3F1C: @ 81D3F1C - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r3, =gUnknown_030012C8 - ldrb r0, [r3] - cmp r0, 0 - beq _081D3F54 - ldr r2, =0x04000128 - ldrh r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r2] - str r5, [r3, 0x8] - ldr r0, =0x04000120 - str r4, [r0] - lsrs r0, r4, 2 - adds r0, 0x1 - str r0, [r3, 0x10] - bl sub_81D3F68 - b _081D3F5C - .pool -_081D3F54: - ldr r1, =0x04000128 - ldrh r0, [r1] - strh r0, [r1] - str r2, [r3, 0x8] -_081D3F5C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3F1C - - thumb_func_start sub_81D3F68 -sub_81D3F68: @ 81D3F68 - ldr r1, =0x0400010c - ldr r2, =0x0000fda7 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =0x0400010e - movs r2, 0x40 - strh r2, [r0] - ldr r3, =0x04000208 - movs r0, 0 - strh r0, [r3] - adds r1, 0xF4 - ldrh r0, [r1] - orrs r0, r2 - strh r0, [r1] - movs r0, 0x1 - strh r0, [r3] - bx lr - .pool - thumb_func_end sub_81D3F68 - - thumb_func_start sub_81D3F9C -sub_81D3F9C: @ 81D3F9C - push {lr} - bl sub_81D414C - bl sub_81D413C - pop {r0} - bx r0 - thumb_func_end sub_81D3F9C - - thumb_func_start sub_81D3FAC -sub_81D3FAC: @ 81D3FAC - push {r4-r6,lr} - sub sp, 0x8 - ldr r2, =gUnknown_030012C8 - ldrb r0, [r2, 0x1] - adds r3, r2, 0 - cmp r0, 0x3 - beq _081D4034 - cmp r0, 0x3 - bgt _081D3FC8 - cmp r0, 0x1 - beq _081D3FD0 - b _081D412A - .pool -_081D3FC8: - cmp r0, 0x5 - bne _081D3FCE - b _081D40FC -_081D3FCE: - b _081D412A -_081D3FD0: - ldr r1, =0x0400012a - ldr r2, =0x0000ccd0 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =0x04000120 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - movs r1, 0 - movs r2, 0 - movs r4, 0 - ldr r6, =0x0000ccd0 - ldr r5, =0x0000ffff -_081D3FEC: - lsls r0, r1, 1 - add r0, sp - ldrh r0, [r0] - cmp r0, r6 - bne _081D4010 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - b _081D401A - .pool -_081D4010: - cmp r0, r5 - beq _081D401A - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 -_081D401A: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x3 - bls _081D3FEC - cmp r2, 0x2 - beq _081D402A - b _081D412A -_081D402A: - cmp r4, 0 - beq _081D4030 - b _081D412A -_081D4030: - strb r2, [r3, 0x1] - b _081D412A -_081D4034: - ldr r0, =0x04000120 - ldr r4, [r0] - ldr r0, [r2, 0xC] - cmp r0, 0 - bne _081D404A - ldrb r0, [r2] - cmp r0, 0 - bne _081D404A - lsrs r0, r4, 2 - adds r0, 0x1 - str r0, [r2, 0x10] -_081D404A: - ldrb r0, [r3] - cmp r0, 0x1 - bne _081D4080 - ldr r1, [r3, 0xC] - ldr r0, [r3, 0x10] - cmp r1, r0 - bge _081D4074 - ldr r2, =0x04000120 - ldr r0, [r3, 0x8] - lsls r1, 2 - adds r1, r0 - ldr r0, [r1] - str r0, [r2] - ldr r0, [r3, 0x14] - ldr r1, [r1] - adds r0, r1 - str r0, [r3, 0x14] - b _081D40BA - .pool -_081D4074: - ldr r1, =0x04000120 - ldr r0, [r3, 0x14] - b _081D40B8 - .pool -_081D4080: - ldr r1, [r3, 0xC] - cmp r1, 0 - ble _081D40A0 - ldr r0, [r3, 0x10] - adds r0, 0x1 - cmp r1, r0 - bge _081D40A0 - ldr r0, [r3, 0x8] - lsls r1, 2 - adds r1, r0 - subs r1, 0x4 - str r4, [r1] - ldr r0, [r3, 0x14] - adds r0, r4 - str r0, [r3, 0x14] - b _081D40B4 -_081D40A0: - ldr r0, [r3, 0xC] - cmp r0, 0 - beq _081D40B4 - ldr r0, [r3, 0x14] - cmp r0, r4 - bne _081D40B0 - movs r0, 0x1 - b _081D40B2 -_081D40B0: - movs r0, 0x2 -_081D40B2: - strb r0, [r3, 0x3] -_081D40B4: - ldr r1, =gUnknown_030012E8 - movs r0, 0 -_081D40B8: - str r0, [r1] -_081D40BA: - ldr r1, [r3, 0xC] - adds r1, 0x1 - str r1, [r3, 0xC] - ldr r0, [r3, 0x10] - adds r0, 0x2 - cmp r1, r0 - bge _081D40EA - ldrb r0, [r3] - cmp r0, 0 - beq _081D40E4 - ldr r0, =0x0400010e - ldrh r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strh r1, [r0] - b _081D412A - .pool -_081D40E4: - bl sub_81D413C - b _081D412A -_081D40EA: - movs r0, 0 - movs r1, 0x4 - strb r1, [r3, 0x1] - ldr r1, =gUnknown_030012E6 - strh r0, [r1] - b _081D412A - .pool -_081D40FC: - ldrb r3, [r2] - cmp r3, 0 - bne _081D4108 - ldr r1, =0x0400012a - ldrb r0, [r2, 0x3] - strh r0, [r1] -_081D4108: - ldr r0, =0x04000120 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - mov r0, sp - ldrh r1, [r0, 0x2] - subs r0, r1, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bhi _081D412A - cmp r3, 0x1 - bne _081D4126 - strb r1, [r2, 0x3] -_081D4126: - movs r0, 0x6 - strb r0, [r2, 0x1] -_081D412A: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D3FAC - - thumb_func_start sub_81D413C -sub_81D413C: @ 81D413C - ldr r0, =0x04000128 - ldrh r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_81D413C - - thumb_func_start sub_81D414C -sub_81D414C: @ 81D414C - ldr r2, =0x0400010e - ldrh r1, [r2] - ldr r0, =0x0000ff7f - ands r0, r1 - strh r0, [r2] - ldr r1, =0x0400010c - ldr r2, =0x0000fda7 - adds r0, r2, 0 - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D414C - - thumb_func_start sub_81D4170 -sub_81D4170: @ 81D4170 - push {r4,lr} - ldr r0, =0x04000130 - ldrh r0, [r0] - ldr r2, =0x000003ff - adds r1, r2, 0 - eors r1, r0 - ldr r4, =gUnknown_030012E2 - ldr r3, =gUnknown_030012E0 - ldrh r2, [r3] - adds r0, r1, 0 - bics r0, r2 - strh r0, [r4] - strh r1, [r3] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4170 - - thumb_func_start sub_81D41A0 -sub_81D41A0: @ 81D41A0 - ldr r1, =gUnknown_030012EC - ldr r0, =0x04000208 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012EE - ldr r0, =0x04000200 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012F0 - ldr r0, =0x0400010e - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012F2 - ldr r0, =0x04000128 - ldrh r0, [r0] - strh r0, [r1] - ldr r1, =gUnknown_030012F4 - ldr r0, =0x04000134 - ldrh r0, [r0] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D41A0 - - thumb_func_start sub_81D41F4 -sub_81D41F4: @ 81D41F4 - ldr r1, =0x04000208 - ldr r0, =gUnknown_030012EC - ldrh r0, [r0] - strh r0, [r1] - subs r1, 0x8 - ldr r0, =gUnknown_030012EE - ldrh r0, [r0] - strh r0, [r1] - subs r1, 0xF2 - ldr r0, =gUnknown_030012F0 - ldrh r0, [r0] - strh r0, [r1] - adds r1, 0x1A - ldr r0, =gUnknown_030012F2 - ldrh r0, [r0] - strh r0, [r1] - adds r1, 0xC - ldr r0, =gUnknown_030012F4 - ldrh r0, [r0] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D41F4 - - thumb_func_start sub_81D4238 -sub_81D4238: @ 81D4238 - push {lr} - sub sp, 0x4 - movs r0, 0 - str r0, [sp] - ldr r1, =gUnknown_030012C8 - ldr r2, =0x05000006 - mov r0, sp - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4238 - - thumb_func_start sub_81D4258 -sub_81D4258: @ 81D4258 - push {lr} - sub sp, 0x4 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrb r1, [r0, 0x5] - ldrb r2, [r0, 0x4] - movs r0, 0x1 - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - mov r0, sp - ldrb r0, [r0] - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D4258 - - thumb_func_start sub_81D427C -sub_81D427C: @ 81D427C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - bl sub_81D4258 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r2, =gEventObjects - adds r5, r1, r2 - ldr r4, =gUnknown_030012F8 - ldr r3, =gPlayerAvatar - ldrb r1, [r3, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x14] - ldrh r1, [r5, 0x10] - subs r0, r1 - strh r0, [r4] - ldr r4, =gUnknown_030012FA - ldrb r1, [r3, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x16] - ldrh r1, [r5, 0x12] - subs r0, r1 - strh r0, [r4] - movs r0, 0 - mov r8, r0 - ldr r2, =gUnknown_030012FC - movs r1, 0 -_081D42CA: - mov r3, r8 - adds r0, r3, r2 - strb r1, [r0] - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x3 - bls _081D42CA - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - movs r4, 0x14 - ldrsh r1, [r2, r4] - movs r6, 0x10 - ldrsh r0, [r2, r6] - cmp r1, r0 - bne _081D4304 - movs r0, 0x16 - ldrsh r1, [r2, r0] - movs r3, 0x12 - ldrsh r0, [r2, r3] - cmp r1, r0 - beq _081D4356 -_081D4304: - ldr r0, =0x0000403a - bl VarGet - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - cmp r1, 0 - bne _081D4338 - ldrb r1, [r5, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r1 - b _081D433E - .pool -_081D4338: - ldrb r0, [r5, 0x1] - movs r1, 0x20 - orrs r0, r1 -_081D433E: - strb r0, [r5, 0x1] - ldr r0, =0x0000403a - bl VarGet - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x9 - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - bne _081D4360 -_081D4356: - movs r0, 0 - b _081D4816 - .pool -_081D4360: - movs r4, 0 - mov r8, r4 - ldr r6, =gEventObjects - mov r10, r6 -_081D4368: - ldr r3, =gPlayerAvatar - ldrb r1, [r3, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - mov r1, r10 - adds r4, r0, r1 - mov r2, r8 - lsls r1, r2, 2 - ldr r6, =gUnknown_0862608C - adds r0, r1, r6 - movs r6, 0x14 - ldrsh r2, [r4, r6] - movs r6, 0 - ldrsh r0, [r0, r6] - ldr r6, =gEventObjects - mov r9, r6 - mov r12, r3 - adds r7, r1, 0 - cmp r2, r0 - beq _081D4394 - b _081D449E -_081D4394: - movs r3, 0 - ldr r1, =gUnknown_0862608C + 2 - adds r0, r7, r1 - movs r2, 0x16 - ldrsh r1, [r4, r2] - movs r4, 0 - ldrsh r2, [r0, r4] - cmp r1, r2 - bge _081D43C0 - movs r6, 0x12 - ldrsh r0, [r5, r6] - cmp r0, r2 - bgt _081D43CA - b _081D449E - .pool -_081D43C0: - movs r1, 0x12 - ldrsh r0, [r5, r1] - cmp r0, r2 - blt _081D43CA - movs r3, 0x1 -_081D43CA: - cmp r3, 0 - bne _081D449E - ldr r0, =gUnknown_030012F8 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - ble _081D4410 - movs r3, 0x10 - ldrsh r2, [r5, r3] - adds r2, 0x1 - mov r4, r12 - ldrb r1, [r4, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r9 - movs r6, 0x14 - ldrsh r0, [r0, r6] - cmp r2, r0 - bne _081D4446 - ldrh r0, [r5, 0x10] - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x12 - ldrsh r1, [r5, r2] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4446 -_081D4408: - movs r0, 0x4 - b _081D4816 - .pool -_081D4410: - cmp r0, 0 - bge _081D4446 - movs r3, 0x10 - ldrsh r2, [r5, r3] - subs r2, 0x1 - mov r4, r12 - ldrb r1, [r4, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r9 - movs r6, 0x14 - ldrsh r0, [r0, r6] - cmp r2, r0 - bne _081D4446 - ldrh r0, [r5, 0x10] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x12 - ldrsh r1, [r5, r2] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4446 - b _081D45AA -_081D4446: - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r10 - movs r3, 0x10 - ldrsh r1, [r5, r3] - movs r4, 0x14 - ldrsh r0, [r0, r4] - cmp r1, r0 - bne _081D449E - ldr r0, =gUnknown_030012FA - movs r6, 0 - ldrsh r0, [r0, r6] - cmp r0, 0 - ble _081D4488 - adds r0, r1, 0 - ldrh r1, [r5, 0x12] - subs r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D449E -_081D447C: - movs r0, 0x2 - b _081D4816 - .pool -_081D4488: - movs r2, 0x10 - ldrsh r0, [r5, r2] - ldrh r1, [r5, 0x12] - adds r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - bne _081D4538 -_081D449E: - ldr r2, =gPlayerAvatar - ldrb r1, [r2, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - mov r3, r10 - adds r4, r0, r3 - ldr r6, =gUnknown_0862608C - ldr r1, =gUnknown_0862608C + 2 - adds r0, r7, r1 - movs r3, 0x16 - ldrsh r1, [r4, r3] - movs r3, 0 - ldrsh r0, [r0, r3] - ldr r3, =gEventObjects - mov r9, r3 - mov r12, r2 - cmp r1, r0 - beq _081D44C6 - b _081D45D0 -_081D44C6: - movs r3, 0 - adds r0, r7, r6 - movs r6, 0x14 - ldrsh r1, [r4, r6] - movs r4, 0 - ldrsh r2, [r0, r4] - cmp r1, r2 - bge _081D44F0 - movs r6, 0x10 - ldrsh r0, [r5, r6] - cmp r0, r2 - bgt _081D44FA - b _081D45D0 - .pool -_081D44F0: - movs r1, 0x10 - ldrsh r0, [r5, r1] - cmp r0, r2 - blt _081D44FA - movs r3, 0x1 -_081D44FA: - cmp r3, 0 - bne _081D45D0 - ldr r0, =gUnknown_030012FA - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - ble _081D4540 - movs r3, 0x12 - ldrsh r2, [r5, r3] - adds r2, 0x1 - mov r4, r12 - ldrb r1, [r4, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r9 - movs r6, 0x16 - ldrsh r0, [r0, r6] - cmp r2, r0 - bne _081D4576 - movs r1, 0x10 - ldrsh r0, [r5, r1] - ldrh r1, [r5, 0x12] - adds r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4576 -_081D4538: - movs r0, 0x1 - b _081D4816 - .pool -_081D4540: - cmp r0, 0 - bge _081D4576 - movs r3, 0x12 - ldrsh r2, [r5, r3] - subs r2, 0x1 - mov r4, r12 - ldrb r1, [r4, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r9 - movs r6, 0x16 - ldrsh r0, [r0, r6] - cmp r2, r0 - bne _081D4576 - movs r1, 0x10 - ldrsh r0, [r5, r1] - ldrh r1, [r5, 0x12] - subs r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4576 - b _081D447C -_081D4576: - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r10 - movs r2, 0x12 - ldrsh r1, [r5, r2] - movs r3, 0x16 - ldrsh r0, [r0, r3] - cmp r1, r0 - bne _081D45D0 - ldr r0, =gUnknown_030012F8 - movs r4, 0 - ldrsh r0, [r0, r4] - cmp r0, 0 - ble _081D45B8 - ldrh r0, [r5, 0x10] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D45D0 -_081D45AA: - movs r0, 0x3 - b _081D4816 - .pool -_081D45B8: - ldrh r0, [r5, 0x10] - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x12 - ldrsh r1, [r5, r2] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D45D0 - b _081D4408 -_081D45D0: - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x3 - bhi _081D45E0 - b _081D4368 -_081D45E0: - adds r0, r5, 0 - movs r1, 0 - bl sub_81D4C14 - lsls r0, 24 - cmp r0, 0 - beq _081D461C - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4C58 - lsls r0, 24 - cmp r0, 0 - beq _081D4604 - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D4604: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4CE0 - lsls r0, 24 - cmp r0, 0 - bne _081D4614 - b _081D447C -_081D4614: - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D461C: - adds r0, r5, 0 - movs r1, 0 - bl sub_81D4C9C - lsls r0, 24 - cmp r0, 0 - beq _081D4658 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4C58 - lsls r0, 24 - cmp r0, 0 - beq _081D4640 - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D4640: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4CE0 - lsls r0, 24 - cmp r0, 0 - bne _081D4650 - b _081D4538 -_081D4650: - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D4658: - adds r0, r5, 0 - movs r1, 0 - bl sub_81D4C58 - lsls r0, 24 - cmp r0, 0 - beq _081D4694 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4C14 - lsls r0, 24 - cmp r0, 0 - beq _081D467C - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D467C: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4C9C - lsls r0, 24 - cmp r0, 0 - bne _081D468C - b _081D4408 -_081D468C: - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D4694: - adds r0, r5, 0 - movs r1, 0 - bl sub_81D4CE0 - lsls r0, 24 - cmp r0, 0 - beq _081D46D0 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4C14 - lsls r0, 24 - cmp r0, 0 - beq _081D46B8 - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D46B8: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81D4C9C - lsls r0, 24 - cmp r0, 0 - bne _081D46C8 - b _081D45AA -_081D46C8: - movs r0, 0x2 - bl sub_81D4D24 - b _081D4812 -_081D46D0: - ldr r0, =gUnknown_030012FA - movs r3, 0 - ldrsh r0, [r0, r3] - cmp r0, 0 - bne _081D476E - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r4, 0x12 - ldrsh r1, [r0, r4] - ldrh r2, [r5, 0x12] - movs r6, 0x12 - ldrsh r0, [r5, r6] - cmp r1, r0 - ble _081D470C - movs r1, 0x10 - ldrsh r0, [r5, r1] - subs r1, r2, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D470C - b _081D447C -_081D470C: - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r2, 0x12 - ldrsh r1, [r0, r2] - ldrh r2, [r5, 0x12] - movs r3, 0x12 - ldrsh r0, [r5, r3] - cmp r1, r0 - bge _081D473E - movs r4, 0x10 - ldrsh r0, [r5, r4] - adds r1, r2, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D473E - b _081D4538 -_081D473E: - movs r6, 0x10 - ldrsh r0, [r5, r6] - ldrh r1, [r5, 0x12] - subs r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4756 - b _081D447C -_081D4756: - movs r1, 0x10 - ldrsh r0, [r5, r1] - ldrh r1, [r5, 0x12] - adds r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D476E - b _081D4538 -_081D476E: - ldr r0, =gUnknown_030012F8 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _081D480C - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r3, 0x10 - ldrsh r1, [r0, r3] - ldrh r2, [r5, 0x10] - movs r4, 0x10 - ldrsh r0, [r5, r4] - cmp r1, r0 - ble _081D47AA - subs r0, r2, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r6, 0x12 - ldrsh r1, [r5, r6] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D47AA - b _081D45AA -_081D47AA: - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r2, 0x10 - ldrsh r1, [r0, r2] - ldrh r2, [r5, 0x10] - movs r3, 0x10 - ldrsh r0, [r5, r3] - cmp r1, r0 - bge _081D47DC - adds r0, r2, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r4, 0x12 - ldrsh r1, [r5, r4] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D47DC - b _081D4408 -_081D47DC: - ldrh r0, [r5, 0x10] - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r6, 0x12 - ldrsh r1, [r5, r6] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D47F4 - b _081D4408 -_081D47F4: - ldrh r0, [r5, 0x10] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x12 - ldrsh r1, [r5, r2] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D480C - b _081D45AA -_081D480C: - movs r0, 0 - bl sub_81D4890 -_081D4812: - lsls r0, 24 - lsrs r0, 24 -_081D4816: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D427C - - thumb_func_start sub_81D4834 -sub_81D4834: @ 81D4834 - push {r4,lr} - lsls r0, 16 - lsls r1, 16 - lsrs r4, r1, 16 - ldr r3, =gEventObjects - ldr r1, =gPlayerAvatar - ldrb r2, [r1, 0x5] - lsls r1, r2, 3 - adds r1, r2 - lsls r1, 2 - adds r2, r1, r3 - movs r3, 0x10 - ldrsh r1, [r2, r3] - lsrs r3, r0, 16 - asrs r0, 16 - cmp r1, r0 - bne _081D4870 - movs r0, 0x12 - ldrsh r1, [r2, r0] - lsls r0, r4, 16 - asrs r0, 16 - cmp r1, r0 - bne _081D4870 - movs r0, 0 - b _081D4888 - .pool -_081D4870: - lsls r0, r3, 16 - asrs r0, 16 - lsls r1, r4, 16 - asrs r1, 16 - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsPokeGrass - lsls r0, 24 - lsrs r0, 24 -_081D4888: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D4834 - - thumb_func_start sub_81D4890 -sub_81D4890: @ 81D4890 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - bl sub_81D4258 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r4, r1, r0 - movs r1, 0 - ldr r3, =gUnknown_030012FC - movs r2, 0 -_081D48B0: - adds r0, r1, r3 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _081D48B0 - movs r1, 0x10 - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x12] - subs r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081D48E8 - cmp r6, 0x2 - beq _081D48E8 - ldr r0, =gUnknown_030012FC - adds r0, r5, r0 - movs r1, 0x2 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_081D48E8: - ldrh r0, [r4, 0x10] - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x12 - ldrsh r1, [r4, r2] - bl sub_81D4834 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081D4912 - cmp r6, 0x4 - beq _081D4912 - ldr r0, =gUnknown_030012FC - adds r0, r5, r0 - movs r1, 0x4 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_081D4912: - movs r1, 0x10 - ldrsh r0, [r4, r1] - ldrh r1, [r4, 0x12] - adds r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x1 - bne _081D493A - cmp r6, 0x1 - beq _081D493A - ldr r0, =gUnknown_030012FC - adds r0, r5, r0 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_081D493A: - ldrh r0, [r4, 0x10] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x12 - ldrsh r1, [r4, r2] - bl sub_81D4834 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081D4964 - cmp r6, 0x3 - beq _081D4964 - ldr r0, =gUnknown_030012FC - adds r0, r5, r0 - movs r1, 0x3 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_081D4964: - cmp r5, 0x1 - bhi _081D4974 - ldr r0, =gUnknown_030012FC - b _081D4988 - .pool -_081D4974: - ldr r4, =gUnknown_030012FC - ldr r0, =0x0000403a - bl VarGet - lsls r0, 16 - lsrs r0, 16 - adds r1, r5, 0 - bl __modsi3 - adds r0, r4 -_081D4988: - ldrb r0, [r0] - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D4890 - - thumb_func_start sub_81D4998 -sub_81D4998: @ 81D4998 - push {r4,lr} - ldr r4, =0x0000403a - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x0000391a - cmp r1, r0 - bne _081D49E0 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =0x0000270e - cmp r2, r0 - bls _081D49D8 - adds r0, r4, 0 - movs r1, 0 - bl VarSet - b _081D49E0 - .pool -_081D49D8: - adds r0, r4, 0 - adds r1, r2, 0 - bl VarSet -_081D49E0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81D4998 - - thumb_func_start EventObjectIsFarawayIslandMew -@ bool8 EventObjectIsFarawayIslandMew(struct npc_state *eventObject) -EventObjectIsFarawayIslandMew: @ 81D49E8 - push {lr} - adds r2, r0, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x0000391a - cmp r1, r0 - bne _081D4A0C - ldrb r0, [r2, 0x5] - cmp r0, 0xE5 - bne _081D4A0C - movs r0, 0x1 - b _081D4A0E - .pool -_081D4A0C: - movs r0, 0 -_081D4A0E: - pop {r1} - bx r1 - thumb_func_end EventObjectIsFarawayIslandMew - - thumb_func_start IsMewPlayingHideAndSeek -IsMewPlayingHideAndSeek: @ 81D4A14 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x0000391a - cmp r1, r0 - bne _081D4A50 - movs r0, 0xE5 - lsls r0, 1 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081D4A50 - ldr r0, =0x000002ce - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081D4A50 - movs r0, 0x1 - b _081D4A52 - .pool -_081D4A50: - movs r0, 0 -_081D4A52: - pop {r1} - bx r1 - thumb_func_end IsMewPlayingHideAndSeek - - thumb_func_start sub_81D4A58 -sub_81D4A58: @ 81D4A58 - push {r4,lr} - ldr r4, =0x0000403a - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - beq _081D4A88 - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - cmp r1, 0 - bne _081D4A88 - movs r0, 0x1 - b _081D4A8A - .pool -_081D4A88: - movs r0, 0 -_081D4A8A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D4A58 - - thumb_func_start sub_81D4A90 -sub_81D4A90: @ 81D4A90 - push {r4-r6,lr} - sub sp, 0x4 - bl sub_81D4258 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r5, r1, r0 - ldrb r1, [r5, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r1 - strb r0, [r5, 0x1] - ldr r0, =gSpecialVar_0x8004 - ldrh r4, [r0] - cmp r4, 0x1 - bne _081D4AF8 - ldrb r0, [r5, 0x3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r5, 0x3] - ldr r3, =gSprites - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x42 - ldrb r2, [r0] - movs r1, 0x3F - ands r1, r2 - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x43 - strb r4, [r0] - b _081D4BC4 - .pool -_081D4AF8: - ldr r0, =0x0000403a - ldr r1, =0x0000ffff - bl VarSet - ldrb r0, [r5, 0x3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r5, 0x3] - ldr r6, =gSprites - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x42 - ldrb r2, [r0] - movs r1, 0x3F - ands r1, r2 - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - ldr r0, =gSpecialVar_Facing - ldrh r0, [r0] - cmp r0, 0x2 - beq _081D4B3A - ldrb r0, [r5, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r1, 0x43 - movs r0, 0x1 - strb r0, [r1] -_081D4B3A: - ldr r4, =gFieldEffectObjectPaletteInfo1 - adds r0, r4, 0 - bl LoadSpritePalette - ldrh r0, [r4, 0x4] - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - bl UpdateSpritePaletteWithWeather - ldrh r1, [r5, 0x10] - mov r0, sp - strh r1, [r0] - ldrh r0, [r5, 0x12] - mov r4, sp - adds r4, 0x2 - strh r0, [r4] - mov r0, sp - adds r1, r4, 0 - movs r2, 0x8 - movs r3, 0x8 - bl sub_80930E0 - ldr r0, =gFieldEffectObjectTemplatePointers - ldr r0, [r0, 0x3C] - mov r1, sp - movs r2, 0 - ldrsh r1, [r1, r2] - movs r3, 0 - ldrsh r2, [r4, r3] - ldrb r4, [r5, 0x4] - lsls r3, r4, 4 - adds r3, r4 - lsls r3, 2 - adds r3, r6 - adds r3, 0x43 - ldrb r3, [r3] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - bl CreateSpriteAtEnd - ldr r1, =gUnknown_0203CF50 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _081D4BC4 - ldrb r0, [r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r3, r1, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r3] - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - movs r2, 0x8 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r0, =SpriteCallbackDummy - str r0, [r1, 0x1C] -_081D4BC4: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4A90 - - thumb_func_start sub_81D4BEC -sub_81D4BEC: @ 81D4BEC - push {lr} - ldr r1, =gUnknown_0203CF50 - ldrb r0, [r1] - cmp r0, 0x40 - beq _081D4C06 - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite -_081D4C06: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4BEC - - thumb_func_start sub_81D4C14 -sub_81D4C14: @ 81D4C14 - push {r4,lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_030012FA - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - ble _081D4C50 - movs r1, 0x10 - ldrsh r0, [r2, r1] - ldrh r1, [r2, 0x12] - subs r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4C50 - ldr r0, =gUnknown_030012FC - adds r0, r4, r0 - movs r1, 0x2 - strb r1, [r0] - movs r0, 0x1 - b _081D4C52 - .pool -_081D4C50: - movs r0, 0 -_081D4C52: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D4C14 - - thumb_func_start sub_81D4C58 -sub_81D4C58: @ 81D4C58 - push {r4,lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_030012F8 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _081D4C94 - ldrh r0, [r2, 0x10] - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r3, 0x12 - ldrsh r1, [r2, r3] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4C94 - ldr r0, =gUnknown_030012FC - adds r0, r4, r0 - movs r1, 0x4 - strb r1, [r0] - movs r0, 0x1 - b _081D4C96 - .pool -_081D4C94: - movs r0, 0 -_081D4C96: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D4C58 - - thumb_func_start sub_81D4C9C -sub_81D4C9C: @ 81D4C9C - push {r4,lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_030012FA - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _081D4CD8 - movs r1, 0x10 - ldrsh r0, [r2, r1] - ldrh r1, [r2, 0x12] - adds r1, 0x1 - lsls r1, 16 - asrs r1, 16 - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4CD8 - ldr r0, =gUnknown_030012FC - adds r0, r4, r0 - movs r1, 0x1 - strb r1, [r0] - movs r0, 0x1 - b _081D4CDA - .pool -_081D4CD8: - movs r0, 0 -_081D4CDA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D4C9C - - thumb_func_start sub_81D4CE0 -sub_81D4CE0: @ 81D4CE0 - push {r4,lr} - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_030012F8 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - ble _081D4D1C - ldrh r0, [r2, 0x10] - subs r0, 0x1 - lsls r0, 16 - asrs r0, 16 - movs r3, 0x12 - ldrsh r1, [r2, r3] - bl sub_81D4834 - lsls r0, 24 - cmp r0, 0 - beq _081D4D1C - ldr r0, =gUnknown_030012FC - adds r0, r4, r0 - movs r1, 0x3 - strb r1, [r0] - movs r0, 0x1 - b _081D4D1E - .pool -_081D4D1C: - movs r0, 0 -_081D4D1E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D4CE0 - - thumb_func_start sub_81D4D24 -sub_81D4D24: @ 81D4D24 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_030012FC - ldr r0, =0x0000403a - bl VarGet - lsls r0, 16 - lsrs r0, 16 - adds r1, r4, 0 - bl __modsi3 - adds r0, r5 - ldrb r0, [r0] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D4D24 - - thumb_func_start sub_81D4D50 -sub_81D4D50: @ 81D4D50 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - adds r5, r0, 0 - adds r6, r1, 0 - mov r8, r2 - mov r1, sp - ldr r4, =0x04000208 - ldrh r0, [r4] - strh r0, [r1] - movs r0, 0 - strh r0, [r4] - ldr r1, =gIntrTable - ldr r0, =sub_81D3FAC - str r0, [r1, 0x4] - ldr r0, =sub_81D3F9C - str r0, [r1, 0x8] - bl sub_81D41A0 - bl sub_81D4238 - ldr r2, =0x04000200 - ldrh r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strh r0, [r2] - mov r0, sp - ldrh r0, [r0] - strh r0, [r4] - movs r0, 0 - strh r0, [r5] - str r6, [r5, 0x4] - mov r0, r8 - str r0, [r5, 0x8] - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4D50 - - thumb_func_start sub_81D4DB8 -sub_81D4DB8: @ 81D4DB8 - push {r4,lr} - sub sp, 0x4 - mov r1, sp - ldr r4, =0x04000208 - ldrh r0, [r4] - strh r0, [r1] - movs r0, 0 - strh r0, [r4] - bl sub_81D4238 - bl sub_81D41F4 - bl RestoreSerialTimer3IntrHandlers - mov r0, sp - ldrh r0, [r0] - strh r0, [r4] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4DB8 - - thumb_func_start sub_81D4DE8 -sub_81D4DE8: @ 81D4DE8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r5, 0 - ldr r1, [r4, 0x4] - ldr r2, [r4, 0x8] - movs r0, 0x1 - movs r3, 0 - bl sub_81D3D70 - adds r1, r0, 0 - strh r1, [r4] - movs r0, 0x13 - ands r0, r1 - cmp r0, 0x10 - bne _081D4E08 - movs r5, 0x1 -_081D4E08: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081D4E12 - movs r5, 0x2 -_081D4E12: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081D4E1C - movs r5, 0x3 -_081D4E1C: - ldr r1, =gShouldAdvanceLinkState - movs r0, 0 - strb r0, [r1] - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D4DE8 - - thumb_func_start sub_81D4E30 -sub_81D4E30: @ 81D4E30 - push {lr} - ldr r0, =gDecompressionBuffer - movs r2, 0x80 - lsls r2, 6 - movs r1, 0 - bl memset - ldr r1, =gLinkType - ldr r2, =0x00005503 - adds r0, r2, 0 - strh r0, [r1] - bl OpenLink - movs r0, 0x1 - bl SetSuppressLinkErrorMessage - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D4E30 - - thumb_func_start sub_81D4E60 -sub_81D4E60: @ 81D4E60 - push {lr} - sub sp, 0xC - mov r1, sp - ldr r2, =0x04000208 - ldrh r0, [r2] - strh r0, [r1] - movs r0, 0 - strh r0, [r2] - ldr r0, =gLink+0x4 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x4] - str r1, [sp, 0x8] - mov r0, sp - ldrh r0, [r0] - strh r0, [r2] - add r2, sp, 0x4 - ldrh r1, [r2] - ldr r0, =0x0000b9a0 - cmp r1, r0 - bne _081D4EB8 - ldrh r1, [r2, 0x2] - ldr r0, =0x0000ccd0 - cmp r1, r0 - bne _081D4EB8 - ldrh r1, [r2, 0x4] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _081D4EB8 - ldrh r0, [r2, 0x6] - cmp r0, r1 - bne _081D4EB8 - movs r0, 0x1 - b _081D4EBA - .pool -_081D4EB8: - movs r0, 0 -_081D4EBA: - add sp, 0xC - pop {r1} - bx r1 - thumb_func_end sub_81D4E60 - - thumb_func_start sub_81D4EC0 -sub_81D4EC0: @ 81D4EC0 - push {lr} - bl IsLinkMaster - lsls r0, 24 - cmp r0, 0 - beq _081D4EDC - bl GetLinkPlayerCount_2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081D4EDC - movs r0, 0x1 - b _081D4EDE -_081D4EDC: - movs r0, 0 -_081D4EDE: - pop {r1} - bx r1 - thumb_func_end sub_81D4EC0 - - thumb_func_start sub_81D4EE4 -sub_81D4EE4: @ 81D4EE4 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrb r0, [r4] - subs r0, 0x3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _081D4F08 - bl HasLinkErrorOccurred - lsls r0, 24 - cmp r0, 0 - beq _081D4F08 - movs r0, 0 - strb r0, [r4] - movs r0, 0x3 - b _081D500E -_081D4F08: - ldrb r0, [r4] - cmp r0, 0x5 - bls _081D4F10 - b _081D500C -_081D4F10: - lsls r0, 2 - ldr r1, =_081D4F20 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081D4F20: - .4byte _081D4F38 - .4byte _081D4F54 - .4byte _081D4F6C - .4byte _081D4FA0 - .4byte _081D4FEC - .4byte _081D4FF8 -_081D4F38: - bl IsLinkMaster - lsls r0, 24 - cmp r0, 0 - beq _081D4F88 - bl GetLinkPlayerCount_2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _081D4F88 - movs r0, 0x1 - strb r0, [r4] - b _081D500C -_081D4F54: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x5 - bls _081D500C - movs r0, 0 - strh r0, [r5] - movs r0, 0x2 - strb r0, [r4] - b _081D500C -_081D4F6C: - bl GetLinkPlayerCount_2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _081D4F88 - movs r0, 0x49 - bl PlaySE - bl sub_800A620 - movs r0, 0 - strh r0, [r5] - b _081D4FE6 -_081D4F88: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081D500C - movs r0, 0 - strb r0, [r4] - movs r0, 0x1 - b _081D500E - .pool -_081D4FA0: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1E - bls _081D4FB6 - movs r0, 0 - strb r0, [r4] - movs r0, 0x5 - b _081D500E -_081D4FB6: - bl IsLinkConnectionEstablished - lsls r0, 24 - cmp r0, 0 - beq _081D500C - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _081D4FE6 - bl IsLinkPlayerDataExchangeComplete - lsls r0, 24 - cmp r0, 0 - beq _081D4FE0 - movs r0, 0 - strb r0, [r4] - movs r0, 0x2 - b _081D500E - .pool -_081D4FE0: - movs r0, 0x4 - strb r0, [r4] - b _081D500C -_081D4FE6: - movs r0, 0x3 - strb r0, [r4] - b _081D500C -_081D4FEC: - movs r0, 0 - bl sub_800ABF4 - movs r0, 0x5 - strb r0, [r4] - b _081D500C -_081D4FF8: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _081D500C - strb r0, [r4] - movs r0, 0x4 - b _081D500E - .pool -_081D500C: - movs r0, 0 -_081D500E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81D4EE4 - - thumb_func_start sub_81D5014 -sub_81D5014: @ 81D5014 - push {r4,lr} - ldr r0, =sub_81D5084 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - movs r0, 0 - strb r0, [r4, 0x8] - strb r0, [r4, 0x9] - strb r0, [r4, 0xA] - strb r0, [r4, 0xB] - strb r0, [r4, 0xC] - strb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4] - strh r0, [r4, 0x2] - strh r0, [r4, 0x4] - strh r0, [r4, 0x6] - strb r1, [r4, 0xE] - movs r0, 0x40 - bl AllocZeroed - str r0, [r4, 0x10] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5014 - - thumb_func_start sub_81D505C -sub_81D505C: @ 81D505C - movs r1, 0 - strh r1, [r0] - bx lr - thumb_func_end sub_81D505C - - thumb_func_start sub_81D5064 -sub_81D5064: @ 81D5064 - push {lr} - adds r2, r0, 0 - lsls r1, 16 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - cmp r0, r1 - bhi _081D507A - movs r0, 0 - b _081D5080 -_081D507A: - movs r0, 0 - strh r0, [r2] - movs r0, 0x1 -_081D5080: - pop {r1} - bx r1 - thumb_func_end sub_81D5064 - - thumb_func_start sub_81D5084 -sub_81D5084: @ 81D5084 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrb r0, [r4, 0x8] - cmp r0, 0x1A - bls _081D509C - b _081D548A -_081D509C: - lsls r0, 2 - ldr r1, =_081D50B0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081D50B0: - .4byte _081D511C - .4byte _081D5138 - .4byte _081D5148 - .4byte _081D515C - .4byte _081D516C - .4byte _081D5198 - .4byte _081D51D0 - .4byte _081D524C - .4byte _081D5268 - .4byte _081D5290 - .4byte _081D52AC - .4byte _081D52DC - .4byte _081D52F2 - .4byte _081D5308 - .4byte _081D536A - .4byte _081D5390 - .4byte _081D53A8 - .4byte _081D53C6 - .4byte _081D53F2 - .4byte _081D5418 - .4byte _081D5448 - .4byte _081D5454 - .4byte _081D5460 - .4byte _081D5430 - .4byte _081D548A - .4byte _081D548A - .4byte _081D5478 -_081D511C: - adds r0, r4, 0 - adds r0, 0x9 - ldr r1, =gUnknown_085EDFD6 - bl mevent_0814257C - cmp r0, 0 - bne _081D512C - b _081D548A -_081D512C: - movs r0, 0x1 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5138: - bl sub_81D4E30 - adds r0, r4, 0 - bl sub_81D505C - movs r0, 0x2 - strb r0, [r4, 0x8] - b _081D548A -_081D5148: - adds r0, r4, 0 - movs r1, 0xA - bl sub_81D5064 - cmp r0, 0 - bne _081D5156 - b _081D548A -_081D5156: - movs r0, 0x3 - strb r0, [r4, 0x8] - b _081D548A -_081D515C: - bl sub_81D4EC0 - cmp r0, 0 - beq _081D5166 - b _081D52FC -_081D5166: - bl CloseLink - b _081D525C -_081D516C: - adds r0, r4, 0 - adds r0, 0x9 - ldr r1, =gUnknown_085EDFF5 - bl mevent_0814257C - cmp r0, 0 - bne _081D517C - b _081D548A -_081D517C: - ldr r0, =gUnknown_085EE014 - bl sub_8018884 - adds r0, r4, 0 - bl sub_81D505C - movs r0, 0x5 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5198: - adds r0, r4, 0 - movs r1, 0x5A - bl sub_81D5064 - cmp r0, 0 - beq _081D51AE - bl sub_81D4E30 - movs r0, 0x6 - strb r0, [r4, 0x8] - b _081D548A -_081D51AE: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _081D51BC - b _081D548A -_081D51BC: - adds r0, r4, 0 - bl sub_81D505C - movs r0, 0x5 - bl PlaySE - b _081D535A - .pool -_081D51D0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081D51F4 - movs r0, 0x5 - bl PlaySE - bl CloseLink - adds r0, r4, 0 - bl sub_81D505C - b _081D535A - .pool -_081D51F4: - bl GetLinkPlayerCount_2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _081D5210 - adds r0, r4, 0 - bl sub_81D505C - bl CloseLink - movs r0, 0x7 - strb r0, [r4, 0x8] - b _081D548A -_081D5210: - bl sub_81D4E60 - cmp r0, 0 - beq _081D522E - movs r0, 0x5 - bl PlaySE - bl CloseLink - adds r0, r4, 0 - bl sub_81D505C - movs r0, 0x8 - strb r0, [r4, 0x8] - b _081D548A -_081D522E: - adds r0, r4, 0 - movs r1, 0xA - bl sub_81D5064 - cmp r0, 0 - bne _081D523C - b _081D548A -_081D523C: - bl CloseLink - bl sub_81D4E30 - adds r0, r4, 0 - bl sub_81D505C - b _081D548A -_081D524C: - adds r0, r4, 0 - adds r0, 0x9 - ldr r1, =gUnknown_085EE05C - bl mevent_0814257C - cmp r0, 0 - bne _081D525C - b _081D548A -_081D525C: - movs r0, 0x4 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5268: - ldr r0, =gUnknown_085EE097 - bl sub_8018884 - ldr r0, =gUnknown_03006370 - ldr r1, =gMultiBootProgram_BerryGlitchFix_Start - ldr r2, =gUnknown_089A3470 - subs r1, r2 - bl sub_81D4D50 - movs r0, 0x9 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5290: - ldr r0, =gUnknown_03006370 - bl sub_81D4DE8 - strb r0, [r4, 0xE] - lsls r0, 24 - cmp r0, 0 - bne _081D52A0 - b _081D548A -_081D52A0: - movs r0, 0xA - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D52AC: - ldr r0, =gUnknown_03006370 - bl sub_81D4DB8 - ldrb r0, [r4, 0xE] - cmp r0, 0x3 - bne _081D52BA - b _081D53C0 -_081D52BA: - cmp r0, 0x1 - beq _081D52C0 - b _081D546E -_081D52C0: - adds r0, r4, 0 - bl sub_81D505C - ldr r0, =gUnknown_085EE120 - bl sub_8018884 - movs r0, 0xB - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D52DC: - movs r1, 0xD2 - lsls r1, 2 - adds r0, r4, 0 - bl sub_81D5064 - cmp r0, 0 - bne _081D52EC - b _081D548A -_081D52EC: - movs r0, 0xC - strb r0, [r4, 0x8] - b _081D548A -_081D52F2: - bl sub_81D4E30 - ldr r0, =gUnknown_085EE0DC - bl sub_8018884 -_081D52FC: - movs r0, 0xD - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5308: - adds r0, r4, 0 - adds r0, 0x9 - adds r1, r4, 0 - bl sub_81D4EE4 - cmp r0, 0x5 - bls _081D5318 - b _081D548A -_081D5318: - lsls r0, 2 - ldr r1, =_081D5328 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081D5328: - .4byte _081D548A - .4byte _081D5350 - .4byte _081D5340 - .4byte _081D5374 - .4byte _081D5374 - .4byte _081D5360 -_081D5340: - ldr r0, =gUnknown_085EE097 - bl sub_8018884 - movs r0, 0xE - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5350: - movs r0, 0x5 - bl PlaySE - bl CloseLink -_081D535A: - movs r0, 0x17 - strb r0, [r4, 0x8] - b _081D548A -_081D5360: - bl CloseLink - movs r0, 0x15 - strb r0, [r4, 0x8] - b _081D548A -_081D536A: - bl HasLinkErrorOccurred - lsls r0, 24 - cmp r0, 0 - beq _081D537A -_081D5374: - bl CloseLink - b _081D53C0 -_081D537A: - bl GetBlockReceivedStatus - lsls r0, 24 - cmp r0, 0 - bne _081D5386 - b _081D548A -_081D5386: - bl ResetBlockReceivedFlags - movs r0, 0xF - strb r0, [r4, 0x8] - b _081D548A -_081D5390: - ldr r0, =gDecompressionBuffer - bl sub_81D3920 - strb r0, [r4, 0xE] - ldrb r0, [r4, 0xE] - bl sub_800ABF4 - movs r0, 0x10 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D53A8: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _081D548A - ldrb r0, [r4, 0xE] - cmp r0, 0x1 - bne _081D53C0 - movs r0, 0x11 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D53C0: - movs r0, 0x14 - strb r0, [r4, 0x8] - b _081D548A -_081D53C6: - ldr r0, =gDecompressionBuffer - bl sub_81D3AB0 - cmp r0, 0 - beq _081D53EC - ldr r0, =gUnknown_085EE0FA - bl sub_8018884 - adds r0, r4, 0 - bl sub_81D505C - movs r0, 0x12 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D53EC: - movs r0, 0x16 - strb r0, [r4, 0x8] - b _081D548A -_081D53F2: - adds r0, r4, 0 - movs r1, 0x78 - bl sub_81D5064 - cmp r0, 0 - beq _081D548A - ldr r0, =gUnknown_085EE107 - bl sub_8018884 - movs r0, 0xB9 - lsls r0, 1 - bl PlayFanfare - movs r0, 0x13 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5418: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _081D548A - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - b _081D543A - .pool -_081D5430: - adds r0, r4, 0 - adds r0, 0x9 - ldr r1, =gUnknown_085EE06B - bl mevent_0814257C -_081D543A: - cmp r0, 0 - beq _081D548A - movs r0, 0x1A - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5448: - adds r0, r4, 0 - adds r0, 0x9 - ldr r1, =gUnknown_085EE0A3 - b _081D5466 - .pool -_081D5454: - adds r0, r4, 0 - adds r0, 0x9 - ldr r1, =gUnknown_085EE0BF - b _081D5466 - .pool -_081D5460: - adds r0, r4, 0 - adds r0, 0x9 - ldr r1, =gUnknown_085EE12D -_081D5466: - bl mevent_0814257C - cmp r0, 0 - beq _081D548A -_081D546E: - movs r0, 0 - strb r0, [r4, 0x8] - b _081D548A - .pool -_081D5478: - ldr r0, [r4, 0x10] - bl Free - adds r0, r5, 0 - bl DestroyTask - ldr r0, =sub_80186A4 - bl SetMainCallback2 -_081D548A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5084 - - thumb_func_start sp194_trainer_tower -sp194_trainer_tower: @ 81D5494 - push {lr} - bl sub_81D56B0 - ldr r1, =gUnknown_0862A618 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - bl sub_81D5710 - pop {r0} - bx r0 - .pool - thumb_func_end sp194_trainer_tower - - thumb_func_start sub_81D54BC -sub_81D54BC: @ 81D54BC - push {r4-r6,lr} - ldr r4, =gSaveBlock2Ptr - ldr r1, [r4] - ldr r3, =0x00000ef9 - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1] - ldr r1, [r4] - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r2, =gSaveBlock1Ptr - ldr r0, [r2] - ldr r1, =0x00003d68 - adds r0, r1 - movs r1, 0 - str r1, [r0] - adds r6, r2, 0 - ldr r5, =0x00003718 - movs r4, 0x3 -_081D54EE: - ldr r0, [r6] - adds r0, r5 - ldr r1, =0x00034bbf - bl sub_81D5DF4 - adds r5, 0x4 - subs r4, 0x1 - cmp r4, 0 - bge _081D54EE - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D54BC - - thumb_func_start sub_81D5520 -sub_81D5520: @ 81D5520 - ldr r0, =gMapHeader - ldrb r0, [r0, 0x12] - adds r0, 0x61 - lsls r0, 24 - lsrs r0, 24 - bx lr - .pool - thumb_func_end sub_81D5520 - - thumb_func_start GetTrainerHillOpponentClass -GetTrainerHillOpponentClass: @ 81D5530 - lsls r0, 24 - movs r1, 0xFF - lsls r1, 24 - adds r0, r1 - lsrs r0, 24 - ldr r2, =gFacilityClassToTrainerClass - ldr r1, =gUnknown_0203CF58 - ldr r1, [r1] - adds r1, 0x16 - adds r1, r0 - ldrb r0, [r1] - adds r0, r2 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetTrainerHillOpponentClass - - thumb_func_start GetTrainerHillTrainerName -GetTrainerHillTrainerName: @ 81D5554 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - movs r0, 0xFF - lsls r0, 24 - adds r1, r0 - lsrs r1, 24 - movs r3, 0 - ldr r0, =gUnknown_0203CF58 - ldr r2, [r0] - movs r0, 0xB - muls r0, r1 - adds r2, r0, r2 -_081D556E: - adds r1, r4, r3 - ldrb r0, [r2] - strb r0, [r1] - adds r2, 0x1 - adds r3, 0x1 - cmp r3, 0xA - ble _081D556E - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end GetTrainerHillTrainerName - - thumb_func_start GetTrainerHillTrainerFrontSpriteId -GetTrainerHillTrainerFrontSpriteId: @ 81D5588 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_81D56B0 - subs r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CF54 - ldr r3, [r0] - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r4 - ldrb r2, [r3] - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 3 - subs r0, r2 - adds r0, r1 - lsls r0, 3 - adds r3, r0 - ldrb r4, [r3, 0x1B] - bl sub_81D5710 - ldr r0, =gFacilityClassToPicIndex - adds r4, r0 - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetTrainerHillTrainerFrontSpriteId - - thumb_func_start sub_81D55D0 -sub_81D55D0: @ 81D55D0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - bl sub_81D56B0 - ldr r4, =gUnknown_0203CF58 - movs r0, 0x18 - bl AllocZeroed - str r0, [r4] - movs r6, 0 - ldr r0, =gUnknown_0203CF54 - mov r10, r0 -_081D55EE: - movs r5, 0 - lsls r1, r6, 2 - mov r8, r1 - adds r0, r6, 0x1 - mov r9, r0 - movs r0, 0xB - adds r1, r6, 0 - muls r1, r0 - mov r12, r1 - mov r1, r8 - adds r0, r1, r6 - lsls r0, 3 - adds r0, r6 - lsls r7, r0, 3 -_081D560A: - ldr r0, =gUnknown_0203CF58 - ldr r4, [r0] - mov r1, r12 - adds r0, r5, r1 - adds r4, r0 - mov r0, r10 - ldr r2, [r0] - adds r3, r5, r7 - ldrb r1, [r2] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 3 - subs r0, r1 - lsls r0, 3 - adds r3, r0 - adds r2, 0x10 - adds r2, r3 - ldrb r0, [r2] - strb r0, [r4] - adds r5, 0x1 - cmp r5, 0xA - ble _081D560A - ldr r1, =gUnknown_0203CF58 - ldr r4, [r1] - adds r4, 0x16 - adds r4, r6 - mov r0, r10 - ldr r3, [r0] - mov r1, r8 - adds r2, r1, r6 - lsls r2, 3 - adds r2, r6 - ldrb r1, [r3] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 3 - subs r0, r1 - adds r0, r2 - lsls r0, 3 - adds r3, r0 - ldrb r0, [r3, 0x1B] - strb r0, [r4] - mov r6, r9 - cmp r6, 0x1 - ble _081D55EE - ldr r1, =gSaveBlock1Ptr - ldr r0, [r1] - ldr r1, =0x00003d64 - adds r0, r1 - bl sub_80008DC - bl sub_81D5710 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D55D0 - - thumb_func_start sub_81D5694 -sub_81D5694: @ 81D5694 - push {r4,lr} - ldr r4, =gUnknown_0203CF58 - ldr r0, [r4] - cmp r0, 0 - beq _081D56A6 - bl Free - movs r0, 0 - str r0, [r4] -_081D56A6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5694 - - thumb_func_start sub_81D56B0 -sub_81D56B0: @ 81D56B0 - push {r4,lr} - ldr r4, =gUnknown_0203CF54 - ldr r0, [r4] - cmp r0, 0 - bne _081D56EC - ldr r0, =0x00000eec - bl AllocZeroed - str r0, [r4] - ldr r1, =gMapHeader - ldrb r1, [r1, 0x12] - adds r1, 0x61 - strb r1, [r0] - ldr r1, =gUnknown_0862A5F8 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003d6e - adds r0, r2 - ldrb r0, [r0] - lsrs r0, 6 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r4] - adds r1, 0x4 - ldr r2, =0x040003ba - bl CpuSet - bl nullsub_2 -_081D56EC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D56B0 - - thumb_func_start sub_81D5710 -sub_81D5710: @ 81D5710 - push {r4,lr} - ldr r4, =gUnknown_0203CF54 - ldr r0, [r4] - cmp r0, 0 - beq _081D5722 - bl Free - movs r0, 0 - str r0, [r4] -_081D5722: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5710 - - thumb_func_start CopyTrainerHillTrainerText -CopyTrainerHillTrainerText: @ 81D572C - push {r4-r6,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_81D56B0 - bl sub_81D5520 - lsls r0, 24 - lsrs r2, r0, 24 - subs r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - cmp r5, 0x3 - beq _081D5790 - cmp r5, 0x3 - bgt _081D575A - cmp r5, 0x2 - beq _081D5764 - b _081D580E -_081D575A: - cmp r6, 0x4 - beq _081D57BC - cmp r6, 0x5 - beq _081D57E8 - b _081D580E -_081D5764: - ldr r0, =gUnknown_0203CF54 - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 3 - subs r1, r2 - lsls r1, 3 - adds r1, 0xC - ldr r0, [r0] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r4 - lsls r1, 3 - adds r1, 0x4 - adds r0, r1 - adds r0, 0x10 - bl FrontierSpeechToString - b _081D580E - .pool -_081D5790: - ldr r0, =gUnknown_0203CF54 - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 3 - subs r1, r2 - lsls r1, 3 - adds r1, 0xC - ldr r0, [r0] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r4 - lsls r1, 3 - adds r1, 0x4 - adds r0, r1 - adds r0, 0x1C - bl FrontierSpeechToString - b _081D580E - .pool -_081D57BC: - ldr r0, =gUnknown_0203CF54 - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 3 - subs r1, r2 - lsls r1, 3 - adds r1, 0xC - ldr r0, [r0] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r4 - lsls r1, 3 - adds r1, 0x4 - adds r0, r1 - adds r0, 0x28 - bl FrontierSpeechToString - b _081D580E - .pool -_081D57E8: - ldr r0, =gUnknown_0203CF54 - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 3 - subs r1, r2 - lsls r1, 3 - adds r1, 0xC - ldr r0, [r0] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r4 - lsls r1, 3 - adds r1, 0x4 - adds r0, r1 - adds r0, 0x34 - bl FrontierSpeechToString -_081D580E: - bl sub_81D5710 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end CopyTrainerHillTrainerText - - thumb_func_start sub_81D581C -sub_81D581C: @ 81D581C - push {r4-r6,lr} - bl nullsub_2 - bl sub_81D3B34 - cmp r0, 0 - bne _081D5844 - ldr r3, =gSaveBlock1Ptr - ldr r1, [r3] - ldr r0, =0x00003d6e - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x20 - orrs r0, r2 - b _081D5854 - .pool -_081D5844: - ldr r3, =gSaveBlock1Ptr - ldr r1, [r3] - ldr r0, =0x00003d6e - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 -_081D5854: - strb r0, [r1] - adds r6, r3, 0 - ldr r0, [r6] - ldr r1, =0x00003d6c - adds r0, r1 - movs r5, 0 - strb r5, [r0] - ldr r0, [r6] - ldr r4, =0x00003d64 - adds r0, r4 - bl sub_80008DC - ldr r1, [r6] - adds r4, r1, r4 - str r5, [r4] - ldr r3, =0x00003d6e - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, [r6] - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r1, [r6] - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xEE - lsls r1, 4 - adds r0, r1 - strb r5, [r0] - ldr r0, =gBattleOutcome - strb r5, [r0] - ldr r1, [r6] - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D581C - - thumb_func_start sub_81D58D8 -sub_81D58D8: @ 81D58D8 - push {lr} - bl sub_80008E8 - ldr r3, =gSpecialVar_Result - movs r0, 0 - strh r0, [r3] - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d6e - adds r2, r0, r1 - ldrb r1, [r2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _081D58FA - movs r0, 0x1 - strh r0, [r3] -_081D58FA: - ldrb r1, [r2] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x3 - bne _081D590A - ldrh r0, [r3] - adds r0, 0x1 - strh r0, [r3] -_081D590A: - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D58D8 - - thumb_func_start sub_81D5924 -sub_81D5924: @ 81D5924 - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl sub_81D6640 - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =gUnknown_0203CF54 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - cmp r0, 0x4 - bne _081D5952 - ldr r0, =gSaveBlock1Ptr - mov r8, r0 - ldr r0, [r0] - ldr r7, =0x00003d6e - adds r0, r7 - ldrb r0, [r0] - movs r6, 0x1 - adds r4, r6, 0 - ands r4, r0 - cmp r4, 0 - beq _081D596C -_081D5952: - ldr r1, =gSpecialVar_Result - movs r0, 0x2 - strh r0, [r1] - b _081D59C0 - .pool -_081D596C: - adds r0, r5, 0 - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081D59BC - ldr r1, =gStringVar2 - adds r0, r5, 0 - bl CopyItemName - mov r0, r8 - ldr r1, [r0] - adds r1, r7 - ldrb r0, [r1] - movs r2, 0x1 - orrs r0, r2 - strb r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r0, =0x00000ef9 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x80 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, =gSpecialVar_Result - strh r4, [r0] - b _081D59C0 - .pool -_081D59BC: - ldr r0, =gSpecialVar_Result - strh r6, [r0] -_081D59C0: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5924 - - thumb_func_start sub_81D59D0 -sub_81D59D0: @ 81D59D0 - push {r4-r6,lr} - ldr r4, =gSaveBlock1Ptr - ldr r2, [r4] - ldr r6, =0x00003d6e - adds r0, r2, r6 - ldrb r1, [r0] - movs r3, 0x2 - adds r0, r3, 0 - ands r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _081D59FC - ldr r0, =gSpecialVar_Result - strh r3, [r0] - b _081D5A4E - .pool -_081D59FC: - ldr r1, =0x00003d68 - adds r0, r2, r1 - bl free_203F458 - ldr r2, [r4] - ldr r3, =0x00003d64 - adds r1, r2, r3 - ldr r1, [r1] - cmp r0, r1 - bls _081D5A48 - adds r3, 0x4 - adds r0, r2, r3 - bl sub_81D5DF4 - ldr r2, [r4] - adds r0, r2, r6 - ldrb r0, [r0] - lsrs r0, 6 - lsls r0, 2 - ldr r3, =0x00003718 - adds r1, r2, r3 - adds r1, r0 - ldr r0, =0x00003d68 - adds r2, r0 - ldr r0, [r2] - str r0, [r1] - ldr r0, =gSpecialVar_Result - strh r5, [r0] - b _081D5A4E - .pool -_081D5A48: - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] -_081D5A4E: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r3, =0x00003d6e - adds r1, r3 - ldrb r0, [r1] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D59D0 - - thumb_func_start sub_81D5A70 -sub_81D5A70: @ 81D5A70 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =0x00003d6e - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _081D5AAE - ldr r0, =0x00003d64 - adds r2, r0 - ldr r1, [r2] - ldr r0, =0x00034bbe - cmp r1, r0 - bls _081D5AA8 - adds r0, 0x1 - str r0, [r2] - b _081D5AAE - .pool -_081D5AA8: - adds r0, r2, 0 - bl sub_80008DC -_081D5AAE: - pop {r0} - bx r0 - thumb_func_end sub_81D5A70 - - thumb_func_start sub_81D5AB4 -sub_81D5AB4: @ 81D5AB4 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x00003d6e - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x8 - orrs r0, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_81D5AB4 - - thumb_func_start sub_81D5AD0 -sub_81D5AD0: @ 81D5AD0 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d6e - adds r2, r0, r1 - ldrb r1, [r2] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081D5B00 - movs r0, 0x9 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r1, =gSpecialVar_Result - movs r0, 0 - b _081D5B20 - .pool -_081D5B00: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _081D5B1C - movs r0, 0x11 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - b _081D5B20 - .pool -_081D5B1C: - ldr r1, =gSpecialVar_Result - movs r0, 0x2 -_081D5B20: - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5AD0 - - thumb_func_start sub_81D5B2C -sub_81D5B2C: @ 81D5B2C - push {r4-r7,lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d64 - adds r0, r1 - ldr r7, [r0] - ldr r0, =0x00034bbe - cmp r7, r0 - ble _081D5B40 - ldr r7, =0x00034bbf -_081D5B40: - movs r4, 0xE1 - lsls r4, 4 - adds r0, r7, 0 - adds r1, r4, 0 - bl __divsi3 - adds r6, r0, 0 - adds r0, r7, 0 - adds r1, r4, 0 - bl __modsi3 - adds r7, r0, 0 - movs r1, 0x3C - bl __divsi3 - adds r5, r0, 0 - adds r0, r7, 0 - movs r1, 0x3C - bl __modsi3 - adds r7, r0, 0 - movs r0, 0xA8 - muls r0, r7 - movs r1, 0x64 - bl __divsi3 - adds r4, r0, 0 - ldr r0, =gStringVar1 - adds r1, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar3 - adds r1, r4, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5B2C - - thumb_func_start sub_81D5BBC -sub_81D5BBC: @ 81D5BBC - push {lr} - bl sub_81D56B0 - ldr r0, =gUnknown_0203CF54 - ldr r1, [r0] - ldrb r0, [r1, 0x6] - cmp r0, 0x4 - beq _081D5BEC - ldr r0, =gStringVar1 - ldrb r1, [r1, 0x6] - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r1, =gSpecialVar_Result - movs r0, 0 - b _081D5BF0 - .pool -_081D5BEC: - ldr r1, =gSpecialVar_Result - movs r0, 0x1 -_081D5BF0: - strh r0, [r1] - bl sub_81D5710 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5BBC - - thumb_func_start sub_81D5C00 -sub_81D5C00: @ 81D5C00 - push {lr} - bl sub_81D56B0 - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - bl sub_81D5710 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5C00 - - thumb_func_start sub_81D5C18 -sub_81D5C18: @ 81D5C18 - push {lr} - ldr r0, =0x000040d6 - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _081D5C42 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d6e - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _081D5C42 - bl GetCurrentTrainerHillMapId - lsls r0, 24 - cmp r0, 0 - bne _081D5C54 -_081D5C42: - movs r0, 0 - b _081D5C56 - .pool -_081D5C54: - movs r0, 0x1 -_081D5C56: - pop {r1} - bx r1 - thumb_func_end sub_81D5C18 - - thumb_func_start sub_81D5C5C -sub_81D5C5C: @ 81D5C5C - push {lr} - bl sub_81D5C18 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _081D5C74 - ldr r0, =gSpecialVar_Result - strh r1, [r0] - b _081D5C7A - .pool -_081D5C74: - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] -_081D5C7A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5C5C - - thumb_func_start nullsub_129 -nullsub_129: @ 81D5C84 - bx lr - thumb_func_end nullsub_129 - - thumb_func_start nullsub_2 -nullsub_2: @ 81D5C88 - bx lr - thumb_func_end nullsub_2 - - thumb_func_start PrintOnTrainerHillRecordsWindow -PrintOnTrainerHillRecordsWindow: @ 81D5C8C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - bl sub_81D56B0 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r5, =gText_TimeBoard - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0xD0 - bl GetStringCenterAlignXOffset - lsls r2, r0, 24 - lsrs r2, 24 - ldr r6, =gUnknown_0862A5F4 - str r6, [sp] - movs r4, 0x1 - negs r4, r4 - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r3, 0x2 - bl AddTextPrinterParameterized3 - movs r7, 0x12 - movs r0, 0 - mov r8, r0 - mov r10, r4 - ldr r1, =gStringVar4 - mov r9, r1 -_081D5CD6: - lsls r3, r7, 24 - lsrs r3, 24 - ldr r0, =gUnknown_0862A5F4 - str r0, [sp] - mov r1, r10 - str r1, [sp, 0x4] - ldr r0, =gUnknown_0862A660 - mov r1, r8 - lsls r4, r1, 2 - adds r0, r4, r0 - ldr r0, [r0] - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - bl AddTextPrinterParameterized3 - adds r7, 0xF - ldr r0, =gSaveBlock1Ptr - ldr r1, =0x00003718 - adds r4, r1 - ldr r0, [r0] - adds r0, r4 - bl free_203F458 - adds r4, r0, 0 - movs r5, 0xE1 - lsls r5, 4 - adds r1, r5, 0 - bl __udivsi3 - adds r6, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - bl __umodsi3 - adds r5, r0, 0 - ldr r0, =gStringVar1 - adds r1, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r0, r5, 0 - movs r1, 0x3C - bl __udivsi3 - adds r4, r0, 0 - adds r0, r5, 0 - movs r1, 0x3C - bl __umodsi3 - adds r5, r0, 0 - ldr r0, =gStringVar2 - adds r1, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r0, 0xA8 - muls r0, r5 - movs r1, 0x64 - bl __udivsi3 - adds r1, r0, 0 - ldr r0, =gStringVar3 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - mov r0, r9 - ldr r1, =gText_TimeCleared - bl StringCopy - ldr r1, =gText_XMinYDotZSec - bl StringExpandPlaceholders - movs r0, 0x1 - mov r1, r9 - movs r2, 0xD0 - bl GetStringRightAlignXOffset - lsls r2, r0, 24 - lsrs r2, 24 - lsls r3, r7, 24 - lsrs r3, 24 - ldr r0, =gUnknown_0862A5F4 - str r0, [sp] - mov r1, r10 - str r1, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParameterized3 - adds r7, 0x11 - movs r1, 0x1 - add r8, r1 - mov r0, r8 - cmp r0, 0x3 - ble _081D5CD6 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - bl sub_81D5710 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end PrintOnTrainerHillRecordsWindow - - thumb_func_start free_203F458 -free_203F458: @ 81D5DF0 - ldr r0, [r0] - bx lr - thumb_func_end free_203F458 - - thumb_func_start sub_81D5DF4 -sub_81D5DF4: @ 81D5DF4 - str r1, [r0] - bx lr - thumb_func_end sub_81D5DF4 - - thumb_func_start sub_81D5DF8 -sub_81D5DF8: @ 81D5DF8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0xC7 - lsls r1, 4 - adds r1, r0, r1 - str r1, [sp, 0x4] - bl sub_81D5F48 - cmp r0, 0 - beq _081D5F0E - bl sub_81D56B0 - movs r7, 0 - ldr r4, =gSaveBlock2Ptr - ldr r3, =0x00000cb4 - ldr r0, =0x0000ffff - adds r2, r0, 0 -_081D5E26: - ldr r1, [r4] - lsls r0, r7, 1 - adds r1, r3 - adds r1, r0 - ldrh r0, [r1] - orrs r0, r2 - strh r0, [r1] - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x1 - bls _081D5E26 - movs r0, 0 - str r0, [sp] - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r2, 0xC7 - lsls r2, 4 - adds r1, r2 - ldr r2, =0x05000180 - mov r0, sp - bl CpuSet - bl sub_81D5520 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r7, 0 - ldr r3, =gUnknown_0203CF54 - mov r10, r3 -_081D5E64: - lsls r4, r7, 1 - mov r8, r4 - adds r5, r4, r7 - lsls r5, 3 - ldr r0, [sp, 0x4] - adds r5, r0 - adds r1, r5, 0 - ldr r0, =gUnknown_0862A670 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - adds r6, r7, 0x1 - strb r6, [r5] - mov r0, r10 - ldr r1, [r0] - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r7 - lsls r0, 3 - mov r2, r9 - lsls r4, r2, 4 - subs r4, r2 - lsls r4, 3 - subs r4, r2 - lsls r4, 3 - adds r0, r4 - adds r1, r0 - ldrb r0, [r1, 0x1B] - bl sub_81660B8 - strb r0, [r5, 0x1] - mov r0, r10 - ldr r3, [r0] - adds r0, r7, r4 - movs r2, 0xF0 - lsls r2, 2 - adds r1, r3, r2 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0xF - ands r0, r2 - strh r0, [r5, 0x4] - ldrb r0, [r1] - lsrs r0, 4 - movs r1, 0xF - ands r0, r1 - adds r0, 0x5 - strh r0, [r5, 0x6] - lsls r1, r7, 26 - lsrs r1, 24 - adds r3, r4 - ldr r2, =0x000003c2 - adds r3, r2 - ldrb r0, [r3] - asrs r0, r1 - movs r3, 0xF - ands r0, r3 - adds r0, 0x7 - strb r0, [r5, 0x9] - mov r2, r10 - ldr r0, [r2] - adds r0, r4 - ldr r3, =0x000003c3 - adds r0, r3 - ldrb r0, [r0] - asrs r0, r1 - movs r1, 0xF - ands r0, r1 - strh r0, [r5, 0xE] - ldr r0, =EventScript_2C83F0 - str r0, [r5, 0x10] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r4, =0x00000cb4 - adds r0, r4 - add r0, r8 - strh r6, [r0] - lsls r6, 24 - lsrs r7, r6, 24 - cmp r7, 0x1 - bls _081D5E64 - bl sub_81D5710 -_081D5F0E: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5DF8 - - thumb_func_start sub_81D5F48 -sub_81D5F48: @ 81D5F48 - push {lr} - bl sub_81D56B0 - bl sub_81D5710 - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_81D5F48 - - thumb_func_start sub_81D5F58 -sub_81D5F58: @ 81D5F58 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gUnknown_0203CF54 - ldr r4, [r4] - mov r12, r4 - lsls r4, r2, 1 - lsls r5, r0, 4 - subs r5, r0 - lsls r5, 3 - subs r5, r0 - lsls r5, 3 - adds r4, r5 - movs r0, 0xE8 - lsls r0, 2 - add r0, r12 - adds r0, r4 - ldrh r0, [r0] - movs r4, 0xF - subs r4, r1 - asrs r0, r4 - movs r4, 0x1 - ands r0, r4 - muls r2, r3 - adds r2, r1 - adds r2, r5 - movs r1, 0xA8 - lsls r1, 2 - add r1, r12 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0x80 - lsls r2, 2 - adds r3, r2, 0 - movs r2, 0xC0 - lsls r2, 6 - lsls r0, 10 - orrs r0, r2 - orrs r1, r3 - orrs r0, r1 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D5F58 - - thumb_func_start sub_81D5FB4 -sub_81D5FB4: @ 81D5FB4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r4, r0, 0 - bl GetCurrentTrainerHillMapId - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - cmp r0, 0x6 - bne _081D5FD2 - bl InitMapFromSavedGame - b _081D605E -_081D5FD2: - bl sub_81D56B0 - mov r0, r9 - cmp r0, 0x5 - bne _081D5FE6 - bl InitMapFromSavedGame - bl sub_81D5710 - b _081D605E -_081D5FE6: - bl sub_81D5520 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r0, =gMapHeader - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r1, =gBackupMapLayout - str r4, [r1, 0x8] - movs r0, 0x1F - str r0, [r1] - movs r0, 0x23 - str r0, [r1, 0x4] - movs r0, 0xE0 - lsls r0, 1 - adds r3, r4, r0 - movs r6, 0x4 -_081D600A: - adds r4, r2, 0 - adds r4, 0x20 - adds r1, r3, 0 - movs r5, 0xF -_081D6012: - ldrh r0, [r2] - strh r0, [r1] - adds r2, 0x2 - adds r1, 0x2 - subs r5, 0x1 - cmp r5, 0 - bge _081D6012 - adds r3, 0x3E - adds r2, r4, 0 - subs r6, 0x1 - cmp r6, 0 - bge _081D600A - movs r6, 0 -_081D602C: - movs r5, 0 - adds r7, r3, 0 - adds r7, 0x3E - adds r0, r6, 0x1 - mov r8, r0 - adds r4, r3, 0 -_081D6038: - mov r0, r9 - adds r1, r5, 0 - adds r2, r6, 0 - movs r3, 0x10 - bl sub_81D5F58 - strh r0, [r4] - adds r4, 0x2 - adds r5, 0x1 - cmp r5, 0xF - ble _081D6038 - adds r3, r7, 0 - mov r6, r8 - cmp r6, 0xF - ble _081D602C - bl mapheader_run_script_with_tag_x1 - bl sub_81D5710 -_081D605E: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D5FB4 - - thumb_func_start InTrainerHill -InTrainerHill: @ 81D6074 - push {lr} - ldr r1, =gMapHeader - ldr r2, =0xfffffe61 - adds r0, r2, 0 - ldrh r1, [r1, 0x12] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0 - cmp r0, 0x3 - bhi _081D608C - movs r1, 0x1 -_081D608C: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end InTrainerHill - - thumb_func_start GetCurrentTrainerHillMapId -@ u8 GetCurrentTrainerHillMapId() -GetCurrentTrainerHillMapId: @ 81D609C - push {lr} - ldr r0, =gMapHeader - ldrh r2, [r0, 0x12] - ldr r0, =0x0000019f - cmp r2, r0 - bne _081D60B4 - movs r1, 0x1 - b _081D60F8 - .pool -_081D60B4: - movs r0, 0xD0 - lsls r0, 1 - cmp r2, r0 - bne _081D60C0 - movs r1, 0x2 - b _081D60F8 -_081D60C0: - ldr r0, =0x000001a1 - cmp r2, r0 - bne _081D60D0 - movs r1, 0x3 - b _081D60F8 - .pool -_081D60D0: - movs r0, 0xD1 - lsls r0, 1 - cmp r2, r0 - bne _081D60DC - movs r1, 0x4 - b _081D60F8 -_081D60DC: - ldr r0, =0x000001a3 - cmp r2, r0 - bne _081D60EC - movs r1, 0x5 - b _081D60F8 - .pool -_081D60EC: - movs r0, 0xCF - lsls r0, 1 - movs r1, 0 - cmp r2, r0 - bne _081D60F8 - movs r1, 0x6 -_081D60F8: - adds r0, r1, 0 - pop {r1} - bx r1 - thumb_func_end GetCurrentTrainerHillMapId - - thumb_func_start sub_81D6100 -sub_81D6100: @ 81D6100 - push {lr} - ldr r0, =gMapHeader - ldrh r1, [r0, 0x12] - ldr r0, =0x000001a3 - movs r2, 0 - cmp r1, r0 - bne _081D6110 - movs r2, 0x1 -_081D6110: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D6100 - - thumb_func_start sub_81D6120 -sub_81D6120: @ 81D6120 - push {lr} - movs r0, 0x1A - movs r1, 0x40 - bl Overworld_GetMapHeaderByGroupAndId - ldr r0, [r0, 0x4] - ldr r0, [r0, 0x8] - adds r0, 0x8 - pop {r1} - bx r1 - thumb_func_end sub_81D6120 - - thumb_func_start sub_81D6134 -sub_81D6134: @ 81D6134 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081D614C - ldr r0, =gMapHeader - ldr r0, [r0, 0x4] - ldr r0, [r0, 0x8] - adds r0, 0x8 - b _081D6176 - .pool -_081D614C: - bl sub_81D6490 - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0xFF - lsls r1, 24 - adds r0, r1 - lsrs r0, 24 - cmp r0, 0x3 - bls _081D6162 - movs r2, 0x4 -_081D6162: - ldr r1, =gUnknown_0862A688 - subs r0, r2, 0x1 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0x1A - bl Overworld_GetMapHeaderByGroupAndId - ldr r0, [r0, 0x4] - ldr r0, [r0, 0x8] -_081D6176: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D6134 - - thumb_func_start sub_81D6180 -sub_81D6180: @ 81D6180 - lsls r0, 24 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - lsrs r0, 23 - adds r1, r0 - ldr r0, =0x00000cb2 - adds r1, r0 - ldrh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D6180 - - thumb_func_start GetTrainerHillTrainerFlag -@ u8 GetTrainerHillTrainerFlag(u8 eventObjectId) -GetTrainerHillTrainerFlag: @ 81D619C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_81D5520 - lsls r0, 24 - lsrs r0, 23 - ldr r2, =gEventObjects - lsls r1, r4, 3 - adds r1, r4 - lsls r1, 2 - adds r1, r2 - adds r0, 0xFF - ldrb r1, [r1, 0x8] - adds r0, r1 - lsls r0, 24 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - movs r2, 0xEE - lsls r2, 4 - adds r1, r2 - ldr r2, =gBitTable - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ldrb r1, [r1] - ands r0, r1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetTrainerHillTrainerFlag - - thumb_func_start sub_81D61E8 -sub_81D61E8: @ 81D61E8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl sub_81D5520 - lsls r0, 25 - lsrs r4, r0, 24 - movs r3, 0 - ldr r0, =gTrainerBattleOpponent_A - mov r8, r0 - ldr r6, =gSaveBlock2Ptr - ldr r1, =gBitTable - mov r12, r1 - adds r5, r6, 0 -_081D6204: - ldr r2, [r5] - lsls r0, r3, 1 - ldr r7, =0x00000cb4 - adds r1, r2, r7 - adds r1, r0 - ldrh r0, [r1] - mov r1, r8 - ldrh r1, [r1] - cmp r0, r1 - bne _081D6240 - movs r7, 0xEE - lsls r7, 4 - adds r2, r7 - adds r0, r4, r3 - lsls r0, 2 - add r0, r12 - ldr r0, [r0] - ldrb r1, [r2] - orrs r0, r1 - strb r0, [r2] - b _081D624A - .pool -_081D6240: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _081D6204 -_081D624A: - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _081D62A2 - movs r3, 0 - ldr r5, =gTrainerBattleOpponent_B - ldr r0, =gBitTable - mov r8, r0 -_081D6260: - ldr r2, [r6] - lsls r0, r3, 1 - ldr r7, =0x00000cb4 - adds r1, r2, r7 - adds r1, r0 - ldrh r0, [r1] - ldrh r1, [r5] - cmp r0, r1 - bne _081D6298 - movs r7, 0xEE - lsls r7, 4 - adds r2, r7 - adds r0, r4, r3 - lsls r0, 2 - add r0, r8 - ldr r0, [r0] - ldrb r1, [r2] - orrs r0, r1 - strb r0, [r2] - b _081D62A2 - .pool -_081D6298: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _081D6260 -_081D62A2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81D61E8 - - thumb_func_start sub_81D62AC -sub_81D62AC: @ 81D62AC - ldr r0, =EventScript_2C83F0 - bx lr - .pool - thumb_func_end sub_81D62AC - - thumb_func_start sub_81D62B4 -sub_81D62B4: @ 81D62B4 - push {lr} - ldr r0, =gSpecialVar_LastTalked - ldrh r1, [r0] - movs r0, 0x5 - bl CopyTrainerHillTrainerText - bl sub_80982B8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D62B4 - - thumb_func_start sub_81D62CC -sub_81D62CC: @ 81D62CC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - subs r1, r0, 0x1 - lsls r0, r1, 16 - lsrs r0, 16 - cmp r0, 0x1 - bhi _081D636A - lsls r0, r1, 24 - lsrs r6, r0, 24 - bl sub_81D56B0 - bl GetHighestLevelInPlayerParty - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - bl sub_81D5520 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r5, r9 - adds r0, r5, 0x3 - cmp r5, r0 - bge _081D6366 - ldr r1, =gUnknown_0862A698 - lsls r0, r6, 1 - adds r0, r6 - adds r7, r0, r1 -_081D6316: - ldrb r2, [r7] - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - mov r1, r8 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 3 - subs r0, r1 - lsls r0, 3 - adds r0, 0xC - ldr r3, =gUnknown_0203CF54 - ldr r1, [r3] - adds r1, r0 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r6 - lsls r0, 3 - adds r0, 0x4 - adds r1, r0 - movs r0, 0x2C - muls r0, r2 - adds r0, 0x40 - adds r1, r0 - adds r0, r4, 0 - bl sub_806819C - adds r0, r4, 0 - mov r1, r10 - bl sub_81D642C - adds r5, 0x1 - adds r7, 0x1 - mov r0, r9 - adds r0, 0x3 - cmp r5, r0 - blt _081D6316 -_081D6366: - bl sub_81D5710 -_081D636A: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D62CC - - thumb_func_start sub_81D6384 -sub_81D6384: @ 81D6384 - push {lr} - bl ZeroEnemyPartyMons - ldr r0, =gTrainerBattleOpponent_A - ldrh r0, [r0] - movs r1, 0 - bl sub_81D62CC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D6384 - - thumb_func_start sub_81D639C -sub_81D639C: @ 81D639C - push {lr} - bl ZeroEnemyPartyMons - ldr r0, =gTrainerBattleOpponent_A - ldrh r0, [r0] - movs r1, 0 - bl sub_81D62CC - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - movs r1, 0x3 - bl sub_81D62CC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D639C - - thumb_func_start sub_81D63C4 -sub_81D63C4: @ 81D63C4 - movs r0, 0x7 - bx lr - thumb_func_end sub_81D63C4 - - thumb_func_start sub_81D63C8 -sub_81D63C8: @ 81D63C8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_81D56B0 - subs r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203CF54 - ldr r3, [r0] - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r4 - ldrb r2, [r3] - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 3 - subs r0, r2 - adds r0, r1 - lsls r0, 3 - adds r3, r0 - ldrb r4, [r3, 0x1B] - bl sub_81D5710 - movs r2, 0 - ldr r0, =gFacilityClassToTrainerClass - adds r4, r0 - ldrb r3, [r4] - ldr r1, =gUnknown_0862A3B4 -_081D6406: - ldrb r0, [r1] - cmp r0, r3 - bne _081D641C - ldrb r0, [r1, 0x1] - b _081D6426 - .pool -_081D641C: - adds r1, 0x4 - adds r2, 0x1 - cmp r2, 0x35 - bls _081D6406 - movs r0, 0 -_081D6426: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81D63C8 - - thumb_func_start sub_81D642C -sub_81D642C: @ 81D642C - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - mov r0, sp - strb r1, [r0] - adds r0, r4, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r5, =gExperienceTables - mov r1, sp - ldrb r2, [r1] - lsls r2, 2 - ldr r3, =gBaseStats - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r1, [r1, 0x13] - movs r0, 0xCA - lsls r0, 1 - muls r0, r1 - adds r2, r0 - adds r2, r5 - ldr r0, [r2] - str r0, [sp, 0x4] - add r2, sp, 0x4 - adds r0, r4, 0 - movs r1, 0x19 - bl SetMonData - adds r0, r4, 0 - movs r1, 0x38 - mov r2, sp - bl SetMonData - adds r0, r4, 0 - bl CalculateMonStats - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D642C - - thumb_func_start sub_81D6490 -sub_81D6490: @ 81D6490 - push {r4,lr} - bl sub_81D56B0 - ldr r0, =gUnknown_0203CF54 - ldr r0, [r0] - ldrb r4, [r0, 0x6] - bl sub_81D5710 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D6490 - - thumb_func_start sub_81D64AC -sub_81D64AC: @ 81D64AC - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xEE - lsls r1, 4 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_81D64AC - - thumb_func_start sub_81D64C0 -sub_81D64C0: @ 81D64C0 - push {lr} - bl sub_81D6534 - cmp r0, 0x1 - bne _081D64D4 - ldr r0, =gUnknown_0862A5D4 - movs r1, 0x70 - movs r2, 0x20 - bl LoadPalette -_081D64D4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D64C0 - - thumb_func_start sub_81D64DC -sub_81D64DC: @ 81D64DC - ldr r1, =gSpecialVar_Result - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r2, =0x00000ef9 - adds r0, r2 - ldrb r0, [r0] - lsrs r0, 7 - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81D64DC - - thumb_func_start sub_81D64FC -sub_81D64FC: @ 81D64FC - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r0, =0x00000ef9 - adds r1, r0 - ldrb r0, [r1] - movs r2, 0x80 - orrs r0, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_81D64FC - - thumb_func_start sub_81D6518 -sub_81D6518: @ 81D6518 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r0, =0x00000ef9 - adds r1, r0 - ldrb r2, [r1] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_81D6518 - - thumb_func_start sub_81D6534 -sub_81D6534: @ 81D6534 - push {lr} - bl sub_81D5C18 - lsls r0, 24 - cmp r0, 0 - beq _081D6560 - bl GetCurrentTrainerHillMapId - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x6 - beq _081D6560 - bl sub_81D5C00 - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0 - beq _081D6560 - movs r0, 0x1 - b _081D6562 - .pool -_081D6560: - movs r0, 0 -_081D6562: - pop {r1} - bx r1 - thumb_func_end sub_81D6534 - - thumb_func_start sub_81D6568 -sub_81D6568: @ 81D6568 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d6e - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _081D6590 - ldr r1, =gSpecialVar_Result - movs r0, 0 - b _081D6594 - .pool -_081D6590: - ldr r1, =gSpecialVar_Result - movs r0, 0x1 -_081D6594: - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D6568 - - thumb_func_start sub_81D65A0 -sub_81D65A0: @ 81D65A0 - push {r4,r5,lr} - ldr r4, =gSaveBlock1Ptr - ldr r2, [r4] - ldr r5, =gSpecialVar_0x8005 - ldr r0, =0x00003d6e - adds r2, r0 - ldrb r1, [r5] - lsls r1, 6 - ldrb r3, [r2] - movs r0, 0x3F - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - ldr r1, [r4] - ldr r3, =0x00003d68 - adds r2, r1, r3 - ldrh r0, [r5] - lsls r0, 2 - ldr r3, =0x00003718 - adds r1, r3 - adds r1, r0 - ldr r0, [r1] - str r0, [r2] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D65A0 - - thumb_func_start sub_81D65E8 -sub_81D65E8: @ 81D65E8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - movs r3, 0 - movs r4, 0 - ldr r0, =gUnknown_0203CF54 - ldr r6, [r0] - movs r5, 0x1F -_081D65F8: - lsls r1, r4, 4 - subs r1, r4 - lsls r1, 3 - subs r1, r4 - lsls r1, 3 - adds r1, r6, r1 - ldrb r2, [r1, 0xC] - adds r0, r5, 0 - ands r0, r2 - eors r3, r0 - ldrb r1, [r1, 0xD] - adds r0, r5, 0 - ands r0, r1 - eors r3, r0 - lsls r0, r3, 24 - lsrs r3, r0, 24 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _081D65F8 - movs r1, 0x5 - cmp r7, 0 - beq _081D662A - movs r1, 0xA -_081D662A: - adds r0, r3, 0 - bl __umodsi3 - lsls r0, 24 - lsrs r3, r0, 24 - adds r0, r3, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D65E8 - - thumb_func_start sub_81D6640 -sub_81D6640: @ 81D6640 - push {r4,r5,lr} - movs r3, 0 - movs r2, 0 - ldr r0, =gUnknown_0203CF54 - ldr r4, [r0] -_081D664A: - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 3 - subs r0, r2 - lsls r0, 3 - adds r0, r4, r0 - ldrb r1, [r0, 0xC] - adds r1, r3, r1 - ldrb r0, [r0, 0xD] - adds r3, r1, r0 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _081D664A - adds r0, r3, 0 - cmp r0, 0 - bge _081D6670 - adds r0, 0xFF -_081D6670: - asrs r4, r0, 8 - lsrs r0, 31 - adds r0, r4, r0 - asrs r0, 1 - lsls r0, 1 - subs r4, r0 - ldr r0, =0x00000864 @ = FLAG_SYS_GAME_CLEAR - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _081D66A0 - ldr r0, =gUnknown_0203CF54 - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0x8 - bne _081D66A0 - movs r0, 0x1 - b _081D66A2 - .pool -_081D66A0: - movs r0, 0 -_081D66A2: - bl sub_81D65E8 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gSaveBlock1Ptr - ldr r5, [r0] - ldr r1, =0x00003d6e - adds r0, r5, r1 - ldrb r1, [r0] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0xC0 - bne _081D66C8 - adds r0, r2, 0x1 - movs r1, 0xA - bl __modsi3 - lsls r0, 24 - lsrs r2, r0, 24 -_081D66C8: - ldr r1, =gUnknown_0862A5CC - lsls r0, r4, 2 - adds r0, r1 - ldr r1, [r0] - lsls r0, r2, 2 - adds r0, r1 - ldr r4, [r0] - ldr r1, =0x00003d64 - adds r0, r5, r1 - ldr r0, [r0] - movs r1, 0xE1 - lsls r1, 4 - bl __divsi3 - movs r1, 0 - cmp r0, 0xB - ble _081D6704 - movs r1, 0x1 - cmp r0, 0xC - ble _081D6704 - movs r1, 0x2 - cmp r0, 0xD - ble _081D6704 - movs r1, 0x3 - cmp r0, 0xF - ble _081D6704 - movs r1, 0x5 - cmp r0, 0x11 - bgt _081D6704 - movs r1, 0x4 -_081D6704: - lsls r0, r1, 1 - adds r0, r4 - ldrh r0, [r0] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81D6640 - .align 2, 0 @ Don't pad with nop. diff --git a/asm/rom_81D1C44.s b/asm/rom_81D1C44.s new file mode 100644 index 000000000..13664a4b2 --- /dev/null +++ b/asm/rom_81D1C44.s @@ -0,0 +1,7087 @@ + + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + + thumb_func_start sub_81D1C44 +sub_81D1C44: @ 81D1C44 + push {r4,lr} + lsls r0, 24 + ldr r4, =gUnknown_0203CF4C + lsrs r0, 21 + adds r0, 0x8 + bl Alloc + str r0, [r4] + cmp r0, 0 + bne _081D1C60 + movs r0, 0 + b _081D1C7A + .pool +_081D1C60: + movs r2, 0 + ldr r4, =gUnknown_0203CF48 + movs r3, 0xFF +_081D1C66: + adds r0, r2, r4 + ldrb r1, [r0] + orrs r1, r3 + strb r1, [r0] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x2 + bls _081D1C66 + movs r0, 0x1 +_081D1C7A: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D1C44 + + thumb_func_start sub_81D1C84 +sub_81D1C84: @ 81D1C84 + push {r4-r6,lr} + sub sp, 0x8 + lsls r0, 24 + lsrs r4, r0, 24 + ldr r6, =gUnknown_0203CF48 + adds r5, r4, r6 + ldrb r0, [r5] + cmp r0, 0xFF + bne _081D1CEC + cmp r4, 0x2 + bne _081D1CD4 + ldr r0, =gUnknown_086253E8 + ldr r1, [r0, 0x14] + ldr r0, [r0, 0x10] + str r0, [sp] + str r1, [sp, 0x4] + ldr r0, =gMailboxMailOptions + movs r1, 0x4 + bl GetMaxWidthInMenuTable + lsls r0, 24 + ldr r2, =0x00ffffff + ldr r1, [sp] + ands r1, r2 + orrs r1, r0 + str r1, [sp] + mov r0, sp + bl AddWindow + strb r0, [r6, 0x2] + b _081D1CE0 + .pool +_081D1CD4: + lsls r0, r4, 3 + ldr r1, =gUnknown_086253E8 + adds r0, r1 + bl AddWindow + strb r0, [r5] +_081D1CE0: + ldr r0, =gUnknown_0203CF48 + adds r0, r4, r0 + ldrb r0, [r0] + movs r1, 0 + bl SetStandardWindowBorderStyle +_081D1CEC: + ldr r0, =gUnknown_0203CF48 + adds r0, r4, r0 + ldrb r0, [r0] + add sp, 0x8 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D1C84 + + thumb_func_start sub_81D1D04 +sub_81D1D04: @ 81D1D04 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =gUnknown_0203CF48 + adds r4, r0 + ldrb r0, [r4] + movs r1, 0 + bl sub_8198070 + ldrb r0, [r4] + bl ClearWindowTilemap + ldrb r0, [r4] + bl RemoveWindow + movs r0, 0xFF + strb r0, [r4] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D1D04 + + thumb_func_start sub_81D1D34 +sub_81D1D34: @ 81D1D34 + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gUnknown_0203CF48 + adds r0, r1 + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_81D1D34 + + thumb_func_start sub_81D1D44 +sub_81D1D44: @ 81D1D44 + push {r4,r5,lr} + sub sp, 0x34 + adds r3, r1, 0 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r2, 24 + lsrs r5, r2, 24 + movs r0, 0x2 + negs r0, r0 + cmp r3, r0 + beq _081D1DAC + ldr r0, =gSaveBlock1Ptr + lsls r1, r3, 3 + adds r1, r3 + lsls r1, 2 + ldr r0, [r0] + adds r1, r0 + ldr r0, =0x00002cca + adds r1, r0 + add r0, sp, 0x14 + bl StringCopy + add r0, sp, 0x14 + bl sub_81DB52C + add r0, sp, 0x14 + bl StringLength + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x5 + bhi _081D1D8C + add r0, sp, 0x14 + movs r1, 0x1 + bl ConvertInternationalString +_081D1D8C: + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + ldr r0, =gUnknown_08625400 + str r0, [sp, 0x8] + movs r0, 0x1 + negs r0, r0 + str r0, [sp, 0xC] + add r0, sp, 0x14 + str r0, [sp, 0x10] + adds r0, r4, 0 + movs r1, 0x1 + movs r2, 0x8 + adds r3, r5, 0 + bl AddTextPrinterParameterized4 +_081D1DAC: + add sp, 0x34 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D1D44 + + thumb_func_start sub_81D1DC0 +sub_81D1DC0: @ 81D1DC0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + adds r5, r0, 0 + movs r3, 0 + ldr r7, =gUnknown_0203CF4C + ldr r0, =gText_Cancel2 + mov r12, r0 + ldr r4, =gMultiuseListMenuTemplate + ldr r1, =gUnknown_0203CF48 + mov r8, r1 + ldr r2, =sub_81D1E7C + mov r9, r2 + ldr r0, =sub_81D1D44 + mov r10, r0 + ldrb r1, [r5, 0x5] + cmp r3, r1 + bcs _081D1E02 + adds r6, r7, 0 + ldr r2, =gUnknown_08625403 +_081D1DEC: + ldr r1, [r6] + lsls r0, r3, 3 + adds r0, r1 + str r2, [r0] + str r3, [r0, 0x4] + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + ldrb r0, [r5, 0x5] + cmp r3, r0 + bcc _081D1DEC +_081D1E02: + ldr r2, [r7] + lsls r0, r3, 3 + adds r0, r2 + mov r1, r12 + str r1, [r0] + movs r1, 0x2 + negs r1, r1 + str r1, [r0, 0x4] + str r2, [r4] + ldrb r0, [r5, 0x5] + adds r0, 0x1 + movs r1, 0 + strh r0, [r4, 0xC] + mov r2, r8 + ldrb r0, [r2, 0x1] + strb r0, [r4, 0x10] + strb r1, [r4, 0x11] + movs r0, 0x8 + strb r0, [r4, 0x12] + strb r1, [r4, 0x13] + strh r0, [r4, 0xE] + movs r0, 0x29 + strb r0, [r4, 0x14] + movs r0, 0x31 + strb r0, [r4, 0x15] + mov r0, r9 + str r0, [r4, 0x4] + mov r1, r10 + str r1, [r4, 0x8] + movs r0, 0x1 + strb r0, [r4, 0x17] + movs r0, 0 + strb r0, [r4, 0x16] + ldrh r1, [r5, 0x2] + ldrh r2, [r5] + adds r0, r4, 0 + bl ListMenuInit + lsls r0, 24 + lsrs r0, 24 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D1DC0 + + thumb_func_start sub_81D1E7C +sub_81D1E7C: @ 81D1E7C + push {lr} + lsls r1, 24 + lsrs r1, 24 + cmp r1, 0x1 + beq _081D1E8C + movs r0, 0x5 + bl PlaySE +_081D1E8C: + pop {r0} + bx r0 + thumb_func_end sub_81D1E7C + + thumb_func_start sub_81D1E90 +sub_81D1E90: @ 81D1E90 + push {r4,lr} + sub sp, 0x10 + adds r4, r0, 0 + ldrb r0, [r4, 0x5] + ldrb r1, [r4, 0x4] + subs r0, r1 + adds r0, 0x1 + str r0, [sp] + movs r0, 0x6E + str r0, [sp, 0x4] + str r0, [sp, 0x8] + adds r0, r4, 0x2 + str r0, [sp, 0xC] + movs r0, 0x2 + movs r1, 0xC8 + movs r2, 0xC + movs r3, 0x94 + bl AddScrollIndicatorArrowPairParameterized + strb r0, [r4, 0x9] + add sp, 0x10 + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81D1E90 + + thumb_func_start sub_81D1EC0 +sub_81D1EC0: @ 81D1EC0 + push {lr} + ldr r0, =gUnknown_0203CF4C + ldr r0, [r0] + bl Free + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D1EC0 + + thumb_func_start sub_81D1ED4 +sub_81D1ED4: @ 81D1ED4 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + adds r3, r0, 0 + movs r6, 0 + movs r7, 0 +_081D1EE6: + movs r2, 0 + lsls r5, r6, 2 + adds r0, r6, 0x1 + mov r10, r0 + adds r4, r5, 0 +_081D1EF0: + lsls r0, r2, 2 + adds r0, r2 + lsls r0, 2 + adds r0, r4, r0 + adds r0, r3, r0 + adds r1, r0, 0 + adds r1, 0x64 + strh r7, [r1] + adds r0, 0x66 + strh r7, [r0] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x9 + bls _081D1EF0 + movs r2, 0 + mov r9, r2 + str r5, [sp] + movs r1, 0x9B + mov r8, r1 + movs r4, 0x5B + mov r12, r4 +_081D1F1C: + lsls r0, r2, 2 + adds r0, r2 + adds r1, r6, r0 + adds r1, r3, r1 + mov r4, r9 + strb r4, [r1] + lsls r0, 2 + ldr r1, [sp] + adds r0, r1, r0 + adds r0, r3, r0 + mov r4, r8 + strh r4, [r0, 0x14] + mov r1, r12 + strh r1, [r0, 0x16] + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x3 + bls _081D1F1C + adds r1, r3, r5 + movs r2, 0x96 + lsls r2, 1 + adds r0, r1, r2 + strh r7, [r0] + movs r4, 0x97 + lsls r4, 1 + adds r0, r1, r4 + strh r7, [r0] + mov r1, r10 + lsls r0, r1, 24 + lsrs r6, r0, 24 + cmp r6, 0x4 + bls _081D1EE6 + movs r2, 0xD5 + lsls r2, 2 + adds r0, r3, r2 + movs r1, 0 + strb r1, [r0] + ldr r4, =0x00000352 + adds r0, r3, r4 + strh r1, [r0] + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D1ED4 + + thumb_func_start sub_81D1F84 +sub_81D1F84: @ 81D1F84 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x8 + mov r8, r0 + str r1, [sp] + mov r9, r2 + movs r7, 0 +_081D1F98: + lsls r4, r7, 2 + ldr r1, [sp] + adds r0, r4, r1 + ldrh r1, [r0] + lsls r5, r1, 8 + mov r2, r9 + adds r0, r4, r2 + ldrh r0, [r0] + subs r0, r1 + lsls r0, 8 + movs r1, 0xA + bl __divsi3 + adds r6, r0, 0 + movs r3, 0 + adds r7, 0x1 + mov r10, r7 + mov r12, r4 +_081D1FBC: + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 2 + add r0, r12 + add r0, r8 + asrs r2, r5, 8 + asrs r1, r5, 7 + movs r7, 0x1 + ands r1, r7 + adds r2, r1 + adds r0, 0x64 + strh r2, [r0] + adds r5, r6 + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0x8 + bls _081D1FBC + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 2 + adds r0, r4, r0 + add r0, r8 + mov r1, r9 + adds r2, r4, r1 + ldrh r1, [r2] + adds r0, 0x64 + strh r1, [r0] + ldr r7, [sp] + adds r0, r4, r7 + ldrh r1, [r0, 0x2] + lsls r5, r1, 8 + ldrh r0, [r2, 0x2] + subs r0, r1 + lsls r0, 8 + movs r1, 0xA + bl __divsi3 + adds r6, r0, 0 + movs r3, 0 + str r4, [sp, 0x4] + movs r0, 0x1 + mov r12, r0 +_081D2012: + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 2 + ldr r1, [sp, 0x4] + adds r0, r1, r0 + add r0, r8 + asrs r2, r5, 8 + asrs r1, r5, 7 + mov r7, r12 + ands r1, r7 + adds r2, r1 + adds r0, 0x66 + strh r2, [r0] + adds r5, r6 + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + cmp r3, 0x8 + bls _081D2012 + lsls r0, r3, 2 + adds r0, r3 + lsls r0, 2 + adds r0, r4, r0 + add r0, r8 + mov r2, r9 + adds r1, r4, r2 + ldrh r1, [r1, 0x2] + adds r0, 0x66 + strh r1, [r0] + mov r7, r10 + lsls r0, r7, 16 + lsrs r7, r0, 16 + cmp r7, 0x4 + bls _081D1F98 + ldr r1, =0x00000352 + add r1, r8 + movs r0, 0 + strh r0, [r1] + add sp, 0x8 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D1F84 + + thumb_func_start sub_81D2074 +sub_81D2074: @ 81D2074 + push {r4,lr} + adds r1, r0, 0 + ldr r0, =0x00000352 + adds r4, r1, r0 + ldrh r0, [r4] + cmp r0, 0x9 + bls _081D208C + movs r0, 0 + b _081D20A6 + .pool +_081D208C: + adds r0, r1, 0 + bl sub_81D2230 + ldrh r1, [r4] + adds r1, 0x1 + strh r1, [r4] + lsls r1, 16 + lsrs r1, 16 + movs r0, 0xA + eors r1, r0 + negs r0, r1 + orrs r0, r1 + lsrs r0, 31 +_081D20A6: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D2074 + + thumb_func_start sub_81D20AC +sub_81D20AC: @ 81D20AC + ldr r1, =0x00000355 + adds r0, r1 + movs r1, 0 + strb r1, [r0] + bx lr + .pool + thumb_func_end sub_81D20AC + + thumb_func_start sub_81D20BC +sub_81D20BC: @ 81D20BC + push {r4,r5,lr} + sub sp, 0xC + ldr r1, =0x00000355 + adds r4, r0, r1 + ldrb r0, [r4] + cmp r0, 0 + beq _081D20D4 + cmp r0, 0x1 + beq _081D20E2 + b _081D20FA + .pool +_081D20D4: + bl ScanlineEffect_Clear + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] + movs r0, 0x1 + b _081D20FC +_081D20E2: + mov r0, sp + ldr r1, =gUnknown_08625404 + ldm r1!, {r2,r3,r5} + stm r0!, {r2,r3,r5} + ldr r0, [sp] + ldr r1, [sp, 0x4] + ldr r2, [sp, 0x8] + bl ScanlineEffect_SetParams + ldrb r0, [r4] + adds r0, 0x1 + strb r0, [r4] +_081D20FA: + movs r0, 0 +_081D20FC: + add sp, 0xC + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D20BC + + thumb_func_start sub_81D2108 +sub_81D2108: @ 81D2108 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x10 + adds r6, r0, 0 + movs r1, 0xD5 + lsls r1, 2 + adds r0, r6, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _081D21BE + adds r0, r6, 0 + bl sub_81D24A4 + adds r0, r6, 0 + bl sub_81D2634 + movs r7, 0 + ldr r5, =gScanlineEffectRegBuffers + mov r12, r5 + movs r0, 0xF0 + lsls r0, 3 + add r0, r12 + mov r9, r0 + movs r1, 0xA0 + lsls r1, 1 + adds r1, r6, r1 + str r1, [sp] + ldr r5, =0x0000ffff + mov r8, r5 + movs r0, 0xA1 + lsls r0, 1 + adds r0, r6, r0 + str r0, [sp, 0x4] + movs r1, 0x92 + lsls r1, 2 + adds r1, r6, r1 + str r1, [sp, 0x8] + ldr r5, =0x0000024a + adds r5, r6 + mov r10, r5 +_081D215E: + adds r2, r7, 0 + adds r2, 0x37 + lsls r3, r2, 2 + mov r0, r9 + adds r0, r3, r0 + str r0, [sp, 0xC] + add r3, r12 + lsls r4, r7, 2 + ldr r1, [sp] + adds r0, r1, r4 + ldrh r0, [r0] + lsls r0, 8 + ldr r5, [sp, 0x4] + adds r1, r5, r4 + ldrh r1, [r1] + orrs r0, r1 + strh r0, [r3] + mov r1, r8 + ands r0, r1 + ldr r5, [sp, 0xC] + strh r0, [r5] + lsls r2, 1 + adds r2, 0x1 + lsls r2, 1 + mov r0, r9 + adds r3, r2, r0 + add r2, r12 + ldr r1, [sp, 0x8] + adds r0, r1, r4 + ldrh r0, [r0] + lsls r0, 8 + add r4, r10 + ldrh r1, [r4] + orrs r0, r1 + strh r0, [r2] + mov r5, r8 + ands r0, r5 + strh r0, [r3] + adds r0, r7, 0x1 + lsls r0, 16 + lsrs r7, r0, 16 + cmp r7, 0x41 + bls _081D215E + movs r0, 0xD5 + lsls r0, 2 + adds r1, r6, r0 + movs r0, 0 + strb r0, [r1] +_081D21BE: + add sp, 0x10 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D2108 + + thumb_func_start sub_81D21DC +sub_81D21DC: @ 81D21DC + push {r4,r5,lr} + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x3 + bls _081D21E8 + movs r1, 0 +_081D21E8: + movs r0, 0x1 + lsls r0, r1 + movs r5, 0x1F + bics r5, r0 + movs r0, 0x40 + movs r1, 0xF0 + bl SetGpuReg + movs r0, 0x42 + movs r1, 0x9B + bl SetGpuReg + ldr r4, =0x00003879 + movs r0, 0x44 + adds r1, r4, 0 + bl SetGpuReg + movs r0, 0x46 + adds r1, r4, 0 + bl SetGpuReg + ldr r1, =0x00003f3f + movs r0, 0x48 + bl SetGpuReg + movs r0, 0x4A + adds r1, r5, 0 + bl SetGpuReg + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D21DC + + thumb_func_start sub_81D2230 +sub_81D2230: @ 81D2230 + push {r4-r7,lr} + mov r12, r0 + movs r4, 0 + movs r7, 0x96 + lsls r7, 1 + add r7, r12 + ldr r6, =0x00000352 + add r6, r12 + mov r5, r12 + adds r5, 0x64 +_081D2244: + lsls r2, r4, 2 + adds r3, r7, r2 + ldrh r1, [r6] + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 2 + adds r2, r0 + adds r2, r5, r2 + ldr r0, [r2] + str r0, [r3] + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0x4 + bls _081D2244 + movs r1, 0xD5 + lsls r1, 2 + add r1, r12 + movs r0, 0x1 + strb r0, [r1] + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D2230 + + thumb_func_start sub_81D2278 +sub_81D2278: @ 81D2278 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + str r0, [sp] + adds r6, r1, 0 + adds r5, r2, 0 + str r3, [sp, 0x4] + ldr r0, [sp, 0x38] + ldr r7, [sp, 0x3C] + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + movs r0, 0 + str r0, [sp, 0xC] + ldrh r0, [r5, 0x2] + ldrh r1, [r3, 0x2] + cmp r0, r1 + bcs _081D22B2 + adds r2, r0, 0 + mov r10, r2 + ldrh r0, [r3, 0x2] + ldrh r1, [r5] + lsls r4, r1, 10 + ldrh r3, [r3] + str r3, [sp, 0x8] + b _081D22C6 +_081D22B2: + ldrh r0, [r5, 0x2] + ldr r1, [sp, 0x4] + ldrh r1, [r1, 0x2] + mov r10, r1 + ldr r2, [sp, 0x4] + ldrh r1, [r2] + lsls r4, r1, 10 + ldrh r3, [r5] + str r3, [sp, 0x8] + mov r2, r10 +_081D22C6: + subs r0, r2 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + cmp r0, 0 + beq _081D22DE + subs r0, r3, r1 + lsls r0, 10 + mov r1, r8 + bl __divsi3 + str r0, [sp, 0xC] +_081D22DE: + mov r0, r8 + adds r0, 0x1 + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + cmp r7, 0 + bne _081D2328 + mov r0, r10 + subs r0, 0x38 + lsls r0, 2 + adds r6, r0 + movs r5, 0 + mov r3, r9 + lsls r3, 1 + mov r12, r3 + ldr r0, [sp, 0x8] + add r0, r9 + str r0, [sp, 0x10] + cmp r7, r8 + bcs _081D23B6 + movs r7, 0x1 +_081D2308: + adds r2, r3, r6 + asrs r1, r4, 10 + asrs r0, r4, 9 + ands r0, r7 + adds r1, r0 + add r1, r9 + strh r1, [r2] + ldr r1, [sp, 0xC] + adds r4, r1 + adds r6, 0x4 + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, r8 + bcc _081D2308 + b _081D23B6 +_081D2328: + ldr r2, [sp, 0xC] + cmp r2, 0 + ble _081D23C0 + mov r0, r10 + subs r0, 0x38 + lsls r0, 2 + adds r7, r0 + movs r5, 0 + mov r3, r9 + lsls r3, 1 + mov r12, r3 + ldr r0, [sp, 0x8] + add r0, r9 + str r0, [sp, 0x10] + cmp r5, r8 + bcs _081D237A + ldr r0, =0x00026bff + cmp r4, r0 + bgt _081D237A + mov r1, r12 + str r1, [sp, 0x14] +_081D2352: + ldr r3, [sp, 0x14] + adds r2, r3, r7 + asrs r1, r4, 10 + asrs r0, r4, 9 + movs r3, 0x1 + ands r0, r3 + adds r1, r0 + add r1, r9 + strh r1, [r2] + ldr r0, [sp, 0xC] + adds r4, r0 + adds r7, 0x4 + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, r8 + bcs _081D237A + ldr r1, =0x00026bff + cmp r4, r1 + ble _081D2352 +_081D237A: + mov r2, r10 + adds r1, r2, r5 + ldr r3, [sp] + movs r2, 0xD4 + lsls r2, 2 + adds r0, r3, r2 + strh r1, [r0] + ldrh r0, [r0] + subs r0, 0x38 + lsls r0, 2 + adds r6, r0 + cmp r5, r8 + bcs _081D23B6 + mov r3, r12 + movs r7, 0x1 +_081D2398: + adds r2, r3, r6 + asrs r1, r4, 10 + asrs r0, r4, 9 + ands r0, r7 + adds r1, r0 + add r1, r9 + strh r1, [r2] + ldr r0, [sp, 0xC] + adds r4, r0 + adds r6, 0x4 + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, r8 + bcc _081D2398 +_081D23B6: + subs r0, r6, 0x4 + b _081D248C + .pool +_081D23C0: + ldr r1, [sp, 0xC] + cmp r1, 0 + bge _081D2464 + mov r0, r10 + subs r0, 0x38 + lsls r0, 2 + adds r6, r0 + movs r5, 0 + mov r2, r9 + lsls r2, 1 + mov r12, r2 + ldr r3, [sp, 0x8] + add r3, r9 + str r3, [sp, 0x10] + cmp r5, r8 + bcs _081D241E + adds r3, r2, r6 + asrs r1, r4, 10 + asrs r0, r4, 9 + movs r2, 0x1 + ands r0, r2 + adds r1, r0 + add r1, r9 + strh r1, [r3] + b _081D2414 +_081D23F2: + ldr r0, [sp, 0xC] + adds r4, r0 + adds r6, 0x4 + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, r8 + bcs _081D241E + mov r1, r12 + adds r3, r1, r6 + asrs r2, r4, 10 + asrs r0, r4, 9 + movs r1, 0x1 + ands r0, r1 + adds r2, r0 + add r2, r9 + strh r2, [r3] +_081D2414: + ldr r0, =0x00026bff + cmp r4, r0 + bgt _081D23F2 + movs r0, 0x9B + strh r0, [r3] +_081D241E: + mov r2, r10 + adds r1, r2, r5 + ldr r3, [sp] + movs r2, 0xD4 + lsls r2, 2 + adds r0, r3, r2 + strh r1, [r0] + ldrh r0, [r0] + subs r0, 0x38 + lsls r0, 2 + adds r7, r0 + cmp r5, r8 + bcs _081D245A + mov r3, r12 + movs r6, 0x1 +_081D243C: + adds r2, r3, r7 + asrs r1, r4, 10 + asrs r0, r4, 9 + ands r0, r6 + adds r1, r0 + add r1, r9 + strh r1, [r2] + ldr r0, [sp, 0xC] + adds r4, r0 + adds r7, 0x4 + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, r8 + bcc _081D243C +_081D245A: + subs r0, r7, 0x4 + b _081D248C + .pool +_081D2464: + ldr r1, [sp] + movs r2, 0xD4 + lsls r2, 2 + adds r0, r1, r2 + mov r3, r10 + strh r3, [r0] + mov r0, r10 + subs r0, 0x38 + lsls r0, 2 + adds r6, r0 + adds r7, r0 + ldrh r0, [r5] + adds r0, 0x1 + strh r0, [r6, 0x2] + ldr r1, [sp, 0x4] + ldrh r0, [r1] + strh r0, [r7] + movs r0, 0x9B + strh r0, [r7, 0x2] + b _081D2494 +_081D248C: + add r0, r12 + mov r2, sp + ldrh r2, [r2, 0x10] + strh r2, [r0] +_081D2494: + add sp, 0x18 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81D2278 + + thumb_func_start sub_81D24A4 +sub_81D24A4: @ 81D24A4 + push {r4-r7,lr} + sub sp, 0x8 + adds r4, r0, 0 + movs r0, 0x97 + lsls r0, 1 + adds r2, r4, r0 + movs r3, 0x99 + lsls r3, 1 + adds r1, r4, r3 + ldrh r0, [r2] + ldrh r3, [r1] + cmp r0, r3 + bcs _081D24E0 + adds r7, r0, 0 + movs r0, 0xA0 + lsls r0, 1 + adds r1, r4, r0 + movs r3, 0x96 + lsls r3, 1 + adds r2, r4, r3 + subs r0, 0x10 + adds r3, r4, r0 + movs r0, 0x1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + adds r0, r4, 0 + bl sub_81D2278 + b _081D2500 +_081D24E0: + ldrh r7, [r1] + movs r2, 0xA0 + lsls r2, 1 + adds r1, r4, r2 + movs r3, 0x98 + lsls r3, 1 + adds r2, r4, r3 + movs r0, 0x96 + lsls r0, 1 + adds r3, r4, r0 + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + adds r0, r4, 0 + bl sub_81D2278 +_081D2500: + movs r1, 0xA0 + lsls r1, 1 + adds r5, r4, r1 + movs r3, 0x98 + lsls r3, 1 + adds r2, r4, r3 + movs r0, 0x9A + lsls r0, 1 + adds r6, r4, r0 + movs r0, 0x1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + adds r0, r4, 0 + adds r1, r5, 0 + adds r3, r6, 0 + bl sub_81D2278 + movs r2, 0 + movs r1, 0x9B + lsls r1, 1 + adds r0, r4, r1 + movs r3, 0x9D + lsls r3, 1 + adds r1, r4, r3 + ldrh r0, [r0] + ldrh r1, [r1] + cmp r0, r1 + bhi _081D253C + movs r2, 0x1 +_081D253C: + movs r0, 0x9C + lsls r0, 1 + adds r3, r4, r0 + str r2, [sp] + movs r1, 0x92 + lsls r1, 2 + adds r0, r4, r1 + str r0, [sp, 0x4] + adds r0, r4, 0 + adds r1, r5, 0 + adds r2, r6, 0 + bl sub_81D2278 + movs r2, 0x38 + cmp r2, r7 + bcs _081D257E + adds r6, r5, 0 + movs r3, 0 + movs r0, 0xA1 + lsls r0, 1 + adds r5, r4, r0 +_081D2566: + adds r0, r2, 0 + subs r0, 0x38 + lsls r0, 2 + adds r1, r6, r0 + strh r3, [r1] + adds r0, r5, r0 + strh r3, [r0] + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, r7 + bcc _081D2566 +_081D257E: + movs r1, 0x97 + lsls r1, 1 + adds r0, r4, r1 + ldrh r2, [r0] + movs r3, 0xD4 + lsls r3, 2 + adds r0, r4, r3 + ldrh r1, [r0] + cmp r2, r1 + bhi _081D25B2 + movs r1, 0xA0 + lsls r1, 1 + adds r3, r4, r1 + movs r5, 0x9B + adds r1, r0, 0 +_081D259C: + adds r0, r2, 0 + subs r0, 0x38 + lsls r0, 2 + adds r0, r3, r0 + strh r5, [r0] + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + ldrh r0, [r1] + cmp r2, r0 + bls _081D259C +_081D25B2: + movs r2, 0x9B + lsls r2, 1 + adds r1, r4, r2 + movs r3, 0xD4 + lsls r3, 2 + adds r0, r4, r3 + ldrh r0, [r0] + ldrh r1, [r1] + cmp r0, r1 + bcs _081D25C8 + adds r0, r1, 0 +_081D25C8: + adds r0, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0x79 + bhi _081D25F8 + movs r0, 0xA0 + lsls r0, 1 + adds r6, r4, r0 + movs r3, 0 + movs r1, 0xA1 + lsls r1, 1 + adds r5, r4, r1 +_081D25E0: + adds r0, r2, 0 + subs r0, 0x38 + lsls r0, 2 + adds r1, r6, r0 + strh r3, [r1] + adds r0, r5, r0 + strh r3, [r0] + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0x79 + bls _081D25E0 +_081D25F8: + movs r2, 0x38 + movs r3, 0xA0 + lsls r3, 1 + adds r5, r4, r3 + movs r0, 0xA1 + lsls r0, 1 + adds r4, r0 + movs r6, 0x9B +_081D2608: + adds r0, r2, 0 + subs r0, 0x38 + lsls r1, r0, 2 + adds r3, r5, r1 + ldrh r0, [r3] + cmp r0, 0 + bne _081D2620 + adds r0, r4, r1 + ldrh r0, [r0] + cmp r0, 0 + beq _081D2620 + strh r6, [r3] +_081D2620: + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0x79 + bls _081D2608 + add sp, 0x8 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81D24A4 + + thumb_func_start sub_81D2634 +sub_81D2634: @ 81D2634 + push {r4-r6,lr} + sub sp, 0x8 + adds r4, r0, 0 + movs r0, 0x97 + lsls r0, 1 + adds r2, r4, r0 + movs r3, 0x9F + lsls r3, 1 + adds r1, r4, r3 + ldrh r0, [r2] + ldrh r5, [r1] + cmp r0, r5 + bcs _081D266E + adds r6, r0, 0 + movs r0, 0x92 + lsls r0, 2 + adds r1, r4, r0 + subs r3, 0x12 + adds r2, r4, r3 + movs r5, 0x9E + lsls r5, 1 + adds r3, r4, r5 + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + adds r0, r4, 0 + bl sub_81D2278 + b _081D2690 +_081D266E: + ldrh r6, [r1] + movs r0, 0x92 + lsls r0, 2 + adds r1, r4, r0 + movs r3, 0x9E + lsls r3, 1 + adds r2, r4, r3 + movs r5, 0x96 + lsls r5, 1 + adds r3, r4, r5 + movs r0, 0x1 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + adds r0, r4, 0 + bl sub_81D2278 +_081D2690: + movs r0, 0x92 + lsls r0, 2 + adds r5, r4, r0 + movs r1, 0x9E + lsls r1, 1 + adds r2, r4, r1 + movs r0, 0x9C + lsls r0, 1 + adds r3, r4, r0 + movs r0, 0 + str r0, [sp] + str r0, [sp, 0x4] + adds r0, r4, 0 + adds r1, r5, 0 + bl sub_81D2278 + cmp r6, 0x38 + ble _081D26C8 + movs r0, 0 + adds r1, r5, 0 + adds r2, r6, 0 + subs r2, 0x38 +_081D26BC: + strh r0, [r1] + strh r0, [r1, 0x2] + adds r1, 0x4 + subs r2, 0x1 + cmp r2, 0 + bne _081D26BC +_081D26C8: + movs r1, 0x97 + lsls r1, 1 + adds r0, r4, r1 + ldrh r2, [r0] + movs r3, 0xD4 + lsls r3, 2 + adds r0, r4, r3 + ldrh r5, [r0] + cmp r2, r5 + bgt _081D26F6 + movs r3, 0x9B + adds r1, r0, 0 + lsls r0, r2, 2 + movs r5, 0xB5 + lsls r5, 1 + adds r0, r5 + adds r0, r4 +_081D26EA: + strh r3, [r0] + adds r0, 0x4 + adds r2, 0x1 + ldrh r5, [r1] + cmp r2, r5 + ble _081D26EA +_081D26F6: + movs r1, 0x9D + lsls r1, 1 + adds r0, r4, r1 + ldrh r0, [r0] + adds r1, r0, 0x1 + movs r2, 0xD4 + lsls r2, 2 + adds r0, r4, r2 + ldrh r0, [r0] + cmp r0, r1 + bge _081D270E + adds r0, r1, 0 +_081D270E: + adds r2, r0, 0 + cmp r2, 0x79 + bgt _081D272C + movs r1, 0 + lsls r0, r2, 2 + movs r3, 0xB4 + lsls r3, 1 + adds r0, r3 + adds r0, r4 +_081D2720: + strh r1, [r0] + strh r1, [r0, 0x2] + adds r0, 0x4 + adds r2, 0x1 + cmp r2, 0x79 + ble _081D2720 +_081D272C: + movs r3, 0 + movs r5, 0x92 + lsls r5, 2 + adds r1, r4, r5 + movs r2, 0x41 +_081D2736: + ldrh r0, [r1] + ldrh r4, [r1, 0x2] + cmp r0, r4 + bcc _081D2742 + strh r3, [r1, 0x2] + strh r3, [r1] +_081D2742: + adds r1, 0x4 + subs r2, 0x1 + cmp r2, 0 + bge _081D2736 + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_81D2634 + + thumb_func_start sub_81D2754 +sub_81D2754: @ 81D2754 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + adds r6, r0, 0 + mov r8, r1 + ldr r1, =gUnknown_08625410 + ldrb r0, [r6] + adds r0, r1 + ldrb r2, [r0] + adds r6, 0x1 + movs r0, 0x9B + mov r3, r8 + strh r0, [r3] + movs r0, 0x5B + subs r0, r2 + strh r0, [r3, 0x2] + movs r7, 0x40 + movs r0, 0 + mov r12, r0 + movs r2, 0x1 + mov r9, r2 + ldr r3, =gSineTable + mov r10, r3 +_081D2786: + adds r0, r7, 0 + adds r0, 0x33 + lsls r0, 24 + lsrs r7, r0, 24 + mov r1, r12 + lsls r0, r1, 24 + movs r2, 0xFF + lsls r2, 24 + adds r0, r2 + lsrs r3, r0, 24 + mov r12, r3 + cmp r0, 0 + bge _081D27A4 + movs r0, 0x4 + mov r12, r0 +_081D27A4: + mov r1, r12 + lsls r0, r1, 24 + asrs r4, r0, 24 + cmp r4, 0x2 + bne _081D27B4 + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 +_081D27B4: + ldrb r0, [r6] + ldr r2, =gUnknown_08625410 + adds r0, r2 + ldrb r2, [r0] + adds r6, 0x1 + lsls r0, r4, 2 + mov r1, r8 + adds r3, r0, r1 + adds r0, r7, 0 + adds r0, 0x40 + lsls r0, 1 + add r0, r10 + movs r1, 0 + ldrsh r0, [r0, r1] + muls r0, r2 + asrs r5, r0, 8 + adds r0, r5, 0 + adds r0, 0x9B + strh r0, [r3] + lsls r0, r7, 1 + add r0, r10 + movs r1, 0 + ldrsh r0, [r0, r1] + adds r1, r2, 0 + muls r1, r0 + asrs r1, 8 + movs r0, 0x5B + subs r0, r1 + strh r0, [r3, 0x2] + cmp r4, 0x2 + bgt _081D2800 + cmp r2, 0x20 + bne _081D27FA + cmp r4, 0x2 + beq _081D2800 +_081D27FA: + adds r0, r5, 0 + adds r0, 0x9C + strh r0, [r3] +_081D2800: + mov r0, r9 + adds r0, 0x1 + lsls r0, 16 + lsrs r0, 16 + mov r9, r0 + cmp r0, 0x4 + bls _081D2786 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D2754 + + thumb_func_start sub_81D2824 +sub_81D2824: @ 81D2824 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + ldr r0, =gUnknown_08625510 + bl InitWindows + bl DeactivateAllTextPrinters + movs r0, 0 + movs r1, 0x1 + movs r2, 0xE0 + bl LoadUserWindowBorderGfx + ldr r0, =gUnknown_0860F074 + movs r1, 0xF0 + movs r2, 0x20 + bl LoadPalette + movs r4, 0 +_081D284A: + adds r0, r4, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x4 + bls _081D284A + cmp r5, 0 + bne _081D287C + movs r0, 0 + bl PutWindowTilemap + movs r0, 0 + movs r1, 0 + movs r2, 0x1 + movs r3, 0xE + bl SetWindowBorderStyle + b _081D288E + .pool +_081D287C: + movs r0, 0x1 + bl PutWindowTilemap + movs r0, 0x1 + movs r1, 0 + movs r2, 0x1 + movs r3, 0xE + bl SetWindowBorderStyle +_081D288E: + movs r0, 0x2 + bl PutWindowTilemap + movs r0, 0x3 + bl PutWindowTilemap + movs r0, 0x2 + movs r1, 0 + movs r2, 0x1 + movs r3, 0xE + bl SetWindowBorderStyle + movs r0, 0x3 + movs r1, 0 + movs r2, 0x1 + movs r3, 0xE + bl SetWindowBorderStyle + bl nullsub_79 + movs r0, 0x1 + bl schedule_bg_copy_tilemap_to_vram + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_81D2824 + + thumb_func_start nullsub_79 +nullsub_79: @ 81D28C4 + bx lr + thumb_func_end nullsub_79 + + thumb_func_start sub_81D28C8 +sub_81D28C8: @ 81D28C8 + push {r4-r7,lr} + lsls r1, 16 + lsrs r4, r1, 16 + ldr r3, =gMultiuseListMenuTemplate + adds r2, r3, 0 + ldr r1, =gUnknown_08625548 + ldm r1!, {r5-r7} + stm r2!, {r5-r7} + ldm r1!, {r5-r7} + stm r2!, {r5-r7} + strh r4, [r3, 0xC] + str r0, [r3] + cmp r4, 0x5 + bhi _081D28F0 + strh r4, [r3, 0xE] + b _081D28F4 + .pool +_081D28F0: + movs r0, 0x6 + strh r0, [r3, 0xE] +_081D28F4: + ldrb r0, [r3, 0xE] + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_81D28C8 + + thumb_func_start sub_81D28FC +sub_81D28FC: @ 81D28FC + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x2C + mov r9, r0 + movs r0, 0 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r5, =gText_BattleMoves2 + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x80 + bl GetStringCenterAlignXOffset + adds r4, r0, 0 + lsls r3, r4, 24 + lsrs r3, 24 + movs r0, 0x1 + str r0, [sp] + movs r0, 0xFF + mov r8, r0 + str r0, [sp, 0x4] + movs r7, 0 + str r7, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + adds r2, r5, 0 + bl AddTextPrinterParameterized + ldr r5, =gText_PPSlash + movs r1, 0x29 + mov r10, r1 + str r1, [sp] + mov r0, r8 + str r0, [sp, 0x4] + str r7, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + adds r2, r5, 0 + movs r3, 0x4 + bl AddTextPrinterParameterized + ldr r5, =gText_PowerSlash + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x6A + bl GetStringRightAlignXOffset + adds r4, r0, 0 + lsls r3, r4, 24 + lsrs r3, 24 + movs r1, 0x19 + str r1, [sp] + mov r0, r8 + str r0, [sp, 0x4] + str r7, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + adds r2, r5, 0 + bl AddTextPrinterParameterized + ldr r5, =gText_AccuracySlash + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x6A + bl GetStringRightAlignXOffset + adds r4, r0, 0 + lsls r3, r4, 24 + lsrs r3, 24 + mov r1, r10 + str r1, [sp] + mov r0, r8 + str r0, [sp, 0x4] + str r7, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + adds r2, r5, 0 + bl AddTextPrinterParameterized + movs r0, 0x2 + negs r0, r0 + cmp r9, r0 + bne _081D29C4 + movs r0, 0 + movs r1, 0x2 + bl CopyWindowToVram + b _081D2AB6 + .pool +_081D29C4: + mov r1, r9 + lsls r0, r1, 1 + add r0, r9 + lsls r0, 2 + ldr r1, =gBattleMoves + adds r6, r0, r1 + ldrb r1, [r6, 0x2] + lsls r0, r1, 3 + subs r0, r1 + ldr r1, =gTypeNames + adds r5, r0, r1 + movs r0, 0x19 + str r0, [sp] + mov r1, r8 + str r1, [sp, 0x4] + str r7, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + adds r2, r5, 0 + movs r3, 0x4 + bl AddTextPrinterParameterized + ldr r1, =gText_PPSlash + movs r0, 0x1 + movs r2, 0 + bl GetStringWidth + adds r4, r0, 0x4 + ldrb r1, [r6, 0x4] + add r0, sp, 0xC + movs r2, 0 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + lsls r3, r4, 24 + lsrs r3, 24 + mov r0, r10 + str r0, [sp] + mov r1, r8 + str r1, [sp, 0x4] + str r7, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + add r2, sp, 0xC + bl AddTextPrinterParameterized + ldrb r0, [r6, 0x1] + cmp r0, 0x1 + bhi _081D2A3C + ldr r5, =gText_ThreeDashes + b _081D2A4A + .pool +_081D2A3C: + ldrb r1, [r6, 0x1] + add r0, sp, 0xC + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + add r5, sp, 0xC +_081D2A4A: + movs r0, 0x19 + str r0, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + movs r0, 0 + str r0, [sp, 0x8] + movs r1, 0x1 + adds r2, r5, 0 + movs r3, 0x6A + bl AddTextPrinterParameterized + ldrb r0, [r6, 0x3] + cmp r0, 0 + bne _081D2A70 + ldr r5, =gText_ThreeDashes + b _081D2A7E + .pool +_081D2A70: + ldrb r1, [r6, 0x3] + add r0, sp, 0xC + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + add r5, sp, 0xC +_081D2A7E: + movs r0, 0x29 + str r0, [sp] + movs r0, 0xFF + str r0, [sp, 0x4] + movs r4, 0 + str r4, [sp, 0x8] + movs r0, 0 + movs r1, 0x1 + adds r2, r5, 0 + movs r3, 0x6A + bl AddTextPrinterParameterized + ldr r1, =gMoveDescriptionPointers + mov r0, r9 + subs r0, 0x1 + lsls r0, 2 + adds r0, r1 + ldr r5, [r0] + movs r0, 0x41 + str r0, [sp] + str r4, [sp, 0x4] + str r4, [sp, 0x8] + movs r0, 0 + movs r1, 0x7 + adds r2, r5, 0 + movs r3, 0 + bl AddTextPrinterParameterized +_081D2AB6: + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D28FC + + thumb_func_start sub_81D2ACC +sub_81D2ACC: @ 81D2ACC + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0xC + adds r4, r0, 0 + bl ShowHideHearts + movs r0, 0x1 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r5, =gText_ContestMoves2 + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x80 + bl GetStringCenterAlignXOffset + lsls r3, r0, 24 + lsrs r3, 24 + movs r0, 0x1 + str r0, [sp] + movs r7, 0xFF + str r7, [sp, 0x4] + movs r6, 0 + str r6, [sp, 0x8] + movs r1, 0x1 + adds r2, r5, 0 + bl AddTextPrinterParameterized + ldr r5, =gText_Appeal2 + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x5C + bl GetStringRightAlignXOffset + lsls r3, r0, 24 + lsrs r3, 24 + movs r0, 0x19 + mov r8, r0 + str r0, [sp] + str r7, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x1 + adds r2, r5, 0 + bl AddTextPrinterParameterized + ldr r5, =gText_Jam2 + movs r0, 0x1 + adds r1, r5, 0 + movs r2, 0x5C + bl GetStringRightAlignXOffset + lsls r3, r0, 24 + lsrs r3, 24 + movs r0, 0x29 + str r0, [sp] + str r7, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x1 + adds r2, r5, 0 + bl AddTextPrinterParameterized + movs r0, 0x2 + negs r0, r0 + cmp r4, r0 + bne _081D2B6C + movs r0, 0x1 + movs r1, 0x2 + bl CopyWindowToVram + b _081D2BB8 + .pool +_081D2B6C: + lsls r4, 3 + ldr r0, =gContestMoves + adds r4, r0 + ldr r1, =gContestMoveTypeTextPointers + ldrb r0, [r4, 0x1] + lsls r0, 29 + lsrs r0, 27 + adds r0, r1 + ldr r5, [r0] + mov r0, r8 + str r0, [sp] + str r7, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x1 + adds r2, r5, 0 + movs r3, 0x4 + bl AddTextPrinterParameterized + ldr r1, =gContestEffectDescriptionPointers + ldrb r0, [r4] + lsls r0, 2 + adds r0, r1 + ldr r5, [r0] + movs r0, 0x41 + str r0, [sp] + str r7, [sp, 0x4] + str r6, [sp, 0x8] + movs r0, 0x1 + movs r1, 0x7 + adds r2, r5, 0 + movs r3, 0 + bl AddTextPrinterParameterized + movs r0, 0x1 + movs r1, 0x2 + bl CopyWindowToVram +_081D2BB8: + add sp, 0xC + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D2ACC + + thumb_func_start sub_81D2BD0 +sub_81D2BD0: @ 81D2BD0 + push {r4,lr} + adds r4, r0, 0 + lsls r1, 24 + lsrs r1, 24 + cmp r1, 0x1 + beq _081D2BE2 + movs r0, 0x5 + bl PlaySE +_081D2BE2: + adds r0, r4, 0 + bl sub_81D28FC + adds r0, r4, 0 + bl sub_81D2ACC + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81D2BD0 + + thumb_func_start sub_81D2BF4 +sub_81D2BF4: @ 81D2BF4 + push {r4,lr} + sub sp, 0x10 + adds r4, r0, 0 + movs r0, 0x3 + movs r1, 0x11 + bl FillWindowPixelBuffer + ldr r2, =gTextFlags + ldrb r0, [r2] + movs r1, 0x1 + orrs r0, r1 + strb r0, [r2] + bl GetPlayerTextSpeedDelay + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r1, 0x1 + adds r2, r4, 0 + bl AddTextPrinterParameterized2 + add sp, 0x10 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D2BF4 + + thumb_func_start sub_81D2C3C +sub_81D2C3C: @ 81D2C3C + push {lr} + bl RunTextPrinters + movs r0, 0x3 + bl IsTextPrinterActive + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end sub_81D2C3C + + thumb_func_start sub_81D2C50 +sub_81D2C50: @ 81D2C50 + push {lr} + ldr r0, =gUnknown_08625540 + movs r1, 0x1 + movs r2, 0xE + movs r3, 0 + bl CreateYesNoMenu + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D2C50 + + thumb_func_start sub_81D2C68 +sub_81D2C68: @ 81D2C68 + push {lr} + lsls r0, 16 + lsrs r0, 16 + lsls r1, 16 + lsrs r1, 16 + cmp r0, 0xE + bne _081D2CA8 + cmp r2, 0x2 + beq _081D2C7E + cmp r2, 0x7 + bne _081D2C94 +_081D2C7E: + movs r0, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + adds r1, r2, 0 + adds r2, r3, 0 + bl GetMonData + b _081D2CCA + .pool +_081D2C94: + movs r0, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + adds r1, r2, 0 + bl GetMonData + b _081D2CCA + .pool +_081D2CA8: + cmp r2, 0x2 + beq _081D2CB0 + cmp r2, 0x7 + bne _081D2CBE +_081D2CB0: + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + bl GetAndCopyBoxMonDataAt + b _081D2CCA +_081D2CBE: + lsls r0, 24 + lsrs r0, 24 + lsls r1, 24 + lsrs r1, 24 + bl GetBoxMonDataAt +_081D2CCA: + pop {r1} + bx r1 + thumb_func_end sub_81D2C68 + + thumb_func_start sub_81D2CD0 +sub_81D2CD0: @ 81D2CD0 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r5, r0, 0 + lsls r1, 16 + lsrs r4, r1, 16 + lsls r2, 16 + lsrs r6, r2, 16 + movs r0, 0xFC + strb r0, [r5] + adds r5, 0x1 + movs r0, 0x4 + strb r0, [r5] + adds r5, 0x1 + movs r0, 0x8 + strb r0, [r5] + adds r5, 0x1 + movs r0, 0 + strb r0, [r5] + adds r5, 0x1 + movs r0, 0x9 + strb r0, [r5] + adds r5, 0x1 + adds r0, r4, 0 + adds r1, r6, 0 + movs r2, 0x2D + movs r3, 0 + bl sub_81D2C68 + cmp r0, 0 + beq _081D2D20 + ldr r1, =gText_EggNickname + adds r0, r5, 0 + movs r2, 0 + movs r3, 0xC + bl StringCopyPadded + b _081D2E70 + .pool +_081D2D20: + adds r0, r4, 0 + adds r1, r6, 0 + movs r2, 0x2 + adds r3, r5, 0 + bl sub_81D2C68 + adds r0, r5, 0 + bl StringGetEnd10 + adds r0, r4, 0 + adds r1, r6, 0 + movs r2, 0xB + movs r3, 0 + bl sub_81D2C68 + lsls r0, 16 + lsrs r7, r0, 16 + cmp r4, 0xE + bne _081D2D70 + movs r0, 0x64 + adds r4, r6, 0 + muls r4, r0 + ldr r0, =gPlayerParty + adds r4, r0 + adds r0, r4, 0 + movs r1, 0x38 + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 + adds r0, r4, 0 + bl GetMonGender + lsls r0, 24 + lsrs r6, r0, 24 + b _081D2D92 + .pool +_081D2D70: + lsls r0, r4, 24 + lsrs r0, 24 + lsls r1, r6, 24 + lsrs r1, 24 + bl GetBoxedMonPtr + adds r4, r0, 0 + bl GetBoxMonGender + lsls r0, 24 + lsrs r6, r0, 24 + adds r0, r4, 0 + bl GetLevelFromBoxMonExp + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 +_081D2D92: + cmp r7, 0x1D + beq _081D2D9A + cmp r7, 0x20 + bne _081D2DB0 +_081D2D9A: + movs r0, 0xB + adds r1, r7, 0 + muls r1, r0 + ldr r0, =gSpeciesNames + adds r1, r0 + adds r0, r5, 0 + bl StringCompare + cmp r0, 0 + bne _081D2DB0 + movs r6, 0xFF +_081D2DB0: + adds r3, r5, 0 + b _081D2DBA + .pool +_081D2DB8: + adds r3, 0x1 +_081D2DBA: + ldrb r0, [r3] + cmp r0, 0xFF + bne _081D2DB8 + movs r1, 0xFC + strb r1, [r3] + adds r3, 0x1 + movs r0, 0x12 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x3C + strb r0, [r3] + adds r3, 0x1 + cmp r6, 0 + beq _081D2DDE + cmp r6, 0xFE + beq _081D2E02 + movs r0, 0 + b _081D2E24 +_081D2DDE: + strb r1, [r3] + adds r3, 0x1 + movs r0, 0x1 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x4 + strb r0, [r3] + adds r3, 0x1 + strb r1, [r3] + adds r3, 0x1 + movs r0, 0x3 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x5 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0xB5 + b _081D2E24 +_081D2E02: + strb r1, [r3] + adds r3, 0x1 + movs r0, 0x1 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x6 + strb r0, [r3] + adds r3, 0x1 + strb r1, [r3] + adds r3, 0x1 + movs r0, 0x3 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x7 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0xB6 +_081D2E24: + strb r0, [r3] + adds r3, 0x1 + movs r0, 0xFC + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x4 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x8 + strb r0, [r3] + adds r3, 0x1 + movs r4, 0 + strb r4, [r3] + adds r3, 0x1 + movs r0, 0x9 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0xBA + strb r0, [r3] + adds r3, 0x1 + movs r0, 0xF9 + strb r0, [r3] + adds r3, 0x1 + movs r0, 0x5 + strb r0, [r3] + adds r3, 0x1 + adds r0, r3, 0 + mov r1, r8 + movs r2, 0 + movs r3, 0x3 + bl ConvertIntToDecimalStringN + adds r3, r0, 0 + strb r4, [r3] + adds r3, 0x1 + movs r0, 0xFF + strb r0, [r3] + adds r0, r3, 0 +_081D2E70: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_81D2CD0 + + thumb_func_start sub_81D2E7C +sub_81D2E7C: @ 81D2E7C + push {r4,lr} + adds r4, r0, 0 + lsls r2, 16 + lsrs r2, 16 + b _081D2E94 +_081D2E86: + strb r3, [r4] + adds r1, 0x1 + adds r4, 0x1 + lsls r0, r2, 16 + ldr r2, =0xffff0000 + adds r0, r2 + lsrs r2, r0, 16 +_081D2E94: + ldrb r3, [r1] + adds r0, r3, 0 + cmp r0, 0xFF + bne _081D2E86 + adds r1, r2, 0 + lsls r0, r1, 16 + ldr r2, =0xffff0000 + adds r0, r2 + lsrs r2, r0, 16 + lsls r1, 16 + cmp r1, 0 + ble _081D2EC2 + movs r3, 0 +_081D2EAE: + strb r3, [r4] + adds r4, 0x1 + adds r1, r2, 0 + lsls r0, r1, 16 + ldr r2, =0xffff0000 + adds r0, r2 + lsrs r2, r0, 16 + lsls r1, 16 + cmp r1, 0 + bgt _081D2EAE +_081D2EC2: + movs r0, 0xFF + strb r0, [r4] + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D2E7C + + thumb_func_start sub_81D2ED4 +sub_81D2ED4: @ 81D2ED4 + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + ldr r0, [sp, 0x14] + ldr r1, [sp, 0x18] + ldr r4, [sp, 0x1C] + lsls r2, 16 + lsrs r7, r2, 16 + lsls r3, 16 + lsrs r3, 16 + lsls r0, 16 + lsrs r2, r0, 16 + lsls r1, 16 + lsrs r0, r1, 16 + lsls r4, 24 + cmp r4, 0 + bne _081D2EFC + subs r0, 0x1 + lsls r0, 16 + lsrs r0, 16 +_081D2EFC: + cmp r2, r0 + beq _081D2F42 + adds r0, r6, 0 + adds r1, r7, 0 + adds r2, r3, 0 + bl sub_81D2CD0 + movs r0, 0xFC + strb r0, [r5] + movs r0, 0x4 + strb r0, [r5, 0x1] + movs r0, 0x8 + strb r0, [r5, 0x2] + movs r0, 0 + strb r0, [r5, 0x3] + movs r0, 0x9 + strb r0, [r5, 0x4] + cmp r7, 0xE + bne _081D2F2C + adds r0, r5, 0x5 + ldr r1, =gText_InParty + b _081D2F3A + .pool +_081D2F2C: + adds r4, r5, 0x5 + lsls r0, r7, 24 + lsrs r0, 24 + bl GetBoxNamePtr + adds r1, r0, 0 + adds r0, r4, 0 +_081D2F3A: + movs r2, 0x8 + bl sub_81D2E7C + b _081D2F72 +_081D2F42: + movs r1, 0 + movs r2, 0 +_081D2F46: + adds r0, r6, r1 + strb r2, [r0] + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, 0xB + bls _081D2F46 + adds r1, r6, r1 + movs r0, 0xFF + strb r0, [r1] + movs r1, 0 + movs r2, 0 +_081D2F5E: + adds r0, r5, r1 + strb r2, [r0] + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, 0x7 + bls _081D2F5E + adds r1, r5, r1 + movs r0, 0xFF + strb r0, [r1] +_081D2F72: + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81D2ED4 + + thumb_func_start sub_81D2F78 +sub_81D2F78: @ 81D2F78 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r8, r0 + mov r10, r1 + ldr r0, [sp, 0x20] + ldr r1, [sp, 0x24] + ldr r4, [sp, 0x28] + ldr r5, [sp, 0x2C] + lsls r2, 16 + lsrs r7, r2, 16 + lsls r3, 16 + lsrs r6, r3, 16 + lsls r0, 16 + lsrs r2, r0, 16 + lsls r1, 16 + lsrs r1, 16 + mov r9, r1 + lsls r4, 16 + lsrs r0, r4, 16 + lsls r5, 24 + cmp r5, 0 + bne _081D2FB0 + subs r0, 0x1 + lsls r0, 16 + lsrs r0, 16 +_081D2FB0: + cmp r2, r0 + beq _081D305C + adds r0, r7, 0 + adds r1, r6, 0 + movs r2, 0x16 + movs r3, 0 + bl sub_81D2C68 + mov r1, r9 + lsls r5, r1, 2 + adds r4, r5, r1 + mov r2, r8 + adds r1, r2, r4 + strb r0, [r1] + adds r0, r7, 0 + adds r1, r6, 0 + movs r2, 0x2F + movs r3, 0 + bl sub_81D2C68 + mov r1, r8 + adds r1, 0x1 + adds r1, r4 + strb r0, [r1] + adds r0, r7, 0 + adds r1, r6, 0 + movs r2, 0x21 + movs r3, 0 + bl sub_81D2C68 + mov r1, r8 + adds r1, 0x2 + adds r1, r4 + strb r0, [r1] + adds r0, r7, 0 + adds r1, r6, 0 + movs r2, 0x18 + movs r3, 0 + bl sub_81D2C68 + mov r1, r8 + adds r1, 0x3 + adds r1, r4 + strb r0, [r1] + adds r0, r7, 0 + adds r1, r6, 0 + movs r2, 0x17 + movs r3, 0 + bl sub_81D2C68 + mov r1, r8 + adds r1, 0x4 + adds r1, r4 + strb r0, [r1] + mov r4, r10 + add r4, r9 + adds r0, r7, 0 + adds r1, r6, 0 + movs r2, 0x30 + movs r3, 0 + bl sub_81D2C68 + cmp r0, 0xFF + beq _081D3044 + adds r0, r7, 0 + adds r1, r6, 0 + movs r2, 0x30 + movs r3, 0 + bl sub_81D2C68 + movs r1, 0x1D + bl __udivsi3 + b _081D3046 +_081D3044: + movs r0, 0x9 +_081D3046: + strb r0, [r4] + mov r0, r9 + adds r1, r5, r0 + mov r2, r8 + adds r0, r2, r1 + lsls r1, 2 + adds r1, 0x14 + add r1, r8 + bl sub_81D2754 + b _081D3086 +_081D305C: + movs r2, 0 + mov r0, r9 + lsls r5, r0, 2 + adds r1, r5, r0 + movs r6, 0 + lsls r3, r1, 2 + movs r5, 0x9B + movs r4, 0x5B +_081D306C: + adds r0, r2, r1 + add r0, r8 + strb r6, [r0] + lsls r0, r2, 2 + adds r0, r3 + add r0, r8 + strh r5, [r0, 0x14] + strh r4, [r0, 0x16] + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0x4 + bls _081D306C +_081D3086: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81D2F78 + + thumb_func_start sub_81D3094 +sub_81D3094: @ 81D3094 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x4 + mov r8, r0 + mov r9, r1 + ldr r0, [sp, 0x20] + ldr r1, [sp, 0x24] + ldr r4, [sp, 0x28] + lsls r2, 16 + lsrs r7, r2, 16 + lsls r3, 16 + lsrs r5, r3, 16 + lsls r0, 16 + lsrs r2, r0, 16 + lsls r1, 16 + lsrs r0, r1, 16 + lsls r4, 24 + cmp r4, 0 + bne _081D30C4 + subs r0, 0x1 + lsls r0, 16 + lsrs r0, 16 +_081D30C4: + cmp r2, r0 + beq _081D311A + adds r0, r7, 0 + adds r1, r5, 0 + movs r2, 0x41 + movs r3, 0 + bl sub_81D2C68 + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + adds r0, r7, 0 + adds r1, r5, 0 + movs r2, 0x1 + movs r3, 0 + bl sub_81D2C68 + adds r6, r0, 0 + adds r0, r7, 0 + adds r1, r5, 0 + movs r2, 0 + movs r3, 0 + bl sub_81D2C68 + adds r5, r0, 0 + lsls r0, r4, 3 + ldr r1, =gMonFrontPicTable + adds r0, r1 + movs r1, 0x1 + str r1, [sp] + mov r1, r8 + adds r2, r4, 0 + adds r3, r5, 0 + bl LoadSpecialPokePic + adds r0, r4, 0 + adds r1, r6, 0 + adds r2, r5, 0 + bl GetFrontSpritePalFromSpeciesAndPersonality + mov r1, r9 + bl LZ77UnCompWram +_081D311A: + add sp, 0x4 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3094 + + thumb_func_start sub_81D312C +sub_81D312C: @ 81D312C + push {lr} + adds r1, r0, 0 + ldrh r0, [r1] + adds r0, 0x18 + strh r0, [r1] + lsls r0, 16 + cmp r0, 0 + ble _081D3140 + movs r0, 0 + strh r0, [r1] +_081D3140: + movs r0, 0 + ldrsh r1, [r1, r0] + negs r0, r1 + orrs r0, r1 + lsrs r0, 31 + pop {r1} + bx r1 + thumb_func_end sub_81D312C + + thumb_func_start sub_81D3150 +sub_81D3150: @ 81D3150 + push {lr} + adds r1, r0, 0 + ldrh r0, [r1] + subs r0, 0x18 + strh r0, [r1] + lsls r0, 16 + asrs r0, 16 + movs r2, 0x50 + negs r2, r2 + cmp r0, r2 + bge _081D3168 + strh r2, [r1] +_081D3168: + movs r0, 0 + ldrsh r1, [r1, r0] + eors r1, r2 + negs r0, r1 + orrs r0, r1 + lsrs r0, 31 + pop {r1} + bx r1 + thumb_func_end sub_81D3150 + + thumb_func_start sub_81D3178 +sub_81D3178: @ 81D3178 + push {r4,r5,lr} + adds r5, r1, 0 + bl sub_81D2074 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r5, 0 + bl sub_81D312C + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + cmp r4, 0 + bne _081D319A + cmp r0, 0 + beq _081D319C +_081D319A: + movs r1, 0x1 +_081D319C: + adds r0, r1, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D3178 + + thumb_func_start sub_81D31A4 +sub_81D31A4: @ 81D31A4 + push {r4,r5,lr} + adds r5, r1, 0 + bl sub_81D2074 + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + adds r0, r5, 0 + bl sub_81D3150 + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + cmp r4, 0 + bne _081D31C6 + cmp r0, 0 + beq _081D31C8 +_081D31C6: + movs r1, 0x1 +_081D31C8: + adds r0, r1, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D31A4 + + thumb_func_start sub_81D31D0 +sub_81D31D0: @ 81D31D0 + push {r4-r7,lr} + sub sp, 0x20 + ldr r3, =gUnknown_08625A48 + ldr r4, [r3] + ldr r5, [r3, 0x4] + str r4, [sp, 0x18] + str r5, [sp, 0x1C] + mov r4, sp + ldr r3, =gUnknown_08625A50 + ldm r3!, {r5-r7} + stm r4!, {r5-r7} + ldm r3!, {r5-r7} + stm r4!, {r5-r7} + ldr r3, =gUnknown_08625A68 + ldr r4, [r3, 0x4] + ldr r3, [r3] + ldr r5, [sp, 0x18] + ldr r6, [sp, 0x1C] + str r5, [r0] + str r6, [r0, 0x4] + mov r0, sp + ldm r0!, {r5-r7} + stm r1!, {r5-r7} + ldm r0!, {r5-r7} + stm r1!, {r5-r7} + str r3, [r2] + str r4, [r2, 0x4] + add sp, 0x20 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D31D0 + + thumb_func_start sub_81D321C +sub_81D321C: @ 81D321C + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x50 + adds r5, r0, 0 + mov r12, r1 + mov r8, r2 + mov r1, sp + ldr r0, =gUnknown_08625A70 + ldm r0!, {r2-r4} + stm r1!, {r2-r4} + ldm r0!, {r2,r6,r7} + stm r1!, {r2,r6,r7} + ldm r0!, {r3,r4} + stm r1!, {r3,r4} + add r3, sp, 0x20 + adds r1, r3, 0 + ldr r0, =gUnknown_08625A90 + ldm r0!, {r2,r6,r7} + stm r1!, {r2,r6,r7} + ldm r0!, {r4,r6,r7} + stm r1!, {r4,r6,r7} + add r2, sp, 0x38 + adds r1, r2, 0 + ldr r0, =gUnknown_08625AA8 + ldm r0!, {r4,r6,r7} + stm r1!, {r4,r6,r7} + ldm r0!, {r4,r6,r7} + stm r1!, {r4,r6,r7} + movs r4, 0 +_081D3258: + lsls r0, r4, 3 + add r0, sp + ldr r1, [r0, 0x4] + ldr r0, [r0] + stm r5!, {r0,r1} + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _081D3258 + mov r1, r12 + adds r0, r2, 0 + ldm r0!, {r2,r4,r5} + stm r1!, {r2,r4,r5} + ldm r0!, {r2,r6,r7} + stm r1!, {r2,r6,r7} + movs r4, 0 +_081D327A: + lsls r0, r4, 3 + adds r0, r3, r0 + ldr r1, [r0, 0x4] + ldr r0, [r0] + mov r5, r8 + adds r5, 0x8 + mov r8, r5 + subs r5, 0x8 + stm r5!, {r0,r1} + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x2 + bls _081D327A + add sp, 0x50 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D321C + + thumb_func_start sub_81D32B0 +sub_81D32B0: @ 81D32B0 + push {r4,r5,lr} + ldr r2, =gUnknown_08625AC0 + ldr r4, [r2] + ldr r5, [r2, 0x4] + ldr r2, =gUnknown_08625AC8 + ldr r3, [r2, 0x4] + ldr r2, [r2] + str r4, [r0] + str r5, [r0, 0x4] + str r2, [r1] + str r3, [r1, 0x4] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D32B0 + + thumb_func_start sub_81D32D4 +sub_81D32D4: @ 81D32D4 + push {lr} + adds r1, r0, 0 + ldrh r0, [r1, 0x30] + adds r0, 0x1 + strh r0, [r1, 0x30] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x3C + ble _081D32F0 + movs r0, 0 + strh r0, [r1, 0x30] + adds r0, r1, 0 + bl sub_81D3408 +_081D32F0: + pop {r0} + bx r0 + thumb_func_end sub_81D32D4 + + thumb_func_start sub_81D32F4 +sub_81D32F4: @ 81D32F4 + push {lr} + adds r2, r0, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _081D330C + movs r0, 0 + strh r0, [r2, 0x30] + ldr r0, =sub_81D32D4 + str r0, [r2, 0x1C] +_081D330C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D32F4 + + thumb_func_start sub_81D3314 +sub_81D3314: @ 81D3314 + push {r4,r5,lr} + adds r4, r0, 0 + movs r1, 0x36 + ldrsh r0, [r4, r1] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r0, =gSprites + adds r3, r1, r0 + cmp r3, 0 + beq _081D3360 + ldrh r1, [r3, 0x24] + ldrh r2, [r3, 0x20] + adds r1, r2 + ldr r2, =gUnknown_08625B2C + movs r5, 0x2E + ldrsh r0, [r4, r5] + lsls r0, 2 + adds r0, r2 + ldrh r0, [r0] + adds r0, r1 + strh r0, [r4, 0x20] + ldrh r1, [r3, 0x26] + ldrh r3, [r3, 0x22] + adds r1, r3 + movs r3, 0x2E + ldrsh r0, [r4, r3] + lsls r0, 2 + adds r2, 0x2 + adds r0, r2 + ldrh r0, [r0] + adds r0, r1 + b _081D337E + .pool +_081D3360: + ldr r1, =gUnknown_08625B2C + movs r5, 0x2E + ldrsh r0, [r4, r5] + lsls r0, 2 + adds r0, r1 + ldrh r0, [r0] + adds r0, 0x28 + strh r0, [r4, 0x20] + movs r2, 0x2E + ldrsh r0, [r4, r2] + lsls r0, 2 + adds r1, 0x2 + adds r0, r1 + ldrh r0, [r0] + adds r0, 0x68 +_081D337E: + strh r0, [r4, 0x22] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3314 + + thumb_func_start sub_81D338C +sub_81D338C: @ 81D338C + push {r4-r7,lr} + mov r7, r8 + push {r7} + mov r8, r2 + lsls r0, 24 + lsrs r6, r0, 24 + lsls r1, 24 + lsrs r7, r1, 24 + movs r5, 0 +_081D339E: + lsls r0, r5, 2 + mov r1, r8 + adds r4, r0, r1 + ldr r0, [r4] + cmp r0, 0 + beq _081D33F0 + strh r5, [r0, 0x2E] + ldr r1, [r4] + lsls r0, r5, 4 + adds r0, 0x1 + strh r0, [r1, 0x30] + ldr r0, [r4] + strh r6, [r0, 0x32] + ldr r0, [r4] + strh r5, [r0, 0x34] + cmp r7, 0 + beq _081D33C4 + cmp r6, 0x9 + beq _081D33D0 +_081D33C4: + ldr r1, [r4] + ldr r0, =sub_81D3564 + str r0, [r1, 0x1C] + b _081D33F0 + .pool +_081D33D0: + ldr r0, [r4] + bl sub_81D3314 + ldr r0, [r4] + bl sub_81D35E8 + ldr r2, [r4] + ldr r0, =sub_81D32F4 + str r0, [r2, 0x1C] + adds r2, 0x3E + ldrb r0, [r2] + movs r3, 0x5 + negs r3, r3 + adds r1, r3, 0 + ands r0, r1 + strb r0, [r2] +_081D33F0: + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + cmp r5, 0x9 + bls _081D339E + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D338C + + thumb_func_start sub_81D3408 +sub_81D3408: @ 81D3408 + push {r4-r7,lr} + adds r4, r0, 0 + ldrh r0, [r4, 0x38] + lsls r0, 24 + lsrs r2, r0, 24 + movs r3, 0 + movs r1, 0x32 + ldrsh r0, [r4, r1] + adds r0, 0x1 + cmp r3, r0 + bge _081D3454 + ldr r5, =gSprites + movs r7, 0x1C + adds r7, r5 + mov r12, r7 + ldr r6, =sub_81D3564 +_081D3428: + lsls r1, r2, 4 + adds r1, r2 + lsls r1, 2 + adds r2, r1, r5 + movs r7, 0x2E + ldrsh r0, [r2, r7] + lsls r0, 4 + adds r0, 0x1 + strh r0, [r2, 0x30] + add r1, r12 + str r6, [r1] + ldrh r0, [r2, 0x38] + lsls r0, 24 + lsrs r2, r0, 24 + adds r0, r3, 0x1 + lsls r0, 16 + lsrs r3, r0, 16 + movs r1, 0x32 + ldrsh r0, [r4, r1] + adds r0, 0x1 + cmp r3, r0 + blt _081D3428 +_081D3454: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3408 + + thumb_func_start sub_81D3464 +sub_81D3464: @ 81D3464 + push {lr} + adds r2, r0, 0 + movs r1, 0 + movs r3, 0 +_081D346C: + lsls r0, r1, 2 + adds r0, r2 + str r3, [r0] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x9 + bls _081D346C + pop {r0} + bx r0 + thumb_func_end sub_81D3464 + + thumb_func_start sub_81D3480 +sub_81D3480: @ 81D3480 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r8, r0 + lsls r1, 24 + lsrs r1, 24 + mov r10, r1 + lsls r2, 24 + movs r0, 0 + mov r9, r0 + lsrs r7, r2, 24 + movs r5, 0 + adds r0, r7, 0x1 + cmp r9, r0 + bge _081D34FE +_081D34A2: + ldr r0, =gUnknown_08625B14 + movs r1, 0 + movs r2, 0 + movs r3, 0 + bl CreateSprite + lsls r0, 24 + lsrs r3, r0, 24 + adds r6, r3, 0 + cmp r3, 0x40 + beq _081D34FE + lsls r0, r5, 2 + mov r1, r8 + adds r4, r0, r1 + lsls r0, r3, 4 + adds r0, r3 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + str r0, [r4] + adds r0, 0x3E + ldrb r1, [r0] + movs r2, 0x4 + orrs r1, r2 + strb r1, [r0] + ldr r0, [r4] + mov r1, r10 + strh r1, [r0, 0x36] + cmp r5, 0 + beq _081D34F0 + subs r0, r4, 0x4 + ldr r0, [r0] + strh r3, [r0, 0x38] + b _081D34F2 + .pool +_081D34F0: + mov r9, r6 +_081D34F2: + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + adds r0, r7, 0x1 + cmp r5, r0 + blt _081D34A2 +_081D34FE: + lsls r0, r7, 2 + add r0, r8 + ldr r0, [r0] + mov r1, r9 + strh r1, [r0, 0x38] + adds r0, r7, 0 + movs r1, 0x1 + mov r2, r8 + bl sub_81D338C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_81D3480 + + thumb_func_start sub_81D3520 +sub_81D3520: @ 81D3520 + push {r4-r6,lr} + adds r6, r0, 0 + movs r5, 0 +_081D3526: + cmp r5, 0x9 + bhi _081D3544 + lsls r0, r5, 2 + adds r4, r0, r6 + ldr r0, [r4] + cmp r0, 0 + beq _081D3544 + bl DestroySprite + movs r0, 0 + str r0, [r4] + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + b _081D3526 +_081D3544: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_81D3520 + + thumb_func_start sub_81D354C +sub_81D354C: @ 81D354C + push {lr} + bl sub_81D3520 + movs r0, 0x68 + bl FreeSpriteTilesByTag + movs r0, 0x68 + bl FreeSpritePaletteByTag + pop {r0} + bx r0 + thumb_func_end sub_81D354C + + thumb_func_start sub_81D3564 +sub_81D3564: @ 81D3564 + push {r4,lr} + adds r4, r0, 0 + ldrh r1, [r4, 0x30] + movs r2, 0x30 + ldrsh r0, [r4, r2] + cmp r0, 0 + beq _081D3592 + subs r0, r1, 0x1 + strh r0, [r4, 0x30] + lsls r0, 16 + cmp r0, 0 + bne _081D35DC + adds r0, r4, 0 + movs r1, 0 + bl SeekSpriteAnim + adds r2, r4, 0 + adds r2, 0x3E + ldrb r1, [r2] + movs r0, 0x5 + negs r0, r0 + ands r0, r1 + strb r0, [r2] +_081D3592: + adds r0, r4, 0 + bl sub_81D3314 + adds r0, r4, 0 + adds r0, 0x3F + ldrb r1, [r0] + movs r0, 0x10 + ands r0, r1 + cmp r0, 0 + beq _081D35DC + adds r2, r4, 0 + adds r2, 0x3E + ldrb r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r2] + movs r0, 0x34 + ldrsh r1, [r4, r0] + movs r2, 0x32 + ldrsh r0, [r4, r2] + cmp r1, r0 + bne _081D35D8 + cmp r1, 0x9 + bne _081D35D0 + adds r0, r4, 0 + bl sub_81D35E8 + ldr r0, =sub_81D32F4 + b _081D35DA + .pool +_081D35D0: + ldr r0, =sub_81D32D4 + b _081D35DA + .pool +_081D35D8: + ldr r0, =SpriteCallbackDummy +_081D35DA: + str r0, [r4, 0x1C] +_081D35DC: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3564 + + thumb_func_start sub_81D35E8 +sub_81D35E8: @ 81D35E8 + push {r4-r7,lr} + adds r6, r0, 0 + ldrh r0, [r6, 0x38] + lsls r0, 24 + lsrs r1, r0, 24 + movs r5, 0 + movs r2, 0x32 + ldrsh r0, [r6, r2] + adds r0, 0x1 + cmp r5, r0 + bge _081D3636 + movs r0, 0x5 + negs r0, r0 + adds r7, r0, 0 +_081D3604: + lsls r4, r1, 4 + adds r4, r1 + lsls r4, 2 + ldr r0, =gSprites + adds r4, r0 + adds r0, r4, 0 + movs r1, 0 + bl SeekSpriteAnim + adds r1, r4, 0 + adds r1, 0x3E + ldrb r0, [r1] + ands r0, r7 + strb r0, [r1] + ldrh r0, [r4, 0x38] + lsls r0, 24 + lsrs r1, r0, 24 + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + movs r2, 0x32 + ldrsh r0, [r6, r2] + adds r0, 0x1 + cmp r5, r0 + blt _081D3604 +_081D3636: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D35E8 + + thumb_func_start sub_81D3640 +sub_81D3640: @ 81D3640 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x2C + mov r8, r0 + adds r6, r1, 0 + adds r5, r2, 0 + adds r4, r3, 0 + ldr r3, [sp, 0x4C] + ldr r0, [sp, 0x50] + mov r9, r0 + lsls r4, 24 + lsrs r4, 24 + lsls r3, 24 + lsrs r3, 24 + mov r1, r9 + lsls r1, 24 + lsrs r1, 24 + mov r9, r1 + mov r0, r8 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + lsls r1, r4, 4 + orrs r1, r4 + lsls r1, 24 + lsrs r1, 24 + str r3, [sp, 0x28] + bl FillWindowPixelBuffer + add r2, sp, 0xC + ldrh r0, [r5] + ldrh r1, [r6] + subs r0, r1 + strh r0, [r2] + ldrh r0, [r5, 0x2] + ldrh r1, [r6, 0x2] + subs r0, r1 + strh r0, [r2, 0x2] + ldrh r0, [r5, 0x4] + ldrh r1, [r6, 0x4] + subs r0, r1 + strh r0, [r2, 0x4] + ldrh r0, [r5, 0x8] + ldrh r1, [r6, 0x8] + subs r0, r1 + strh r0, [r2, 0x6] + ldrh r0, [r5, 0xA] + ldrh r1, [r6, 0xA] + subs r0, r1 + strh r0, [r2, 0x8] + ldrh r0, [r5, 0x6] + ldrh r1, [r6, 0x6] + subs r0, r1 + strh r0, [r2, 0xA] + add r0, sp, 0x24 + strb r4, [r0] + ldr r3, [sp, 0x28] + strb r3, [r0, 0x1] + mov r1, r9 + strb r1, [r0, 0x2] + movs r7, 0 + mov r10, r0 + movs r0, 0x1 + negs r0, r0 + mov r9, r0 + add r6, sp, 0x18 +_081D36CA: + lsls r0, r7, 4 + subs r0, r7 + lsls r0, 24 + lsrs r5, r0, 24 + mov r1, r10 + str r1, [sp] + mov r0, r9 + str r0, [sp, 0x4] + ldr r1, =gUnknown_08625B54 + lsls r0, r7, 2 + adds r0, r1 + ldr r0, [r0] + str r0, [sp, 0x8] + mov r0, r8 + movs r1, 0x1 + movs r2, 0 + adds r3, r5, 0 + bl AddTextPrinterParameterized3 + lsls r0, r7, 1 + mov r4, sp + adds r4, r0 + adds r4, 0xC + movs r1, 0 + ldrsh r0, [r4, r1] + ldr r1, =gText_Dash + cmp r0, 0 + blt _081D3704 + ldr r1, =gText_UnkCtrlF904 +_081D3704: + adds r0, r6, 0 + bl StringCopy + mov r0, r10 + str r0, [sp] + mov r1, r9 + str r1, [sp, 0x4] + str r6, [sp, 0x8] + mov r0, r8 + movs r1, 0x1 + movs r2, 0x38 + adds r3, r5, 0 + bl AddTextPrinterParameterized3 + movs r0, 0 + ldrsh r1, [r4, r0] + adds r0, r1, 0 + cmp r1, 0 + bge _081D372C + negs r0, r1 +_081D372C: + movs r4, 0xC + cmp r0, 0x9 + bgt _081D3734 + movs r4, 0x12 +_081D3734: + cmp r1, 0 + bge _081D373A + negs r1, r1 +_081D373A: + adds r0, r6, 0 + movs r2, 0 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + adds r2, r4, 0 + adds r2, 0x38 + mov r1, r10 + str r1, [sp] + mov r0, r9 + str r0, [sp, 0x4] + str r6, [sp, 0x8] + mov r0, r8 + movs r1, 0x1 + adds r3, r5, 0 + bl AddTextPrinterParameterized3 + adds r0, r7, 0x1 + lsls r0, 16 + lsrs r7, r0, 16 + cmp r7, 0x5 + bls _081D36CA + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3640 + + thumb_func_start sub_81D3784 +sub_81D3784: @ 81D3784 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x2C + mov r8, r0 + adds r5, r1, 0 + adds r4, r2, 0 + adds r6, r3, 0 + ldr r2, [sp, 0x4C] + lsls r4, 24 + lsrs r4, 24 + lsls r6, 24 + lsrs r6, 24 + lsls r2, 24 + lsrs r2, 24 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + lsls r1, r4, 4 + orrs r1, r4 + lsls r1, 24 + lsrs r1, 24 + str r2, [sp, 0x28] + bl FillWindowPixelBuffer + add r1, sp, 0xC + ldrh r0, [r5] + strh r0, [r1] + ldrh r0, [r5, 0x2] + strh r0, [r1, 0x2] + ldrh r0, [r5, 0x4] + strh r0, [r1, 0x4] + ldrh r0, [r5, 0x8] + strh r0, [r1, 0x6] + ldrh r0, [r5, 0xA] + strh r0, [r1, 0x8] + ldrh r0, [r5, 0x6] + strh r0, [r1, 0xA] + add r0, sp, 0x24 + strb r4, [r0] + strb r6, [r0, 0x1] + ldr r2, [sp, 0x28] + strb r2, [r0, 0x2] + movs r6, 0 + add r1, sp, 0x18 + mov r9, r1 + mov r7, r8 + mov r10, r0 + movs r2, 0x1 + negs r2, r2 + mov r8, r2 +_081D37EE: + lsls r1, r6, 1 + mov r0, sp + adds r0, r1 + adds r0, 0xC + movs r2, 0 + ldrsh r0, [r0, r2] + movs r4, 0x3 + cmp r0, 0x63 + bgt _081D3808 + movs r4, 0x1 + cmp r0, 0x9 + ble _081D3808 + movs r4, 0x2 +_081D3808: + mov r0, sp + adds r0, r1 + adds r0, 0xC + movs r2, 0 + ldrsh r1, [r0, r2] + mov r0, r9 + movs r2, 0 + adds r3, r4, 0 + bl ConvertIntToDecimalStringN + movs r0, 0x4 + subs r0, r4 + lsls r4, r0, 1 + adds r4, r0 + lsls r4, 17 + lsrs r4, 16 + lsls r5, r6, 4 + subs r5, r6 + lsls r5, 24 + lsrs r5, 24 + mov r0, r10 + str r0, [sp] + mov r1, r8 + str r1, [sp, 0x4] + ldr r1, =gUnknown_08625B54 + lsls r0, r6, 2 + adds r0, r1 + ldr r0, [r0] + str r0, [sp, 0x8] + adds r0, r7, 0 + movs r1, 0x1 + movs r2, 0 + adds r3, r5, 0 + bl AddTextPrinterParameterized3 + adds r4, 0x38 + lsls r4, 24 + lsrs r4, 24 + mov r2, r10 + str r2, [sp] + mov r0, r8 + str r0, [sp, 0x4] + mov r1, r9 + str r1, [sp, 0x8] + adds r0, r7, 0 + movs r1, 0x1 + adds r2, r4, 0 + adds r3, r5, 0 + bl AddTextPrinterParameterized3 + adds r0, r6, 0x1 + lsls r0, 16 + lsrs r6, r0, 16 + cmp r6, 0x5 + bls _081D37EE + add sp, 0x2C + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3784 + + thumb_func_start sub_81D388C +sub_81D388C: @ 81D388C + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + movs r1, 0x3A + bl GetMonData + strh r0, [r5] + adds r0, r4, 0 + movs r1, 0x3B + bl GetMonData + strh r0, [r5, 0x2] + adds r0, r4, 0 + movs r1, 0x3C + bl GetMonData + strh r0, [r5, 0x4] + adds r0, r4, 0 + movs r1, 0x3D + bl GetMonData + strh r0, [r5, 0x6] + adds r0, r4, 0 + movs r1, 0x3E + bl GetMonData + strh r0, [r5, 0x8] + adds r0, r4, 0 + movs r1, 0x3F + bl GetMonData + strh r0, [r5, 0xA] + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_81D388C + + thumb_func_start sub_81D38D4 +sub_81D38D4: @ 81D38D4 + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x00003d6d + adds r0, r1 + ldrb r1, [r0] + adds r2, r1, 0x1 + adds r0, r2, 0 + asrs r0, 8 + lsls r0, 8 + subs r0, r2, r0 + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D38D4 + + thumb_func_start sub_81D38FC +sub_81D38FC: @ 81D38FC + push {r4,r5,lr} + adds r4, r0, 0 + movs r5, 0x9C + lsls r5, 2 + adds r1, r5, 0 + bl CalcByteArraySum + adds r4, r5 + ldr r1, [r4] + cmp r0, r1 + bne _081D3916 + movs r0, 0x1 + b _081D3918 +_081D3916: + movs r0, 0 +_081D3918: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D38FC + + thumb_func_start sub_81D3920 +sub_81D3920: @ 81D3920 + push {r4-r7,lr} + adds r7, r0, 0 + ldrb r6, [r7] + subs r0, r6, 0x1 + cmp r0, 0x7 + bhi _081D3964 + movs r5, 0 + cmp r5, r6 + bcs _081D394C + adds r4, r7, 0 + adds r4, 0x8 +_081D3936: + adds r0, r4, 0 + bl sub_81D38FC + cmp r0, 0 + beq _081D3964 + movs r0, 0x9D + lsls r0, 2 + adds r4, r0 + adds r5, 0x1 + cmp r5, r6 + bcc _081D3936 +_081D394C: + adds r0, r7, 0 + adds r0, 0x8 + movs r1, 0x9D + lsls r1, 2 + muls r1, r6 + bl CalcByteArraySum + ldr r1, [r7, 0x4] + cmp r0, r1 + bne _081D3964 + movs r0, 0x1 + b _081D3966 +_081D3964: + movs r0, 0 +_081D3966: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_81D3920 + + thumb_func_start sub_81D396C +sub_81D396C: @ 81D396C + push {r4,lr} + adds r4, r0, 0 + ldrb r0, [r4] + subs r0, 0x1 + cmp r0, 0x7 + bhi _081D398E + adds r0, r4, 0 + adds r0, 0x8 + movs r1, 0xEE + lsls r1, 4 + bl CalcByteArraySum + ldr r1, [r4, 0x4] + cmp r0, r1 + bne _081D398E + movs r0, 0x1 + b _081D3990 +_081D398E: + movs r0, 0 +_081D3990: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D396C + + thumb_func_start sub_81D3998 +sub_81D3998: @ 81D3998 + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r7, r0, 0 + mov r8, r1 + movs r2, 0x80 + lsls r2, 5 + mov r0, r8 + movs r1, 0 + bl memset + ldrb r0, [r7] + mov r1, r8 + strb r0, [r1] + bl sub_81D38D4 + mov r2, r8 + strb r0, [r2, 0x1] + ldrb r0, [r7] + adds r0, 0x1 + asrs r0, 1 + strb r0, [r2, 0x2] + movs r6, 0 + b _081D3A42 +_081D39C8: + movs r0, 0x1 + ands r0, r6 + cmp r0, 0 + bne _081D3A14 + lsrs r0, r6, 31 + adds r0, r6, r0 + asrs r0, 1 + lsls r4, r0, 4 + subs r4, r0 + lsls r4, 3 + subs r4, r0 + lsls r4, 3 + add r4, r8 + movs r0, 0x9D + lsls r0, 2 + adds r5, r6, 0 + muls r5, r0 + adds r5, r7, r5 + ldrb r0, [r5, 0x8] + strb r0, [r4, 0x8] + movs r1, 0xA7 + lsls r1, 2 + adds r0, r4, r1 + movs r2, 0xAA + lsls r2, 1 + adds r1, r5, r2 + subs r2, 0x30 + bl memcpy + adds r4, 0xC + adds r5, 0xC + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0xA4 + lsls r2, 1 + bl memcpy + b _081D3A40 +_081D3A14: + lsrs r1, r6, 31 + adds r1, r6, r1 + asrs r1, 1 + lsls r0, r1, 4 + subs r0, r1 + lsls r0, 3 + subs r0, r1 + lsls r0, 3 + add r0, r8 + movs r1, 0x9D + lsls r1, 2 + muls r1, r6 + adds r1, r7, r1 + ldrb r2, [r1, 0x8] + strb r2, [r0, 0x9] + movs r2, 0xAA + lsls r2, 1 + adds r0, r2 + adds r1, 0xC + subs r2, 0xC + bl memcpy +_081D3A40: + adds r6, 0x1 +_081D3A42: + ldrb r0, [r7] + cmp r6, r0 + blt _081D39C8 + movs r0, 0x1 + ands r0, r6 + cmp r0, 0 + beq _081D3A7E + lsrs r2, r6, 31 + adds r2, r6, r2 + asrs r2, 1 + lsls r0, r2, 4 + subs r0, r2 + lsls r0, 3 + subs r0, r2 + lsls r0, 3 + add r0, r8 + movs r1, 0xAA + lsls r1, 1 + adds r0, r1 + ldr r3, =gUnknown_08625B6C + lsls r1, r2, 2 + adds r1, r2 + lsls r1, 3 + adds r1, r2 + lsls r1, 3 + adds r1, r3 + movs r2, 0xA4 + lsls r2, 1 + bl memcpy +_081D3A7E: + mov r0, r8 + adds r0, 0x8 + movs r1, 0xEE + lsls r1, 4 + bl CalcByteArraySum + mov r2, r8 + str r0, [r2, 0x4] + movs r0, 0x1E + mov r1, r8 + bl sub_8153634 + cmp r0, 0x1 + bne _081D3AA4 + movs r0, 0x1 + b _081D3AA6 + .pool +_081D3AA4: + movs r0, 0 +_081D3AA6: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_81D3998 + + thumb_func_start sub_81D3AB0 +sub_81D3AB0: @ 81D3AB0 + push {r4,r5,lr} + adds r4, r0, 0 + movs r0, 0x80 + lsls r0, 5 + bl AllocZeroed + adds r5, r0, 0 + adds r0, r4, 0 + adds r1, r5, 0 + bl sub_81D3998 + adds r4, r0, 0 + adds r0, r5, 0 + bl Free + adds r0, r4, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D3AB0 + + thumb_func_start sub_81D3AD8 +sub_81D3AD8: @ 81D3AD8 + push {r4,r5,lr} + adds r5, r0, 0 + adds r4, r1, 0 + movs r0, 0x1E + bl TryCopySpecialSaveSection + cmp r0, 0x1 + bne _081D3B04 + ldr r2, =0x00000ee8 + adds r0, r5, 0 + adds r1, r4, 0 + bl memcpy + adds r0, r5, 0 + bl sub_81D396C + cmp r0, 0 + beq _081D3B04 + movs r0, 0x1 + b _081D3B06 + .pool +_081D3B04: + movs r0, 0 +_081D3B06: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D3AD8 + + thumb_func_start sub_81D3B0C +sub_81D3B0C: @ 81D3B0C + push {r4,r5,lr} + adds r4, r0, 0 + movs r0, 0x80 + lsls r0, 5 + bl AllocZeroed + adds r5, r0, 0 + adds r0, r4, 0 + adds r1, r5, 0 + bl sub_81D3AD8 + adds r4, r0, 0 + adds r0, r5, 0 + bl Free + adds r0, r4, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D3B0C + + thumb_func_start sub_81D3B34 +sub_81D3B34: @ 81D3B34 + push {r4,r5,lr} + movs r0, 0x80 + lsls r0, 5 + bl AllocZeroed + adds r4, r0, 0 + bl sub_81D3B0C + adds r5, r0, 0 + adds r0, r4, 0 + bl Free + adds r0, r5, 0 + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D3B34 + + thumb_func_start sub_81D3B54 +sub_81D3B54: @ 81D3B54 + push {r4-r7,lr} + sub sp, 0x4 + adds r6, r0, 0 + adds r5, r1, 0 + bl sub_81D41A0 + movs r7, 0x2 + ldr r4, =gShouldAdvanceLinkState +_081D3B64: + bl sub_81D4170 + ldr r0, =gUnknown_030012E2 + ldrh r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081D3B76 + strb r7, [r4] +_081D3B76: + movs r0, 0x1 + adds r1, r6, 0 + adds r2, r5, 0 + movs r3, 0 + bl sub_81D3D70 + adds r1, r0, 0 + ldr r0, =gUnknown_030012E4 + strh r1, [r0] + movs r0, 0x13 + ands r0, r1 + cmp r0, 0x10 + bne _081D3BA0 + movs r4, 0 + b _081D3BC2 + .pool +_081D3BA0: + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + beq _081D3BAC + movs r4, 0x1 + b _081D3BC2 +_081D3BAC: + movs r0, 0x4 + ands r0, r1 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0 + bne _081D3BC0 + strb r0, [r4] + bl VBlankIntrWait + b _081D3B64 +_081D3BC0: + movs r4, 0x2 +_081D3BC2: + movs r0, 0 + str r0, [sp] + ldr r1, =gUnknown_030012C8 + ldr r2, =0x05000006 + mov r0, sp + bl CpuSet + bl sub_81D41F4 + adds r0, r4, 0 + add sp, 0x4 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D3B54 + + thumb_func_start sub_81D3BE8 +sub_81D3BE8: @ 81D3BE8 + push {r4-r6,lr} + sub sp, 0x4 + adds r5, r0, 0 + bl sub_81D41A0 + movs r6, 0x2 + ldr r4, =gShouldAdvanceLinkState +_081D3BF6: + bl sub_81D4170 + ldr r0, =gUnknown_030012E2 + ldrh r1, [r0] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081D3C08 + strb r6, [r4] +_081D3C08: + movs r0, 0 + movs r1, 0 + movs r2, 0 + adds r3, r5, 0 + bl sub_81D3D70 + adds r1, r0, 0 + ldr r0, =gUnknown_030012E4 + strh r1, [r0] + movs r0, 0x13 + ands r0, r1 + cmp r0, 0x10 + bne _081D3C34 + movs r4, 0 + b _081D3C56 + .pool +_081D3C34: + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + beq _081D3C40 + movs r4, 0x1 + b _081D3C56 +_081D3C40: + movs r0, 0x4 + ands r0, r1 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0 + bne _081D3C54 + strb r0, [r4] + bl VBlankIntrWait + b _081D3BF6 +_081D3C54: + movs r4, 0x2 +_081D3C56: + movs r0, 0 + str r0, [sp] + ldr r1, =gUnknown_030012C8 + ldr r2, =0x05000006 + mov r0, sp + bl CpuSet + bl sub_81D41F4 + adds r0, r4, 0 + add sp, 0x4 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D3BE8 + + thumb_func_start sub_81D3C7C +sub_81D3C7C: @ 81D3C7C + push {r4,lr} + ldr r4, =0x04000208 + movs r3, 0 + strh r3, [r4] + ldr r2, =0x04000200 + ldrh r1, [r2] + ldr r0, =0x0000ff3f + ands r0, r1 + strh r0, [r2] + movs r0, 0x1 + strh r0, [r4] + ldr r0, =0x04000128 + strh r3, [r0] + subs r0, 0x1A + strh r3, [r0] + ldr r1, =0x04000202 + movs r0, 0xC0 + strh r0, [r1] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3C7C + + thumb_func_start sub_81D3CBC +sub_81D3CBC: @ 81D3CBC + push {r4-r7,lr} + sub sp, 0x4 + ldr r5, =0x04000208 + movs r4, 0 + strh r4, [r5] + ldr r3, =0x04000200 + ldrh r1, [r3] + ldr r0, =0x0000ff3f + ands r0, r1 + strh r0, [r3] + movs r6, 0x1 + strh r6, [r5] + ldr r0, =0x04000134 + strh r4, [r0] + ldr r2, =0x04000128 + movs r1, 0x80 + lsls r1, 6 + adds r0, r1, 0 + strh r0, [r2] + ldrh r0, [r2] + ldr r7, =0x00004003 + adds r1, r7, 0 + orrs r0, r1 + strh r0, [r2] + strh r4, [r5] + ldrh r0, [r3] + movs r1, 0x80 + orrs r0, r1 + strh r0, [r3] + strh r6, [r5] + ldr r1, =gUnknown_030012C8 + ldrb r0, [r1, 0x1] + cmp r0, 0 + bne _081D3D0A + str r0, [sp] + ldr r2, =0x05000006 + mov r0, sp + bl CpuSet +_081D3D0A: + add sp, 0x4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3CBC + + thumb_func_start sub_81D3D34 +sub_81D3D34: @ 81D3D34 + ldr r0, =0x04000134 + movs r3, 0 + strh r3, [r0] + ldr r2, =0x04000128 + movs r1, 0xA0 + lsls r1, 7 + adds r0, r1, 0 + strh r0, [r2] + ldrh r0, [r2] + movs r1, 0x8 + orrs r0, r1 + strh r0, [r2] + ldr r0, =gShouldAdvanceLinkState + strb r3, [r0] + ldr r0, =gUnknown_030012E6 + strh r3, [r0] + ldr r1, =gUnknown_030012E8 + movs r0, 0 + str r0, [r1] + bx lr + .pool + thumb_func_end sub_81D3D34 + + thumb_func_start sub_81D3D70 +sub_81D3D70: @ 81D3D70 + push {r4-r6,lr} + adds r4, r1, 0 + adds r5, r2, 0 + adds r6, r3, 0 + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =gUnknown_030012C8 + ldrb r0, [r0, 0x1] + cmp r0, 0x6 + bls _081D3D86 + b _081D3ECC +_081D3D86: + lsls r0, 2 + ldr r1, =_081D3D98 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081D3D98: + .4byte _081D3DB4 + .4byte _081D3DC8 + .4byte _081D3DE8 + .4byte _081D3DFC + .4byte _081D3E74 + .4byte _081D3E84 + .4byte _081D3EBC +_081D3DB4: + bl sub_81D3CBC + ldr r1, =gUnknown_030012C8 + movs r0, 0x1 + strb r0, [r1, 0x2] + strb r0, [r1, 0x1] + b _081D3ECC + .pool +_081D3DC8: + adds r0, r2, 0 + bl sub_81D3EE8 + lsls r0, 16 + cmp r0, 0 + beq _081D3DD8 + bl sub_81D413C +_081D3DD8: + ldr r0, =gShouldAdvanceLinkState + ldrb r0, [r0] + cmp r0, 0x2 + beq _081D3DE2 + b _081D3ECC +_081D3DE2: + b _081D3E04 + .pool +_081D3DE8: + bl sub_81D3D34 + adds r0, r4, 0 + adds r1, r5, 0 + adds r2, r6, 0 + bl sub_81D3F1C + ldr r1, =gUnknown_030012C8 + movs r0, 0x3 + strb r0, [r1, 0x1] +_081D3DFC: + ldr r0, =gShouldAdvanceLinkState + ldrb r0, [r0] + cmp r0, 0x2 + bne _081D3E18 +_081D3E04: + ldr r1, =gUnknown_030012C8 + strb r0, [r1, 0x4] + movs r0, 0x6 + strb r0, [r1, 0x1] + b _081D3ECC + .pool +_081D3E18: + ldr r2, =gUnknown_030012E6 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + ldr r1, =gUnknown_030012E8 + ldr r0, [r1] + adds r3, r0, 0x1 + str r3, [r1] + ldr r1, =gUnknown_030012C8 + ldrb r0, [r1] + cmp r0, 0 + bne _081D3E3C + cmp r3, 0x3C + bls _081D3E3C + movs r0, 0x1 + strb r0, [r1, 0x4] + movs r0, 0x6 + strb r0, [r1, 0x1] +_081D3E3C: + ldr r4, =gUnknown_030012C8 + ldrb r0, [r4, 0x2] + cmp r0, 0x2 + beq _081D3ECC + ldrb r0, [r4] + cmp r0, 0 + beq _081D3E64 + ldrh r0, [r2] + cmp r0, 0x2 + bls _081D3E64 + bl sub_81D413C + movs r0, 0x2 + b _081D3ECA + .pool +_081D3E64: + bl sub_81D413C + ldr r1, =gUnknown_030012C8 + movs r0, 0x2 + strb r0, [r1, 0x2] + b _081D3ECC + .pool +_081D3E74: + bl sub_81D3CBC + ldr r1, =gUnknown_030012C8 + movs r0, 0x5 + strb r0, [r1, 0x1] + b _081D3ECC + .pool +_081D3E84: + ldr r0, =gUnknown_030012C8 + ldrb r0, [r0] + cmp r0, 0x1 + bne _081D3E98 + ldr r0, =gUnknown_030012E6 + ldrh r0, [r0] + cmp r0, 0x2 + bls _081D3E98 + bl sub_81D413C +_081D3E98: + ldr r1, =gUnknown_030012E6 + ldrh r0, [r1] + adds r0, 0x1 + strh r0, [r1] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x3C + bls _081D3ECC + ldr r0, =gUnknown_030012C8 + movs r1, 0x1 + strb r1, [r0, 0x4] + movs r1, 0x6 + strb r1, [r0, 0x1] + b _081D3ECC + .pool +_081D3EBC: + ldr r4, =gUnknown_030012C8 + ldrb r0, [r4, 0x2] + cmp r0, 0 + beq _081D3ECC + bl sub_81D3C7C + movs r0, 0 +_081D3ECA: + strb r0, [r4, 0x2] +_081D3ECC: + ldr r2, =gUnknown_030012C8 + ldrb r0, [r2, 0x2] + ldrb r1, [r2, 0x4] + lsls r1, 2 + orrs r0, r1 + ldrb r1, [r2, 0x3] + lsls r1, 4 + orrs r0, r1 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D3D70 + + thumb_func_start sub_81D3EE8 +sub_81D3EE8: @ 81D3EE8 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =0x04000128 + ldr r0, [r0] + movs r1, 0xC + ands r0, r1 + cmp r0, 0x8 + bne _081D3F0C + cmp r2, 0 + beq _081D3F0C + ldr r1, =gUnknown_030012C8 + movs r0, 0x1 + b _081D3F10 + .pool +_081D3F0C: + ldr r1, =gUnknown_030012C8 + movs r0, 0 +_081D3F10: + strb r0, [r1] + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D3EE8 + + thumb_func_start sub_81D3F1C +sub_81D3F1C: @ 81D3F1C + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + ldr r3, =gUnknown_030012C8 + ldrb r0, [r3] + cmp r0, 0 + beq _081D3F54 + ldr r2, =0x04000128 + ldrh r0, [r2] + movs r1, 0x1 + orrs r0, r1 + strh r0, [r2] + str r5, [r3, 0x8] + ldr r0, =0x04000120 + str r4, [r0] + lsrs r0, r4, 2 + adds r0, 0x1 + str r0, [r3, 0x10] + bl sub_81D3F68 + b _081D3F5C + .pool +_081D3F54: + ldr r1, =0x04000128 + ldrh r0, [r1] + strh r0, [r1] + str r2, [r3, 0x8] +_081D3F5C: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3F1C + + thumb_func_start sub_81D3F68 +sub_81D3F68: @ 81D3F68 + ldr r1, =0x0400010c + ldr r2, =0x0000fda7 + adds r0, r2, 0 + strh r0, [r1] + ldr r0, =0x0400010e + movs r2, 0x40 + strh r2, [r0] + ldr r3, =0x04000208 + movs r0, 0 + strh r0, [r3] + adds r1, 0xF4 + ldrh r0, [r1] + orrs r0, r2 + strh r0, [r1] + movs r0, 0x1 + strh r0, [r3] + bx lr + .pool + thumb_func_end sub_81D3F68 + + thumb_func_start sub_81D3F9C +sub_81D3F9C: @ 81D3F9C + push {lr} + bl sub_81D414C + bl sub_81D413C + pop {r0} + bx r0 + thumb_func_end sub_81D3F9C + + thumb_func_start sub_81D3FAC +sub_81D3FAC: @ 81D3FAC + push {r4-r6,lr} + sub sp, 0x8 + ldr r2, =gUnknown_030012C8 + ldrb r0, [r2, 0x1] + adds r3, r2, 0 + cmp r0, 0x3 + beq _081D4034 + cmp r0, 0x3 + bgt _081D3FC8 + cmp r0, 0x1 + beq _081D3FD0 + b _081D412A + .pool +_081D3FC8: + cmp r0, 0x5 + bne _081D3FCE + b _081D40FC +_081D3FCE: + b _081D412A +_081D3FD0: + ldr r1, =0x0400012a + ldr r2, =0x0000ccd0 + adds r0, r2, 0 + strh r0, [r1] + ldr r0, =0x04000120 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + movs r1, 0 + movs r2, 0 + movs r4, 0 + ldr r6, =0x0000ccd0 + ldr r5, =0x0000ffff +_081D3FEC: + lsls r0, r1, 1 + add r0, sp + ldrh r0, [r0] + cmp r0, r6 + bne _081D4010 + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + b _081D401A + .pool +_081D4010: + cmp r0, r5 + beq _081D401A + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 +_081D401A: + adds r0, r1, 0x1 + lsls r0, 16 + lsrs r1, r0, 16 + cmp r1, 0x3 + bls _081D3FEC + cmp r2, 0x2 + beq _081D402A + b _081D412A +_081D402A: + cmp r4, 0 + beq _081D4030 + b _081D412A +_081D4030: + strb r2, [r3, 0x1] + b _081D412A +_081D4034: + ldr r0, =0x04000120 + ldr r4, [r0] + ldr r0, [r2, 0xC] + cmp r0, 0 + bne _081D404A + ldrb r0, [r2] + cmp r0, 0 + bne _081D404A + lsrs r0, r4, 2 + adds r0, 0x1 + str r0, [r2, 0x10] +_081D404A: + ldrb r0, [r3] + cmp r0, 0x1 + bne _081D4080 + ldr r1, [r3, 0xC] + ldr r0, [r3, 0x10] + cmp r1, r0 + bge _081D4074 + ldr r2, =0x04000120 + ldr r0, [r3, 0x8] + lsls r1, 2 + adds r1, r0 + ldr r0, [r1] + str r0, [r2] + ldr r0, [r3, 0x14] + ldr r1, [r1] + adds r0, r1 + str r0, [r3, 0x14] + b _081D40BA + .pool +_081D4074: + ldr r1, =0x04000120 + ldr r0, [r3, 0x14] + b _081D40B8 + .pool +_081D4080: + ldr r1, [r3, 0xC] + cmp r1, 0 + ble _081D40A0 + ldr r0, [r3, 0x10] + adds r0, 0x1 + cmp r1, r0 + bge _081D40A0 + ldr r0, [r3, 0x8] + lsls r1, 2 + adds r1, r0 + subs r1, 0x4 + str r4, [r1] + ldr r0, [r3, 0x14] + adds r0, r4 + str r0, [r3, 0x14] + b _081D40B4 +_081D40A0: + ldr r0, [r3, 0xC] + cmp r0, 0 + beq _081D40B4 + ldr r0, [r3, 0x14] + cmp r0, r4 + bne _081D40B0 + movs r0, 0x1 + b _081D40B2 +_081D40B0: + movs r0, 0x2 +_081D40B2: + strb r0, [r3, 0x3] +_081D40B4: + ldr r1, =gUnknown_030012E8 + movs r0, 0 +_081D40B8: + str r0, [r1] +_081D40BA: + ldr r1, [r3, 0xC] + adds r1, 0x1 + str r1, [r3, 0xC] + ldr r0, [r3, 0x10] + adds r0, 0x2 + cmp r1, r0 + bge _081D40EA + ldrb r0, [r3] + cmp r0, 0 + beq _081D40E4 + ldr r0, =0x0400010e + ldrh r1, [r0] + movs r2, 0x80 + orrs r1, r2 + strh r1, [r0] + b _081D412A + .pool +_081D40E4: + bl sub_81D413C + b _081D412A +_081D40EA: + movs r0, 0 + movs r1, 0x4 + strb r1, [r3, 0x1] + ldr r1, =gUnknown_030012E6 + strh r0, [r1] + b _081D412A + .pool +_081D40FC: + ldrb r3, [r2] + cmp r3, 0 + bne _081D4108 + ldr r1, =0x0400012a + ldrb r0, [r2, 0x3] + strh r0, [r1] +_081D4108: + ldr r0, =0x04000120 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp] + str r1, [sp, 0x4] + mov r0, sp + ldrh r1, [r0, 0x2] + subs r0, r1, 0x1 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1 + bhi _081D412A + cmp r3, 0x1 + bne _081D4126 + strb r1, [r2, 0x3] +_081D4126: + movs r0, 0x6 + strb r0, [r2, 0x1] +_081D412A: + add sp, 0x8 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D3FAC + + thumb_func_start sub_81D413C +sub_81D413C: @ 81D413C + ldr r0, =0x04000128 + ldrh r1, [r0] + movs r2, 0x80 + orrs r1, r2 + strh r1, [r0] + bx lr + .pool + thumb_func_end sub_81D413C + + thumb_func_start sub_81D414C +sub_81D414C: @ 81D414C + ldr r2, =0x0400010e + ldrh r1, [r2] + ldr r0, =0x0000ff7f + ands r0, r1 + strh r0, [r2] + ldr r1, =0x0400010c + ldr r2, =0x0000fda7 + adds r0, r2, 0 + strh r0, [r1] + bx lr + .pool + thumb_func_end sub_81D414C + + thumb_func_start sub_81D4170 +sub_81D4170: @ 81D4170 + push {r4,lr} + ldr r0, =0x04000130 + ldrh r0, [r0] + ldr r2, =0x000003ff + adds r1, r2, 0 + eors r1, r0 + ldr r4, =gUnknown_030012E2 + ldr r3, =gUnknown_030012E0 + ldrh r2, [r3] + adds r0, r1, 0 + bics r0, r2 + strh r0, [r4] + strh r1, [r3] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D4170 + + thumb_func_start sub_81D41A0 +sub_81D41A0: @ 81D41A0 + ldr r1, =gUnknown_030012EC + ldr r0, =0x04000208 + ldrh r0, [r0] + strh r0, [r1] + ldr r1, =gUnknown_030012EE + ldr r0, =0x04000200 + ldrh r0, [r0] + strh r0, [r1] + ldr r1, =gUnknown_030012F0 + ldr r0, =0x0400010e + ldrh r0, [r0] + strh r0, [r1] + ldr r1, =gUnknown_030012F2 + ldr r0, =0x04000128 + ldrh r0, [r0] + strh r0, [r1] + ldr r1, =gUnknown_030012F4 + ldr r0, =0x04000134 + ldrh r0, [r0] + strh r0, [r1] + bx lr + .pool + thumb_func_end sub_81D41A0 + + thumb_func_start sub_81D41F4 +sub_81D41F4: @ 81D41F4 + ldr r1, =0x04000208 + ldr r0, =gUnknown_030012EC + ldrh r0, [r0] + strh r0, [r1] + subs r1, 0x8 + ldr r0, =gUnknown_030012EE + ldrh r0, [r0] + strh r0, [r1] + subs r1, 0xF2 + ldr r0, =gUnknown_030012F0 + ldrh r0, [r0] + strh r0, [r1] + adds r1, 0x1A + ldr r0, =gUnknown_030012F2 + ldrh r0, [r0] + strh r0, [r1] + adds r1, 0xC + ldr r0, =gUnknown_030012F4 + ldrh r0, [r0] + strh r0, [r1] + bx lr + .pool + thumb_func_end sub_81D41F4 + + thumb_func_start sub_81D4238 +sub_81D4238: @ 81D4238 + push {lr} + sub sp, 0x4 + movs r0, 0 + str r0, [sp] + ldr r1, =gUnknown_030012C8 + ldr r2, =0x05000006 + mov r0, sp + bl CpuSet + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D4238 + + thumb_func_start sub_81D4258 +sub_81D4258: @ 81D4258 + push {lr} + sub sp, 0x4 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrb r1, [r0, 0x5] + ldrb r2, [r0, 0x4] + movs r0, 0x1 + mov r3, sp + bl TryGetEventObjectIdByLocalIdAndMap + mov r0, sp + ldrb r0, [r0] + add sp, 0x4 + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D4258 + + thumb_func_start sub_81D427C +sub_81D427C: @ 81D427C + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + bl sub_81D4258 + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 3 + adds r1, r0 + lsls r1, 2 + ldr r2, =gEventObjects + adds r5, r1, r2 + ldr r4, =gUnknown_030012F8 + ldr r3, =gPlayerAvatar + ldrb r1, [r3, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldrh r0, [r0, 0x14] + ldrh r1, [r5, 0x10] + subs r0, r1 + strh r0, [r4] + ldr r4, =gUnknown_030012FA + ldrb r1, [r3, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + ldrh r0, [r0, 0x16] + ldrh r1, [r5, 0x12] + subs r0, r1 + strh r0, [r4] + movs r0, 0 + mov r8, r0 + ldr r2, =gUnknown_030012FC + movs r1, 0 +_081D42CA: + mov r3, r8 + adds r0, r3, r2 + strb r1, [r0] + mov r0, r8 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + cmp r0, 0x3 + bls _081D42CA + ldr r2, =gEventObjects + ldr r0, =gPlayerAvatar + ldrb r1, [r0, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r2, r0, r2 + movs r4, 0x14 + ldrsh r1, [r2, r4] + movs r6, 0x10 + ldrsh r0, [r2, r6] + cmp r1, r0 + bne _081D4304 + movs r0, 0x16 + ldrsh r1, [r2, r0] + movs r3, 0x12 + ldrsh r0, [r2, r3] + cmp r1, r0 + beq _081D4356 +_081D4304: + ldr r0, =0x0000403a + bl VarGet + lsls r0, 16 + movs r1, 0xE0 + lsls r1, 11 + ands r1, r0 + cmp r1, 0 + bne _081D4338 + ldrb r1, [r5, 0x1] + movs r0, 0x21 + negs r0, r0 + ands r0, r1 + b _081D433E + .pool +_081D4338: + ldrb r0, [r5, 0x1] + movs r1, 0x20 + orrs r0, r1 +_081D433E: + strb r0, [r5, 0x1] + ldr r0, =0x0000403a + bl VarGet + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x9 + bl __umodsi3 + lsls r0, 16 + cmp r0, 0 + bne _081D4360 +_081D4356: + movs r0, 0 + b _081D4816 + .pool +_081D4360: + movs r4, 0 + mov r8, r4 + ldr r6, =gEventObjects + mov r10, r6 +_081D4368: + ldr r3, =gPlayerAvatar + ldrb r1, [r3, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + mov r1, r10 + adds r4, r0, r1 + mov r2, r8 + lsls r1, r2, 2 + ldr r6, =gUnknown_0862608C + adds r0, r1, r6 + movs r6, 0x14 + ldrsh r2, [r4, r6] + movs r6, 0 + ldrsh r0, [r0, r6] + ldr r6, =gEventObjects + mov r9, r6 + mov r12, r3 + adds r7, r1, 0 + cmp r2, r0 + beq _081D4394 + b _081D449E +_081D4394: + movs r3, 0 + ldr r1, =gUnknown_0862608C + 2 + adds r0, r7, r1 + movs r2, 0x16 + ldrsh r1, [r4, r2] + movs r4, 0 + ldrsh r2, [r0, r4] + cmp r1, r2 + bge _081D43C0 + movs r6, 0x12 + ldrsh r0, [r5, r6] + cmp r0, r2 + bgt _081D43CA + b _081D449E + .pool +_081D43C0: + movs r1, 0x12 + ldrsh r0, [r5, r1] + cmp r0, r2 + blt _081D43CA + movs r3, 0x1 +_081D43CA: + cmp r3, 0 + bne _081D449E + ldr r0, =gUnknown_030012F8 + movs r2, 0 + ldrsh r0, [r0, r2] + cmp r0, 0 + ble _081D4410 + movs r3, 0x10 + ldrsh r2, [r5, r3] + adds r2, 0x1 + mov r4, r12 + ldrb r1, [r4, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + add r0, r9 + movs r6, 0x14 + ldrsh r0, [r0, r6] + cmp r2, r0 + bne _081D4446 + ldrh r0, [r5, 0x10] + adds r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r2, 0x12 + ldrsh r1, [r5, r2] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4446 +_081D4408: + movs r0, 0x4 + b _081D4816 + .pool +_081D4410: + cmp r0, 0 + bge _081D4446 + movs r3, 0x10 + ldrsh r2, [r5, r3] + subs r2, 0x1 + mov r4, r12 + ldrb r1, [r4, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + add r0, r9 + movs r6, 0x14 + ldrsh r0, [r0, r6] + cmp r2, r0 + bne _081D4446 + ldrh r0, [r5, 0x10] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r2, 0x12 + ldrsh r1, [r5, r2] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4446 + b _081D45AA +_081D4446: + ldr r0, =gPlayerAvatar + ldrb r1, [r0, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + add r0, r10 + movs r3, 0x10 + ldrsh r1, [r5, r3] + movs r4, 0x14 + ldrsh r0, [r0, r4] + cmp r1, r0 + bne _081D449E + ldr r0, =gUnknown_030012FA + movs r6, 0 + ldrsh r0, [r0, r6] + cmp r0, 0 + ble _081D4488 + adds r0, r1, 0 + ldrh r1, [r5, 0x12] + subs r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D449E +_081D447C: + movs r0, 0x2 + b _081D4816 + .pool +_081D4488: + movs r2, 0x10 + ldrsh r0, [r5, r2] + ldrh r1, [r5, 0x12] + adds r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + bne _081D4538 +_081D449E: + ldr r2, =gPlayerAvatar + ldrb r1, [r2, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + mov r3, r10 + adds r4, r0, r3 + ldr r6, =gUnknown_0862608C + ldr r1, =gUnknown_0862608C + 2 + adds r0, r7, r1 + movs r3, 0x16 + ldrsh r1, [r4, r3] + movs r3, 0 + ldrsh r0, [r0, r3] + ldr r3, =gEventObjects + mov r9, r3 + mov r12, r2 + cmp r1, r0 + beq _081D44C6 + b _081D45D0 +_081D44C6: + movs r3, 0 + adds r0, r7, r6 + movs r6, 0x14 + ldrsh r1, [r4, r6] + movs r4, 0 + ldrsh r2, [r0, r4] + cmp r1, r2 + bge _081D44F0 + movs r6, 0x10 + ldrsh r0, [r5, r6] + cmp r0, r2 + bgt _081D44FA + b _081D45D0 + .pool +_081D44F0: + movs r1, 0x10 + ldrsh r0, [r5, r1] + cmp r0, r2 + blt _081D44FA + movs r3, 0x1 +_081D44FA: + cmp r3, 0 + bne _081D45D0 + ldr r0, =gUnknown_030012FA + movs r2, 0 + ldrsh r0, [r0, r2] + cmp r0, 0 + ble _081D4540 + movs r3, 0x12 + ldrsh r2, [r5, r3] + adds r2, 0x1 + mov r4, r12 + ldrb r1, [r4, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + add r0, r9 + movs r6, 0x16 + ldrsh r0, [r0, r6] + cmp r2, r0 + bne _081D4576 + movs r1, 0x10 + ldrsh r0, [r5, r1] + ldrh r1, [r5, 0x12] + adds r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4576 +_081D4538: + movs r0, 0x1 + b _081D4816 + .pool +_081D4540: + cmp r0, 0 + bge _081D4576 + movs r3, 0x12 + ldrsh r2, [r5, r3] + subs r2, 0x1 + mov r4, r12 + ldrb r1, [r4, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + add r0, r9 + movs r6, 0x16 + ldrsh r0, [r0, r6] + cmp r2, r0 + bne _081D4576 + movs r1, 0x10 + ldrsh r0, [r5, r1] + ldrh r1, [r5, 0x12] + subs r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4576 + b _081D447C +_081D4576: + ldr r0, =gPlayerAvatar + ldrb r1, [r0, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + add r0, r10 + movs r2, 0x12 + ldrsh r1, [r5, r2] + movs r3, 0x16 + ldrsh r0, [r0, r3] + cmp r1, r0 + bne _081D45D0 + ldr r0, =gUnknown_030012F8 + movs r4, 0 + ldrsh r0, [r0, r4] + cmp r0, 0 + ble _081D45B8 + ldrh r0, [r5, 0x10] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D45D0 +_081D45AA: + movs r0, 0x3 + b _081D4816 + .pool +_081D45B8: + ldrh r0, [r5, 0x10] + adds r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r2, 0x12 + ldrsh r1, [r5, r2] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D45D0 + b _081D4408 +_081D45D0: + mov r0, r8 + adds r0, 0x1 + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + cmp r0, 0x3 + bhi _081D45E0 + b _081D4368 +_081D45E0: + adds r0, r5, 0 + movs r1, 0 + bl sub_81D4C14 + lsls r0, 24 + cmp r0, 0 + beq _081D461C + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4C58 + lsls r0, 24 + cmp r0, 0 + beq _081D4604 + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D4604: + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4CE0 + lsls r0, 24 + cmp r0, 0 + bne _081D4614 + b _081D447C +_081D4614: + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D461C: + adds r0, r5, 0 + movs r1, 0 + bl sub_81D4C9C + lsls r0, 24 + cmp r0, 0 + beq _081D4658 + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4C58 + lsls r0, 24 + cmp r0, 0 + beq _081D4640 + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D4640: + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4CE0 + lsls r0, 24 + cmp r0, 0 + bne _081D4650 + b _081D4538 +_081D4650: + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D4658: + adds r0, r5, 0 + movs r1, 0 + bl sub_81D4C58 + lsls r0, 24 + cmp r0, 0 + beq _081D4694 + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4C14 + lsls r0, 24 + cmp r0, 0 + beq _081D467C + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D467C: + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4C9C + lsls r0, 24 + cmp r0, 0 + bne _081D468C + b _081D4408 +_081D468C: + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D4694: + adds r0, r5, 0 + movs r1, 0 + bl sub_81D4CE0 + lsls r0, 24 + cmp r0, 0 + beq _081D46D0 + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4C14 + lsls r0, 24 + cmp r0, 0 + beq _081D46B8 + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D46B8: + adds r0, r5, 0 + movs r1, 0x1 + bl sub_81D4C9C + lsls r0, 24 + cmp r0, 0 + bne _081D46C8 + b _081D45AA +_081D46C8: + movs r0, 0x2 + bl sub_81D4D24 + b _081D4812 +_081D46D0: + ldr r0, =gUnknown_030012FA + movs r3, 0 + ldrsh r0, [r0, r3] + cmp r0, 0 + bne _081D476E + ldr r2, =gEventObjects + ldr r0, =gPlayerAvatar + ldrb r1, [r0, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r4, 0x12 + ldrsh r1, [r0, r4] + ldrh r2, [r5, 0x12] + movs r6, 0x12 + ldrsh r0, [r5, r6] + cmp r1, r0 + ble _081D470C + movs r1, 0x10 + ldrsh r0, [r5, r1] + subs r1, r2, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D470C + b _081D447C +_081D470C: + ldr r2, =gEventObjects + ldr r0, =gPlayerAvatar + ldrb r1, [r0, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r2, 0x12 + ldrsh r1, [r0, r2] + ldrh r2, [r5, 0x12] + movs r3, 0x12 + ldrsh r0, [r5, r3] + cmp r1, r0 + bge _081D473E + movs r4, 0x10 + ldrsh r0, [r5, r4] + adds r1, r2, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D473E + b _081D4538 +_081D473E: + movs r6, 0x10 + ldrsh r0, [r5, r6] + ldrh r1, [r5, 0x12] + subs r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4756 + b _081D447C +_081D4756: + movs r1, 0x10 + ldrsh r0, [r5, r1] + ldrh r1, [r5, 0x12] + adds r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D476E + b _081D4538 +_081D476E: + ldr r0, =gUnknown_030012F8 + movs r2, 0 + ldrsh r0, [r0, r2] + cmp r0, 0 + bne _081D480C + ldr r2, =gEventObjects + ldr r0, =gPlayerAvatar + ldrb r1, [r0, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r3, 0x10 + ldrsh r1, [r0, r3] + ldrh r2, [r5, 0x10] + movs r4, 0x10 + ldrsh r0, [r5, r4] + cmp r1, r0 + ble _081D47AA + subs r0, r2, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r6, 0x12 + ldrsh r1, [r5, r6] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D47AA + b _081D45AA +_081D47AA: + ldr r2, =gEventObjects + ldr r0, =gPlayerAvatar + ldrb r1, [r0, 0x5] + lsls r0, r1, 3 + adds r0, r1 + lsls r0, 2 + adds r0, r2 + movs r2, 0x10 + ldrsh r1, [r0, r2] + ldrh r2, [r5, 0x10] + movs r3, 0x10 + ldrsh r0, [r5, r3] + cmp r1, r0 + bge _081D47DC + adds r0, r2, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r4, 0x12 + ldrsh r1, [r5, r4] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D47DC + b _081D4408 +_081D47DC: + ldrh r0, [r5, 0x10] + adds r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r6, 0x12 + ldrsh r1, [r5, r6] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D47F4 + b _081D4408 +_081D47F4: + ldrh r0, [r5, 0x10] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r2, 0x12 + ldrsh r1, [r5, r2] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D480C + b _081D45AA +_081D480C: + movs r0, 0 + bl sub_81D4890 +_081D4812: + lsls r0, 24 + lsrs r0, 24 +_081D4816: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D427C + + thumb_func_start sub_81D4834 +sub_81D4834: @ 81D4834 + push {r4,lr} + lsls r0, 16 + lsls r1, 16 + lsrs r4, r1, 16 + ldr r3, =gEventObjects + ldr r1, =gPlayerAvatar + ldrb r2, [r1, 0x5] + lsls r1, r2, 3 + adds r1, r2 + lsls r1, 2 + adds r2, r1, r3 + movs r3, 0x10 + ldrsh r1, [r2, r3] + lsrs r3, r0, 16 + asrs r0, 16 + cmp r1, r0 + bne _081D4870 + movs r0, 0x12 + ldrsh r1, [r2, r0] + lsls r0, r4, 16 + asrs r0, 16 + cmp r1, r0 + bne _081D4870 + movs r0, 0 + b _081D4888 + .pool +_081D4870: + lsls r0, r3, 16 + asrs r0, 16 + lsls r1, r4, 16 + asrs r1, 16 + bl MapGridGetMetatileBehaviorAt + lsls r0, 24 + lsrs r0, 24 + bl MetatileBehavior_IsPokeGrass + lsls r0, 24 + lsrs r0, 24 +_081D4888: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D4834 + + thumb_func_start sub_81D4890 +sub_81D4890: @ 81D4890 + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + movs r5, 0 + bl sub_81D4258 + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 3 + adds r1, r0 + lsls r1, 2 + ldr r0, =gEventObjects + adds r4, r1, r0 + movs r1, 0 + ldr r3, =gUnknown_030012FC + movs r2, 0 +_081D48B0: + adds r0, r1, r3 + strb r2, [r0] + adds r0, r1, 0x1 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x3 + bls _081D48B0 + movs r1, 0x10 + ldrsh r0, [r4, r1] + ldrh r1, [r4, 0x12] + subs r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081D48E8 + cmp r6, 0x2 + beq _081D48E8 + ldr r0, =gUnknown_030012FC + adds r0, r5, r0 + movs r1, 0x2 + strb r1, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_081D48E8: + ldrh r0, [r4, 0x10] + adds r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r2, 0x12 + ldrsh r1, [r4, r2] + bl sub_81D4834 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081D4912 + cmp r6, 0x4 + beq _081D4912 + ldr r0, =gUnknown_030012FC + adds r0, r5, r0 + movs r1, 0x4 + strb r1, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_081D4912: + movs r1, 0x10 + ldrsh r0, [r4, r1] + ldrh r1, [r4, 0x12] + adds r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x1 + bne _081D493A + cmp r6, 0x1 + beq _081D493A + ldr r0, =gUnknown_030012FC + adds r0, r5, r0 + strb r1, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_081D493A: + ldrh r0, [r4, 0x10] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r2, 0x12 + ldrsh r1, [r4, r2] + bl sub_81D4834 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _081D4964 + cmp r6, 0x3 + beq _081D4964 + ldr r0, =gUnknown_030012FC + adds r0, r5, r0 + movs r1, 0x3 + strb r1, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_081D4964: + cmp r5, 0x1 + bhi _081D4974 + ldr r0, =gUnknown_030012FC + b _081D4988 + .pool +_081D4974: + ldr r4, =gUnknown_030012FC + ldr r0, =0x0000403a + bl VarGet + lsls r0, 16 + lsrs r0, 16 + adds r1, r5, 0 + bl __modsi3 + adds r0, r4 +_081D4988: + ldrb r0, [r0] + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D4890 + + thumb_func_start sub_81D4998 +sub_81D4998: @ 81D4998 + push {r4,lr} + ldr r4, =0x0000403a + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + ldr r0, =0x0000391a + cmp r1, r0 + bne _081D49E0 + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =0x0000270e + cmp r2, r0 + bls _081D49D8 + adds r0, r4, 0 + movs r1, 0 + bl VarSet + b _081D49E0 + .pool +_081D49D8: + adds r0, r4, 0 + adds r1, r2, 0 + bl VarSet +_081D49E0: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81D4998 + + thumb_func_start EventObjectIsFarawayIslandMew +@ bool8 EventObjectIsFarawayIslandMew(struct npc_state *eventObject) +EventObjectIsFarawayIslandMew: @ 81D49E8 + push {lr} + adds r2, r0, 0 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + ldr r0, =0x0000391a + cmp r1, r0 + bne _081D4A0C + ldrb r0, [r2, 0x5] + cmp r0, 0xE5 + bne _081D4A0C + movs r0, 0x1 + b _081D4A0E + .pool +_081D4A0C: + movs r0, 0 +_081D4A0E: + pop {r1} + bx r1 + thumb_func_end EventObjectIsFarawayIslandMew + + thumb_func_start IsMewPlayingHideAndSeek +IsMewPlayingHideAndSeek: @ 81D4A14 + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + ldr r0, =0x0000391a + cmp r1, r0 + bne _081D4A50 + movs r0, 0xE5 + lsls r0, 1 + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081D4A50 + ldr r0, =0x000002ce + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _081D4A50 + movs r0, 0x1 + b _081D4A52 + .pool +_081D4A50: + movs r0, 0 +_081D4A52: + pop {r1} + bx r1 + thumb_func_end IsMewPlayingHideAndSeek + + thumb_func_start sub_81D4A58 +sub_81D4A58: @ 81D4A58 + push {r4,lr} + ldr r4, =0x0000403a + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + ldr r1, =0xffff0000 + cmp r0, r1 + beq _081D4A88 + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + movs r1, 0xC0 + lsls r1, 10 + ands r1, r0 + cmp r1, 0 + bne _081D4A88 + movs r0, 0x1 + b _081D4A8A + .pool +_081D4A88: + movs r0, 0 +_081D4A8A: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D4A58 + + thumb_func_start sub_81D4A90 +sub_81D4A90: @ 81D4A90 + push {r4-r6,lr} + sub sp, 0x4 + bl sub_81D4258 + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 3 + adds r1, r0 + lsls r1, 2 + ldr r0, =gEventObjects + adds r5, r1, r0 + ldrb r1, [r5, 0x1] + movs r0, 0x21 + negs r0, r0 + ands r0, r1 + strb r0, [r5, 0x1] + ldr r0, =gSpecialVar_0x8004 + ldrh r4, [r0] + cmp r4, 0x1 + bne _081D4AF8 + ldrb r0, [r5, 0x3] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r5, 0x3] + ldr r3, =gSprites + ldrb r1, [r5, 0x4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + adds r0, 0x42 + ldrb r2, [r0] + movs r1, 0x3F + ands r1, r2 + movs r2, 0x80 + orrs r1, r2 + strb r1, [r0] + ldrb r1, [r5, 0x4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + adds r0, 0x43 + strb r4, [r0] + b _081D4BC4 + .pool +_081D4AF8: + ldr r0, =0x0000403a + ldr r1, =0x0000ffff + bl VarSet + ldrb r0, [r5, 0x3] + movs r1, 0x4 + orrs r0, r1 + strb r0, [r5, 0x3] + ldr r6, =gSprites + ldrb r1, [r5, 0x4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r6 + adds r0, 0x42 + ldrb r2, [r0] + movs r1, 0x3F + ands r1, r2 + movs r2, 0x80 + orrs r1, r2 + strb r1, [r0] + ldr r0, =gSpecialVar_Facing + ldrh r0, [r0] + cmp r0, 0x2 + beq _081D4B3A + ldrb r0, [r5, 0x4] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r6 + adds r1, 0x43 + movs r0, 0x1 + strb r0, [r1] +_081D4B3A: + ldr r4, =gFieldEffectObjectPaletteInfo1 + adds r0, r4, 0 + bl LoadSpritePalette + ldrh r0, [r4, 0x4] + bl IndexOfSpritePaletteTag + lsls r0, 24 + lsrs r0, 24 + bl UpdateSpritePaletteWithWeather + ldrh r1, [r5, 0x10] + mov r0, sp + strh r1, [r0] + ldrh r0, [r5, 0x12] + mov r4, sp + adds r4, 0x2 + strh r0, [r4] + mov r0, sp + adds r1, r4, 0 + movs r2, 0x8 + movs r3, 0x8 + bl sub_80930E0 + ldr r0, =gFieldEffectObjectTemplatePointers + ldr r0, [r0, 0x3C] + mov r1, sp + movs r2, 0 + ldrsh r1, [r1, r2] + movs r3, 0 + ldrsh r2, [r4, r3] + ldrb r4, [r5, 0x4] + lsls r3, r4, 4 + adds r3, r4 + lsls r3, 2 + adds r3, r6 + adds r3, 0x43 + ldrb r3, [r3] + subs r3, 0x1 + lsls r3, 24 + lsrs r3, 24 + bl CreateSpriteAtEnd + ldr r1, =gUnknown_0203CF50 + strb r0, [r1] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x40 + beq _081D4BC4 + ldrb r0, [r1] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r6 + adds r3, r1, 0 + adds r3, 0x3E + ldrb r0, [r3] + movs r2, 0x2 + orrs r0, r2 + strb r0, [r3] + ldrb r2, [r1, 0x5] + movs r0, 0xD + negs r0, r0 + ands r0, r2 + movs r2, 0x8 + orrs r0, r2 + strb r0, [r1, 0x5] + ldr r0, =SpriteCallbackDummy + str r0, [r1, 0x1C] +_081D4BC4: + add sp, 0x4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D4A90 + + thumb_func_start sub_81D4BEC +sub_81D4BEC: @ 81D4BEC + push {lr} + ldr r1, =gUnknown_0203CF50 + ldrb r0, [r1] + cmp r0, 0x40 + beq _081D4C06 + adds r1, r0, 0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + bl DestroySprite +_081D4C06: + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D4BEC + + thumb_func_start sub_81D4C14 +sub_81D4C14: @ 81D4C14 + push {r4,lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + ldr r0, =gUnknown_030012FA + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, 0 + ble _081D4C50 + movs r1, 0x10 + ldrsh r0, [r2, r1] + ldrh r1, [r2, 0x12] + subs r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4C50 + ldr r0, =gUnknown_030012FC + adds r0, r4, r0 + movs r1, 0x2 + strb r1, [r0] + movs r0, 0x1 + b _081D4C52 + .pool +_081D4C50: + movs r0, 0 +_081D4C52: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D4C14 + + thumb_func_start sub_81D4C58 +sub_81D4C58: @ 81D4C58 + push {r4,lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + ldr r0, =gUnknown_030012F8 + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, 0 + bge _081D4C94 + ldrh r0, [r2, 0x10] + adds r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r3, 0x12 + ldrsh r1, [r2, r3] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4C94 + ldr r0, =gUnknown_030012FC + adds r0, r4, r0 + movs r1, 0x4 + strb r1, [r0] + movs r0, 0x1 + b _081D4C96 + .pool +_081D4C94: + movs r0, 0 +_081D4C96: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D4C58 + + thumb_func_start sub_81D4C9C +sub_81D4C9C: @ 81D4C9C + push {r4,lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + ldr r0, =gUnknown_030012FA + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, 0 + bge _081D4CD8 + movs r1, 0x10 + ldrsh r0, [r2, r1] + ldrh r1, [r2, 0x12] + adds r1, 0x1 + lsls r1, 16 + asrs r1, 16 + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4CD8 + ldr r0, =gUnknown_030012FC + adds r0, r4, r0 + movs r1, 0x1 + strb r1, [r0] + movs r0, 0x1 + b _081D4CDA + .pool +_081D4CD8: + movs r0, 0 +_081D4CDA: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D4C9C + + thumb_func_start sub_81D4CE0 +sub_81D4CE0: @ 81D4CE0 + push {r4,lr} + adds r2, r0, 0 + lsls r1, 24 + lsrs r4, r1, 24 + ldr r0, =gUnknown_030012F8 + movs r1, 0 + ldrsh r0, [r0, r1] + cmp r0, 0 + ble _081D4D1C + ldrh r0, [r2, 0x10] + subs r0, 0x1 + lsls r0, 16 + asrs r0, 16 + movs r3, 0x12 + ldrsh r1, [r2, r3] + bl sub_81D4834 + lsls r0, 24 + cmp r0, 0 + beq _081D4D1C + ldr r0, =gUnknown_030012FC + adds r0, r4, r0 + movs r1, 0x3 + strb r1, [r0] + movs r0, 0x1 + b _081D4D1E + .pool +_081D4D1C: + movs r0, 0 +_081D4D1E: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81D4CE0 + + thumb_func_start sub_81D4D24 +sub_81D4D24: @ 81D4D24 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r5, =gUnknown_030012FC + ldr r0, =0x0000403a + bl VarGet + lsls r0, 16 + lsrs r0, 16 + adds r1, r4, 0 + bl __modsi3 + adds r0, r5 + ldrb r0, [r0] + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D4D24 + + thumb_func_start sub_81D4D50 +sub_81D4D50: @ 81D4D50 + push {r4-r6,lr} + mov r6, r8 + push {r6} + sub sp, 0x4 + adds r5, r0, 0 + adds r6, r1, 0 + mov r8, r2 + mov r1, sp + ldr r4, =0x04000208 + ldrh r0, [r4] + strh r0, [r1] + movs r0, 0 + strh r0, [r4] + ldr r1, =gIntrTable + ldr r0, =sub_81D3FAC + str r0, [r1, 0x4] + ldr r0, =sub_81D3F9C + str r0, [r1, 0x8] + bl sub_81D41A0 + bl sub_81D4238 + ldr r2, =0x04000200 + ldrh r0, [r2] + movs r1, 0x4 + orrs r0, r1 + strh r0, [r2] + mov r0, sp + ldrh r0, [r0] + strh r0, [r4] + movs r0, 0 + strh r0, [r5] + str r6, [r5, 0x4] + mov r0, r8 + str r0, [r5, 0x8] + add sp, 0x4 + pop {r3} + mov r8, r3 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D4D50 + + thumb_func_start sub_81D4DB8 +sub_81D4DB8: @ 81D4DB8 + push {r4,lr} + sub sp, 0x4 + mov r1, sp + ldr r4, =0x04000208 + ldrh r0, [r4] + strh r0, [r1] + movs r0, 0 + strh r0, [r4] + bl sub_81D4238 + bl sub_81D41F4 + bl RestoreSerialTimer3IntrHandlers + mov r0, sp + ldrh r0, [r0] + strh r0, [r4] + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D4DB8 + + thumb_func_start sub_81D4DE8 +sub_81D4DE8: @ 81D4DE8 + push {r4,r5,lr} + adds r4, r0, 0 + movs r5, 0 + ldr r1, [r4, 0x4] + ldr r2, [r4, 0x8] + movs r0, 0x1 + movs r3, 0 + bl sub_81D3D70 + adds r1, r0, 0 + strh r1, [r4] + movs r0, 0x13 + ands r0, r1 + cmp r0, 0x10 + bne _081D4E08 + movs r5, 0x1 +_081D4E08: + movs r0, 0x8 + ands r0, r1 + cmp r0, 0 + beq _081D4E12 + movs r5, 0x2 +_081D4E12: + movs r0, 0x4 + ands r0, r1 + cmp r0, 0 + beq _081D4E1C + movs r5, 0x3 +_081D4E1C: + ldr r1, =gShouldAdvanceLinkState + movs r0, 0 + strb r0, [r1] + adds r0, r5, 0 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81D4DE8 + + thumb_func_start sub_81D4E30 +sub_81D4E30: @ 81D4E30 + push {lr} + ldr r0, =gDecompressionBuffer + movs r2, 0x80 + lsls r2, 6 + movs r1, 0 + bl memset + ldr r1, =gLinkType + ldr r2, =0x00005503 + adds r0, r2, 0 + strh r0, [r1] + bl OpenLink + movs r0, 0x1 + bl SetSuppressLinkErrorMessage + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D4E30 + + thumb_func_start sub_81D4E60 +sub_81D4E60: @ 81D4E60 + push {lr} + sub sp, 0xC + mov r1, sp + ldr r2, =0x04000208 + ldrh r0, [r2] + strh r0, [r1] + movs r0, 0 + strh r0, [r2] + ldr r0, =gLink+0x4 + ldr r1, [r0, 0x4] + ldr r0, [r0] + str r0, [sp, 0x4] + str r1, [sp, 0x8] + mov r0, sp + ldrh r0, [r0] + strh r0, [r2] + add r2, sp, 0x4 + ldrh r1, [r2] + ldr r0, =0x0000b9a0 + cmp r1, r0 + bne _081D4EB8 + ldrh r1, [r2, 0x2] + ldr r0, =0x0000ccd0 + cmp r1, r0 + bne _081D4EB8 + ldrh r1, [r2, 0x4] + ldr r0, =0x0000ffff + cmp r1, r0 + bne _081D4EB8 + ldrh r0, [r2, 0x6] + cmp r0, r1 + bne _081D4EB8 + movs r0, 0x1 + b _081D4EBA + .pool +_081D4EB8: + movs r0, 0 +_081D4EBA: + add sp, 0xC + pop {r1} + bx r1 + thumb_func_end sub_81D4E60 + + thumb_func_start sub_81D4EC0 +sub_81D4EC0: @ 81D4EC0 + push {lr} + bl IsLinkMaster + lsls r0, 24 + cmp r0, 0 + beq _081D4EDC + bl GetLinkPlayerCount_2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _081D4EDC + movs r0, 0x1 + b _081D4EDE +_081D4EDC: + movs r0, 0 +_081D4EDE: + pop {r1} + bx r1 + thumb_func_end sub_81D4EC0 + + thumb_func_start sub_81D4EE4 +sub_81D4EE4: @ 81D4EE4 + push {r4,r5,lr} + adds r4, r0, 0 + adds r5, r1, 0 + ldrb r0, [r4] + subs r0, 0x3 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bhi _081D4F08 + bl HasLinkErrorOccurred + lsls r0, 24 + cmp r0, 0 + beq _081D4F08 + movs r0, 0 + strb r0, [r4] + movs r0, 0x3 + b _081D500E +_081D4F08: + ldrb r0, [r4] + cmp r0, 0x5 + bls _081D4F10 + b _081D500C +_081D4F10: + lsls r0, 2 + ldr r1, =_081D4F20 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081D4F20: + .4byte _081D4F38 + .4byte _081D4F54 + .4byte _081D4F6C + .4byte _081D4FA0 + .4byte _081D4FEC + .4byte _081D4FF8 +_081D4F38: + bl IsLinkMaster + lsls r0, 24 + cmp r0, 0 + beq _081D4F88 + bl GetLinkPlayerCount_2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _081D4F88 + movs r0, 0x1 + strb r0, [r4] + b _081D500C +_081D4F54: + ldrh r0, [r5] + adds r0, 0x1 + strh r0, [r5] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x5 + bls _081D500C + movs r0, 0 + strh r0, [r5] + movs r0, 0x2 + strb r0, [r4] + b _081D500C +_081D4F6C: + bl GetLinkPlayerCount_2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x2 + bne _081D4F88 + movs r0, 0x49 + bl PlaySE + bl sub_800A620 + movs r0, 0 + strh r0, [r5] + b _081D4FE6 +_081D4F88: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081D500C + movs r0, 0 + strb r0, [r4] + movs r0, 0x1 + b _081D500E + .pool +_081D4FA0: + ldrh r0, [r5] + adds r0, 0x1 + strh r0, [r5] + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1E + bls _081D4FB6 + movs r0, 0 + strb r0, [r4] + movs r0, 0x5 + b _081D500E +_081D4FB6: + bl IsLinkConnectionEstablished + lsls r0, 24 + cmp r0, 0 + beq _081D500C + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + beq _081D4FE6 + bl IsLinkPlayerDataExchangeComplete + lsls r0, 24 + cmp r0, 0 + beq _081D4FE0 + movs r0, 0 + strb r0, [r4] + movs r0, 0x2 + b _081D500E + .pool +_081D4FE0: + movs r0, 0x4 + strb r0, [r4] + b _081D500C +_081D4FE6: + movs r0, 0x3 + strb r0, [r4] + b _081D500C +_081D4FEC: + movs r0, 0 + bl sub_800ABF4 + movs r0, 0x5 + strb r0, [r4] + b _081D500C +_081D4FF8: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _081D500C + strb r0, [r4] + movs r0, 0x4 + b _081D500E + .pool +_081D500C: + movs r0, 0 +_081D500E: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_81D4EE4 + + thumb_func_start sub_81D5014 +sub_81D5014: @ 81D5014 + push {r4,lr} + ldr r0, =sub_81D5084 + movs r1, 0 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r4, r0, 2 + adds r4, r0 + lsls r4, 3 + ldr r0, =gTasks + 0x8 + adds r4, r0 + movs r0, 0 + strb r0, [r4, 0x8] + strb r0, [r4, 0x9] + strb r0, [r4, 0xA] + strb r0, [r4, 0xB] + strb r0, [r4, 0xC] + strb r0, [r4, 0xD] + movs r1, 0 + strh r0, [r4] + strh r0, [r4, 0x2] + strh r0, [r4, 0x4] + strh r0, [r4, 0x6] + strb r1, [r4, 0xE] + movs r0, 0x40 + bl AllocZeroed + str r0, [r4, 0x10] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D5014 + + thumb_func_start sub_81D505C +sub_81D505C: @ 81D505C + movs r1, 0 + strh r1, [r0] + bx lr + thumb_func_end sub_81D505C + + thumb_func_start sub_81D5064 +sub_81D5064: @ 81D5064 + push {lr} + adds r2, r0, 0 + lsls r1, 16 + ldrh r0, [r2] + adds r0, 0x1 + strh r0, [r2] + lsls r0, 16 + cmp r0, r1 + bhi _081D507A + movs r0, 0 + b _081D5080 +_081D507A: + movs r0, 0 + strh r0, [r2] + movs r0, 0x1 +_081D5080: + pop {r1} + bx r1 + thumb_func_end sub_81D5064 + + thumb_func_start sub_81D5084 +sub_81D5084: @ 81D5084 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrb r0, [r4, 0x8] + cmp r0, 0x1A + bls _081D509C + b _081D548A +_081D509C: + lsls r0, 2 + ldr r1, =_081D50B0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081D50B0: + .4byte _081D511C + .4byte _081D5138 + .4byte _081D5148 + .4byte _081D515C + .4byte _081D516C + .4byte _081D5198 + .4byte _081D51D0 + .4byte _081D524C + .4byte _081D5268 + .4byte _081D5290 + .4byte _081D52AC + .4byte _081D52DC + .4byte _081D52F2 + .4byte _081D5308 + .4byte _081D536A + .4byte _081D5390 + .4byte _081D53A8 + .4byte _081D53C6 + .4byte _081D53F2 + .4byte _081D5418 + .4byte _081D5448 + .4byte _081D5454 + .4byte _081D5460 + .4byte _081D5430 + .4byte _081D548A + .4byte _081D548A + .4byte _081D5478 +_081D511C: + adds r0, r4, 0 + adds r0, 0x9 + ldr r1, =gUnknown_085EDFD6 + bl mevent_0814257C + cmp r0, 0 + bne _081D512C + b _081D548A +_081D512C: + movs r0, 0x1 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5138: + bl sub_81D4E30 + adds r0, r4, 0 + bl sub_81D505C + movs r0, 0x2 + strb r0, [r4, 0x8] + b _081D548A +_081D5148: + adds r0, r4, 0 + movs r1, 0xA + bl sub_81D5064 + cmp r0, 0 + bne _081D5156 + b _081D548A +_081D5156: + movs r0, 0x3 + strb r0, [r4, 0x8] + b _081D548A +_081D515C: + bl sub_81D4EC0 + cmp r0, 0 + beq _081D5166 + b _081D52FC +_081D5166: + bl CloseLink + b _081D525C +_081D516C: + adds r0, r4, 0 + adds r0, 0x9 + ldr r1, =gUnknown_085EDFF5 + bl mevent_0814257C + cmp r0, 0 + bne _081D517C + b _081D548A +_081D517C: + ldr r0, =gUnknown_085EE014 + bl sub_8018884 + adds r0, r4, 0 + bl sub_81D505C + movs r0, 0x5 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5198: + adds r0, r4, 0 + movs r1, 0x5A + bl sub_81D5064 + cmp r0, 0 + beq _081D51AE + bl sub_81D4E30 + movs r0, 0x6 + strb r0, [r4, 0x8] + b _081D548A +_081D51AE: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + bne _081D51BC + b _081D548A +_081D51BC: + adds r0, r4, 0 + bl sub_81D505C + movs r0, 0x5 + bl PlaySE + b _081D535A + .pool +_081D51D0: + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x2 + ands r0, r1 + cmp r0, 0 + beq _081D51F4 + movs r0, 0x5 + bl PlaySE + bl CloseLink + adds r0, r4, 0 + bl sub_81D505C + b _081D535A + .pool +_081D51F4: + bl GetLinkPlayerCount_2 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bls _081D5210 + adds r0, r4, 0 + bl sub_81D505C + bl CloseLink + movs r0, 0x7 + strb r0, [r4, 0x8] + b _081D548A +_081D5210: + bl sub_81D4E60 + cmp r0, 0 + beq _081D522E + movs r0, 0x5 + bl PlaySE + bl CloseLink + adds r0, r4, 0 + bl sub_81D505C + movs r0, 0x8 + strb r0, [r4, 0x8] + b _081D548A +_081D522E: + adds r0, r4, 0 + movs r1, 0xA + bl sub_81D5064 + cmp r0, 0 + bne _081D523C + b _081D548A +_081D523C: + bl CloseLink + bl sub_81D4E30 + adds r0, r4, 0 + bl sub_81D505C + b _081D548A +_081D524C: + adds r0, r4, 0 + adds r0, 0x9 + ldr r1, =gUnknown_085EE05C + bl mevent_0814257C + cmp r0, 0 + bne _081D525C + b _081D548A +_081D525C: + movs r0, 0x4 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5268: + ldr r0, =gUnknown_085EE097 + bl sub_8018884 + ldr r0, =gUnknown_03006370 + ldr r1, =gMultiBootProgram_BerryGlitchFix_Start + ldr r2, =gUnknown_089A3470 + subs r1, r2 + bl sub_81D4D50 + movs r0, 0x9 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5290: + ldr r0, =gUnknown_03006370 + bl sub_81D4DE8 + strb r0, [r4, 0xE] + lsls r0, 24 + cmp r0, 0 + bne _081D52A0 + b _081D548A +_081D52A0: + movs r0, 0xA + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D52AC: + ldr r0, =gUnknown_03006370 + bl sub_81D4DB8 + ldrb r0, [r4, 0xE] + cmp r0, 0x3 + bne _081D52BA + b _081D53C0 +_081D52BA: + cmp r0, 0x1 + beq _081D52C0 + b _081D546E +_081D52C0: + adds r0, r4, 0 + bl sub_81D505C + ldr r0, =gUnknown_085EE120 + bl sub_8018884 + movs r0, 0xB + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D52DC: + movs r1, 0xD2 + lsls r1, 2 + adds r0, r4, 0 + bl sub_81D5064 + cmp r0, 0 + bne _081D52EC + b _081D548A +_081D52EC: + movs r0, 0xC + strb r0, [r4, 0x8] + b _081D548A +_081D52F2: + bl sub_81D4E30 + ldr r0, =gUnknown_085EE0DC + bl sub_8018884 +_081D52FC: + movs r0, 0xD + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5308: + adds r0, r4, 0 + adds r0, 0x9 + adds r1, r4, 0 + bl sub_81D4EE4 + cmp r0, 0x5 + bls _081D5318 + b _081D548A +_081D5318: + lsls r0, 2 + ldr r1, =_081D5328 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081D5328: + .4byte _081D548A + .4byte _081D5350 + .4byte _081D5340 + .4byte _081D5374 + .4byte _081D5374 + .4byte _081D5360 +_081D5340: + ldr r0, =gUnknown_085EE097 + bl sub_8018884 + movs r0, 0xE + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5350: + movs r0, 0x5 + bl PlaySE + bl CloseLink +_081D535A: + movs r0, 0x17 + strb r0, [r4, 0x8] + b _081D548A +_081D5360: + bl CloseLink + movs r0, 0x15 + strb r0, [r4, 0x8] + b _081D548A +_081D536A: + bl HasLinkErrorOccurred + lsls r0, 24 + cmp r0, 0 + beq _081D537A +_081D5374: + bl CloseLink + b _081D53C0 +_081D537A: + bl GetBlockReceivedStatus + lsls r0, 24 + cmp r0, 0 + bne _081D5386 + b _081D548A +_081D5386: + bl ResetBlockReceivedFlags + movs r0, 0xF + strb r0, [r4, 0x8] + b _081D548A +_081D5390: + ldr r0, =gDecompressionBuffer + bl sub_81D3920 + strb r0, [r4, 0xE] + ldrb r0, [r4, 0xE] + bl sub_800ABF4 + movs r0, 0x10 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D53A8: + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _081D548A + ldrb r0, [r4, 0xE] + cmp r0, 0x1 + bne _081D53C0 + movs r0, 0x11 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D53C0: + movs r0, 0x14 + strb r0, [r4, 0x8] + b _081D548A +_081D53C6: + ldr r0, =gDecompressionBuffer + bl sub_81D3AB0 + cmp r0, 0 + beq _081D53EC + ldr r0, =gUnknown_085EE0FA + bl sub_8018884 + adds r0, r4, 0 + bl sub_81D505C + movs r0, 0x12 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D53EC: + movs r0, 0x16 + strb r0, [r4, 0x8] + b _081D548A +_081D53F2: + adds r0, r4, 0 + movs r1, 0x78 + bl sub_81D5064 + cmp r0, 0 + beq _081D548A + ldr r0, =gUnknown_085EE107 + bl sub_8018884 + movs r0, 0xB9 + lsls r0, 1 + bl PlayFanfare + movs r0, 0x13 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5418: + bl IsFanfareTaskInactive + lsls r0, 24 + cmp r0, 0 + beq _081D548A + ldr r0, =gMain + ldrh r1, [r0, 0x2E] + movs r0, 0x3 + ands r0, r1 + b _081D543A + .pool +_081D5430: + adds r0, r4, 0 + adds r0, 0x9 + ldr r1, =gUnknown_085EE06B + bl mevent_0814257C +_081D543A: + cmp r0, 0 + beq _081D548A + movs r0, 0x1A + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5448: + adds r0, r4, 0 + adds r0, 0x9 + ldr r1, =gUnknown_085EE0A3 + b _081D5466 + .pool +_081D5454: + adds r0, r4, 0 + adds r0, 0x9 + ldr r1, =gUnknown_085EE0BF + b _081D5466 + .pool +_081D5460: + adds r0, r4, 0 + adds r0, 0x9 + ldr r1, =gUnknown_085EE12D +_081D5466: + bl mevent_0814257C + cmp r0, 0 + beq _081D548A +_081D546E: + movs r0, 0 + strb r0, [r4, 0x8] + b _081D548A + .pool +_081D5478: + ldr r0, [r4, 0x10] + bl Free + adds r0, r5, 0 + bl DestroyTask + ldr r0, =sub_80186A4 + bl SetMainCallback2 +_081D548A: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81D5084 + + .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index be91c7c7e..8ddf56ef8 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -599,7 +599,7 @@ BattleScript_EffectBide:: ppreduce attackanimation waitanimation - orword gHitMarker, HITMARKER_x8000000 + orword gHitMarker, HITMARKER_CHARGING setbide goto BattleScript_MoveEnd @@ -824,7 +824,7 @@ BattleScriptFirstChargingTurn:: ppreduce attackanimation waitanimation - orword gHitMarker, HITMARKER_x8000000 + orword gHitMarker, HITMARKER_CHARGING setmoveeffect MOVE_EFFECT_CHARGING | MOVE_EFFECT_AFFECTS_USER seteffectprimary copybyte cMULTISTRING_CHOOSER, sTWOTURN_STRINGID @@ -1941,7 +1941,7 @@ BattleScript_SolarbeamDecideTurn:: call BattleScriptFirstChargingTurn goto BattleScript_MoveEnd BattleScript_SolarbeamOnFirstTurn:: - orword gHitMarker, HITMARKER_x8000000 + orword gHitMarker, HITMARKER_CHARGING setmoveeffect MOVE_EFFECT_CHARGING | MOVE_EFFECT_AFFECTS_USER seteffectprimary ppreduce diff --git a/data/event_scripts.s b/data/event_scripts.s index 34a8484e5..d52f4f1ba 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -3221,7 +3221,7 @@ EventScript_2736F8:: @ 82736F8 compare VAR_RESULT, 2 goto_if_eq BattleFrontier_BattlePyramidTop_EventScript_252B42 setvar VAR_0x8004, 10 - special sp194_trainer_tower + special CallTrainerHillFunction compare VAR_RESULT, 1 goto_if_eq TrainerHill_1F_EventScript_2C83C9 special sub_80B05B4 @@ -7429,7 +7429,7 @@ TrainerHill_4F_MapScript1_2C8336: @ 82C8336 TrainerHill_Roof_MapScript1_2C8336: @ 82C8336 setvar VAR_TEMP_2, 0 setvar VAR_0x8004, 4 - special sp194_trainer_tower + special CallTrainerHillFunction setvar VAR_0x8004, 1 setvar VAR_0x8005, 5 special CallFrontierUtilFunc @@ -7462,7 +7462,7 @@ TrainerHill_Roof_MapScript2_2C8381: @ 82C8381 EventScript_TrainerHillTimer:: @ 82C8393 lockall setvar VAR_0x8004, 7 - special sp194_trainer_tower + special CallTrainerHillFunction msgbox TrainerHill_Entrance_Text_268D47, MSGBOX_DEFAULT releaseall end @@ -7470,7 +7470,7 @@ EventScript_TrainerHillTimer:: @ 82C8393 TrainerHill_1F_EventScript_2C83A6:: @ 82C83A6 setvar VAR_TEMP_2, 1 setvar VAR_0x8004, 9 - special sp194_trainer_tower + special CallTrainerHillFunction compare VAR_RESULT, 1 goto_if_eq TrainerHill_1F_EventScript_2C83BF end @@ -7482,9 +7482,9 @@ TrainerHill_1F_EventScript_2C83BF:: @ 82C83BF TrainerHill_1F_EventScript_2C83C9:: @ 82C83C9 setvar VAR_0x8004, 12 - special sp194_trainer_tower + special CallTrainerHillFunction setvar VAR_0x8004, 5 - special sp194_trainer_tower + special CallTrainerHillFunction setvar VAR_TEMP_1, 1 end @@ -7502,7 +7502,7 @@ TrainerHill_1F_Movement_2C83EE:: @ 82C83EE EventScript_2C83F0:: @ 82C83F0 trainerbattle TRAINER_BATTLE_12, TRAINER_PHILLIP, 0, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D setvar VAR_0x8004, 11 - special sp194_trainer_tower + special CallTrainerHillFunction waitmessage waitbuttonpress closemessage diff --git a/data/maps/TrainerHill_Entrance/scripts.inc b/data/maps/TrainerHill_Entrance/scripts.inc index 4d315a158..846b7f6c3 100644 --- a/data/maps/TrainerHill_Entrance/scripts.inc +++ b/data/maps/TrainerHill_Entrance/scripts.inc @@ -16,10 +16,10 @@ TrainerHill_Entrance_MapScript1_2680CF: @ 82680CF TrainerHill_Entrance_MapScript1_2680D0: @ 82680D0 setvar VAR_0x8004, 4 - special sp194_trainer_tower + special CallTrainerHillFunction setvar VAR_TEMP_0, 0 setvar VAR_0x8004, 9 - special sp194_trainer_tower + special CallTrainerHillFunction compare VAR_RESULT, 0 goto_if_eq TrainerHill_Entrance_EventScript_2680FF setobjectxy EVENT_OBJ_ID_PLAYER, 9, 6 @@ -28,7 +28,7 @@ TrainerHill_Entrance_MapScript1_2680D0: @ 82680D0 TrainerHill_Entrance_EventScript_2680FF:: @ 82680FF setvar VAR_0x8004, 16 - special sp194_trainer_tower + special CallTrainerHillFunction compare VAR_RESULT, 1 goto_if_eq TrainerHill_Entrance_EventScript_26811A applymovement EVENT_OBJ_ID_PLAYER, TrainerHill_Entrance_Movement_26837F @@ -75,7 +75,7 @@ TrainerHill_Entrance_EventScript_268160:: @ 8268160 TrainerHill_Entrance_EventScript_268182:: @ 8268182 setvar VAR_TEMP_0, 1 setvar VAR_0x8004, 6 - special sp194_trainer_tower + special CallTrainerHillFunction switch VAR_RESULT case 0, TrainerHill_Entrance_EventScript_2681B5 case 1, TrainerHill_Entrance_EventScript_2681CA @@ -115,7 +115,7 @@ TrainerHill_Entrance_EventScript_2681FD:: @ 82681FD lock faceplayer setvar VAR_0x8004, 10 - special sp194_trainer_tower + special CallTrainerHillFunction compare VAR_RESULT, 0 goto_if_eq TrainerHill_Entrance_EventScript_26821F msgbox TrainerHill_Entrance_Text_2686F4, MSGBOX_DEFAULT @@ -134,11 +134,11 @@ TrainerHill_Entrance_EventScript_268229:: @ 8268229 goto_if_unset FLAG_SYS_GAME_CLEAR, TrainerHill_Entrance_EventScript_26836A msgbox TrainerHill_Entrance_Text_2684C6, MSGBOX_DEFAULT setvar VAR_0x8004, 13 - special sp194_trainer_tower + special CallTrainerHillFunction compare VAR_RESULT, 0 call_if_eq TrainerHill_Entrance_EventScript_26832E setvar VAR_0x8004, 8 - special sp194_trainer_tower + special CallTrainerHillFunction compare VAR_RESULT, 1 goto_if_eq TrainerHill_Entrance_EventScript_268275 msgbox TrainerHill_Entrance_Text_268564, MSGBOX_DEFAULT @@ -170,13 +170,13 @@ TrainerHill_Entrance_EventScript_2682C8:: @ 82682C8 case 127, TrainerHill_Entrance_EventScript_268314 setvar VAR_0x8004, 17 copyvar VAR_0x8005, VAR_RESULT - special sp194_trainer_tower + special CallTrainerHillFunction setvar VAR_0x40D6, 1 setvar VAR_TEMP_5, 0 special HealPlayerParty msgbox TrainerHill_Entrance_Text_26862A, MSGBOX_DEFAULT setvar VAR_0x8004, 0 - special sp194_trainer_tower + special CallTrainerHillFunction releaseall end @@ -192,18 +192,18 @@ TrainerHill_Entrance_EventScript_268314:: @ 8268314 TrainerHill_Entrance_EventScript_26832E:: @ 826832E msgbox TrainerHill_Entrance_Text_26851C, MSGBOX_DEFAULT setvar VAR_0x8004, 14 - special sp194_trainer_tower + special CallTrainerHillFunction setvar VAR_TEMP_5, 1 call TrainerHill_Entrance_EventScript_27134F compare VAR_RESULT, 0 goto_if_eq TrainerHill_Entrance_EventScript_26835C setvar VAR_0x8004, 14 - special sp194_trainer_tower + special CallTrainerHillFunction return TrainerHill_Entrance_EventScript_26835C:: @ 826835C setvar VAR_0x8004, 15 - special sp194_trainer_tower + special CallTrainerHillFunction goto TrainerHill_Entrance_EventScript_268314 end diff --git a/data/maps/TrainerHill_Roof/scripts.inc b/data/maps/TrainerHill_Roof/scripts.inc index 19e8ef567..b959481f2 100644 --- a/data/maps/TrainerHill_Roof/scripts.inc +++ b/data/maps/TrainerHill_Roof/scripts.inc @@ -5,11 +5,11 @@ TrainerHill_Roof_MapScripts:: @ 8268FA7 TrainerHill_Roof_EventScript_268FB2:: @ 8268FB2 setvar VAR_0x8004, 12 - special sp194_trainer_tower + special CallTrainerHillFunction lock faceplayer setvar VAR_0x8004, 1 - special sp194_trainer_tower + special CallTrainerHillFunction switch VAR_RESULT case 0, TrainerHill_Roof_EventScript_268FEA case 1, TrainerHill_Roof_EventScript_268FF2 @@ -20,7 +20,7 @@ TrainerHill_Roof_EventScript_268FEA:: @ 8268FEA TrainerHill_Roof_EventScript_268FF2:: @ 8268FF2 setvar VAR_0x8004, 2 - special sp194_trainer_tower + special CallTrainerHillFunction switch VAR_RESULT case 0, TrainerHill_Roof_EventScript_269020 case 1, TrainerHill_Roof_EventScript_269037 @@ -42,7 +42,7 @@ TrainerHill_Roof_EventScript_269037:: @ 8269037 TrainerHill_Roof_EventScript_269054:: @ 8269054 setvar VAR_0x8004, 3 - special sp194_trainer_tower + special CallTrainerHillFunction switch VAR_RESULT case 0, TrainerHill_Roof_EventScript_269082 case 1, TrainerHill_Roof_EventScript_269090 diff --git a/data/pokenav.s b/data/pokenav.s index eaa2ea269..1a5e2bd99 100644 --- a/data/pokenav.s +++ b/data/pokenav.s @@ -2030,408 +2030,3 @@ gUnknown_08624CF8:: @ 8624CF8 gUnknown_08624D04:: @ 8624D04 spr_template 9, 15, gUnknown_08624CB0, gDummySpriteAnimTable, NULL, gUnknown_08624CF8, SpriteCallbackDummy - - .section .rodata.after.match.call - -gUnknown_086253E8:: @ 86253E8 - .4byte 0x8010100 - .4byte 0x80F02 - .4byte 0x8011500 - .4byte 0x180F12 - .4byte 0xB010100 - .4byte 0x180F08 - -gUnknown_08625400:: @ 8625400 - .byte 1, 2, 3 - -gUnknown_08625403:: @ 8625403 - .byte 0xFF - -gUnknown_08625404:: @ 8625404 - .byte 0x40, 0, 0, 4, 1, 0, 0x60, 0xA6, 1, 0, 0, 0 - -gUnknown_08625410:: @ 8625410 - .byte 4, 5, 6, 7, 8, 9, 9, 0xA, 0xA, 0xB, 0xB, 0xC, 0xC, 0xD, 0xD, 0xD, 0xD, 0xE, 0xE, 0xE, 0xE, 0xF, 0xF, 0xF, 0xF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23 - -gUnknown_08625510:: @ 8625510 - .4byte 0x10010101 - .4byte 0xA0F0C - .4byte 0x10010101 - .4byte 0xCA0F0C - .4byte 0xA011301 - .4byte 0x18A0F0C - .4byte 0x160F0401 - .4byte 0x2020F04 - .4byte 0x5081600 - .4byte 0x25A0F04 - .4byte 0xFF - .4byte NULL - -gUnknown_08625540:: @ 8625540 - .4byte 0x5081600 - .4byte 0x25A0F04 - -gUnknown_08625548:: @ 8625548 - .4byte NULL - .4byte sub_81D2BD0 - .4byte NULL - .2byte 0 - .2byte 0 - .byte 2 - .byte 0 - .byte 8 - .byte 0 - .4byte 0x1003121 - -gUnknown_08625560:: @ 8625560 - .incbin "graphics/pokenav/pokeball.4bpp" - -gUnknown_08625660:: @ 8625660 - .incbin "graphics/pokenav/8625660.4bpp" - -gUnknown_08625680:: @ 8625680 - .incbin "graphics/pokenav/sparkle.gbapal" - -gUnknown_086256A0:: @ 86255A0 - .incbin "graphics/pokenav/sparkle.4bpp" - -gUnknown_08625A20:: @ 8625A20 - .2byte 0 - .2byte 0xC000 - .2byte 0x400 - .2byte 0 - -gUnknown_08625A28:: @ 8625A28 - .2byte 0 - .2byte 0x4000 - .2byte 0x800 - .2byte 0 - -gUnknown_08625A30:: @ 8625A30 - .2byte 0 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_08625A38:: @ 8625A38 - .2byte 4 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_08625A40:: @ 8625A40 - .4byte gUnknown_08625A30 - .4byte gUnknown_08625A38 - -gUnknown_08625A48:: @ 8625A48 - .4byte NULL - .4byte 0x640800 - -gUnknown_08625A50:: @ 8625A50 - spr_template 0x64, 0x64, gUnknown_08625A20, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_08625A68:: @ 8625A68 - .4byte NULL - .4byte 0x64 - -gUnknown_08625A70:: @ 8625A70 - .4byte gUnknown_08625560 - .byte 0, 1, 0x65, 0 - .4byte gUnknown_08625660 - .2byte 0x20, 0x67 - .4byte gPokenavConditionCancel_Gfx - .byte 0, 1, 0x66, 0 - .4byte NULL, NULL - -gUnknown_08625A90:: @ 8625A90 - .4byte gPokenavConditionCancel_Pal + 0x0 - .byte 0x65, 0, 0, 0 - .4byte gPokenavConditionCancel_Pal + 0x20 - .byte 0x66, 0, 0, 0 - .4byte NULL, NULL - -gUnknown_08625AA8:: @ 8625AA8 - spr_template 0x65, 0x65, gUnknown_08625A28, gUnknown_08625A40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_08625AC0:: @ 8625AC0 - .4byte gUnknown_086256A0 - .byte 0x80, 3, 0x68, 0 - -gUnknown_08625AC8:: @ 8625AC8 - .4byte gUnknown_08625680 - .byte 0x68, 0, 0, 0 - -gUnknown_08625AD0:: @ 8625AD0 - .2byte 0 - .2byte 0x4000 - .2byte 0 - .2byte 0 - -gUnknown_08625AD8:: @ 8625AD8 - .2byte 0 - .2byte 5 - .2byte 4 - .2byte 5 - -gUnknown_08625AE0:: @ 8625AE0 - .2byte 8 - .2byte 5 - .2byte 12 - .2byte 5 - -gUnknown_08625AE8:: @ 8625AE8 - .2byte 16 - .2byte 5 - .2byte 20 - .2byte 5 - -gUnknown_08625AF0:: @ 8625AF0 - .2byte 24 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_08625AF8:: @ 8625AF8 - .4byte gUnknown_08625AD8 - .4byte gUnknown_08625AE0 - -gUnknown_08625B00:: @ 8625B00 - .4byte gUnknown_08625AE8 - .4byte gUnknown_08625AF0 - -gUnknown_08625B08:: @ 8625B08 - .4byte gUnknown_08625AF8 - .4byte gUnknown_08625B00 - .4byte gUnknown_08625B08 - -gUnknown_08625B14:: @ 8625B14 - spr_template 0x68, 0x68, gUnknown_08625AD0, gUnknown_08625AF8, NULL gDummySpriteAffineAnimTable, sub_81D3564 - -gUnknown_08625B2C:: @ 8625B2C - .2byte 0, 0xFFDD - .2byte 20, 0xFFE4 - .2byte 33, 0xFFF6 - .2byte 33, 10 - .2byte 20, 28 - .2byte 0, 35 - .2byte 0xFFEC, 28 - .2byte 0xFFDF, 10 - .2byte 0xFFDF, 0xFFF6 - .2byte 0xFFEC, 0xFFE4 - -gUnknown_08625B54:: @ 8625B54 - .4byte gUnknown_085EEA46 - .4byte gUnknown_085EEA4E - .4byte gUnknown_085EEA55 - .4byte gUnknown_085EEA63 - .4byte gUnknown_085EEA6B - .4byte gUnknown_085EEA5D - -gUnknown_08625B6C:: @ 8625B6C -@ apparently e-reader trainer data? idk -.byte 0x6f, 0x57, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x14, 0x0c, 0x0e, 0x23, 0x10, 0x47, 0x0a, 0x1f, 0x06, 0x24, 0x0e, 0x48, 0x0a, 0x0f, 0x06 -.byte 0x22, 0x27, 0x2c, 0x16, 0x07, 0x06, 0x01, 0x0c, 0x47, 0x0a, 0x06, 0x06, 0x24, 0x0e, 0x00, 0x1e, 0x19, 0x12, 0x05, 0x0c, 0x25, 0x16, 0x25, 0x10, 0x0d, 0x1c, 0x2a, 0x1c, 0x06, 0x0a, 0x06, 0x0c -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0x00, 0x70, 0x01, 0xdb, 0x00, 0xbc, 0x00, 0xf7, 0x00, 0xdc, 0x00, 0x19, 0x01, 0x00, 0x00, 0x37, 0xff, 0x64, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a -.byte 0x80, 0x00, 0x00, 0x00, 0x6f, 0x79, 0x69, 0xae, 0x71, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0xbc, 0x00, 0xf7, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0xff -.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x95, 0x58, 0x59, 0x52, 0x79, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7d, 0x01, 0xb7, 0x00 -.byte 0xf6, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x9b, 0xff, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x2f, 0x00, 0x00, 0x00, 0x8d, 0xae, 0x77, 0x7e -.byte 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6a, 0x79, 0x6b, 0x64, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x54, 0x27, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a -.byte 0x20, 0x06, 0x00, 0x0c, 0x13, 0x24, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x05, 0x12, 0x00, 0x0c, 0x6b, 0x26, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x0e, 0x12, 0x00, 0x0c, 0x2c, 0x24, 0x2b, 0x0e -.byte 0xff, 0xff, 0x3b, 0x0a, 0x17, 0x12, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x59, 0x01, 0xb7, 0x00, 0xca, 0x00, 0xb9, 0x00, 0x09, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x64, 0x00, 0xff, 0x64 -.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x8c, 0x00, 0x00, 0x00, 0x69, 0x58, 0x60, 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x01, 0xb3, 0x00, 0x07, 0x01, 0x4c, 0x01 -.byte 0x62, 0x00, 0x68, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x55, 0x55, 0x5d, 0x96, 0x72, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0xff, 0x44, 0x01, 0x86, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a -.byte 0x00, 0x00, 0x00, 0x00, 0x65, 0x6f, 0x8e, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x72, 0x52, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x00 -.byte 0x4a, 0x04, 0x0e, 0x02, 0x35, 0x16, 0x10, 0x10, 0xda, 0x26, 0x3e, 0x10, 0x4a, 0x04, 0x0e, 0x02, 0x47, 0x0a, 0xd9, 0x26, 0x21, 0x16, 0x3e, 0x10, 0x14, 0x1e, 0x07, 0x1e, 0x30, 0x06, 0x23, 0x16 -.byte 0x24, 0x0e, 0x06, 0x0c, 0x18, 0x14, 0x2f, 0x14, 0x1a, 0x08, 0x27, 0x1c, 0x00, 0x0c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3c, 0x01, 0x8d, 0x00, 0x2f, 0x00, 0x22, 0x00, 0xf7, 0x00, 0xe7, 0x00 -.byte 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x03, 0x00, 0x00, 0x00, 0x54, 0x68, 0x5a, 0x7b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0x6b, 0x01, 0xc8, 0x00, 0xca, 0x00, 0x40, 0x01, 0x5c, 0x00, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x06, 0x00, 0x00, 0x00 -.byte 0x7b, 0x8f, 0x78, 0x51, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0x4c, 0x01, 0xd5, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x64, 0xc8, 0x00, 0x00, 0xc8, 0x00 -.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x51, 0x8a, 0x6a, 0x7e, 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9c, 0x54, 0xae, 0x79, 0xff, 0xff, 0xff, 0xff -.byte 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x0a, 0x0a, 0x23, 0x10, 0x00, 0x0c, 0x28, 0x0c, 0x14, 0x18, 0x32, 0x14, 0x02, 0x16, 0x05, 0x10, 0xff, 0xff -.byte 0x0c, 0x1e, 0x0a, 0x0a, 0x34, 0x12, 0x11, 0x1e, 0x1a, 0x08, 0x05, 0x0c, 0x1e, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x22, 0x0a, 0x15, 0x10, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x63, 0x01, 0xb3, 0x00 -.byte 0xf2, 0x00, 0x35, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0xff, 0x9b, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x58, 0x61, 0xae, 0x64 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0xc6, 0x00, 0x39, 0x00, 0xf2, 0x00, 0x26, 0x00, 0x59, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10 -.byte 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x5b, 0x72, 0x6a, 0x91, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x01, 0x8d, 0x00, 0x5e, 0x00, 0xf7, 0x00, 0x55, 0x00, 0x05, 0x01 -.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x8d, 0x85, 0x9e, 0xa0, 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - -gUnknown_0862608C:: @ 862608C - .2byte 21, 16 - .2byte 25, 16 - .2byte 16, 17 - .2byte 20, 20 - -gUnknown_0862609C:: @ 862609C - .incbin "data/unknown_jp_62609C.bin" - -gUnknown_08626814:: @ 8626814 - .incbin "data/pokenav/unk_struct_1.bin" - -gUnknown_086276FC:: @ 86276FC - .incbin "data/pokenav/unk_struct_2.bin" - -gUnknown_086285E4:: @ 86285E4 - .incbin "data/pokenav/unk_struct_3.bin" - -gUnknown_086294CC:: @ 86294CC - .incbin "data/pokenav/unk_struct_4.bin" - -gUnknown_0862A3B4:: @ 862A3B4 - .byte 0x03, 0x06, 0x00, 0x00, 0x0B, 0x06, 0x00, 0x00, 0x0D, 0x06, 0x00, 0x00, 0x0F, 0x01, 0x00, 0x00, 0x2B, 0x04, 0x00, 0x00, 0x2D, 0x01, 0x00, 0x00, 0x24, 0x09, 0x00, 0x00, 0x29, 0x04, 0x00, 0x00, 0x05, 0x05, 0x00, 0x00, 0x18, 0x04, 0x00, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x2E, 0x09, 0x00, 0x00, 0x11, 0x0C, 0x00, 0x00, 0x10, 0x0B, 0x00, 0x00, 0x1E, 0x0D, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x17, 0x03, 0x00, 0x00, 0x0C, 0x04, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x1C, 0x03, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x19, 0x0B, 0x00, 0x00, 0x09, 0x07, 0x00, 0x00, 0x31, 0x07, 0x00, 0x00, 0x35, 0x07, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x2A, 0x03, 0x00, 0x00, 0x16, 0x0D, 0x00, 0x00, 0x0E, 0x03, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x2C, 0x01, 0x00, 0x00, 0x1B, 0x02, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x34, 0x05, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x1D, 0x04, 0x00, 0x00, 0x22, 0x09, 0x00, 0x00, 0x1F, 0x01, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x0A, 0x04, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x27, 0x0B, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x39, 0x08, 0x00, 0x00, 0x02, 0x0B, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00 - -gUnknown_0862A48C:: @ 862A48C - .2byte 0x44, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A498:: @ 862A498 - .2byte 0xB, 0x22, 0x14, 0x18, 0x51, 3 - -gUnknown_0862A4A4:: @ 862A4A4 - .2byte 0x19, 0x22, 0x14, 0x18, 0x51, 3 - -gUnknown_0862A4B0:: @ 862A4B0 - .2byte 0x23, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A4BC:: @ 862A4BC - .2byte 0x24, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A4C8:: @ 862A4C8 - .2byte 0x125, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A4D4:: @ 862A4D4 - .2byte 0x144, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A4E0:: @ 862A4E0 - .2byte 0x126, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A4EC:: @ 862A4EC - .2byte 0x12B, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A4F8:: @ 862A4F8 - .2byte 0x13A, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A504:: @ 862A504 - .2byte 0x44, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A510:: @ 862A510 - .2byte 0xB, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A51C:: @ 862A51C - .2byte 0x19, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A528:: @ 862A528 - .2byte 0x23, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A534:: @ 862A534 - .2byte 0x24, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A540:: @ 862A540 - .2byte 0x13F, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A54C:: @ 862A54C - .2byte 0x149, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A558:: @ 862A558 - .2byte 0x150, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A564:: @ 862A564 - .2byte 0x133, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A570:: @ 862A570 - .2byte 0x14D, 0x22, 0x14, 0x18, 0x51, 0x3 - -gUnknown_0862A57C:: @ 862A57C - .4byte gUnknown_0862A48C - .4byte gUnknown_0862A498 - .4byte gUnknown_0862A4A4 - .4byte gUnknown_0862A4B0 - .4byte gUnknown_0862A4BC - .4byte gUnknown_0862A4C8 - .4byte gUnknown_0862A4D4 - .4byte gUnknown_0862A4E0 - .4byte gUnknown_0862A4EC - .4byte gUnknown_0862A4F8 - -gUnknown_0862A5A4:: @ 862A5A4 - .4byte gUnknown_0862A504 - .4byte gUnknown_0862A510 - .4byte gUnknown_0862A51C - .4byte gUnknown_0862A528 - .4byte gUnknown_0862A534 - .4byte gUnknown_0862A540 - .4byte gUnknown_0862A54C - .4byte gUnknown_0862A558 - .4byte gUnknown_0862A564 - .4byte gUnknown_0862A570 - -gUnknown_0862A5CC:: @ 862A5CC - .4byte gUnknown_0862A57C - .4byte gUnknown_0862A5A4 - -gUnknown_0862A5D4:: @ 862A5D4 - .incbin "graphics/pokenav/862A5D4.gbapal" - -gUnknown_0862A5F4:: @ 862A5F4 - .byte 0, 2, 3, 0 - -gUnknown_0862A5F8:: @ 862A5F8 - .4byte gUnknown_08626814 - .4byte gUnknown_086276FC - .4byte gUnknown_086285E4 - .4byte gUnknown_086294CC - .4byte gUnknown_085EF8B6 - .4byte gUnknown_085EF8B9 - .4byte gUnknown_085EF8BC - .4byte gUnknown_085EF8BF - -gUnknown_0862A618:: @ 862A618 - .4byte sub_81D581C - .4byte sub_81D58D8 - .4byte sub_81D5924 - .4byte sub_81D59D0 - .4byte sub_81D5A70 - .4byte sub_81D5AB4 - .4byte sub_81D5AD0 - .4byte sub_81D5B2C - .4byte sub_81D5BBC - .4byte sub_81D5C00 - .4byte sub_81D5C5C - .4byte sub_81D62B4 - .4byte sub_81D64AC - .4byte sub_81D64DC - .4byte sub_81D64FC - .4byte sub_81D6518 - .4byte sub_81D6568 - .4byte sub_81D65A0 - -gUnknown_0862A660:: @ 862A660 - .4byte gUnknown_085EB32D - .4byte gUnknown_085EB33E - .4byte gUnknown_085EB350 - .4byte gUnknown_085EB361 - -gUnknown_0862A670:: @ 862A670 - .byte 0, 0x64 - .4byte NULL - .2byte 0, 0x103, 17, 1, 0, 0, 0, 0, 0 - -gUnknown_0862A688:: @ 862A688 - .2byte 0x3E, 0, 0x3F, 0, 0x40, 0, 0x41, 0 - -gUnknown_0862A698:: @ 862A698 - .byte 0, 1, 2, 3, 4, 5, 0, 0 diff --git a/data/rom_81D1C44.s b/data/rom_81D1C44.s new file mode 100644 index 000000000..d393580b8 --- /dev/null +++ b/data/rom_81D1C44.s @@ -0,0 +1,263 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnknown_086253E8:: @ 86253E8 + .4byte 0x8010100 + .4byte 0x80F02 + .4byte 0x8011500 + .4byte 0x180F12 + .4byte 0xB010100 + .4byte 0x180F08 + +gUnknown_08625400:: @ 8625400 + .byte 1, 2, 3 + +gUnknown_08625403:: @ 8625403 + .byte 0xFF + +gUnknown_08625404:: @ 8625404 + .byte 0x40, 0, 0, 4, 1, 0, 0x60, 0xA6, 1, 0, 0, 0 + +gUnknown_08625410:: @ 8625410 + .byte 4, 5, 6, 7, 8, 9, 9, 0xA, 0xA, 0xB, 0xB, 0xC, 0xC, 0xD, 0xD, 0xD, 0xD, 0xE, 0xE, 0xE, 0xE, 0xF, 0xF, 0xF, 0xF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23 + +gUnknown_08625510:: @ 8625510 + .4byte 0x10010101 + .4byte 0xA0F0C + .4byte 0x10010101 + .4byte 0xCA0F0C + .4byte 0xA011301 + .4byte 0x18A0F0C + .4byte 0x160F0401 + .4byte 0x2020F04 + .4byte 0x5081600 + .4byte 0x25A0F04 + .4byte 0xFF + .4byte NULL + +gUnknown_08625540:: @ 8625540 + .4byte 0x5081600 + .4byte 0x25A0F04 + +gUnknown_08625548:: @ 8625548 + .4byte NULL + .4byte sub_81D2BD0 + .4byte NULL + .2byte 0 + .2byte 0 + .byte 2 + .byte 0 + .byte 8 + .byte 0 + .4byte 0x1003121 + +gUnknown_08625560:: @ 8625560 + .incbin "graphics/pokenav/pokeball.4bpp" + +gUnknown_08625660:: @ 8625660 + .incbin "graphics/pokenav/8625660.4bpp" + +gUnknown_08625680:: @ 8625680 + .incbin "graphics/pokenav/sparkle.gbapal" + +gUnknown_086256A0:: @ 86255A0 + .incbin "graphics/pokenav/sparkle.4bpp" + +gUnknown_08625A20:: @ 8625A20 + .2byte 0 + .2byte 0xC000 + .2byte 0x400 + .2byte 0 + +gUnknown_08625A28:: @ 8625A28 + .2byte 0 + .2byte 0x4000 + .2byte 0x800 + .2byte 0 + +gUnknown_08625A30:: @ 8625A30 + .2byte 0 + .2byte 5 + .2byte 0xFFFF + .2byte 0 + +gUnknown_08625A38:: @ 8625A38 + .2byte 4 + .2byte 5 + .2byte 0xFFFF + .2byte 0 + +gUnknown_08625A40:: @ 8625A40 + .4byte gUnknown_08625A30 + .4byte gUnknown_08625A38 + +gUnknown_08625A48:: @ 8625A48 + .4byte NULL + .4byte 0x640800 + +gUnknown_08625A50:: @ 8625A50 + spr_template 0x64, 0x64, gUnknown_08625A20, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + +gUnknown_08625A68:: @ 8625A68 + .4byte NULL + .4byte 0x64 + +gUnknown_08625A70:: @ 8625A70 + .4byte gUnknown_08625560 + .byte 0, 1, 0x65, 0 + .4byte gUnknown_08625660 + .2byte 0x20, 0x67 + .4byte gPokenavConditionCancel_Gfx + .byte 0, 1, 0x66, 0 + .4byte NULL, NULL + +gUnknown_08625A90:: @ 8625A90 + .4byte gPokenavConditionCancel_Pal + 0x0 + .byte 0x65, 0, 0, 0 + .4byte gPokenavConditionCancel_Pal + 0x20 + .byte 0x66, 0, 0, 0 + .4byte NULL, NULL + +gUnknown_08625AA8:: @ 8625AA8 + spr_template 0x65, 0x65, gUnknown_08625A28, gUnknown_08625A40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy + +gUnknown_08625AC0:: @ 8625AC0 + .4byte gUnknown_086256A0 + .byte 0x80, 3, 0x68, 0 + +gUnknown_08625AC8:: @ 8625AC8 + .4byte gUnknown_08625680 + .byte 0x68, 0, 0, 0 + +gUnknown_08625AD0:: @ 8625AD0 + .2byte 0 + .2byte 0x4000 + .2byte 0 + .2byte 0 + +gUnknown_08625AD8:: @ 8625AD8 + .2byte 0 + .2byte 5 + .2byte 4 + .2byte 5 + +gUnknown_08625AE0:: @ 8625AE0 + .2byte 8 + .2byte 5 + .2byte 12 + .2byte 5 + +gUnknown_08625AE8:: @ 8625AE8 + .2byte 16 + .2byte 5 + .2byte 20 + .2byte 5 + +gUnknown_08625AF0:: @ 8625AF0 + .2byte 24 + .2byte 5 + .2byte 0xFFFF + .2byte 0 + +gUnknown_08625AF8:: @ 8625AF8 + .4byte gUnknown_08625AD8 + .4byte gUnknown_08625AE0 + +gUnknown_08625B00:: @ 8625B00 + .4byte gUnknown_08625AE8 + .4byte gUnknown_08625AF0 + +gUnknown_08625B08:: @ 8625B08 + .4byte gUnknown_08625AF8 + .4byte gUnknown_08625B00 + .4byte gUnknown_08625B08 + +gUnknown_08625B14:: @ 8625B14 + spr_template 0x68, 0x68, gUnknown_08625AD0, gUnknown_08625AF8, NULL gDummySpriteAffineAnimTable, sub_81D3564 + +gUnknown_08625B2C:: @ 8625B2C + .2byte 0, 0xFFDD + .2byte 20, 0xFFE4 + .2byte 33, 0xFFF6 + .2byte 33, 10 + .2byte 20, 28 + .2byte 0, 35 + .2byte 0xFFEC, 28 + .2byte 0xFFDF, 10 + .2byte 0xFFDF, 0xFFF6 + .2byte 0xFFEC, 0xFFE4 + +gUnknown_08625B54:: @ 8625B54 + .4byte gUnknown_085EEA46 + .4byte gUnknown_085EEA4E + .4byte gUnknown_085EEA55 + .4byte gUnknown_085EEA63 + .4byte gUnknown_085EEA6B + .4byte gUnknown_085EEA5D + +gUnknown_08625B6C:: @ 8625B6C +@ apparently e-reader trainer data? idk +.byte 0x6f, 0x57, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x14, 0x0c, 0x0e, 0x23, 0x10, 0x47, 0x0a, 0x1f, 0x06, 0x24, 0x0e, 0x48, 0x0a, 0x0f, 0x06 +.byte 0x22, 0x27, 0x2c, 0x16, 0x07, 0x06, 0x01, 0x0c, 0x47, 0x0a, 0x06, 0x06, 0x24, 0x0e, 0x00, 0x1e, 0x19, 0x12, 0x05, 0x0c, 0x25, 0x16, 0x25, 0x10, 0x0d, 0x1c, 0x2a, 0x1c, 0x06, 0x0a, 0x06, 0x0c +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +.byte 0xff, 0xff, 0xff, 0x00, 0x70, 0x01, 0xdb, 0x00, 0xbc, 0x00, 0xf7, 0x00, 0xdc, 0x00, 0x19, 0x01, 0x00, 0x00, 0x37, 0xff, 0x64, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a +.byte 0x80, 0x00, 0x00, 0x00, 0x6f, 0x79, 0x69, 0xae, 0x71, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0xbc, 0x00, 0xf7, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0xff +.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x95, 0x58, 0x59, 0x52, 0x79, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7d, 0x01, 0xb7, 0x00 +.byte 0xf6, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x9b, 0xff, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x2f, 0x00, 0x00, 0x00, 0x8d, 0xae, 0x77, 0x7e +.byte 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6a, 0x79, 0x6b, 0x64, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x54, 0x27, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a +.byte 0x20, 0x06, 0x00, 0x0c, 0x13, 0x24, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x05, 0x12, 0x00, 0x0c, 0x6b, 0x26, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x0e, 0x12, 0x00, 0x0c, 0x2c, 0x24, 0x2b, 0x0e +.byte 0xff, 0xff, 0x3b, 0x0a, 0x17, 0x12, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x59, 0x01, 0xb7, 0x00, 0xca, 0x00, 0xb9, 0x00, 0x09, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x64, 0x00, 0xff, 0x64 +.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x8c, 0x00, 0x00, 0x00, 0x69, 0x58, 0x60, 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x01, 0xb3, 0x00, 0x07, 0x01, 0x4c, 0x01 +.byte 0x62, 0x00, 0x68, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x55, 0x55, 0x5d, 0x96, 0x72, 0xff, 0xff, 0xff +.byte 0xff, 0xff, 0xff, 0xff, 0x44, 0x01, 0x86, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a +.byte 0x00, 0x00, 0x00, 0x00, 0x65, 0x6f, 0x8e, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x72, 0x52, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x00 +.byte 0x4a, 0x04, 0x0e, 0x02, 0x35, 0x16, 0x10, 0x10, 0xda, 0x26, 0x3e, 0x10, 0x4a, 0x04, 0x0e, 0x02, 0x47, 0x0a, 0xd9, 0x26, 0x21, 0x16, 0x3e, 0x10, 0x14, 0x1e, 0x07, 0x1e, 0x30, 0x06, 0x23, 0x16 +.byte 0x24, 0x0e, 0x06, 0x0c, 0x18, 0x14, 0x2f, 0x14, 0x1a, 0x08, 0x27, 0x1c, 0x00, 0x0c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff +.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3c, 0x01, 0x8d, 0x00, 0x2f, 0x00, 0x22, 0x00, 0xf7, 0x00, 0xe7, 0x00 +.byte 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x03, 0x00, 0x00, 0x00, 0x54, 0x68, 0x5a, 0x7b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +.byte 0x6b, 0x01, 0xc8, 0x00, 0xca, 0x00, 0x40, 0x01, 0x5c, 0x00, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x06, 0x00, 0x00, 0x00 +.byte 0x7b, 0x8f, 0x78, 0x51, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0x4c, 0x01, 0xd5, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x64, 0xc8, 0x00, 0x00, 0xc8, 0x00 +.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x51, 0x8a, 0x6a, 0x7e, 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9c, 0x54, 0xae, 0x79, 0xff, 0xff, 0xff, 0xff +.byte 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x0a, 0x0a, 0x23, 0x10, 0x00, 0x0c, 0x28, 0x0c, 0x14, 0x18, 0x32, 0x14, 0x02, 0x16, 0x05, 0x10, 0xff, 0xff +.byte 0x0c, 0x1e, 0x0a, 0x0a, 0x34, 0x12, 0x11, 0x1e, 0x1a, 0x08, 0x05, 0x0c, 0x1e, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x22, 0x0a, 0x15, 0x10, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +.byte 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x63, 0x01, 0xb3, 0x00 +.byte 0xf2, 0x00, 0x35, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0xff, 0x9b, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x58, 0x61, 0xae, 0x64 +.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0xc6, 0x00, 0x39, 0x00, 0xf2, 0x00, 0x26, 0x00, 0x59, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10 +.byte 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x5b, 0x72, 0x6a, 0x91, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x01, 0x8d, 0x00, 0x5e, 0x00, 0xf7, 0x00, 0x55, 0x00, 0x05, 0x01 +.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x8d, 0x85, 0x9e, 0xa0, 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + +gUnknown_0862608C:: @ 862608C + .2byte 21, 16 + .2byte 25, 16 + .2byte 16, 17 + .2byte 20, 20 + +gUnknown_0862609C:: @ 862609C + .incbin "data/unknown_jp_62609C.bin" + +gUnknown_08626814:: @ 8626814 + .incbin "data/pokenav/unk_struct_1.bin" + +gUnknown_086276FC:: @ 86276FC + .incbin "data/pokenav/unk_struct_2.bin" + +gUnknown_086285E4:: @ 86285E4 + .incbin "data/pokenav/unk_struct_3.bin" + +gUnknown_086294CC:: @ 86294CC + .incbin "data/pokenav/unk_struct_4.bin" diff --git a/data/specials.inc b/data/specials.inc index 5ac4930c7..a5f272dc9 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -515,7 +515,7 @@ gSpecials:: @ 81DBA64 def_special sub_813B514 def_special sub_813B568 def_special sub_813B534 - def_special sp194_trainer_tower + def_special CallTrainerHillFunction def_special sub_813B7D8 def_special sub_813B80C def_special sub_81D4BEC diff --git a/include/battle_tower.h b/include/battle_tower.h index bd8e80fc1..12d6d2e9e 100644 --- a/include/battle_tower.h +++ b/include/battle_tower.h @@ -79,7 +79,7 @@ void GetBattleTowerTrainerLanguage(u8 *dst, u16 trainerId); u8 SetFacilityPtrsGetLevel(void); u8 GetFrontierEnemyMonLevel(u8 lvlMode); s32 GetHighestLevelInPlayerParty(void); -u8 sub_81660B8(u8 facilityClass); +u8 FacilityClassToGraphicsId(u8 facilityClass); bool32 ValidateBattleTowerRecord(u8 recordId); // unused void sub_8166188(void); diff --git a/include/constants/battle.h b/include/constants/battle.h index acb0f6689..346d5d9ea 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -174,7 +174,7 @@ #define HITMARKER_GRUDGE 0x01000000 #define HITMARKER_OBEYS 0x02000000 #define HITMARKER_x4000000 0x04000000 -#define HITMARKER_x8000000 0x08000000 +#define HITMARKER_CHARGING 0x08000000 #define HITMARKER_FAINTED(battler) (gBitTable[battler] << 0x1C) #define HITMARKER_UNK(battler) (0x10000000 << battler) diff --git a/include/event_scripts.h b/include/event_scripts.h index e611dc6e0..afeac6628 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -584,4 +584,7 @@ extern const u8 EventScript_275A86[]; extern const u8 EventScript_275ADF[]; extern const u8 EventScript_275B38[]; +// trainer hill +extern const u8 EventScript_2C83F0[]; + #endif // GUARD_EVENT_SCRIPTS_H diff --git a/include/field_message_box.h b/include/field_message_box.h index e3deee4d6..9515a54fd 100644 --- a/include/field_message_box.h +++ b/include/field_message_box.h @@ -11,6 +11,7 @@ enum bool8 ShowFieldMessage(const u8 *message); bool8 sub_8098238(const u8 *message); +bool8 sub_80982B8(void); bool8 ShowFieldAutoScrollMessage(const u8 *message); void HideFieldMessageBox(void); bool8 IsFieldMessageBoxHidden(void); diff --git a/include/global.h b/include/global.h index c11bddc2d..f45d36f68 100644 --- a/include/global.h +++ b/include/global.h @@ -378,7 +378,8 @@ struct BattleFrontier /*0xEE0*/ u8 field_EE0; /*0xEE1*/ u8 field_EE1[2][PLAYER_NAME_LENGTH + 1]; /*0xEF1*/ u8 field_EF1[2][4]; - /*0xEF9*/ u8 field_EF9; + /*0xEF9*/ u8 field_EF9_0:7; + /*0xEF9*/ u8 field_EF9_1:1; /*0xEFA*/ u8 field_EFA; /*0xEFB*/ u8 field_EFB; /*0xEFC*/ struct FrontierMonData field_EFC[3]; @@ -792,6 +793,21 @@ struct UnkSaveSubstruct_3b98 u8 trainerName[PLAYER_NAME_LENGTH + 1]; }; +struct SaveTrainerHill +{ + /*0x3D64*/ u32 field_3D64; + /*0x3D68*/ u32 field_3D68; + /*0x3D6C*/ u8 field_3D6C; + /*0x3D6D*/ u8 unused; + /*0x3D6E*/ u16 field_3D6E_0a:1; // 1 + /*0x3D6E*/ u16 field_3D6E_0b:1; // 2 + /*0x3D6E*/ u16 field_3D6E_0c:1; // 4 + /*0x3D6E*/ u16 field_3D6E_0d:1; // 8 + /*0x3D6E*/ u16 field_3D6E_0e:1; // x10 + /*0x3D6E*/ u16 field_3D6E_0f:1; // x20 + /*0x3D6E*/ u16 tag:2; // x40, x80 = xC0 +}; + struct SaveBlock1 { /*0x00*/ struct Coords16 pos; @@ -869,13 +885,15 @@ struct SaveBlock1 /*0x31A8*/ u8 giftRibbons[52]; /*0x31DC*/ struct Roamer roamer; /*0x31F8*/ struct EnigmaBerry enigmaBerry; - /*0x322C*/ u8 field_322C[1276]; + /*0x322C*/ u8 field_322C[1260]; + /*0x3718*/ u32 trainerHillTimes[4]; /*0x3728*/ struct RamScript ramScript; /*0x3B14*/ struct RecordMixingGift recordMixingGift; /*0x3B24*/ u8 seen2[DEX_FLAGS_NO]; /*0x3B58*/ LilycoveLady lilycoveLady; /*0x3B98*/ struct UnkSaveSubstruct_3b98 unk_3B98[20]; - /*0x3C88*/ u8 filler_3C88[0xE8]; + /*0x3C88*/ u8 filler_3C88[0xDC]; + /*0x3D64*/ struct SaveTrainerHill trainerHill; /*0x3D70*/ struct WaldaPhrase waldaPhrase; // sizeof: 0x3D88 }; diff --git a/include/main.h b/include/main.h index 0d441035d..2ed30307b 100644 --- a/include/main.h +++ b/include/main.h @@ -61,6 +61,8 @@ void SetHBlankCallback(IntrCallback callback); void SetVCountCallback(IntrCallback callback); void SetSerialCallback(IntrCallback callback); void InitFlashTimer(void); +void sub_80008DC(u32 *var); +void sub_80008E8(void); void DoSoftReset(void); void ClearPokemonCrySongs(void); void RestoreSerialTimer3IntrHandlers(void); diff --git a/include/pokemon.h b/include/pokemon.h index cfa5cc350..507497683 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -451,8 +451,8 @@ void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level); void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality); void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId); void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread); -void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src); -void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50); +void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src); +void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50); void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId); void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId); void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest); diff --git a/include/pokenav.h b/include/pokenav.h index d8f0c9f97..e5dba8ae0 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -3,7 +3,6 @@ #include "player_pc.h" #include "list_menu.h" -bool8 sub_81D5C18(void); bool8 sub_81D20BC(void *arg0); bool8 sub_81D312C(void *arg0); void sub_81D1ED4(void *arg0); @@ -14,28 +13,21 @@ void sub_81D3464(void *arg0); void sub_81D3480(void *arg0, u8 arg1); void sub_81D2754(void *arg0, void *arg1); void sub_81D1F84(void *arg0, void *arg1, void *arg2); -const u8 *sub_81D62AC(void); u8 sub_81D1C84(u8); u8 sub_81D1DC0(struct PlayerPCItemPageStruct *); void sub_81D1E90(struct PlayerPCItemPageStruct *); void sub_81D1EC0(void); void sub_81D1D04(u8); bool8 sub_81D1C44(u8); -void sub_81D5FB4(u16*); bool8 sub_81D4A58(struct EventObject*); void sub_81D2BF4(u8 *); u16 sub_81D2C3C(void); void sub_81D2C50(void); u8 sub_81D28C8(const struct ListMenuItem *items, u16 numChoices); void sub_81D2824(u16); -bool32 InTrainerHill(void); bool8 EventObjectIsFarawayIslandMew(struct EventObject *); u32 sub_81D427C(void); void sub_81D4998(void); -u8 GetCurrentTrainerHillMapId(void); -u8 sub_81D6490(void); -const struct WarpEvent *sub_81D6120(void); -const struct WarpEvent *sub_81D6134(u8); void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); diff --git a/include/strings.h b/include/strings.h index d16dd21f8..ff0d08195 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1231,10 +1231,17 @@ extern const u8 gText_MtPyre[]; extern const u8 gText_SkyPillar[]; extern const u8 gText_DontRemember[]; extern const u8 gUnknown_085EB597[]; -extern const u8 gUnknown_085EB32D[]; -extern const u8 gUnknown_085EB33E[]; -extern const u8 gUnknown_085EB350[]; -extern const u8 gUnknown_085EB361[]; +extern const u8 gText_NormalTagMatch[]; +extern const u8 gText_VarietyTagMatch[]; +extern const u8 gText_UniqueTagMatch[]; +extern const u8 gText_ExpertTagMatch[]; +extern const u8 gText_TimeBoard[]; +extern const u8 gText_TimeCleared[]; +extern const u8 gText_XMinYDotZSec[]; +extern const u8 gText_TrainerHill1F[]; +extern const u8 gText_TrainerHill2F[]; +extern const u8 gText_TrainerHill3F[]; +extern const u8 gText_TrainerHill4F[]; extern const u8 OldaleTown_PokemonCenter_2F_Text_277F1B[]; extern const u8 OldaleTown_PokemonCenter_2F_Text_277F5A[]; diff --git a/include/trainer_hill.h b/include/trainer_hill.h new file mode 100644 index 000000000..bbc4f45c5 --- /dev/null +++ b/include/trainer_hill.h @@ -0,0 +1,36 @@ +#ifndef GUARD_TRAINER_HILL_H +#define GUARD_TRAINER_HILL_H + +extern u32 *gUnknown_0203CF5C; + +void CallTrainerHillFunction(void); +void ResetTrainerHillResults(void); +u8 GetTrainerHillOpponentClass(u16 trainerId); +void GetTrainerHillTrainerName(u8 *dst, u16 trainerId); +u8 GetTrainerHillTrainerFrontSpriteId(u16 trainerId); +void InitTrainerHillBattleStruct(void); +void FreeTrainerHillBattleStruct(void); +void CopyTrainerHillTrainerText(u8 which, u16 trainerId); +bool8 sub_81D5C18(void); +void nullsub_129(void); +void PrintOnTrainerHillRecordsWindow(void); +void sub_81D5DF8(void); +bool32 sub_81D5F48(void); +void sub_81D5FB4(u16 *mapArg); +bool32 InTrainerHill(void); +u8 GetCurrentTrainerHillMapId(void); +const struct WarpEvent* sub_81D6120(void); +const struct WarpEvent* sub_81D6134(u8 warpEventId); +u16 LocalIdToHillTrainerId(u8 localId); +bool8 GetHillTrainerFlag(u8 eventObjectId); +void SetHillTrainerFlag(void); +const u8 *sub_81D62AC(void); +void FillHillTrainerParty(void); +void FillHillTrainersParties(void); +u32 sub_81D63C4(void); +u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId); +u8 sub_81D6490(void); +void sub_81D64C0(void); +bool32 sub_81D6534(void); + +#endif // GUARD_TRAINER_HILL_H diff --git a/ld_script.txt b/ld_script.txt index 5e273d616..29ee5e192 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -292,7 +292,8 @@ SECTIONS { src/battle_pyramid_bag.o(.text); asm/pokenav.o(.text); src/pokenav_match_call.o(.text); - asm/pokenav.o(.text.after.match.call); + asm/rom_81D1C44.o(.text); + src/trainer_hill.o(.text); src/rayquaza_scene.o(.text); src/walda_phrase.o(.text); src/contest_link_81D9DE4.o(.text); @@ -596,7 +597,8 @@ SECTIONS { src/battle_pyramid_bag.o(.rodata); data/pokenav.o(.rodata); src/pokenav_match_call.o(.rodata); - data/pokenav.o(.rodata.after.match.call); + data/rom_81D1C44.o(.rodata); + src/trainer_hill.o(.rodata); src/rayquaza_scene.o(.rodata); src/walda_phrase.o(.rodata); src/gym_leader_rematch.o(.rodata); @@ -1195,6 +1197,31 @@ SECTIONS { src/graphics.o(.rodata); } =0 + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* Discard everything not specifically mentioned above. */ /DISCARD/ : { diff --git a/src/apprentice.c b/src/apprentice.c index 5d636d05d..9cf8cd4b4 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -1080,7 +1080,7 @@ void ResetApprenticeStruct(struct Apprentice *apprentice) u8 i; for (i = 0; i < 6; i++) - apprentice->easyChatWords[i] |= 0xFFFF; + apprentice->easyChatWords[i] = 0xFFFF; apprentice->playerName[0] = EOS; apprentice->id = 16; @@ -1094,7 +1094,7 @@ void ResetAllApprenticeData(void) for (i = 0; i < 4; i++) { for (j = 0; j < 6; j++) - gSaveBlock2Ptr->apprentices[i].easyChatWords[j] |= 0xFFFF; + gSaveBlock2Ptr->apprentices[i].easyChatWords[j] = 0xFFFF; gSaveBlock2Ptr->apprentices[i].id = 16; gSaveBlock2Ptr->apprentices[i].playerName[0] = EOS; gSaveBlock2Ptr->apprentices[i].lvlMode = 0; diff --git a/src/battle_anim.c b/src/battle_anim.c index 7dd1526dd..1f4831c54 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1450,7 +1450,7 @@ void ClearBattleAnimationVars(void) // Clear index array. for (i = 0; i < ANIM_SPRITE_INDEX_COUNT; i++) - sAnimSpriteIndexArray[i] |= 0xFFFF; + sAnimSpriteIndexArray[i] = 0xFFFF; // Clear anim args. for (i = 0; i < ANIM_ARGS_COUNT; i++) @@ -1511,7 +1511,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo gAnimScriptCallback = RunAnimScriptCommand; for (i = 0; i < ANIM_SPRITE_INDEX_COUNT; i++) - sAnimSpriteIndexArray[i] |= 0xFFFF; + sAnimSpriteIndexArray[i] = 0xFFFF; if (isMoveAnim) { @@ -1572,7 +1572,7 @@ static void ClearSpriteIndex(u16 index) { if (sAnimSpriteIndexArray[i] == index) { - sAnimSpriteIndexArray[i] |= 0xFFFF; + sAnimSpriteIndexArray[i] = 0xFFFF; return; } } @@ -1779,7 +1779,7 @@ static void ScriptCmd_end(void) { FreeSpriteTilesByTag(gBattleAnimPicTable[sAnimSpriteIndexArray[i]].tag); FreeSpritePaletteByTag(gBattleAnimPicTable[sAnimSpriteIndexArray[i]].tag); - sAnimSpriteIndexArray[i] |= 0xFFFF; // set terminator. + sAnimSpriteIndexArray[i] = 0xFFFF; // set terminator. } } diff --git a/src/battle_dome.c b/src/battle_dome.c index efc69313e..b9e27675b 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -3548,7 +3548,7 @@ static void sub_8190400(u8 taskId) SetVBlankCallback(VblankCb0_BattleDome); sBattleDomeStruct = AllocZeroed(sizeof(*sBattleDomeStruct)); for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++) - sBattleDomeStruct->arr[i] |= 0xFF; + sBattleDomeStruct->arr[i] = 0xFF; LoadMonIconPalettes(); i = CreateTask(sub_8190CD4, 0); gTasks[i].data[0] = 0; diff --git a/src/battle_factory.c b/src/battle_factory.c index 0445d5dea..5793c78e9 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -198,9 +198,9 @@ static void sub_81A5E94(void) gUnknown_03001288 = FALSE; for (i = 0; i < 6; i++) - gSaveBlock2Ptr->frontier.field_E70[i].monId |= 0xFFFF; + gSaveBlock2Ptr->frontier.field_E70[i].monId = 0xFFFF; for (i = 0; i < 3; i++) - gUnknown_03006298[i] |= 0xFFFF; + gUnknown_03006298[i] = 0xFFFF; SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); gTrainerBattleOpponent_A = 0; diff --git a/src/battle_main.c b/src/battle_main.c index 4e2a87beb..1aeaa25ca 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5862,7 +5862,7 @@ static void HandleAction_NothingIsFainted(void) | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000 | HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT - | HITMARKER_x8000000 | HITMARKER_x4000000); + | HITMARKER_CHARGING | HITMARKER_x4000000); } static void HandleAction_ActionFinished(void) @@ -5875,7 +5875,7 @@ static void HandleAction_ActionFinished(void) | HITMARKER_NO_PPDEDUCT | HITMARKER_IGNORE_SAFEGUARD | HITMARKER_IGNORE_ON_AIR | HITMARKER_IGNORE_UNDERGROUND | HITMARKER_IGNORE_UNDERWATER | HITMARKER_x100000 | HITMARKER_OBEYS | HITMARKER_x10 | HITMARKER_SYNCHRONISE_EFFECT - | HITMARKER_x8000000 | HITMARKER_x4000000); + | HITMARKER_CHARGING | HITMARKER_x4000000); gCurrentMove = 0; gBattleMoveDamage = 0; diff --git a/src/battle_message.c b/src/battle_message.c index 112ab9630..7b8085219 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -16,6 +16,7 @@ #include "string_util.h" #include "strings.h" #include "text.h" +#include "trainer_hill.h" #include "window.h" #include "constants/battle_string_ids.h" #include "constants/items.h" @@ -41,10 +42,6 @@ extern u8 gUnknown_0203C7B4; extern const u8 gTrainerClassNames[][13]; extern const u16 gUnknown_08D85620[]; -extern u8 GetTrainerHillOpponentClass(u16 trainerId); // pokenav -extern void GetTrainerHillTrainerName(u8 *txtPtr, u16 trainerId); // pokenav -extern void CopyTrainerHillTrainerText(u8 arg0, u16 trainerId); // pokenav - // this file's functions static void ChooseMoveUsedParticle(u8 *textPtr); static void ChooseTypeOfMoveUsedString(u8 *dst); diff --git a/src/battle_pike.c b/src/battle_pike.c index a4b429bd5..c12038efb 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -1446,7 +1446,7 @@ static void sub_81A84B4(void) u8 i; for (i = 0; i < 14; i++) - gSaveBlock2Ptr->frontier.field_CB4[i] |= 0xFFFF; + gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF; } static void sub_81A84EC(void) diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 2f0d35feb..c0ff1ecf5 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -1537,7 +1537,7 @@ void sub_81AA1D8(void) u8 var0, var1; for (i = 0; i < 8; i++) - gSaveBlock2Ptr->frontier.field_CB4[i] |= 0xFFFF; + gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF; id = sub_81AA9E4(); sub_81AA33C(&var0, &var1); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2490d6e13..0995eec45 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8459,7 +8459,7 @@ static u8 AttacksThisTurn(u8 battlerId, u16 move) // Note: returns 1 if it's a c || gBattleMoves[move].effect == EFFECT_SEMI_INVULNERABLE || gBattleMoves[move].effect == EFFECT_BIDE) { - if ((gHitMarker & HITMARKER_x8000000)) + if ((gHitMarker & HITMARKER_CHARGING)) return 1; } return 2; diff --git a/src/battle_setup.c b/src/battle_setup.c index 195af0c28..f5e9e3e9e 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -29,6 +29,7 @@ #include "field_message_box.h" #include "sound.h" #include "strings.h" +#include "trainer_hill.h" #include "secret_base.h" #include "string_util.h" #include "overworld.h" @@ -61,18 +62,9 @@ struct TrainerBattleParameter u8 ptrType; }; -extern bool32 InTrainerHill(void); extern void ClearPoisonStepCounter(void); extern void sub_808BCF4(void); extern void sub_80AF6F0(void); -extern u16 sub_81D6180(u8 localId); -extern bool8 GetTrainerHillTrainerFlag(u8 eventObjId); -extern bool8 sub_81D5C18(void); -extern void sub_81D639C(void); -extern void sub_81D6384(void); -extern void sub_81D61E8(void); -extern void sub_80982B8(void); -extern void CopyTrainerHillTrainerText(u8 a0, u16 arg1); // this file's functions static void DoBattlePikeWildBattle(void); @@ -1148,12 +1140,12 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data) { TrainerBattleLoadArgs(sOrdinaryBattleParams, data); SetMapVarsToTrainer(); - gTrainerBattleOpponent_A = sub_81D6180(gSpecialVar_LastTalked); + gTrainerBattleOpponent_A = LocalIdToHillTrainerId(gSpecialVar_LastTalked); } else { TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data); - gTrainerBattleOpponent_B = sub_81D6180(gSpecialVar_LastTalked); + gTrainerBattleOpponent_B = LocalIdToHillTrainerId(gSpecialVar_LastTalked); } return EventScript_TryDoNormalTrainerBattle; default: @@ -1215,7 +1207,7 @@ bool8 GetTrainerFlag(void) if (InBattlePyramid()) return GetBattlePyramidTrainerFlag(gSelectedEventObject); else if (InTrainerHill()) - return GetTrainerHillTrainerFlag(gSelectedEventObject); + return GetHillTrainerFlag(gSelectedEventObject); else return FlagGet(GetTrainerAFlag()); } @@ -1281,11 +1273,11 @@ void BattleSetup_StartTrainerBattle(void) gBattleTypeFlags |= BATTLE_TYPE_TRAINER_HILL; if (gNoOfApproachingTrainers == 2) - sub_81D639C(); + FillHillTrainersParties(); else - sub_81D6384(); + FillHillTrainerParty(); - sub_81D61E8(); + SetHillTrainerFlag(); } sNoOfPossibleTrainerRetScripts = gNoOfApproachingTrainers; @@ -1367,9 +1359,9 @@ void ShowTrainerIntroSpeech(void) else if (sub_81D5C18()) { if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1) - CopyTrainerHillTrainerText(2, sub_81D6180(gSpecialVar_LastTalked)); + CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gSpecialVar_LastTalked)); else - CopyTrainerHillTrainerText(2, sub_81D6180(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId)); + CopyTrainerHillTrainerText(2, LocalIdToHillTrainerId(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId)); sub_80982B8(); } diff --git a/src/battle_tower.c b/src/battle_tower.c index deb5acb2e..088ef7972 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1888,7 +1888,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) else if (trainerId == TRAINER_EREADER) { for (i = firstMonId; i < firstMonId + 3; i++) - sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); + CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); return; } else if (trainerId == TRAINER_FRONTIER_BRAIN) @@ -1904,7 +1904,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount) if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j].species != 0 && gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j].level <= level) { - sub_8068338(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j], FALSE); + CreateBattleTowerMon2(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j], FALSE); } } return; @@ -2075,7 +2075,7 @@ static void FillFactoryFrontierTrainerParty(u16 trainerId, u8 firstMonId) else if (trainerId == TRAINER_EREADER) { for (i = firstMonId; i < firstMonId + 3; i++) - sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); + CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i - firstMonId]); return; } else if (trainerId == TRAINER_FRONTIER_BRAIN) @@ -2276,7 +2276,7 @@ void DoSpecialTrainerBattle(void) case SPECIAL_BATTLE_EREADER: ZeroEnemyPartyMons(); for (i = 0; i < 3; i++) - sub_806819C(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i]); + CreateBattleTowerMon(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.ereaderTrainer.party[i]); gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_EREADER_TRAINER; gTrainerBattleOpponent_A = 0; CreateTask(Task_StartBattleAfterTransition, 1); @@ -3258,7 +3258,7 @@ static void FillPartnerParty(u16 trainerId) if (monData.nickname[0] == EXT_CTRL_CODE_BEGIN && monData.nickname[1] == EXT_CTRL_CODE_JPN) trainerName[5] = EOS; } - sub_8068338(&gPlayerParty[3 + i], &monData, TRUE); + CreateBattleTowerMon2(&gPlayerParty[3 + i], &monData, TRUE); SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_NAME, trainerName); j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_FRIEND); SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j); @@ -3663,7 +3663,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount) } } -u8 sub_81660B8(u8 facilityClass) +u8 FacilityClassToGraphicsId(u8 facilityClass) { u8 trainerObjectGfxId; u8 i; diff --git a/src/battle_util2.c b/src/battle_util2.c index 0a0f65b95..9c0d55a57 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -3,21 +3,19 @@ #include "battle_controllers.h" #include "alloc.h" #include "pokemon.h" +#include "trainer_hill.h" #include "party_menu.h" #include "event_data.h" #include "constants/abilities.h" #include "random.h" #include "battle_scripts.h" -extern void sub_81D55D0(void); -extern void sub_81D5694(void); - void AllocateBattleResources(void) { gBattleResources = gBattleResources; // something dumb needed to match if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) - sub_81D55D0(); + InitTrainerHillBattleStruct(); gBattleStruct = AllocZeroed(sizeof(*gBattleStruct)); @@ -47,7 +45,7 @@ void AllocateBattleResources(void) void FreeBattleResources(void) { if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL) - sub_81D5694(); + FreeTrainerHillBattleStruct(); if (gBattleResources != NULL) { diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 7cee717bf..6e1bae31e 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -20,6 +20,7 @@ #include "sprite.h" #include "task.h" #include "trainer_see.h" +#include "trainer_hill.h" #include "util.h" #include "constants/event_object_movement_constants.h" #include "constants/event_objects.h" diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 4f6f5acdf..00dce4c7d 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -25,6 +25,7 @@ #include "sound.h" #include "start_menu.h" #include "trainer_see.h" +#include "trainer_hill.h" #include "wild_encounter.h" #include "constants/bg_event_constants.h" #include "constants/event_objects.h" diff --git a/src/field_poison.c b/src/field_poison.c index fac17dea9..89cd02728 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -13,6 +13,7 @@ #include "string_util.h" #include "strings.h" #include "task.h" +#include "trainer_hill.h" #include "constants/species.h" static bool32 IsMonValidSpecies(struct Pokemon *pokemon) diff --git a/src/fieldmap.c b/src/fieldmap.c index d2ff34b1c..f67f61ede 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -11,6 +11,7 @@ #include "pokenav.h" #include "script.h" #include "secret_base.h" +#include "trainer_hill.h" #include "tv.h" #include "constants/rgb.h" diff --git a/src/frontier_util.c b/src/frontier_util.c index 40b1edbe3..742b73858 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -1827,7 +1827,7 @@ void sub_81A3ACC(void) s32 i; for (i = 0; i < 20; i++) - gSaveBlock2Ptr->frontier.field_CB4[i] |= 0xFFFF; + gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF; } static void sub_81A3B00(void) diff --git a/src/link_rfu.c b/src/link_rfu.c index 0f997591f..ebfc802e0 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4524,7 +4524,7 @@ void sub_80115EC(s32 a0) if ((a0 >> i) & 1) { gUnknown_03005000.unk_cea[i] = 0; - gUnknown_03005000.unk_cee[i] |= 0xFF; + gUnknown_03005000.unk_cee[i] = 0xFF; } } } diff --git a/src/load_save.c b/src/load_save.c index a7593d007..0d19c6dae 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -8,13 +8,12 @@ #include "pokemon_storage_system.h" #include "random.h" #include "save_location.h" +#include "trainer_hill.h" #include "gba/flash_internal.h" #include "decoration_inventory.h" static void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey); -extern void* gUnknown_0203CF5C; - extern bool16 IdentifyFlash(void); extern void ApplyNewEncryptionKeyToBerryPowder(u32 key); diff --git a/src/main.c b/src/main.c index c4962286c..61c5e3386 100644 --- a/src/main.c +++ b/src/main.c @@ -22,10 +22,10 @@ #include "text.h" #include "intro.h" #include "main.h" +#include "trainer_hill.h" extern void sub_800B9B8(void); extern u8 gUnknown_03002748; -extern u32 *gUnknown_0203CF5C; static void VBlankIntr(void); static void HBlankIntr(void); diff --git a/src/new_game.c b/src/new_game.c index 1b3fa2b00..158120245 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -17,6 +17,7 @@ #include "easy_chat.h" #include "event_data.h" #include "money.h" +#include "trainer_hill.h" #include "tv.h" #include "coins.h" #include "text.h" @@ -49,7 +50,6 @@ extern void copy_strings_to_sav1(void); extern void InitMatchCallCounters(void); extern void sub_801AFD8(void); extern void sub_800E5AC(void); -extern void sub_81D54BC(void); extern void ResetContestLinkResults(void); extern void ResetPokeJumpResults(void); extern void SetBerryPowder(u32* powder, u32 newValue); @@ -212,7 +212,7 @@ void NewGameInitData(void) InitMatchCallCounters(); sub_801AFD8(); sub_800E5AC(); - sub_81D54BC(); + ResetTrainerHillResults(); ResetContestLinkResults(); } diff --git a/src/overworld.c b/src/overworld.c index 9df69e360..a67b4b68f 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -19,7 +19,6 @@ #include "field_tasks.h" #include "field_weather.h" #include "fieldmap.h" -// #include "fldeff_flash.h" #include "gpu_regs.h" #include "heal_location.h" #include "link.h" @@ -50,6 +49,7 @@ #include "task.h" // #include "tileset_anim.h" #include "time_events.h" +#include "trainer_hill.h" #include "tv.h" #include "scanline_effect.h" #include "wild_encounter.h" @@ -106,7 +106,6 @@ extern void apply_map_tileset2_palette(const struct MapLayout *); extern void copy_map_tileset2_to_vram_2(const struct MapLayout *); extern void RestartWildEncounterImmunitySteps(void); extern void ShowMapNamePopup(void); -extern bool32 InTrainerHill(void); extern bool32 sub_808651C(void); extern bool8 sub_80AF6A4(void); extern bool8 sub_80E909C(void); @@ -129,14 +128,11 @@ extern void WriteFlashScanlineEffectBuffer(u8); extern void sub_81AA2F8(void); extern void InitMatchCallCounters(void); extern void sub_80EDB44(void); -extern void sub_81D64C0(void); extern void InitFieldMessageBox(void); extern void copy_map_tileset1_to_vram(const struct MapLayout *); extern void copy_map_tileset2_to_vram(const struct MapLayout *); extern void FieldUpdateBgTilemapScroll(void); extern void TransferTilesetAnimsBuffer(void); -extern bool32 sub_81D5F48(void); -extern u8 GetCurrentTrainerHillMapId(void); extern bool8 warp0_in_pokecenter(void); extern void ResetAllPicSprites(void); extern void FieldEffectActiveListClear(void); diff --git a/src/party_menu.c b/src/party_menu.c index 241df1c91..a8c98faec 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1563,7 +1563,7 @@ static void InitPartyMenu(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc task, MainCallb for (i = 0; i <= 15; i++) gUnknown_0203CEC4->data[i] = 0; for (i = 0; i < 3; i++) - gUnknown_0203CEC4->unkC[i] |= 0xFF; + gUnknown_0203CEC4->unkC[i] = 0xFF; if (d == 0) gUnknown_0203CEC8.unk9 = 0; @@ -1851,10 +1851,10 @@ static void PartyMenuInitHelperStructs(u8 a) gUnknown_0203CEDC[i].unk0 = &gUnknown_086156C4[1]; gUnknown_0203CEDC[i].unk4 = gUnknown_08615704[a][i]; gUnknown_0203CEDC[i].windowId = i; - gUnknown_0203CEDC[i].unk9 |= 0xFF; - gUnknown_0203CEDC[i].unkA |= 0xFF; - gUnknown_0203CEDC[i].unkB |= 0xFF; - gUnknown_0203CEDC[i].unkC |= 0xFF; + gUnknown_0203CEDC[i].unk9 = 0xFF; + gUnknown_0203CEDC[i].unkA = 0xFF; + gUnknown_0203CEDC[i].unkB = 0xFF; + gUnknown_0203CEDC[i].unkC = 0xFF; } gUnknown_0203CEDC[0].unk0 = &gUnknown_086156C4[0]; if (a == 3) diff --git a/src/pokedex.c b/src/pokedex.c index 755a46821..8c6ed3159 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1264,7 +1264,7 @@ static void ResetPokedexView(struct PokedexView *pokedexView) for (i = 0; i < NATIONAL_DEX_COUNT; i++) { - pokedexView->pokedexList[i].dexNum |= 0xFFFF; + pokedexView->pokedexList[i].dexNum = 0xFFFF; pokedexView->pokedexList[i].seen = 0; pokedexView->pokedexList[i].owned = 0; } @@ -1281,7 +1281,7 @@ static void ResetPokedexView(struct PokedexView *pokedexView) pokedexView->seenCount = 0; pokedexView->ownCount = 0; for (i = 0; i < 4; i++) - pokedexView->unk61E[i] |= 0xFFFF; + pokedexView->unk61E[i] = 0xFFFF; pokedexView->unk628 = 0; pokedexView->unk62A = 0; pokedexView->unk62C = 0; @@ -2030,7 +2030,7 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode) for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++) { - sPokedexView->pokedexList[i].dexNum |= 0xFFFF; + sPokedexView->pokedexList[i].dexNum = 0xFFFF; sPokedexView->pokedexList[i].seen = FALSE; sPokedexView->pokedexList[i].owned = FALSE; } @@ -2437,7 +2437,7 @@ u8 sub_80BDA40(void) if (sPokedexView->unk61E[i] != 0xFFFF) { FreeAndDestroyMonPicSprite(sPokedexView->unk61E[i]); - sPokedexView->unk61E[i] |= 0xFFFF; + sPokedexView->unk61E[i] = 0xFFFF; } } return FALSE; diff --git a/src/pokemon.c b/src/pokemon.c index 580216b2c..174f7ae66 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -22,7 +22,6 @@ #include "pokemon_animation.h" #include "pokemon_summary_screen.h" #include "pokemon_storage_system.h" -#include "pokenav.h" #include "random.h" #include "recorded_battle.h" #include "rtc.h" @@ -31,6 +30,7 @@ #include "strings.h" #include "task.h" #include "text.h" +#include "trainer_hill.h" #include "util.h" #include "constants/abilities.h" #include "constants/battle_frontier.h" @@ -74,7 +74,6 @@ extern const u8 gTrainerClassNames[][13]; extern u16 get_unknown_box_id(void); extern void set_unknown_box_id(u8); extern bool8 sub_806F104(void); -extern u8 sub_81D63C8(u16 trainerOpponentId); // this file's functions static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); @@ -2745,7 +2744,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI CalculateMonStats(mon); } -void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src) +void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src) { s32 i; u8 nickname[30]; @@ -2799,7 +2798,7 @@ void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src) CalculateMonStats(mon); } -void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50) +void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50) { s32 i; u8 nickname[30]; @@ -6083,7 +6082,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) if (InBattlePyramid()) return GetTrainerEncounterMusicIdInBattlePyramind(trainerOpponentId); else if (sub_81D5C18()) - return sub_81D63C8(trainerOpponentId); + return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId); else return TRAINER_ENCOUNTER_MUSIC(trainerOpponentId); } diff --git a/src/recorded_battle.c b/src/recorded_battle.c index 03823dd45..0dae76f02 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -124,7 +124,7 @@ void sub_8184DA4(u8 arg0) { for (j = 0; j < BATTLER_RECORD_SIZE; j++) { - sBattleRecords[i][j] |= 0xFF; + sBattleRecords[i][j] = 0xFF; } sBattleFlags = gBattleTypeFlags; sAI_Scripts = gBattleResources->ai->aiFlags; @@ -206,7 +206,7 @@ void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear) for (i = 0; i < bytesToClear; i++) { sRecordedBytesNo[battlerId]--; - sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] |= 0xFF; + sBattleRecords[battlerId][sRecordedBytesNo[battlerId]] = 0xFF; if (sRecordedBytesNo[battlerId] == 0) break; } diff --git a/src/rom_8034C54.c b/src/rom_8034C54.c index cc875bd3f..a3707017e 100644 --- a/src/rom_8034C54.c +++ b/src/rom_8034C54.c @@ -82,7 +82,7 @@ bool32 sub_8034C54(u32 count) for (i = 0; i < count; i++) { gUnknown_02022E10->array[i].isActive = FALSE; - gUnknown_02022E10->array[i].firstOamId |= 0xFF; + gUnknown_02022E10->array[i].firstOamId = 0xFF; } return TRUE; diff --git a/src/save.c b/src/save.c index cfbe5b848..a22e20f0b 100644 --- a/src/save.c +++ b/src/save.c @@ -7,6 +7,7 @@ #include "overworld.h" #include "pokemon_storage_system.h" #include "main.h" +#include "trainer_hill.h" #include "constants/game_stat.h" static u16 CalculateChecksum(void *data, u16 size); @@ -17,10 +18,6 @@ static u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location); static u8 TryWriteSector(u8 sector, u8 *data); static u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location); -// for the chunk declarations - -extern u32 gUnknown_0203CF5C; - // Divide save blocks into individual chunks to be written to flash sectors // Each 4 KiB flash sector contains 3968 bytes of actual data followed by a 128 byte footer @@ -662,10 +659,10 @@ static void UpdateSaveAddresses(void) u8 HandleSavingData(u8 saveType) { u8 i; - u32 backupVar = gUnknown_0203CF5C; + u32 *backupVar = gUnknown_0203CF5C; u8 *tempAddr; - gUnknown_0203CF5C = 0; + gUnknown_0203CF5C = NULL; UpdateSaveAddresses(); switch (saveType) { diff --git a/src/script_menu.c b/src/script_menu.c index d415d65a9..a4f4c6086 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -782,10 +782,10 @@ const struct MenuAction MultichoiceList_112[] = const struct MenuAction MultichoiceList_113[] = { - {gUnknown_085EB32D, NULL}, - {gUnknown_085EB33E, NULL}, - {gUnknown_085EB350, NULL}, - {gUnknown_085EB361, NULL}, + {gText_NormalTagMatch, NULL}, + {gText_VarietyTagMatch, NULL}, + {gText_UniqueTagMatch, NULL}, + {gText_ExpertTagMatch, NULL}, {gText_Exit, NULL}, }; @@ -1407,7 +1407,7 @@ static void sub_80E2578(void) for (i = 0; i < ARRAY_COUNT(gUnknown_03001124); i++) { - gUnknown_03001124[i] |= 0xFF; + gUnknown_03001124[i] = 0xFF; } GetFontAttribute(1, FONTATTR_MAX_LETTER_WIDTH); diff --git a/src/strings.c b/src/strings.c index 7b2b5ca4c..b0eb048ba 100644 --- a/src/strings.c +++ b/src/strings.c @@ -252,7 +252,7 @@ const u8 gText_ThePokemonList[] = _("the POKéMON LIST"); const u8 gText_TheShop[] = _("the shop"); const u8 gText_ThePC[] = _("the PC"); -const u8 *const gReturnToXStringsTable[] = +const u8 *const gReturnToXStringsTable[] = { gText_TheField, gText_TheBattle, @@ -268,7 +268,7 @@ const u8 *const gReturnToXStringsTable[] = gText_ThePC }; -const u8 *const gReturnToXStringsTable2[] = +const u8 *const gReturnToXStringsTable2[] = { gText_TheField, gText_TheBattle, @@ -283,7 +283,7 @@ const u8 gText_TMHMPocket[] = _("TMs & HMs"); const u8 gText_BerriesPocket[] = _("BERRIES"); const u8 gText_KeyItemsPocket[] = _("KEY ITEMS"); -const u8 *const gPocketNamesStringsTable[] = +const u8 *const gPocketNamesStringsTable[] = { gText_ItemsPocket, gText_PokeBallsPocket, @@ -749,10 +749,10 @@ const u8 gUnknown_085EB2FF[] = _("I'll battle now!"); const u8 gUnknown_085EB310[] = _("I won!"); const u8 gUnknown_085EB317[] = _("I lost!"); const u8 gUnknown_085EB31F[] = _("I won't tell."); -const u8 gUnknown_085EB32D[] = _("NORMAL TAG MATCH"); -const u8 gUnknown_085EB33E[] = _("VARIETY TAG MATCH"); -const u8 gUnknown_085EB350[] = _("UNIQUE TAG MATCH"); -const u8 gUnknown_085EB361[] = _("EXPERT TAG MATCH"); +const u8 gText_NormalTagMatch[] = _("NORMAL TAG MATCH"); +const u8 gText_VarietyTagMatch[] = _("VARIETY TAG MATCH"); +const u8 gText_UniqueTagMatch[] = _("UNIQUE TAG MATCH"); +const u8 gText_ExpertTagMatch[] = _("EXPERT TAG MATCH"); const u8 gUnknown_085EB372[] = _("TRADE CENTER"); const u8 gUnknown_085EB37F[] = _("COLOSSEUM"); const u8 gUnknown_085EB389[] = _("RECORD CORNER"); @@ -1737,10 +1737,10 @@ const u8 gText_Lv[] = _("{LV}"); const u8 gText_TimeBoard[] = _("TIME BOARD"); const u8 gText_TimeCleared[] = _("TIME CLEARED "); const u8 gText_XMinYDotZSec[] = _("{STR_VAR_1} min. {STR_VAR_2}.{STR_VAR_3} sec."); -const u8 gUnknown_085EF8B6[] = _("1F"); -const u8 gUnknown_085EF8B9[] = _("2F"); -const u8 gUnknown_085EF8BC[] = _("3F"); -const u8 gUnknown_085EF8BF[] = _("4F"); +const u8 gText_TrainerHill1F[] = _("1F"); +const u8 gText_TrainerHill2F[] = _("2F"); +const u8 gText_TrainerHill3F[] = _("3F"); +const u8 gText_TrainerHill4F[] = _("4F"); const u8 gText_TeachWhichMoveToPkmn[] = _("Teach which move to {STR_VAR_1}?"); const u8 gText_TeachX[] = _("Teach {STR_VAR_2}?"); const u8 gText_PkmnLearnedMove4[] = _("{STR_VAR_1} learned\n{STR_VAR_2}!"); diff --git a/src/trainer_hill.c b/src/trainer_hill.c new file mode 100644 index 000000000..7ec6865fd --- /dev/null +++ b/src/trainer_hill.c @@ -0,0 +1,1121 @@ +#include "global.h" +#include "alloc.h" +#include "battle.h" +#include "battle_tower.h" +#include "battle_setup.h" +#include "event_data.h" +#include "event_scripts.h" +#include "fieldmap.h" +#include "field_message_box.h" +#include "international_string_util.h" +#include "item.h" +#include "main.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "pokemon.h" +#include "script.h" +#include "string_util.h" +#include "strings.h" +#include "text.h" +#include "trainer_hill.h" +#include "window.h" +#include "util.h" +#include "constants/event_object_movement_constants.h" +#include "constants/event_objects.h" +#include "constants/items.h" +#include "constants/maps.h" +#include "constants/trainers.h" + +extern bool32 sub_81D3B34(void); + +#define HILL_TAG_NORMAL 0 +#define HILL_TAG_VARIETY 1 +#define HILL_TAG_UNIQUE 2 +#define HILL_TAG_EXPERT 3 + +#define HILL_TRAINER_NAME_LENGTH 11 +#define HILL_MAX_TIME 215999 // 60 * 60 * 60 - 1 + +struct TrHillRoomTrainers +{ + u8 name[2][HILL_TRAINER_NAME_LENGTH]; + u8 facilityClass[2]; +}; + +struct TrainerHillTrainer +{ + u8 name[HILL_TRAINER_NAME_LENGTH]; + u8 facilityClass; + u32 unused; + u16 speechBefore[6]; + u16 speechWin[6]; + u16 speechLose[6]; + u16 speechAfter[6]; + struct BattleTowerPokemon mons[PARTY_SIZE]; +}; + +struct TrHillFloor +{ + u8 unk0; + u8 unk1; + struct TrainerHillTrainer trainers[2]; + u8 data[0x100]; + u16 unk3A0[16]; + u8 coords[2]; // x first 4 bits, y last 4 bits + u8 direction; // array of 4 bits for each trainer + u8 range; // array of 4 bits for each trainer +}; + +struct TrHillTag +{ + u8 unkField_0; + u8 unused1; + u8 unkField_2; + u8 unused3; + u8 unused4; + u8 unused5; + u8 unused6; + struct TrHillFloor floors[4]; +}; + +struct TrHillStruct2 +{ + u8 floorId; + struct TrHillTag tag; +}; + +// EWRAM +static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL; +static EWRAM_DATA struct TrHillRoomTrainers *sRoomTrainers = NULL; +EWRAM_DATA u32 *gUnknown_0203CF5C = NULL; + +// This file's functions. +static void sub_81D581C(void); +static void sub_81D58D8(void); +static void sub_81D5924(void); +static void sub_81D59D0(void); +static void sub_81D5A70(void); +static void sub_81D5AB4(void); +static void sub_81D5AD0(void); +static void sub_81D5B2C(void); +static void sub_81D5BBC(void); +static void sub_81D5C00(void); +static void sub_81D5C5C(void); +static void sub_81D62B4(void); +static void sub_81D64AC(void); +static void sub_81D64DC(void); +static void sub_81D64FC(void); +static void sub_81D6518(void); +static void sub_81D6568(void); +static void sub_81D65A0(void); +static void SetUpDataStruct(void); +static void FreeDataStruct(void); +static void nullsub_2(void); +static void SetTimerValue(u32 *dst, u32 val); +static u32 GetTimerValue(u32 *src); +static void sub_81D642C(struct Pokemon *mon, u8 level); +static u16 sub_81D6640(void); + +// const data +// I will decompile these soon, no worries :) +extern const struct TrHillTag gUnknown_08626814; +extern const struct TrHillTag gUnknown_086276FC; +extern const struct TrHillTag gUnknown_086285E4; +extern const struct TrHillTag gUnknown_086294CC; + +struct +{ + u8 trainerClass; + u8 musicId; +} static const gUnknown_0862A3B4[] = +{ + {TRAINER_CLASS_TEAM_AQUA, TRAINER_ENCOUNTER_MUSIC_AQUA}, + {TRAINER_CLASS_AQUA_ADMIN, TRAINER_ENCOUNTER_MUSIC_AQUA}, + {TRAINER_CLASS_AQUA_LEADER, TRAINER_ENCOUNTER_MUSIC_AQUA}, + {TRAINER_CLASS_AROMA_LADY, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_BATTLE_GIRL, TRAINER_ENCOUNTER_MUSIC_INTENSE}, + {TRAINER_CLASS_SWIMMER_F, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_POKEFAN, TRAINER_ENCOUNTER_MUSIC_TWINS}, + {TRAINER_CLASS_DRAGON_TAMER, TRAINER_ENCOUNTER_MUSIC_INTENSE}, + {TRAINER_CLASS_COOLTRAINER, TRAINER_ENCOUNTER_MUSIC_COOL}, + {TRAINER_CLASS_GUITARIST, TRAINER_ENCOUNTER_MUSIC_INTENSE}, + {TRAINER_CLASS_SAILOR, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_TWINS, TRAINER_ENCOUNTER_MUSIC_TWINS}, + {TRAINER_CLASS_INTERVIEWER, TRAINER_ENCOUNTER_MUSIC_INTERVIEWER}, + {TRAINER_CLASS_RUIN_MANIAC, TRAINER_ENCOUNTER_MUSIC_HIKER}, + {TRAINER_CLASS_GENTLEMAN, TRAINER_ENCOUNTER_MUSIC_RICH}, + {TRAINER_CLASS_SWIMMER_M, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_POKEMANIAC, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS}, + {TRAINER_CLASS_BLACK_BELT, TRAINER_ENCOUNTER_MUSIC_INTENSE}, + {TRAINER_CLASS_OLD_COUPLE, TRAINER_ENCOUNTER_MUSIC_INTENSE}, + {TRAINER_CLASS_BUG_MANIAC, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS}, + {TRAINER_CLASS_CAMPER, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_KINDLER, TRAINER_ENCOUNTER_MUSIC_HIKER}, + {TRAINER_CLASS_TEAM_MAGMA, TRAINER_ENCOUNTER_MUSIC_MAGMA}, + {TRAINER_CLASS_MAGMA_ADMIN, TRAINER_ENCOUNTER_MUSIC_MAGMA}, + {TRAINER_CLASS_MAGMA_LEADER, TRAINER_ENCOUNTER_MUSIC_MAGMA}, + {TRAINER_CLASS_LASS, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_BUG_CATCHER, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_NINJA_BOY, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS}, + {TRAINER_CLASS_RICH_BOY, TRAINER_ENCOUNTER_MUSIC_RICH}, + {TRAINER_CLASS_HEX_MANIAC, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS}, + {TRAINER_CLASS_BEAUTY, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_LADY, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_PARASOL_LADY, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_PICNICKER, TRAINER_ENCOUNTER_MUSIC_GIRL}, + {TRAINER_CLASS_PKMN_BREEDER, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_COLLECTOR, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS}, + {TRAINER_CLASS_PKMN_RANGER, TRAINER_ENCOUNTER_MUSIC_COOL}, + {TRAINER_CLASS_PKMN_TRAINER_3, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_YOUNG_COUPLE, TRAINER_ENCOUNTER_MUSIC_GIRL}, + {TRAINER_CLASS_PSYCHIC, TRAINER_ENCOUNTER_MUSIC_INTENSE}, + {TRAINER_CLASS_SR_AND_JR, TRAINER_ENCOUNTER_MUSIC_TWINS}, + {TRAINER_CLASS_ELITE_FOUR, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_YOUNGSTER, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_EXPERT, TRAINER_ENCOUNTER_MUSIC_INTENSE}, + {TRAINER_CLASS_TRIATHLETE, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_BIRD_KEEPER, TRAINER_ENCOUNTER_MUSIC_COOL}, + {TRAINER_CLASS_FISHERMAN, TRAINER_ENCOUNTER_MUSIC_HIKER}, + {TRAINER_CLASS_CHAMPION, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_TUBER_M, TRAINER_ENCOUNTER_MUSIC_MALE}, + {TRAINER_CLASS_TUBER_F, TRAINER_ENCOUNTER_MUSIC_GIRL}, + {TRAINER_CLASS_SIS_AND_BRO, TRAINER_ENCOUNTER_MUSIC_SWIMMER}, + {TRAINER_CLASS_HIKER, TRAINER_ENCOUNTER_MUSIC_HIKER}, + {TRAINER_CLASS_LEADER, TRAINER_ENCOUNTER_MUSIC_FEMALE}, + {TRAINER_CLASS_SCHOOL_KID, TRAINER_ENCOUNTER_MUSIC_MALE}, +}; + +static const u16 gUnknown_0862A48C[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A498[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4A4[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4B0[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4BC[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4C8[] = {ITEM_TM05_ROAR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4D4[] = {ITEM_TM36_SLUDGE_BOMB, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4E0[] = {ITEM_TM06_TOXIC, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4EC[] = {ITEM_TM11_SUNNY_DAY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A4F8[] = {ITEM_TM26_EARTHQUAKE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A504[] = {ITEM_RARE_CANDY, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A510[] = {ITEM_LUXURY_BALL, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A51C[] = {ITEM_MAX_REVIVE, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A528[] = {ITEM_MAX_ETHER, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A534[] = {ITEM_ELIXIR, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A540[] = {ITEM_TM31_BRICK_BREAK, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A54C[] = {ITEM_TM41_TORMENT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A558[] = {ITEM_TM48_SKILL_SWAP, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A564[] = {ITEM_TM19_GIGA_DRAIN, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; +static const u16 gUnknown_0862A570[] = {ITEM_TM45_ATTRACT, ITEM_ETHER, ITEM_MAX_POTION, ITEM_REVIVE, ITEM_FLUFFY_TAIL, ITEM_GREAT_BALL}; + +static const u16 *const gUnknown_0862A57C[] = +{ + gUnknown_0862A48C, + gUnknown_0862A498, + gUnknown_0862A4A4, + gUnknown_0862A4B0, + gUnknown_0862A4BC, + gUnknown_0862A4C8, + gUnknown_0862A4D4, + gUnknown_0862A4E0, + gUnknown_0862A4EC, + gUnknown_0862A4F8 +}; + +static const u16 *const gUnknown_0862A5A4[] = +{ + gUnknown_0862A504, + gUnknown_0862A510, + gUnknown_0862A51C, + gUnknown_0862A528, + gUnknown_0862A534, + gUnknown_0862A540, + gUnknown_0862A54C, + gUnknown_0862A558, + gUnknown_0862A564, + gUnknown_0862A570 +}; + +static const u16 *const *const gUnknown_0862A5CC[] = +{ + gUnknown_0862A57C, + gUnknown_0862A5A4 +}; + +static const u16 gUnknown_0862A5D4[] = INCBIN_U16("graphics/pokenav/862A5D4.gbapal"); +static const u8 sRecordWinColors[] = {0, 2, 3}; + +static const struct TrHillTag *const sDataPerTag[] = +{ + &gUnknown_08626814, + &gUnknown_086276FC, + &gUnknown_086285E4, + &gUnknown_086294CC, +}; + +// Unused. +static const u8 *const sFloorStrings[] = +{ + gText_TrainerHill1F, + gText_TrainerHill2F, + gText_TrainerHill3F, + gText_TrainerHill4F, +}; + +static void (* const sHillFunctions[])(void) = +{ + sub_81D581C, + sub_81D58D8, + sub_81D5924, + sub_81D59D0, + sub_81D5A70, + sub_81D5AB4, + sub_81D5AD0, + sub_81D5B2C, + sub_81D5BBC, + sub_81D5C00, + sub_81D5C5C, + sub_81D62B4, + sub_81D64AC, + sub_81D64DC, + sub_81D64FC, + sub_81D6518, + sub_81D6568, + sub_81D65A0, +}; + +static const u8 *const sTagMatchStrings[] = +{ + gText_NormalTagMatch, + gText_VarietyTagMatch, + gText_UniqueTagMatch, + gText_ExpertTagMatch, +}; + +static const struct EventObjectTemplate gUnknown_0862A670 = +{ + .graphicsId = EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL, + .elevation = 3, + .movementType = MOVEMENT_TYPE_LOOK_AROUND, + .movementRangeX = 1, + .movementRangeY = 1, + .trainerType = 1, +}; + +static const u32 gUnknown_0862A688[] = {MAP_NUM(TRAINER_HILL_2F), MAP_NUM(TRAINER_HILL_3F), MAP_NUM(TRAINER_HILL_4F), MAP_NUM(TRAINER_HILL_ROOF)}; +static const u8 gUnknown_0862A698[][3] = {{0, 1, 2}, {3, 4, 5}}; + +// code +void CallTrainerHillFunction(void) +{ + SetUpDataStruct(); + sHillFunctions[gSpecialVar_0x8004](); + FreeDataStruct(); +} + +void ResetTrainerHillResults(void) +{ + s32 i; + + gSaveBlock2Ptr->frontier.field_EF9_1 = 0; + gSaveBlock2Ptr->frontier.field_EF9_0 = 0; + gSaveBlock1Ptr->trainerHill.field_3D68 = 0; + for (i = 0; i < 4; i++) + SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME); +} + +static u8 GetFloorId(void) +{ + return gMapHeader.mapLayoutId - 159; +} + +u8 GetTrainerHillOpponentClass(u16 trainerId) +{ + u8 id = trainerId - 1; + + return gFacilityClassToTrainerClass[sRoomTrainers->facilityClass[id]]; +} + +void GetTrainerHillTrainerName(u8 *dst, u16 trainerId) +{ + s32 i; + u8 id = trainerId - 1; + + for (i = 0; i < HILL_TRAINER_NAME_LENGTH; i++) + dst[i] = sRoomTrainers->name[id][i]; +} + +u8 GetTrainerHillTrainerFrontSpriteId(u16 trainerId) +{ + u8 id, facilityClass; + + SetUpDataStruct(); + id = trainerId - 1; + facilityClass = sHillData->tag.floors[sHillData->floorId].trainers[id].facilityClass; + FreeDataStruct(); + + return gFacilityClassToPicIndex[facilityClass]; +} + +void InitTrainerHillBattleStruct(void) +{ + s32 i, j; + + SetUpDataStruct(); + sRoomTrainers = AllocZeroed(sizeof(*sRoomTrainers)); + + for (i = 0; i < 2; i++) + { + for (j = 0; j < HILL_TRAINER_NAME_LENGTH; j++) + { + sRoomTrainers->name[i][j] = sHillData->tag.floors[sHillData->floorId].trainers[i].name[j]; + } + sRoomTrainers->facilityClass[i] = sHillData->tag.floors[sHillData->floorId].trainers[i].facilityClass; + } + sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64); + FreeDataStruct(); +} + +void FreeTrainerHillBattleStruct(void) +{ + if (sRoomTrainers != NULL) + FREE_AND_SET_NULL(sRoomTrainers); +} + +static void SetUpDataStruct(void) +{ + if (sHillData == NULL) + { + sHillData = AllocZeroed(sizeof(*sHillData)); + sHillData->floorId = gMapHeader.mapLayoutId - 159; + CpuCopy32(sDataPerTag[gSaveBlock1Ptr->trainerHill.tag], &sHillData->tag, sizeof(sHillData->tag)); + nullsub_2(); + } +} + +static void FreeDataStruct(void) +{ + if (sHillData != NULL) + FREE_AND_SET_NULL(sHillData); +} + +void CopyTrainerHillTrainerText(u8 which, u16 trainerId) +{ + u8 id, floorId; + + SetUpDataStruct(); + floorId = GetFloorId(); + id = trainerId - 1; + + switch (which) + { + case 2: + FrontierSpeechToString(sHillData->tag.floors[floorId].trainers[id].speechBefore); + break; + case 3: + FrontierSpeechToString(sHillData->tag.floors[floorId].trainers[id].speechWin); + break; + case 4: + FrontierSpeechToString(sHillData->tag.floors[floorId].trainers[id].speechLose); + break; + case 5: + FrontierSpeechToString(sHillData->tag.floors[floorId].trainers[id].speechAfter); + break; + } + + FreeDataStruct(); +} + +static void sub_81D581C(void) +{ + nullsub_2(); + if (!sub_81D3B34()) + gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 1; + else + gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0; + + gSaveBlock1Ptr->trainerHill.field_3D6C = 0; + sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64); + gSaveBlock1Ptr->trainerHill.field_3D64 = 0; + gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 0; + gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 0; + gSaveBlock1Ptr->trainerHill.field_3D6E_0e = 0; + gSaveBlock2Ptr->frontier.field_EE0 = 0; + gBattleOutcome = 0; + gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 0; +} + +static void sub_81D58D8(void) +{ + sub_80008E8(); + gSpecialVar_Result = 0; + if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c) + gSpecialVar_Result++; + if (gSaveBlock1Ptr->trainerHill.field_3D6E_0a && gSaveBlock1Ptr->trainerHill.field_3D6E_0b) + gSpecialVar_Result++; + + gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 1; +} + +static void sub_81D5924(void) +{ + u16 itemId = sub_81D6640(); + + if (sHillData->tag.unkField_2 != 4 || gSaveBlock1Ptr->trainerHill.field_3D6E_0a) + { + gSpecialVar_Result = 2; + } + else if (AddBagItem(itemId, 1) == TRUE) + { + CopyItemName(itemId, gStringVar2); + gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 1; + gSaveBlock2Ptr->frontier.field_EF9_0 = 0; + gSpecialVar_Result = 0; + } + else + { + gSpecialVar_Result = 1; + } +} + +static void sub_81D59D0(void) +{ + if (gSaveBlock1Ptr->trainerHill.field_3D6E_0b) + { + gSpecialVar_Result = 2; + } + else if (GetTimerValue(&gSaveBlock1Ptr->trainerHill.field_3D68) > gSaveBlock1Ptr->trainerHill.field_3D64) + { + SetTimerValue(&gSaveBlock1Ptr->trainerHill.field_3D68, gSaveBlock1Ptr->trainerHill.field_3D64); + gSaveBlock1Ptr->trainerHillTimes[gSaveBlock1Ptr->trainerHill.tag] = gSaveBlock1Ptr->trainerHill.field_3D68; + gSpecialVar_Result = 0; + } + else + { + gSpecialVar_Result = 1; + } + + gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 1; +} + +static void sub_81D5A70(void) +{ + if (!gSaveBlock1Ptr->trainerHill.field_3D6E_0c) + { + if (gSaveBlock1Ptr->trainerHill.field_3D64 >= HILL_MAX_TIME) + gSaveBlock1Ptr->trainerHill.field_3D64 = HILL_MAX_TIME; + else + sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64); + } +} + +static void sub_81D5AB4(void) +{ + gSaveBlock1Ptr->trainerHill.field_3D6E_0d = 1; +} + +static void sub_81D5AD0(void) +{ + if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d) + { + gSaveBlock1Ptr->trainerHill.field_3D6E_0d = 0; + gSpecialVar_Result = 0; + } + else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0e) + { + gSaveBlock1Ptr->trainerHill.field_3D6E_0e = 0; + gSpecialVar_Result = 1; + } + else + { + gSpecialVar_Result = 2; + } +} + +static void sub_81D5B2C(void) +{ + s32 total, minutes, secondsWhole, secondsFraction; + + total = gSaveBlock1Ptr->trainerHill.field_3D64; + if (total >= HILL_MAX_TIME) + total = HILL_MAX_TIME; + + minutes = total / (60 * 60); + total %= (60 * 60); + secondsWhole = total / 60; + total %= 60; + secondsFraction = (total * 168) / 100; + + ConvertIntToDecimalStringN(gStringVar1, minutes, STR_CONV_MODE_RIGHT_ALIGN, 2); + ConvertIntToDecimalStringN(gStringVar2, secondsWhole, STR_CONV_MODE_RIGHT_ALIGN, 2); + ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2); +} + +static void sub_81D5BBC(void) +{ + SetUpDataStruct(); + if (sHillData->tag.unkField_2 != 4) + { + ConvertIntToDecimalStringN(gStringVar1, sHillData->tag.unkField_2, STR_CONV_MODE_LEFT_ALIGN, 1); + gSpecialVar_Result = 0; + } + else + { + gSpecialVar_Result = 1; + } + + FreeDataStruct(); +} + +static void sub_81D5C00(void) +{ + SetUpDataStruct(); + gSpecialVar_Result = 0; + FreeDataStruct(); +} + +bool8 sub_81D5C18(void) +{ + if (VarGet(VAR_0x40D6) == 0) + return FALSE; + else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c) + return FALSE; + else if (GetCurrentTrainerHillMapId() != 0) + return TRUE; + else + return FALSE; +} + +static void sub_81D5C5C(void) +{ + if (!sub_81D5C18()) + gSpecialVar_Result = 0; + else + gSpecialVar_Result = 1; +} + +void nullsub_129(void) +{ + +} + +static void nullsub_2(void) +{ + +} + +void PrintOnTrainerHillRecordsWindow(void) +{ + s32 i, x, y; + u32 total, minutes, secondsWhole, secondsFraction; + + SetUpDataStruct(); + FillWindowPixelBuffer(0, 0); + x = GetStringCenterAlignXOffset(1, gText_TimeBoard, 0xD0); + AddTextPrinterParameterized3(0, 1, x, 2, sRecordWinColors, TEXT_SPEED_FF, gText_TimeBoard); + + y = 18; + for (i = 0; i < 4; i++) + { + AddTextPrinterParameterized3(0, 1, 0, y, sRecordWinColors, TEXT_SPEED_FF, sTagMatchStrings[i]); + y += 15; + total = GetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i]); + minutes = total / (60 * 60); + total %= (60 * 60); + ConvertIntToDecimalStringN(gStringVar1, minutes, STR_CONV_MODE_RIGHT_ALIGN, 2); + secondsWhole = total / 60; + total %= 60; + ConvertIntToDecimalStringN(gStringVar2, secondsWhole, STR_CONV_MODE_RIGHT_ALIGN, 2); + secondsFraction = (total * 168) / 100; + ConvertIntToDecimalStringN(gStringVar3, secondsFraction, STR_CONV_MODE_LEADING_ZEROS, 2); + StringExpandPlaceholders(StringCopy(gStringVar4, gText_TimeCleared), gText_XMinYDotZSec); + x = GetStringRightAlignXOffset(1, gStringVar4, 0xD0); + AddTextPrinterParameterized3(0, 1, x, y, sRecordWinColors, TEXT_SPEED_FF, gStringVar4); + y += 17; + } + + PutWindowTilemap(0); + CopyWindowToVram(0, 3); + FreeDataStruct(); +} + +// Leftover from Fire Red / Leaf Green as in these games, +// the timer had to be xored by the encryption key in Sav2. +static u32 GetTimerValue(u32 *src) +{ + return *src; +} + +static void SetTimerValue(u32 *dst, u32 val) +{ + *dst = val; +} + +void sub_81D5DF8(void) +{ + u8 i, floorId; + struct EventObjectTemplate *eventTemplates = gSaveBlock1Ptr->eventObjectTemplates; + + if (!sub_81D5F48()) + return; + + SetUpDataStruct(); + for (i = 0; i < 2; i++) + gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF; + CpuFill32(0, gSaveBlock1Ptr->eventObjectTemplates, sizeof(gSaveBlock1Ptr->eventObjectTemplates)); + + floorId = GetFloorId(); + for (i = 0; i < 2; i++) + { + u8 bits; + + eventTemplates[i] = gUnknown_0862A670; + eventTemplates[i].localId = i + 1; + eventTemplates[i].graphicsId = FacilityClassToGraphicsId(sHillData->tag.floors[floorId].trainers[i].facilityClass); + eventTemplates[i].x = sHillData->tag.floors[floorId].coords[i] & 0xF; + eventTemplates[i].y = ((sHillData->tag.floors[floorId].coords[i] >> 4) & 0xF) + 5; + bits = i << 2; + eventTemplates[i].movementType = ((sHillData->tag.floors[floorId].direction >> bits) & 0xF) + MOVEMENT_TYPE_FACE_UP; + eventTemplates[i].trainerRange_berryTreeId = (sHillData->tag.floors[floorId].range >> bits) & 0xF; + eventTemplates[i].script = EventScript_2C83F0; + gSaveBlock2Ptr->frontier.field_CB4[i] = i + 1; + } + + FreeDataStruct(); +} + +bool32 sub_81D5F48(void) +{ + SetUpDataStruct(); + FreeDataStruct(); + return TRUE; +} + +// Functionally equivalent. +#ifdef NONMATCHING +static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3) +{ + u32 var0, var1, var2, var3; + + var0 = (sHillData->tag.floors[floorId].unk3A0[arg2] >> (15 - bit)) & 1; + var1 = sHillData->tag.floors[floorId].data[arg2 * arg3 + bit]; + var3 = 0x200; + var2 = 0x3000; + + return ((var0 << 10) | var2) | (var1 | var3); +} +#else +NAKED +static u32 sub_81D5F58(u8 floorId, u32 bit, u32 arg2, u32 arg3) +{ + asm_unified("\n\ + push {r4,r5,lr}\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + ldr r4, =sHillData\n\ + ldr r4, [r4]\n\ + mov r12, r4\n\ + lsls r4, r2, 1\n\ + lsls r5, r0, 4\n\ + subs r5, r0\n\ + lsls r5, 3\n\ + subs r5, r0\n\ + lsls r5, 3\n\ + adds r4, r5\n\ + movs r0, 0xE8\n\ + lsls r0, 2\n\ + add r0, r12\n\ + adds r0, r4\n\ + ldrh r0, [r0]\n\ + movs r4, 0xF\n\ + subs r4, r1\n\ + asrs r0, r4\n\ + movs r4, 0x1\n\ + ands r0, r4\n\ + muls r2, r3\n\ + adds r2, r1\n\ + adds r2, r5\n\ + movs r1, 0xA8\n\ + lsls r1, 2\n\ + add r1, r12\n\ + adds r1, r2\n\ + ldrb r1, [r1]\n\ + movs r2, 0x80\n\ + lsls r2, 2\n\ + adds r3, r2, 0\n\ + movs r2, 0xC0\n\ + lsls r2, 6\n\ + lsls r0, 10\n\ + orrs r0, r2\n\ + orrs r1, r3\n\ + orrs r0, r1\n\ + pop {r4,r5}\n\ + pop {r1}\n\ + bx r1\n\ + .pool"); +} +#endif // NONMATCHING + +void sub_81D5FB4(u16 *mapArg) +{ + s32 i, j; + u16 *src, *dst; + u8 mapId = GetCurrentTrainerHillMapId(); + + if (mapId == 6) + { + InitMapFromSavedGame(); + return; + } + + SetUpDataStruct(); + if (mapId == 5) + { + InitMapFromSavedGame(); + FreeDataStruct(); + return; + } + + mapId = GetFloorId(); + src = gMapHeader.mapLayout->map; + gBackupMapLayout.map = mapArg; + gBackupMapLayout.width = 31; + gBackupMapLayout.height = 35; + dst = mapArg + 224; + for (i = 0; i < 5; i++) + { + for (j = 0; j < 16; j++) + dst[j] = src[j]; + dst += 31; + src += 16; + } + + for (i = 0; i < 16; i++) + { + for (j = 0; j < 16; j++) + dst[j] = sub_81D5F58(mapId, j, i, 0x10); + dst += 31; + } + + mapheader_run_script_with_tag_x1(); + FreeDataStruct(); +} + +bool32 InTrainerHill(void) +{ + bool32 ret; + + if (gMapHeader.mapLayoutId == 0x19F + || gMapHeader.mapLayoutId == 0x1A0 + || gMapHeader.mapLayoutId == 0x1A1 + || gMapHeader.mapLayoutId == 0x1A2) + ret = TRUE; + else + ret = FALSE; + + return ret; +} + +u8 GetCurrentTrainerHillMapId(void) +{ + u8 ret; + + if (gMapHeader.mapLayoutId == 0x19F) + ret = 1; + else if (gMapHeader.mapLayoutId == 0x1A0) + ret = 2; + else if (gMapHeader.mapLayoutId == 0x1A1) + ret = 3; + else if (gMapHeader.mapLayoutId == 0x1A2) + ret = 4; + else if (gMapHeader.mapLayoutId == 0x1A3) + ret = 5; + else if (gMapHeader.mapLayoutId == 0x19E) + ret = 6; + else + ret = 0; + + return ret; +} + +static bool32 sub_81D6100(void) +{ + bool32 ret; + + if (gMapHeader.mapLayoutId == 0x1A3) + ret = TRUE; + else + ret = FALSE; + + return ret; +} + +const struct WarpEvent* sub_81D6120(void) +{ + const struct MapHeader *header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), MAP_NUM(TRAINER_HILL_4F)); + + return &header->events->warps[1]; +} + +const struct WarpEvent* sub_81D6134(u8 warpEventId) +{ + u8 id; + const struct MapHeader *header; + + if (warpEventId == 1) + return &gMapHeader.events->warps[1]; + + id = sub_81D6490(); + if (id == 0 || id >= 5) + id = 4; + + header = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(TRAINER_HILL_4F), gUnknown_0862A688[id - 1]); + return &header->events->warps[0]; +} + +u16 LocalIdToHillTrainerId(u8 localId) +{ + return gSaveBlock2Ptr->frontier.field_CB4[localId - 1]; +} + +bool8 GetHillTrainerFlag(u8 eventObjectId) +{ + u32 floorId = GetFloorId() * 2; + u8 bitId = gEventObjects[eventObjectId].localId - 1 + floorId; + + return gSaveBlock2Ptr->frontier.field_EE0 & gBitTable[bitId]; +} + +void SetHillTrainerFlag(void) +{ + u8 i; + u8 floorId = GetFloorId() * 2; + + for (i = 0; i < 2; i++) + { + if (gSaveBlock2Ptr->frontier.field_CB4[i] == gTrainerBattleOpponent_A) + { + gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i]; + break; + } + } + + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + for (i = 0; i < 2; i++) + { + if (gSaveBlock2Ptr->frontier.field_CB4[i] == gTrainerBattleOpponent_B) + { + gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i]; + break; + } + } + } +} + +const u8 *sub_81D62AC(void) +{ + return EventScript_2C83F0; +} + +static void sub_81D62B4(void) +{ + CopyTrainerHillTrainerText(5, gSpecialVar_LastTalked); + sub_80982B8(); +} + +static void sub_81D62CC(u16 trainerId, u8 firstMonId) +{ + u8 trId, level; + s32 i, floorId, arrId; + + if (trainerId == 0 || trainerId > 2) + return; + + trId = trainerId - 1; + SetUpDataStruct(); + level = GetHighestLevelInPlayerParty(); + floorId = GetFloorId(); + for (i = firstMonId, arrId = 0; i < firstMonId + 3; i++, arrId++) + { + u8 id = gUnknown_0862A698[trId][arrId]; + struct Pokemon *mon = &gEnemyParty[i]; + + CreateBattleTowerMon(mon, &sHillData->tag.floors[floorId].trainers[trId].mons[id]); + sub_81D642C(mon, level); + } + + FreeDataStruct(); +} + +void FillHillTrainerParty(void) +{ + ZeroEnemyPartyMons(); + sub_81D62CC(gTrainerBattleOpponent_A, 0); +} + +void FillHillTrainersParties(void) +{ + ZeroEnemyPartyMons(); + sub_81D62CC(gTrainerBattleOpponent_A, 0); + sub_81D62CC(gTrainerBattleOpponent_B, 3); +} + +// This function is unused, but my best guess is +// it was supposed to return AI scripts for trainer +// hill trainers. +u32 sub_81D63C4(void) +{ + return 7; +} + +u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId) +{ + s32 i; + u8 trId, facilityClass; + + SetUpDataStruct(); + trId = trainerId - 1; + facilityClass = sHillData->tag.floors[sHillData->floorId].trainers[trId].facilityClass; + FreeDataStruct(); + + for (i = 0; i < ARRAY_COUNT(gUnknown_0862A3B4); i++) + { + if (gUnknown_0862A3B4[i].trainerClass == gFacilityClassToTrainerClass[facilityClass]) + return gUnknown_0862A3B4[i].musicId; + } + + return 0; +} + +static void sub_81D642C(struct Pokemon *mon, u8 level) +{ + u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + u32 exp = gExperienceTables[gBaseStats[species].growthRate][level]; + + SetMonData(mon, MON_DATA_EXP, &exp); + SetMonData(mon, MON_DATA_LEVEL, &level); + CalculateMonStats(mon); +} + +u8 sub_81D6490(void) +{ + u8 ret; + + SetUpDataStruct(); + ret = sHillData->tag.unkField_2; + FreeDataStruct(); + + return ret; +} + +static void sub_81D64AC(void) +{ + gSaveBlock2Ptr->frontier.field_EE0 = 0xFF; +} + +void sub_81D64C0(void) +{ + if (sub_81D6534() == TRUE) + LoadPalette(gUnknown_0862A5D4, 0x70, 0x20); +} + +static void sub_81D64DC(void) +{ + gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_EF9_1; +} + +static void sub_81D64FC(void) +{ + gSaveBlock2Ptr->frontier.field_EF9_1 = 1; +} + +static void sub_81D6518(void) +{ + gSaveBlock2Ptr->frontier.field_EF9_1 = 0; +} + +bool32 sub_81D6534(void) +{ + if (!sub_81D5C18() || GetCurrentTrainerHillMapId() == 6) + return FALSE; + + sub_81D5C00(); + if (gSpecialVar_Result == 0) + return FALSE; + else + return TRUE; +} + +static void sub_81D6568(void) +{ + if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d) + gSpecialVar_Result = 0; + else + gSpecialVar_Result = 1; +} + +static void sub_81D65A0(void) +{ + gSaveBlock1Ptr->trainerHill.tag = gSpecialVar_0x8005; + gSaveBlock1Ptr->trainerHill.field_3D68 = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005]; +} + +static u8 sub_81D65E8(u8 arg0) +{ + u8 var, i, modBy; + + var = 0; + for (i = 0; i < 4; i++) + { + var ^= sHillData->tag.floors[i].unk0 & 0x1F; + var ^= sHillData->tag.floors[i].unk1 & 0x1F; + } + + if (arg0) + modBy = 10; + else + modBy = 5; + + var %= modBy; + return var; +} + +static u16 sub_81D6640(void) +{ + u8 i; + const u16 *ptr; + s32 var = 0, var2, minutes, id; + + for (i = 0; i < 4; i++) + { + var += sHillData->tag.floors[i].unk0; + var += sHillData->tag.floors[i].unk1; + } + + var2 = var / 256; + var2 %= 2; + if (FlagGet(FLAG_SYS_GAME_CLEAR) && sHillData->tag.unkField_0 == 8) + i = sub_81D65E8(1); + else + i = sub_81D65E8(0); + + if (gSaveBlock1Ptr->trainerHill.tag == HILL_TAG_EXPERT) + i = (i + 1) % 10; + + ptr = gUnknown_0862A5CC[var2][i]; + minutes = (signed)(gSaveBlock1Ptr->trainerHill.field_3D64) / (60 * 60); + if (minutes < 12) + id = 0; + else if (minutes < 13) + id = 1; + else if (minutes < 14) + id = 2; + else if (minutes < 16) + id = 3; + else if (minutes < 18) + id = 4; + else + id = 5; + + return ptr[id]; +} diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index 5ddae218b..d57685423 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -109,7 +109,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8 { if (paletteTag == 0xFFFF) { - sCreatingSpriteTemplate.paletteTag |= 0xFFFF; + sCreatingSpriteTemplate.paletteTag = 0xFFFF; LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20); } else @@ -122,7 +122,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8 { if (paletteTag == 0xFFFF) { - sCreatingSpriteTemplate.paletteTag |= 0xFFFF; + sCreatingSpriteTemplate.paletteTag = 0xFFFF; LoadCompressedPalette(gTrainerFrontPicPaletteTable[species].data, 0x100 + paletteSlot * 0x10, 0x20); } else diff --git a/src/trainer_see.c b/src/trainer_see.c index eeebcb575..3846eca46 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -6,18 +6,16 @@ #include "field_effect.h" #include "field_player_avatar.h" #include "pokemon.h" -#include "pokenav.h" #include "script.h" #include "script_movement.h" #include "sprite.h" #include "task.h" #include "trainer_see.h" +#include "trainer_hill.h" #include "util.h" #include "battle_pyramid.h" #include "constants/field_effects.h" -extern bool32 InTrainerHill(void); -extern bool8 GetTrainerHillTrainerFlag(u8 eventObjectId); extern void sub_809BE48(u16 npcId); // this file's functions @@ -240,7 +238,7 @@ static u8 CheckTrainer(u8 eventObjectId) } else if (InTrainerHill() == TRUE) { - if (GetTrainerHillTrainerFlag(eventObjectId)) + if (GetHillTrainerFlag(eventObjectId)) return 0; } else diff --git a/sym_ewram.txt b/sym_ewram.txt index 825a4632f..7b5b6663e 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -289,13 +289,5 @@ gUnknown_0203CF4C: @ 203CF4C gUnknown_0203CF50: @ 203CF50 .space 0x4 -gUnknown_0203CF54: @ 203CF54 - .space 0x4 - -gUnknown_0203CF58: @ 203CF58 - .space 0x4 - -gUnknown_0203CF5C: @ 203CF5C - .space 0x4 - + .include "src/trainer_hill.o" .include "src/rayquaza_scene.o"