diff --git a/asm/berry_crush.s b/asm/berry_crush.s index 00bff2b56..2c2b55250 100755 --- a/asm/berry_crush.s +++ b/asm/berry_crush.s @@ -5,438 +5,8 @@ .text - thumb_func_start sub_80216E0 -sub_80216E0: @ 80216E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - adds r6, r0, 0 - str r1, [sp] - movs r0, 0 - str r0, [sp, 0x4] - movs r1, 0x4E - adds r1, r6 - mov r10, r1 - mov r9, r0 - ldrb r2, [r6, 0x9] - cmp r0, r2 - bcs _080217AE - ldr r7, =gUnknown_082F41CC -_08021704: - mov r3, r10 - ldrh r0, [r3, 0xA] - mov r4, r9 - lsls r1, r4, 1 - add r1, r9 - asrs r0, r1 - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - lsrs r1, 16 - mov r8, r1 - cmp r1, 0 - beq _0802179E - ldr r0, [sp, 0x4] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _08021748 - lsls r4, 2 - ldr r5, [sp] - adds r5, 0x24 - adds r0, r5, r4 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - b _0802175A - .pool -_08021748: - mov r0, r9 - lsls r4, r0, 2 - ldr r5, [sp] - adds r5, 0x24 - adds r0, r5, r4 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim -_0802175A: - adds r3, r5, r4 - ldr r2, [r3] - adds r2, 0x3E - ldrb r0, [r2] - movs r4, 0x5 - negs r4, r4 - adds r1, r4, 0 - ands r0, r1 - strb r0, [r2] - ldr r2, [r3] - adds r2, 0x2C - ldrb r0, [r2] - subs r4, 0x3C - adds r1, r4, 0 - ands r0, r1 - strb r0, [r2] - ldr r2, [r3] - movs r0, 0x3 - mov r1, r8 - ands r1, r0 - mov r8, r1 - subs r1, 0x1 - lsls r1, 1 - adds r0, r1, r7 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - strh r0, [r2, 0x24] - ldr r2, [r3] - ldr r3, =gUnknown_082F41CC+1 - adds r1, r3 - movs r0, 0 - ldrsb r0, [r1, r0] - strh r0, [r2, 0x26] -_0802179E: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldrb r4, [r6, 0x9] - cmp r9, r4 - bcc _08021704 -_080217AE: - ldr r0, [sp, 0x4] - cmp r0, 0 - bne _080217C0 - adds r2, r6, 0 - adds r2, 0x25 - ldrb r1, [r2] - b _0802189C - .pool -_080217C0: - ldrh r0, [r6, 0x28] - movs r1, 0x3 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r1, r8 - str r1, [sp, 0x8] - movs r2, 0 - mov r9, r2 - mov r3, r10 - ldrh r1, [r3, 0xC] - lsls r0, r1, 1 - adds r0, 0x3 - adds r6, 0x25 - str r6, [sp, 0xC] - adds r3, r1, 0 - cmp r9, r0 - bge _08021890 -_080217E8: - mov r4, r9 - lsls r1, r4, 2 - ldr r0, [sp] - adds r0, 0x4C - adds r7, r0, r1 - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0802187E - ldr r0, =sub_8022B28 - str r0, [r2, 0x1C] - lsls r1, r4, 1 - ldr r3, =gUnknown_082F41CC+6 - adds r0, r1, r3 - movs r4, 0 - ldrsb r4, [r0, r4] - adds r0, r4, 0 - adds r0, 0x78 - strh r0, [r2, 0x20] - ldr r2, [r7] - ldr r0, =gUnknown_082F41CC+7 - adds r1, r0 - movs r6, 0 - ldrsb r6, [r1, r6] - mov r1, r8 - lsls r0, r1, 2 - subs r0, 0x88 - subs r0, r6, r0 - strh r0, [r2, 0x22] - ldr r5, [r7] - ldr r2, [sp, 0x8] - lsls r1, r2, 2 - adds r0, r4, 0 - bl __divsi3 - adds r4, r0 - strh r4, [r5, 0x24] - ldr r0, [r7] - strh r6, [r0, 0x26] - mov r3, r10 - ldrb r1, [r3, 0x4] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08021860 - ldr r0, [r7] - movs r1, 0x1 - bl StartSpriteAnim - b _08021868 - .pool -_08021860: - ldr r0, [r7] - movs r1, 0 - bl StartSpriteAnim -_08021868: - mov r0, r8 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - mov r4, r10 - ldrh r3, [r4, 0xC] - cmp r0, 0x3 - bls _0802187E - movs r0, 0 - mov r8, r0 -_0802187E: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r0, r3, 1 - adds r0, 0x3 - cmp r9, r0 - blt _080217E8 -_08021890: - ldr r2, [sp, 0xC] - ldrb r1, [r2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080218A6 -_0802189C: - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - b _080218C4 -_080218A6: - ldr r3, [sp, 0x4] - cmp r3, 0x1 - bne _080218B4 - movs r0, 0x4E - bl PlaySE - b _080218BA -_080218B4: - movs r0, 0x4D - bl PlaySE -_080218BA: - ldr r4, [sp, 0xC] - ldrb r0, [r4] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4] -_080218C4: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80216E0 - thumb_func_start sub_80218D4 -sub_80218D4: @ 80218D4 - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r2, 0 - ldrb r0, [r5, 0x9] - cmp r2, r0 - bcs _08021906 - adds r4, r6, 0 - adds r4, 0x24 - movs r7, 0x4 - adds r3, r0, 0 -_080218EA: - lsls r0, r2, 2 - adds r0, r4, r0 - ldr r0, [r0] - adds r0, 0x3E - ldrb r1, [r0] - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _08021920 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r3 - bcc _080218EA -_08021906: - movs r2, 0 - adds r3, r6, 0 - adds r3, 0x4C - movs r4, 0x4 -_0802190E: - lsls r0, r2, 2 - adds r0, r3, r0 - ldr r0, [r0] - adds r0, 0x3E - ldrb r1, [r0] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _08021924 -_08021920: - movs r0, 0 - b _0802193C -_08021924: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xA - bls _0802190E - movs r1, 0x2C - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _0802193A - movs r0, 0 - strh r0, [r5, 0x2C] -_0802193A: - movs r0, 0x1 -_0802193C: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80218D4 - thumb_func_start sub_8021944 -sub_8021944: @ 8021944 - push {r4-r7,lr} - adds r6, r0, 0 - lsls r4, r1, 16 - lsrs r4, 16 - movs r7, 0 - movs r5, 0xE1 - lsls r5, 4 - adds r0, r4, 0 - adds r1, r5, 0 - bl __udivsi3 - strh r0, [r6, 0x4] - adds r0, r4, 0 - adds r1, r5, 0 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3C - bl __udivsi3 - strh r0, [r6, 0x6] - adds r0, r4, 0 - movs r1, 0x3C - bl __umodsi3 - lsls r0, 24 - asrs r0, 16 - movs r1, 0x4 - bl sub_8151534 - adds r2, r7, 0 - lsls r0, 16 - asrs r3, r0, 16 - movs r0, 0x7 - mov r12, r0 - ldr r5, =gUnknown_082F334C - movs r4, 0x1 -_08021990: - mov r0, r12 - subs r1, r0, r2 - adds r0, r3, 0 - asrs r0, r1 - ands r0, r4 - cmp r0, 0 - beq _080219A6 - lsls r0, r2, 2 - adds r0, r5 - ldr r0, [r0] - adds r7, r0 -_080219A6: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _08021990 - ldr r1, =0x000f4240 - adds r0, r7, 0 - bl __udivsi3 - strh r0, [r6, 0x8] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8021944 - - thumb_func_start sub_80219C8 -sub_80219C8: @ 80219C8 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - adds r6, r0, 0 - adds r4, r1, 0 - adds r5, r2, 0 - mov r8, r3 - lsls r6, 24 - lsrs r6, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - movs r2, 0x1 - negs r2, r2 - movs r0, 0x2 - mov r1, r8 - bl GetStringWidth - lsls r4, 2 - lsrs r0, 1 - subs r4, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r5, 1 - adds r0, r5 - ldr r1, =gUnknown_082F32D8 - adds r0, r1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x2 - adds r2, r4, 0 - movs r3, 0 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80219C8 thumb_func_start sub_8021A28 sub_8021A28: @ 8021A28 diff --git a/asm/pokemon_jump.s b/asm/pokemon_jump.s index 4327bb920..73582cb06 100755 --- a/asm/pokemon_jump.s +++ b/asm/pokemon_jump.s @@ -5,1446 +5,8 @@ .text - thumb_func_start sub_802CE9C -sub_802CE9C: @ 802CE9C - push {r4-r7,lr} - adds r7, r0, 0 - movs r5, 0 - movs r4, 0 - ldr r6, =gUnknown_082FBE58 -_0802CEA6: - ldr r1, =gUnknown_082FBEB8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - ldr r2, =gUnknown_082FBEA8 - lsls r1, r5, 1 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - movs r3, 0 - ldrsh r2, [r6, r3] - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r5, 2 - ldr r3, =0x000081d0 - adds r2, r7, r3 - adds r2, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r2] - adds r5, 0x1 - adds r6, 0x14 - adds r4, 0x1 - cmp r4, 0x3 - ble _0802CEA6 - movs r4, 0x3 - movs r6, 0x3C -_0802CEE8: - ldr r1, =gUnknown_082FBEB8 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - ldr r2, =gUnknown_082FBEA8 - lsls r1, r5, 1 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - ldr r2, =gUnknown_082FBE58 - adds r2, r6, r2 - movs r3, 0 - ldrsh r2, [r2, r3] - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r5, 2 - ldr r3, =0x000081d0 - adds r2, r7, r3 - adds r2, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r2] - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - adds r5, 0x1 - subs r6, 0x14 - subs r4, 0x1 - cmp r4, 0 - bge _0802CEE8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802CE9C + - thumb_func_start sub_802CF50 -sub_802CF50: @ 802CF50 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - str r0, [sp, 0x8] - cmp r1, 0x5 - ble _0802CF70 - movs r0, 0xA - subs r1, r0, r1 - movs r0, 0x3 - str r0, [sp] - ldr r2, [sp, 0x8] - ldrb r0, [r2, 0xF] - b _0802CF78 -_0802CF70: - movs r3, 0x2 - str r3, [sp] - ldr r7, [sp, 0x8] - ldrb r0, [r7, 0xE] -_0802CF78: - movs r6, 0 - lsls r2, r1, 1 - str r2, [sp, 0x4] - lsls r0, 4 - mov r9, r0 - lsls r1, 24 - mov r8, r1 - ldr r0, =gUnknown_082FBE58 - adds r4, r2, r0 - ldr r3, [sp] - lsls r3, 2 - mov r10, r3 - movs r5, 0x3 -_0802CF92: - lsls r0, r6, 2 - ldr r7, [sp, 0x8] - ldr r1, =0x000081d0 - adds r2, r7, r1 - adds r2, r0 - ldr r1, [r2] - ldrh r0, [r4] - strh r0, [r1, 0x22] - ldr r3, [r2] - ldrb r0, [r3, 0x5] - movs r7, 0xD - negs r7, r7 - adds r1, r7, 0 - ands r0, r1 - mov r1, r10 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r3, [r2] - ldrb r1, [r3, 0x5] - movs r0, 0xF - ands r0, r1 - mov r7, r9 - orrs r0, r7 - strb r0, [r3, 0x5] - ldr r0, [r2] - mov r2, r8 - lsrs r1, r2, 24 - bl StartSpriteAnim - adds r6, 0x1 - adds r4, 0x14 - subs r5, 0x1 - cmp r5, 0 - bge _0802CF92 - movs r5, 0x3 - ldr r0, =gUnknown_082FBE58 - ldr r3, [sp, 0x4] - adds r0, r3, r0 - adds r4, r0, 0 - adds r4, 0x3C - ldr r7, [sp] - lsls r7, 2 - mov r10, r7 -_0802CFE8: - lsls r0, r6, 2 - ldr r1, [sp, 0x8] - ldr r3, =0x000081d0 - adds r2, r1, r3 - adds r2, r0 - ldr r1, [r2] - ldrh r0, [r4] - strh r0, [r1, 0x22] - ldr r3, [r2] - ldrb r0, [r3, 0x5] - movs r7, 0xD - negs r7, r7 - adds r1, r7, 0 - ands r0, r1 - mov r1, r10 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r3, [r2] - ldrb r1, [r3, 0x5] - movs r0, 0xF - ands r0, r1 - mov r7, r9 - orrs r0, r7 - strb r0, [r3, 0x5] - ldr r0, [r2] - mov r2, r8 - lsrs r1, r2, 24 - bl StartSpriteAnim - adds r6, 0x1 - subs r4, 0x14 - subs r5, 0x1 - cmp r5, 0 - bge _0802CFE8 - 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 sub_802CF50 - - thumb_func_start sub_802D044 -sub_802D044: @ 802D044 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r0, 0 - str r0, [sp] - movs r0, 0x9 - movs r1, 0x7 - movs r2, 0x78 - movs r3, 0x50 - bl sub_802EB24 - adds r0, r4, 0 - bl sub_802CD3C - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802D044 - - thumb_func_start sub_802D068 -sub_802D068: @ 802D068 - push {lr} - bl sub_802EB84 - pop {r1} - bx r1 - thumb_func_end sub_802D068 - - thumb_func_start sub_802D074 -sub_802D074: @ 802D074 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - str r0, [r4] - bl sub_802D0BC - ldr r0, =sub_802D12C - movs r1, 0x3 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0x6] - ldr r2, [r4] - ldrb r0, [r2, 0x6] - movs r1, 0x2 - bl SetWordTaskArg - ldr r0, =sub_802D150 - bl sub_802D108 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D074 - - thumb_func_start sub_802D0AC -sub_802D0AC: @ 802D0AC - push {lr} - bl FreeAllWindowBuffers - bl sub_8034CC8 - pop {r0} - bx r0 - thumb_func_end sub_802D0AC - - thumb_func_start sub_802D0BC -sub_802D0BC: @ 802D0BC - movs r1, 0 - strh r1, [r0, 0x4] - str r1, [r0] - movs r1, 0xFF - strh r1, [r0, 0x12] - bx lr - thumb_func_end sub_802D0BC - - thumb_func_start sub_802D0C8 -sub_802D0C8: @ 802D0C8 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - ldr r4, =gUnknown_082FE18C -_0802D0D0: - ldr r0, [r4] - cmp r0, r6 - bne _0802D0DC - ldr r0, [r4, 0x4] - bl sub_802D108 -_0802D0DC: - adds r4, 0x8 - adds r5, 0x1 - cmp r5, 0x9 - bls _0802D0D0 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D0C8 - - thumb_func_start sub_802D0F0 -sub_802D0F0: @ 802D0F0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - ldr r1, [r0] - movs r0, 0x1 - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - bx lr - .pool - thumb_func_end sub_802D0F0 - - thumb_func_start sub_802D108 -sub_802D108: @ 802D108 - push {r4,lr} - adds r2, r0, 0 - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrb r0, [r0, 0x6] - movs r1, 0 - bl SetWordTaskArg - ldr r1, [r4] - movs r0, 0 - strh r0, [r1, 0x4] - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D108 - - thumb_func_start sub_802D12C -sub_802D12C: @ 802D12C - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - bne _0802D148 - adds r0, r1, 0 - movs r1, 0 - bl GetWordTaskArg - bl _call_via_r0 -_0802D148: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D12C - - thumb_func_start sub_802D150 -sub_802D150: @ 802D150 - push {r4-r6,lr} - sub sp, 0x8 - ldr r6, =gUnknown_02022D00 - ldr r1, [r6] - ldrh r5, [r1, 0x4] - cmp r5, 0x1 - bne _0802D160 - b _0802D298 -_0802D160: - cmp r5, 0x1 - bgt _0802D170 - cmp r5, 0 - beq _0802D178 - b _0802D2DA - .pool -_0802D170: - cmp r5, 0x2 - bne _0802D176 - b _0802D2D6 -_0802D176: - b _0802D2DA -_0802D178: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082FE164 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r0, =gUnknown_082FE174 - bl InitWindows - bl reset_temp_tile_data_buffers - ldr r0, [r6] - bl sub_802C974 - bl sub_802DD08 - ldr r0, =gPkmnJumpBgPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gPkmnJumpBgGfx - str r5, [sp] - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gPkmnJumpBgTilemap - movs r4, 0x1 - str r4, [sp] - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, =gPkmnJumpVenusaurPal - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gPkmnJumpVenusaurGfx - str r5, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gPkmnJumpVenusaurTilemap - str r4, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, =gPkmnJumpResultsPal - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gPkmnJumpResultsGfx - str r5, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gPkmnJumpResultsTilemap - str r4, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, =gPkmnJumpPal3 - movs r1, 0x20 - movs r2, 0x20 - bl LoadPalette - ldr r1, [r6] - movs r0, 0xD3 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - bl SetBgTilemapBuffer - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - bl sub_802DB8C - movs r0, 0 - bl sub_802DD64 - movs r0, 0 - movs r1, 0x1 - movs r2, 0xE0 - bl sub_8098C6C - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - bl ResetBgPositions - b _0802D2CC - .pool -_0802D298: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - bne _0802D2DA - bl sub_802DBF8 - ldr r0, [r6] - bl sub_802CE9C - ldr r0, [r6] - movs r1, 0x6 - bl sub_802CF50 - movs r0, 0x3 - bl ShowBg - movs r0, 0 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x1 - bl HideBg -_0802D2CC: - ldr r1, [r6] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D2DA -_0802D2D6: - movs r0, 0x1 - str r0, [r1] -_0802D2DA: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802D150 - - thumb_func_start sub_802D2E4 -sub_802D2E4: @ 802D2E4 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrh r0, [r0, 0x4] - cmp r0, 0x1 - beq _0802D310 - cmp r0, 0x1 - bgt _0802D300 - cmp r0, 0 - beq _0802D30A - b _0802D34A - .pool -_0802D300: - cmp r0, 0x2 - beq _0802D322 - cmp r0, 0x3 - beq _0802D33A - b _0802D34A -_0802D30A: - bl sub_802DE1C - b _0802D330 -_0802D310: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D34A - movs r0, 0 - bl sub_802DF70 - b _0802D330 -_0802D322: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D34A - bl sub_802DFD4 -_0802D330: - ldr r1, [r4] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D34A -_0802D33A: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D34A - ldr r1, [r4] - movs r0, 0x1 - str r0, [r1] -_0802D34A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802D2E4 - - thumb_func_start sub_802D350 -sub_802D350: @ 802D350 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrh r0, [r0, 0x4] - cmp r0, 0x1 - beq _0802D37C - cmp r0, 0x1 - bgt _0802D36C - cmp r0, 0 - beq _0802D376 - b _0802D3B6 - .pool -_0802D36C: - cmp r0, 0x2 - beq _0802D38E - cmp r0, 0x3 - beq _0802D3A6 - b _0802D3B6 -_0802D376: - bl sub_802DE1C - b _0802D39C -_0802D37C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D3B6 - movs r0, 0x1 - bl sub_802DF70 - b _0802D39C -_0802D38E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D3B6 - bl sub_802DFD4 -_0802D39C: - ldr r1, [r4] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D3B6 -_0802D3A6: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D3B6 - ldr r1, [r4] - movs r0, 0x1 - str r0, [r1] -_0802D3B6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802D350 - - thumb_func_start sub_802D3BC -sub_802D3BC: @ 802D3BC - push {r4,r5,lr} - bl sub_802C8AC - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - ldrh r0, [r0, 0x4] - cmp r0, 0 - beq _0802D3DC - cmp r0, 0x1 - beq _0802D410 - b _0802D43E - .pool -_0802D3DC: - movs r4, 0 - cmp r4, r5 - bge _0802D3F8 -_0802D3E2: - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x1C - adds r0, r1 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r4, 0x1 - cmp r4, r5 - blt _0802D3E2 -_0802D3F8: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022D00 - ldr r1, [r0] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D43E - .pool -_0802D410: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D43E - movs r4, 0 - cmp r4, r5 - bge _0802D436 -_0802D420: - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x1C - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - adds r4, 0x1 - cmp r4, r5 - blt _0802D420 -_0802D436: - ldr r0, =gUnknown_02022D00 - ldr r1, [r0] - movs r0, 0x1 - str r0, [r1] -_0802D43E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D3BC - - thumb_func_start sub_802D448 -sub_802D448: @ 802D448 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D4A4 - cmp r4, 0x1 - bgt _0802D464 - cmp r4, 0 - beq _0802D46A - b _0802D4EC - .pool -_0802D464: - cmp r4, 0x2 - beq _0802D4DC - b _0802D4EC -_0802D46A: - movs r0, 0x1 - movs r1, 0x8 - movs r2, 0x14 - movs r3, 0x2 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_WantToPlayAgain2 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D4D2 - .pool -_0802D4A4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D4EC - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl DrawTextBorderOuter - movs r0, 0x17 - movs r1, 0x7 - movs r2, 0 - bl sub_802DB18 - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D4D2: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D4EC -_0802D4DC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D4EC - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D4EC: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D448 - - thumb_func_start sub_802D4F4 -sub_802D4F4: @ 802D4F4 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D550 - cmp r4, 0x1 - bgt _0802D510 - cmp r4, 0 - beq _0802D516 - b _0802D58E - .pool -_0802D510: - cmp r4, 0x2 - beq _0802D57E - b _0802D58E -_0802D516: - movs r0, 0x2 - movs r1, 0x7 - movs r2, 0x1A - movs r3, 0x4 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_SavingDontTurnOffPower - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D574 - .pool -_0802D550: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D58E - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl DrawTextBorderOuter - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D574: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D58E -_0802D57E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D58E - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D58E: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D4F4 - - thumb_func_start sub_802D598 -sub_802D598: @ 802D598 - push {r4,r5,lr} - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0 - beq _0802D5B0 - cmp r4, 0x1 - beq _0802D5C8 - b _0802D5DE - .pool -_0802D5B0: - bl sub_802DA14 - bl sub_8198C78 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D5DE -_0802D5C8: - bl sub_802DA44 - cmp r0, 0 - bne _0802D5DE - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D5DE - ldr r0, [r5] - str r4, [r0] -_0802D5DE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D598 - - thumb_func_start sub_802D5E4 -sub_802D5E4: @ 802D5E4 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D640 - cmp r4, 0x1 - bgt _0802D600 - cmp r4, 0 - beq _0802D606 - b _0802D67E - .pool -_0802D600: - cmp r4, 0x2 - beq _0802D66E - b _0802D67E -_0802D606: - movs r0, 0x2 - movs r1, 0x8 - movs r2, 0x16 - movs r3, 0x4 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_SomeoneDroppedOut2 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D664 - .pool -_0802D640: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D67E - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl DrawTextBorderOuter - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D664: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D67E -_0802D66E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D67E - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D67E: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D5E4 - - thumb_func_start sub_802D688 -sub_802D688: @ 802D688 - push {r4,r5,lr} - sub sp, 0xC - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0x1 - beq _0802D6E4 - cmp r4, 0x1 - bgt _0802D6A4 - cmp r4, 0 - beq _0802D6AA - b _0802D722 - .pool -_0802D6A4: - cmp r4, 0x2 - beq _0802D712 - b _0802D722 -_0802D6AA: - movs r0, 0x7 - movs r1, 0xA - movs r2, 0x10 - movs r3, 0x2 - bl sub_802DA9C - ldr r1, [r5] - strh r0, [r1, 0x12] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_CommunicationStandby4 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - b _0802D708 - .pool -_0802D6E4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D722 - ldr r0, [r5] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl DrawTextBorderOuter - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802D708: - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D722 -_0802D712: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802D722 - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1] -_0802D722: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D688 - - thumb_func_start sub_802D72C -sub_802D72C: @ 802D72C - push {r4,r5,lr} - ldr r5, =gUnknown_02022D00 - ldr r0, [r5] - ldrh r4, [r0, 0x4] - cmp r4, 0 - beq _0802D744 - cmp r4, 0x1 - beq _0802D752 - b _0802D75E - .pool -_0802D744: - bl sub_802D044 - ldr r1, [r5] - ldrh r0, [r1, 0x4] - adds r0, 0x1 - strh r0, [r1, 0x4] - b _0802D75E -_0802D752: - bl sub_802D068 - cmp r0, 0 - bne _0802D75E - ldr r0, [r5] - str r4, [r0] -_0802D75E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802D72C - - thumb_func_start sub_802D764 -sub_802D764: @ 802D764 - push {lr} - ldr r1, =gUnknown_02022D00 - ldr r0, [r1] - movs r2, 0 - strb r2, [r0, 0xA] - ldr r0, [r1] - strb r2, [r0, 0xB] - ldr r2, [r1] - movs r0, 0x6 - strb r0, [r2, 0xC] - ldr r0, [r1] - ldrb r0, [r0, 0xC] - bl sub_802DC9C - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D764 - - thumb_func_start sub_802D788 -sub_802D788: @ 802D788 - push {r4,lr} - ldr r0, =gUnknown_02022D00 - ldr r2, [r0] - ldrb r3, [r2, 0xA] - adds r4, r0, 0 - cmp r3, 0 - beq _0802D7A0 - cmp r3, 0x1 - beq _0802D7DA - b _0802D7DE - .pool -_0802D7A0: - ldrb r0, [r2, 0xB] - adds r0, 0x1 - strb r0, [r2, 0xB] - ldr r1, [r4] - ldrb r0, [r1, 0xB] - cmp r0, 0xA - bls _0802D7CA - strb r3, [r1, 0xB] - ldr r0, [r4] - ldrb r1, [r0, 0xC] - adds r1, 0x1 - strb r1, [r0, 0xC] - ldr r1, [r4] - ldrb r0, [r1, 0xC] - cmp r0, 0x9 - bls _0802D7CA - strb r3, [r1, 0xC] - ldr r1, [r4] - ldrb r0, [r1, 0xA] - adds r0, 0x1 - strb r0, [r1, 0xA] -_0802D7CA: - ldr r0, [r4] - ldrb r0, [r0, 0xC] - bl sub_802DC9C - ldr r0, [r4] - ldrb r0, [r0, 0xC] - cmp r0, 0x7 - bne _0802D7DE -_0802D7DA: - movs r0, 0 - b _0802D7E0 -_0802D7DE: - movs r0, 0x1 -_0802D7E0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802D788 - - thumb_func_start sub_802D7E8 -sub_802D7E8: @ 802D7E8 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r1, 0 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - lsrs r4, 16 - ldr r5, =gUnknown_02022D00 - ldr r1, [r5] - adds r1, 0x26 - adds r2, r4, 0 - bl CopyItemNameHandlePlural - ldr r0, [r5] - adds r0, 0x66 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - bl DynamicPlaceholderTextUtil_Reset - ldr r1, [r5] - adds r1, 0x26 - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r1, [r5] - adds r1, 0x66 - movs r0, 0x1 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r0, [r5] - adds r0, 0xA6 - ldr r1, =gText_AwesomeWonF701F700 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - movs r0, 0x4 - movs r1, 0x8 - movs r2, 0x16 - movs r3, 0x4 - bl sub_802DA9C - ldr r2, [r5] - movs r4, 0 - movs r3, 0 - strh r0, [r2, 0x12] - lsls r0, 24 - lsrs r0, 24 - adds r2, 0xA6 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r3, [sp, 0x8] - movs r1, 0x1 - bl AddTextPrinterParameterized - ldr r0, [r5] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x0000016f - strh r0, [r1, 0x14] - strb r4, [r1, 0xD] - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D7E8 - - thumb_func_start sub_802D884 -sub_802D884: @ 802D884 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 16 - lsrs r0, 16 - ldr r4, =gUnknown_02022D00 - ldr r1, [r4] - adds r1, 0x26 - bl CopyItemName - bl DynamicPlaceholderTextUtil_Reset - ldr r1, [r4] - adds r1, 0x26 - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r0, [r4] - adds r0, 0xA6 - ldr r1, =gText_FilledStorageSpace2 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - movs r0, 0x4 - movs r1, 0x8 - movs r2, 0x16 - movs r3, 0x4 - bl sub_802DA9C - ldr r2, [r4] - movs r6, 0 - movs r5, 0 - strh r0, [r2, 0x12] - lsls r0, 24 - lsrs r0, 24 - adds r2, 0xA6 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - strh r5, [r0, 0x14] - strb r6, [r0, 0xD] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D884 - - thumb_func_start sub_802D8FC -sub_802D8FC: @ 802D8FC - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 16 - lsrs r0, 16 - ldr r4, =gUnknown_02022D00 - ldr r1, [r4] - adds r1, 0x26 - bl CopyItemName - bl DynamicPlaceholderTextUtil_Reset - ldr r1, [r4] - adds r1, 0x26 - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r0, [r4] - adds r0, 0xA6 - ldr r1, =gText_CantHoldMore - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - movs r0, 0x4 - movs r1, 0x9 - movs r2, 0x16 - movs r3, 0x2 - bl sub_802DA9C - ldr r2, [r4] - movs r6, 0 - movs r5, 0 - strh r0, [r2, 0x12] - lsls r0, 24 - lsrs r0, 24 - adds r2, 0xA6 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - strh r5, [r0, 0x14] - strb r6, [r0, 0xD] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802D8FC - - thumb_func_start sub_802D974 -sub_802D974: @ 802D974 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrb r0, [r0, 0xD] - cmp r0, 0x1 - beq _0802D9C8 - cmp r0, 0x1 - bgt _0802D990 - cmp r0, 0 - beq _0802D99A - b _0802DA0C - .pool -_0802D990: - cmp r0, 0x2 - beq _0802D9EE - cmp r0, 0x3 - beq _0802DA02 - b _0802DA0C -_0802D99A: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802DA0C - ldr r0, [r4] - ldrb r0, [r0, 0x12] - bl PutWindowTilemap - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - movs r2, 0xE - bl DrawTextBorderOuter - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r4] - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] - b _0802DA0C -_0802D9C8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802DA0C - ldr r1, [r4] - ldrh r0, [r1, 0x14] - cmp r0, 0 - bne _0802D9E0 - ldrb r0, [r1, 0xD] - adds r0, 0x2 - b _0802DA00 -_0802D9E0: - ldrh r0, [r1, 0x14] - bl PlayFanfare - ldr r1, [r4] - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] -_0802D9EE: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _0802DA0C - ldr r0, =gUnknown_02022D00 - ldr r1, [r0] - ldrb r0, [r1, 0xD] - adds r0, 0x1 -_0802DA00: - strb r0, [r1, 0xD] -_0802DA02: - movs r0, 0 - b _0802DA0E - .pool -_0802DA0C: - movs r0, 0x1 -_0802DA0E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802D974 - - thumb_func_start sub_802DA14 -sub_802DA14: @ 802DA14 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldrh r0, [r0, 0x12] - cmp r0, 0xFF - beq _0802DA38 - lsls r0, 24 - lsrs r0, 24 - bl rbox_fill_rectangle - ldr r0, [r4] - ldrb r0, [r0, 0x12] - movs r1, 0x1 - bl CopyWindowToVram - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0xD] -_0802DA38: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DA14 thumb_func_start sub_802DA44 sub_802DA44: @ 802DA44 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index f63d755ad..5d0e562bc 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -82,4 +82,7 @@ #define NUM_STATS 6 #define NUM_BATTLE_STATS 8 +// Shiny odds +#define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536 + #endif // GUARD_CONSTANTS_POKEMON_H diff --git a/include/pokemon_jump.h b/include/pokemon_jump.h index 9dbf194d0..d137c37b2 100644 --- a/include/pokemon_jump.h +++ b/include/pokemon_jump.h @@ -3,7 +3,7 @@ #include "main.h" -void sub_802EB24(u8, u8, u8, u8, u8); +void sub_802EB24(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4); bool32 sub_802EB84(void); void sub_802A9A8(u16 monId, MainCallback callback); bool32 sub_802C908(u16 species); diff --git a/include/strings.h b/include/strings.h index 36a92281e..f30dffa7f 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2707,6 +2707,14 @@ extern const u8 gText_Symbols[]; extern const u8 gText_Register2[]; extern const u8 gText_Exit2[]; +// Pokemon jump +extern const u8 gText_WantToPlayAgain2[]; +extern const u8 gText_SomeoneDroppedOut2[]; +extern const u8 gText_CommunicationStandby4[]; +extern const u8 gText_AwesomeWonF701F700[]; +extern const u8 gText_FilledStorageSpace2[]; +extern const u8 gText_CantHoldMore[]; + // Pokenav Match Call extern const u8 gText_CallCantBeMadeHere[]; extern const u8 gText_NumberRegistered[]; diff --git a/ld_script.txt b/ld_script.txt index 42a94e9aa..0a08cc75f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -3,6 +3,12 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; +/* Modify the following load addresses as needed to make more room. Alternately, delete both the + declarations below and their references further down to get rid of the gaps. */ + +__anim_mon_load_address = 0x8b00000; +__gfx_load_address = 0x8c00000; + SECTIONS { . = 0x2000000; @@ -1237,27 +1243,13 @@ SECTIONS { data/multiboot_pokemon_colosseum.o(.rodata); } =0 - gap1 : - { - gap1_start = ABSOLUTE(.); - BYTE(0x00) - . = 0x8B00000 - gap1_start; - } =0 - - anim_mon_front_pic_data : + anim_mon_front_pic_data __anim_mon_load_address : ALIGN(4) { src/anim_mon_front_pics.o(.rodata); } =0 - gap2 : - { - gap2_start = ABSOLUTE(.); - BYTE(0x00) - . = 0x8C00000 - gap2_start; - } =0 - - gfx_data : + gfx_data __gfx_load_address : ALIGN(4) { src/graphics.o(.rodata); diff --git a/src/battle_anim_special.c b/src/battle_anim_special.c index 740340d14..6780f0a32 100755 --- a/src/battle_anim_special.c +++ b/src/battle_anim_special.c @@ -2029,7 +2029,7 @@ void sub_8172EF0(u8 battler, struct Pokemon *mon) if (IsBattlerSpriteVisible(battler)) { shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); - if (shinyValue < 8) + if (shinyValue < SHINY_ODDS) isShiny = TRUE; if (isShiny) diff --git a/src/berry_crush.c b/src/berry_crush.c index a5d964cc9..6259e0a41 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -55,7 +55,10 @@ struct BerryCrushGame_138_C struct BerryCrushGame_138 { - u8 filler0[0xC]; + u8 filler0[0x4]; + u16 unk4; + u16 unk6; + u16 unk8; struct BerryCrushGame_138_C *unkC[5]; u8 filler1C[0x4]; struct Sprite *unk24[5]; @@ -105,7 +108,7 @@ struct BerryCrushGame u8 filler26[0x2]; u16 unk28; u16 unk2A; - u16 unk2C; + s16 unk2C; u8 filler2E[0x8]; u8 unk36[0xA]; struct BerryCrushGame_40 unk40; @@ -149,6 +152,8 @@ extern const struct SpriteTemplate gUnknown_082F436C; extern const u16 gUnknown_082F41E8[]; extern const s8 gUnknown_082F41CC[][2]; extern const s8 gUnknown_082F41D2[][2]; +extern const u32 gUnknown_082F334C[]; +extern const u8 gUnknown_082F32D8[][3]; struct BerryCrushGame *sub_8020C00(void) { @@ -700,76 +705,121 @@ void sub_80216A8(struct BerryCrushGame *arg0) } } -// void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) -// { -// u8 sp4; -// struct BerryCrushGame_4E *var4E; -// u8 i; -// u16 var0; +void sub_80216E0(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) +{ + u8 sp4; + struct BerryCrushGame_4E *var4E; + u8 i; + u16 var, var2; -// sp4 = 0; -// var4E = &arg0->unk40.unkE; -// for (i = 0; i < arg0->unk9; i++) -// { -// var0 = var4E->unkA >> (i * 3); -// var0 &= 7; -// if (var0) -// { -// int offset; -// sp4++; -// if (var0 & 0x4) -// StartSpriteAnim(arg1->unk24[i], 1); -// else -// StartSpriteAnim(arg1->unk24[i], 0); + sp4 = 0; + var4E = &arg0->unk40.unkE; + for (i = 0; i < arg0->unk9; i++) + { + var = var4E->unkA >> (i * 3); + var &= 7; + if (var) + { + sp4++; + if (var & 0x4) + StartSpriteAnim(arg1->unk24[i], 1); + else + StartSpriteAnim(arg1->unk24[i], 0); -// arg1->unk24[i]->invisible = 0; -// arg1->unk24[i]->animPaused = 0; -// offset = (var0 % 4) - 1; -// arg1->unk24[i]->pos2.x = gUnknown_082F41CC[offset][0]; -// arg1->unk24[i]->pos2.y = gUnknown_082F41CC[offset][1]; -// } -// } + arg1->unk24[i]->invisible = 0; + arg1->unk24[i]->animPaused = 0; + arg1->unk24[i]->pos2.x = gUnknown_082F41CC[(var % 4) - 1][0]; + arg1->unk24[i]->pos2.y = gUnknown_082F41CC[(var % 4) - 1][1]; + } + } -// if (sp4 == 0) -// { -// arg0->unk25_2 = 0; -// } -// else -// { -// u8 var3 = arg0->unk28 % 3; -// u16 var2 = var3; -// for (i = 0; i < var4E->unkC * 2 + 3; i++) -// { -// if (arg1->unk4C[i]->invisible) -// { -// arg1->unk4C[i]->callback = sub_8022B28; -// arg1->unk4C[i]->pos1.x = gUnknown_082F41D2[i][0] + 120; -// arg1->unk4C[i]->pos1.y = gUnknown_082F41D2[i][1] + (136 - var2 * 4); -// arg1->unk4C[i]->pos2.x = gUnknown_082F41D2[i][0] / (var3 * 4); -// arg1->unk4C[i]->pos2.y = gUnknown_082F41D2[i][1]; -// if (var4E->unk4 & 0x2) -// StartSpriteAnim(arg1->unk4C[i], 1); -// else -// StartSpriteAnim(arg1->unk4C[i], 0); + if (sp4 == 0) + { + arg0->unk25_2 = 0; + } + else + { + var = (u8)(arg0->unk28 % 3); + var2 = var; + for (i = 0; i < var4E->unkC * 2 + 3; i++) + { + if (arg1->unk4C[i]->invisible) + { + arg1->unk4C[i]->callback = sub_8022B28; + arg1->unk4C[i]->pos1.x = gUnknown_082F41D2[i][0] + 120; + arg1->unk4C[i]->pos1.y = gUnknown_082F41D2[i][1] + 136 - (var * 4); + arg1->unk4C[i]->pos2.x = gUnknown_082F41D2[i][0] + (gUnknown_082F41D2[i][0] / (var2 * 4)); + arg1->unk4C[i]->pos2.y = gUnknown_082F41D2[i][1]; + if (var4E->unk4 & 0x2) + StartSpriteAnim(arg1->unk4C[i], 1); + else + StartSpriteAnim(arg1->unk4C[i], 0); -// var2++; -// if (var2 > 3) -// var2 = 0; -// } -// } + var++; + if (var > 3) + var = 0; + } + } -// if (arg0->unk25_2) -// { -// arg0->unk25_2 = 0; -// } -// else -// { -// if (sp4 == 1) -// PlaySE(SE_TOY_DANGO); -// else -// PlaySE(SE_TOY_KABE); + if (arg0->unk25_2) + { + arg0->unk25_2 = 0; + } + else + { + if (sp4 == 1) + PlaySE(SE_TOY_DANGO); + else + PlaySE(SE_TOY_KABE); -// arg0->unk25_2 = 1; -// } -// } -// } + arg0->unk25_2 = 1; + } + } +} + +bool32 sub_80218D4(struct BerryCrushGame *arg0, struct BerryCrushGame_138 *arg1) +{ + u8 i; + + for (i = 0; i < arg0->unk9; i++) + { + if (!arg1->unk24[i]->invisible) + return FALSE; + } + + for (i = 0; i < 11; i++) + { + if (!arg1->unk4C[i]->invisible) + return FALSE; + } + + if (arg0->unk2C != 0) + arg0->unk2C = 0; + + return TRUE; +} + +void sub_8021944(struct BerryCrushGame_138 *arg0, u16 arg1) +{ + u8 i = 0; + u32 r7 = 0; + s16 r3 = 0; + + arg0->unk4 = arg1 / 3600; + arg0->unk6 = (arg1 % 3600) / 60; + r3 = sub_8151534((arg1 % 60) << 8, 4); + + for (i = 0; i < 8; i++) + { + if ((r3 >> (7 - i)) & 1) + r7 += gUnknown_082F334C[i]; + } + + arg0->unk8 = r7 / 1000000; +} + +void sub_80219C8(u8 windowId, u8 left, u8 colorId, const u8 *string) +{ + left = (left * 4) - (GetStringWidth(2, string, -1) / 2u); + AddTextPrinterParameterized3(windowId, 2, left, 0, gUnknown_082F32D8[colorId], 0, string); +} diff --git a/src/item_menu.c b/src/item_menu.c index 845ffabb6..5b47a567b 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -81,7 +81,7 @@ void TaskCloseBagMenu_2(u8); u8 AddItemMessageWindow(u8); void bag_menu_RemoveBagItem_message_window(u8); void set_callback3_to_bag(u8); -void sub_81ABC54(u8, s16); +void PrintItemDepositAmount(u8, s16); u8 BagMenu_AddWindow(u8); u8 GetSwitchBagPocketDirection(void); void SwitchBagPocket(u8, s16, u16); @@ -1050,10 +1050,10 @@ void BagMenu_InitListsMenu(u8 taskId) void sub_81ABC3C(u8 a) { - sub_81ABC54(BagMenu_AddWindow(a), 1); + PrintItemDepositAmount(BagMenu_AddWindow(a), 1); } -void sub_81ABC54(u8 a, s16 b) +void PrintItemDepositAmount(u8 a, s16 b) { u8 r3 = (gBagPositionStruct.pocket == BERRIES_POCKET) ? 3 : 2; ConvertIntToDecimalStringN(gStringVar1, b, 2, r3); @@ -1704,7 +1704,7 @@ void Task_ChooseHowManyToToss(u8 taskId) if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) { - sub_81ABC54(gBagMenu->unk817, data[8]); + PrintItemDepositAmount(gBagMenu->unk817, data[8]); } else if (gMain.newKeys & A_BUTTON) { @@ -2056,7 +2056,7 @@ void sub_81ADA7C(u8 taskId) if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE) { - sub_81ABC54(gBagMenu->unk817, data[8]); + PrintItemDepositAmount(gBagMenu->unk817, data[8]); } else if (gMain.newKeys & A_BUTTON) { diff --git a/src/pokemon.c b/src/pokemon.c index c54e8ad2c..6ad47d346 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2183,7 +2183,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, { value = Random32(); shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality); - } while (shinyValue < 8); + } while (shinyValue < SHINY_ODDS); } else if (otIdType == OT_ID_PRESET) //Pokemon has a preset OT ID { @@ -6332,7 +6332,7 @@ const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 return gMonPaletteTable[0].data; shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); - if (shinyValue < 8) + if (shinyValue < SHINY_ODDS) return gMonShinyPaletteTable[species].data; else return gMonPaletteTable[species].data; @@ -6351,7 +6351,7 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u u32 shinyValue; shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); - if (shinyValue < 8) + if (shinyValue < SHINY_ODDS) return &gMonShinyPaletteTable[species]; else return &gMonPaletteTable[species]; @@ -6525,7 +6525,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality) { bool8 retVal = FALSE; u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality); - if (shinyValue < 8) + if (shinyValue < SHINY_ODDS) retVal = TRUE; return retVal; } diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 3a64497bd..61f899801 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -1,7 +1,9 @@ #include "global.h" #include "alloc.h" +#include "bg.h" #include "data.h" #include "decompress.h" +#include "dynamic_placeholder_text_util.h" #include "event_data.h" #include "item.h" #include "link.h" @@ -10,11 +12,14 @@ #include "menu.h" #include "palette.h" #include "random.h" +#include "rom_8034C54.h" #include "save.h" #include "sound.h" #include "sprite.h" #include "string_util.h" +#include "strings.h" #include "task.h" +#include "text_window.h" #include "trig.h" #include "pokemon.h" #include "pokemon_jump.h" @@ -43,6 +48,33 @@ struct PokemonJump1_82E4 u8 unk1C[11]; }; +struct PokemonJump2 +{ + int unk0; + u16 unk4; + u8 unk6; + u8 filler7[0xa - 0x7]; + u8 unkA; + u8 unkB; + u8 unkC; + u8 unkD; + u8 unkE; + u8 unkF; + u16 filler10; + u16 unk12; + u16 unk14; + u8 filler16[0x1c - 0x16]; + u16 unk1C[5]; + u8 txtBuff[2][0x40]; + u8 strBuff[0x100]; + u16 tilemapBuffer[(0x81a8 - 0x1a6) / 2]; // 0x1A6 + struct Sprite *unk81A8[MAX_RFU_PLAYERS]; + struct Sprite *unk81BC[MAX_RFU_PLAYERS]; + struct Sprite *unk81D0[8]; + u8 filler81F0[0xC]; + u8 unk81FC[MAX_RFU_PLAYERS]; +}; + struct PokemonJump1 { MainCallback returnCallback; @@ -102,8 +134,7 @@ struct PokemonJump1 u8 unk8B[MAX_RFU_PLAYERS]; u16 unk90[MAX_RFU_PLAYERS]; u16 unk9A[MAX_RFU_PLAYERS]; - void **unkA4; - u8 fillerA8[0x8200]; + struct PokemonJump2 unkA4; struct PokemonJump1_MonInfo unk82A8[MAX_RFU_PLAYERS]; struct PokemonJump1_82E4 unk82E4[MAX_RFU_PLAYERS]; struct PokemonJump1_82E4 *unk83AC; @@ -125,20 +156,6 @@ struct Unk802B078 int unk8; }; - -struct PokemonJump2 -{ - u8 filler0[0xE]; - u8 unkE; - u8 unkF; - u8 filler10[0x8198]; - struct Sprite *unk81A8[MAX_RFU_PLAYERS]; - struct Sprite *unk81BC[MAX_RFU_PLAYERS]; - struct Sprite *unk81D0[8]; - u8 filler81F0[0xC]; - u8 unk81FC[MAX_RFU_PLAYERS]; -}; - static void sub_802AA60(struct PokemonJump1 *); void sub_802AA94(struct PokemonJump1 *); void sub_802AB20(void); @@ -216,15 +233,16 @@ static void sub_802CC40(struct Sprite *sprite); static void sub_802CD08(struct Sprite *sprite); static void sub_802CDD4(struct Sprite *sprite); void sub_802DC9C(u32); -void sub_802D074(void *); +void sub_802D074(struct PokemonJump2 *); +void sub_802D0BC(struct PokemonJump2 *); void sub_802D0AC(void); void sub_802D0C8(int); -int sub_802D0F0(void); +bool32 sub_802D0F0(void); void sub_802D764(void); bool32 sub_802D788(void); -void sub_802D7E8(u16, u16); -void sub_802D884(u16); -void sub_802D8FC(u16); +void sub_802D7E8(u16 itemId, u16 quantity); +void sub_802D884(u16 itemId); +void sub_802D8FC(u16 itemId); bool32 sub_802D974(void); void sub_802DA14(void); void sub_802DC80(int, s8); @@ -249,6 +267,7 @@ bool32 sub_802E264(struct PokemonJump1_82E4 *, int, u8 *, u16 *); bool32 sub_802E2D0(struct PokemonJump1_82E4 *, int); int sub_802E354(int, u16, u16); void sub_802E3A8(void); +void sub_802D12C(u8 taskId); EWRAM_DATA struct PokemonJump1 *gUnknown_02022CFC = NULL; EWRAM_DATA struct PokemonJump2 *gUnknown_02022D00 = NULL; @@ -388,15 +407,33 @@ extern const u16 gUnknown_082FB64C[4]; extern const u16 gUnknown_082FB654[]; extern const s8 gUnknown_082FB65C[][48]; extern const int gUnknown_082FB6EC[]; -extern const int gUnknown_082FB714[]; +extern const u32 gUnknown_082FB714[][2]; extern const u16 gUnknown_082FB704[8]; extern const struct CompressedSpriteSheet gUnknown_082FBE08[5]; extern const struct SpritePalette gUnknown_082FBE30[2]; extern const struct SpriteTemplate gUnknown_082FBE40; extern const struct SpriteTemplate gUnknown_082FC00C; -extern const s16 gUnknown_082FBE58[]; +extern const s16 gUnknown_082FBE58[][10]; extern const s16 gUnknown_082FBEA8[8]; -extern const struct SpriteTemplate gUnknown_082FBEB8[4]; +extern const struct SpriteTemplate *gUnknown_082FBEB8[4]; +extern const struct BgTemplate gUnknown_082FE164[4]; +extern const struct WindowTemplate gUnknown_082FE174[]; +extern const u16 gPkmnJumpBgPal[]; +extern const u16 gPkmnJumpVenusaurPal[]; +extern const u16 gPkmnJumpResultsPal[]; +extern const u16 gPkmnJumpPal3[]; +extern const u32 gPkmnJumpVenusaurGfx[]; +extern const u32 gPkmnJumpBgTilemap[]; +extern const u32 gPkmnJumpBgGfx[]; +extern const u32 gPkmnJumpVenusaurTilemap[]; +extern const u32 gPkmnJumpResultsGfx[]; +extern const u32 gPkmnJumpResultsTilemap[]; + +struct +{ + int id; + void (*func)(void); +} extern const gUnknown_082FE18C[10]; void sub_802A9A8(u16 partyIndex, MainCallback callback) { @@ -1145,8 +1182,6 @@ static bool32 sub_802B720(void) static bool32 sub_802B7E0(void) { - int var0; - switch (gUnknown_02022CFC->unkA) { case 0: @@ -1155,8 +1190,7 @@ static bool32 sub_802B7E0(void) gUnknown_02022CFC->unkA++; break; case 1: - var0 = sub_802D0F0(); - if (!var0) + if (!sub_802D0F0()) { sub_802DDF4(gUnknown_02022CFC->unk6); gUnknown_02022CFC->unk3C = 0; @@ -1813,7 +1847,7 @@ static void sub_802C398(int multiplayerId) sub_802DC80(multiplayerId, var1); if (!var1 && multiplayerId == gUnknown_02022CFC->unk6) sub_802C1BC(); - + player->unk0 = var1; } @@ -2028,7 +2062,7 @@ static void sub_802C7A0(u16 arg0) static bool32 sub_802C7BC(void) { - if (gUnknown_02022CFC->unk78 >= gUnknown_082FB714[0]) + if (gUnknown_02022CFC->unk78 >= gUnknown_082FB714[0][0]) return TRUE; else return FALSE; @@ -2053,6 +2087,22 @@ static u16 sub_802C818(void) return gUnknown_082FB704[index]; } +#ifdef NONMATCHING +// Impossible to match. +static u16 sub_802C838(void) +{ + u32 val, i; + + val = 0; + for (i = 0; i < 5; val = gUnknown_082FB714[i][1], i++) + { + if (gUnknown_02022CFC->unk78 < gUnknown_082FB714[i][0]) + break; + } + + return val; +} +#else NAKED static u16 sub_802C838(void) { @@ -2091,12 +2141,13 @@ _0802C874:\n\ pop {r1}\n\ bx r1"); } +#endif static u16 sub_802C880(u16 item, u16 quantity) { while (quantity && !CheckBagHasSpace(item, quantity)) quantity--; - + return quantity; } @@ -2151,7 +2202,7 @@ void sub_802C974(struct PokemonJump2 *arg0) for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE08); i++) LoadCompressedSpriteSheet(&gUnknown_082FBE08[i]); - + for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE30); i++) LoadSpritePalette(&gUnknown_082FBE30[i]); @@ -2382,25 +2433,557 @@ void sub_802CE48(struct PokemonJump2 *arg0, s16 x, s16 y, u8 multiplayerId) } } -// void sub_802CE9C(struct PokemonJump2 *arg0) -// { -// int i; -// int count; -// u8 spriteId; +void sub_802CE9C(struct PokemonJump2 *arg0) +{ + int i; + int count; + u8 spriteId; -// count = 0; -// for (i = 0; i < 4; i++) -// { -// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2); -// arg0->unk81D0[count] = &gSprites[spriteId]; -// count++; -// } + count = 0; + for (i = 0; i < 4; i++) + { + spriteId = CreateSprite(gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i][0], 2); + arg0->unk81D0[count] = &gSprites[spriteId]; + count++; + } -// for (i = 0; i < 4; i++) -// { -// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2); -// arg0->unk81D0[count] = &gSprites[spriteId]; -// arg0->unk81D0[count]->hFlip = 1; -// count++; -// } -// } + for (i = 3; i >= 0; i--) + { + spriteId = CreateSprite(gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i][0], 2); + arg0->unk81D0[count] = &gSprites[spriteId]; + arg0->unk81D0[count]->hFlip = 1; + count++; + } +} + +void sub_802CF50(struct PokemonJump2 *arg0, int arg1) +{ + int i, count, palNum; + int priority; + + if (arg1 > 5) + { + arg1 = 10 - arg1; + priority = 3; + palNum = arg0->unkF; + } + else + { + priority = 2; + palNum = arg0->unkE; + } + + count = 0; + for (i = 0; i < 4; i++) + { + arg0->unk81D0[count]->pos1.y = gUnknown_082FBE58[i][arg1]; + arg0->unk81D0[count]->oam.priority = priority; + arg0->unk81D0[count]->oam.paletteNum = palNum; + StartSpriteAnim(arg0->unk81D0[count], arg1); + count++; + } + + for (i = 3; i >= 0; i--) + { + arg0->unk81D0[count]->pos1.y = gUnknown_082FBE58[i][arg1]; + arg0->unk81D0[count]->oam.priority = priority; + arg0->unk81D0[count]->oam.paletteNum = palNum; + StartSpriteAnim(arg0->unk81D0[count], arg1); + count++; + } +} + +void sub_802D044(struct PokemonJump2 *arg0) +{ + sub_802EB24(9, 7, 120, 80, 0); + sub_802CD3C(arg0); +} + +bool32 sub_802D068(void) +{ + return sub_802EB84(); +} + +void sub_802D150(void); +void sub_802DD08(void); +void sub_802DB8C(void); +void sub_802DBF8(void); +void sub_802DE1C(void); +void sub_802DFD4(void); +void sub_802D108(void (*func)(void)); +void sub_802DF70(int arg0); +u32 sub_802DA9C(u8 arg0, u8 arg1, u8 arg2, u8 arg3); +void sub_802DB18(u8 arg0, u8 arg1, u8 arg2); + +void sub_802D074(struct PokemonJump2 *arg0) +{ + u8 taskId; + + gUnknown_02022D00 = arg0; + sub_802D0BC(gUnknown_02022D00); + taskId = CreateTask(sub_802D12C, 3); + gUnknown_02022D00->unk6 = taskId; + SetWordTaskArg(gUnknown_02022D00->unk6, 2, (u32) gUnknown_02022D00); + sub_802D108(sub_802D150); +} + +void sub_802D0AC(void) +{ + FreeAllWindowBuffers(); + sub_8034CC8(); +} + +void sub_802D0BC(struct PokemonJump2 *arg0) +{ + arg0->unk4 = 0; + arg0->unk0 = 0; + arg0->unk12 = 0xFF; +} + +void sub_802D0C8(int arg0) +{ + int i; + + for (i = 0; i < ARRAY_COUNT(gUnknown_082FE18C); i++) + { + if (gUnknown_082FE18C[i].id == arg0) + sub_802D108(gUnknown_082FE18C[i].func); + } +} + +bool32 sub_802D0F0(void) +{ + return (gUnknown_02022D00->unk0 != 1); +} + +void sub_802D108(void (*func)(void)) +{ + SetWordTaskArg(gUnknown_02022D00->unk6, 0, (u32) func); + gUnknown_02022D00->unk4 = 0; + gUnknown_02022D00->unk0 = 0; +} + +void sub_802D12C(u8 taskId) +{ + if (!gUnknown_02022D00->unk0) + { + void (*func)(void) = (void *)(GetWordTaskArg(taskId, 0)); + + func(); + } +} + +void sub_802D150(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082FE164, ARRAY_COUNT(gUnknown_082FE164)); + InitWindows(gUnknown_082FE174); + reset_temp_tile_data_buffers(); + sub_802C974(gUnknown_02022D00); + sub_802DD08(); + LoadPalette(gPkmnJumpBgPal, 0, 0x20); + decompress_and_copy_tile_data_to_vram(3, gPkmnJumpBgGfx, 0, 0, 0); + decompress_and_copy_tile_data_to_vram(3, gPkmnJumpBgTilemap, 0, 0, 1); + LoadPalette(gPkmnJumpVenusaurPal, 0x30, 0x20); + decompress_and_copy_tile_data_to_vram(2, gPkmnJumpVenusaurGfx, 0, 0, 0); + decompress_and_copy_tile_data_to_vram(2, gPkmnJumpVenusaurTilemap, 0, 0, 1); + LoadPalette(gPkmnJumpResultsPal, 0x10, 0x20); + decompress_and_copy_tile_data_to_vram(1, gPkmnJumpResultsGfx, 0, 0, 0); + decompress_and_copy_tile_data_to_vram(1, gPkmnJumpResultsTilemap, 0, 0, 1); + LoadPalette(gPkmnJumpPal3, 0x20, 0x20); + SetBgTilemapBuffer(0, gUnknown_02022D00->tilemapBuffer); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); + sub_802DB8C(); + sub_802DD64(0); + sub_8098C6C(0, 1, 0xE0); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(1); + ResetBgPositions(); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!free_temp_tile_data_buffers_if_possible()) + { + sub_802DBF8(); + sub_802CE9C(gUnknown_02022D00); + sub_802CF50(gUnknown_02022D00, 6); + ShowBg(3); + ShowBg(0); + ShowBg(2); + HideBg(1); + gUnknown_02022D00->unk4++; + } + break; + case 2: + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D2E4(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + sub_802DE1C(); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_802DF70(0); + gUnknown_02022D00->unk4++; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_802DFD4(); + gUnknown_02022D00->unk4++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D350(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + sub_802DE1C(); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_802DF70(1); + gUnknown_02022D00->unk4++; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_802DFD4(); + gUnknown_02022D00->unk4++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D3BC(void) +{ + int i, numPlayers; + + numPlayers = sub_802C8AC(); + switch (gUnknown_02022D00->unk4) + { + case 0: + for (i = 0; i < numPlayers; i++) + ClearWindowTilemap(gUnknown_02022D00->unk1C[i]); + + CopyBgTilemapBufferToVram(0); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + for (i = 0; i < numPlayers; i++) + RemoveWindow(gUnknown_02022D00->unk1C[i]); + + gUnknown_02022D00->unk0 = 1; + } + break; + } +} + +void sub_802D448(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + gUnknown_02022D00->unk12 = sub_802DA9C(1, 8, 20, 2); + AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_WantToPlayAgain2, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_02022D00->unk12, 2); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022D00->unk12); + DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); + sub_802DB18(23, 7, 0); + CopyBgTilemapBufferToVram(0); + gUnknown_02022D00->unk4++; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D4F4(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + gUnknown_02022D00->unk12 = sub_802DA9C(2, 7, 26, 4); + AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_SavingDontTurnOffPower, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_02022D00->unk12, 2); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022D00->unk12); + DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); + CopyBgTilemapBufferToVram(0); + gUnknown_02022D00->unk4++; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D598(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + sub_802DA14(); + sub_8198C78(); + CopyBgTilemapBufferToVram(0); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!sub_802DA44() && !IsDma3ManagerBusyWithBgCopy()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D5E4(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + gUnknown_02022D00->unk12 = sub_802DA9C(2, 8, 22, 4); + AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_SomeoneDroppedOut2, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_02022D00->unk12, 2); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022D00->unk12); + DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); + CopyBgTilemapBufferToVram(0); + gUnknown_02022D00->unk4++; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D688(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + gUnknown_02022D00->unk12 = sub_802DA9C(7, 10, 16, 2); + AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gText_CommunicationStandby4, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_02022D00->unk12, 2); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022D00->unk12); + DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); + CopyBgTilemapBufferToVram(0); + gUnknown_02022D00->unk4++; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D72C(void) +{ + switch (gUnknown_02022D00->unk4) + { + case 0: + sub_802D044(gUnknown_02022D00); + gUnknown_02022D00->unk4++; + break; + case 1: + if (!sub_802D068()) + gUnknown_02022D00->unk0 = 1; + break; + } +} + +void sub_802D764(void) +{ + gUnknown_02022D00->unkA = 0; + gUnknown_02022D00->unkB = 0; + gUnknown_02022D00->unkC = 6; + sub_802DC9C(gUnknown_02022D00->unkC); +} + +bool32 sub_802D788(void) +{ + switch (gUnknown_02022D00->unkA) + { + case 0: + gUnknown_02022D00->unkB++; + if (gUnknown_02022D00->unkB > 10) + { + gUnknown_02022D00->unkB = 0; + gUnknown_02022D00->unkC++; + if (gUnknown_02022D00->unkC >= 10) + { + gUnknown_02022D00->unkC = 0; + gUnknown_02022D00->unkA++; + } + } + sub_802DC9C(gUnknown_02022D00->unkC); + if (gUnknown_02022D00->unkC != 7) + break; + case 1: + return FALSE; + } + + return TRUE; +} + +void sub_802D7E8(u16 itemId, u16 quantity) +{ + CopyItemNameHandlePlural(itemId, gUnknown_02022D00->txtBuff[0], quantity); + ConvertIntToDecimalStringN(gUnknown_02022D00->txtBuff[1], quantity, STR_CONV_MODE_LEFT_ALIGN, 1); + DynamicPlaceholderTextUtil_Reset(); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_02022D00->txtBuff[1]); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_AwesomeWonF701F700); + gUnknown_02022D00->unk12 = sub_802DA9C(4, 8, 22, 4); + AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_02022D00->unk12, 2); + gUnknown_02022D00->unk14 = MUS_FANFA1; + gUnknown_02022D00->unkD = 0; +} + +void sub_802D884(u16 itemId) +{ + CopyItemName(itemId, gUnknown_02022D00->txtBuff[0]); + DynamicPlaceholderTextUtil_Reset(); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_FilledStorageSpace2); + gUnknown_02022D00->unk12 = sub_802DA9C(4, 8, 22, 4); + AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_02022D00->unk12, 2); + gUnknown_02022D00->unk14 = 0; + gUnknown_02022D00->unkD = 0; +} + +void sub_802D8FC(u16 itemId) +{ + CopyItemName(itemId, gUnknown_02022D00->txtBuff[0]); + DynamicPlaceholderTextUtil_Reset(); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02022D00->txtBuff[0]); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022D00->strBuff, gText_CantHoldMore); + gUnknown_02022D00->unk12 = sub_802DA9C(4, 9, 22, 2); + AddTextPrinterParameterized(gUnknown_02022D00->unk12, 1, gUnknown_02022D00->strBuff, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_02022D00->unk12, 2); + gUnknown_02022D00->unk14 = 0; + gUnknown_02022D00->unkD = 0; +} + +bool32 sub_802D974(void) +{ + switch (gUnknown_02022D00->unkD) + { + case 0: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022D00->unk12); + DrawTextBorderOuter(gUnknown_02022D00->unk12, 1, 14); + CopyBgTilemapBufferToVram(0); + gUnknown_02022D00->unkD++; + } + break; + case 1: + if (IsDma3ManagerBusyWithBgCopy()) + break; + if (gUnknown_02022D00->unk14 == 0) + { + gUnknown_02022D00->unkD += 2; + return FALSE; + } + PlayFanfare(gUnknown_02022D00->unk14); + gUnknown_02022D00->unkD++; + case 2: + if (!IsFanfareTaskInactive()) + break; + gUnknown_02022D00->unkD++; + case 3: + return FALSE; + } + + return TRUE; +} + +void sub_802DA14(void) +{ + if (gUnknown_02022D00->unk12 != 0xFF) + { + rbox_fill_rectangle(gUnknown_02022D00->unk12); + CopyWindowToVram(gUnknown_02022D00->unk12, 1); + gUnknown_02022D00->unkD = 0; + } +} + +// Can't match this +/* +bool32 sub_802DA44(void) +{ + if (gUnknown_02022D00->unk12 == 0xFF) + return FALSE; + + if (gUnknown_02022D00->unkD == 0) + { + if (!IsDma3ManagerBusyWithBgCopy()) + { + RemoveWindow(gUnknown_02022D00->unk12); + gUnknown_02022D00->unk12 = 0xFF; + gUnknown_02022D00->unkD++; + return FALSE; + } + } + else if (gUnknown_02022D00->unkD == 1) + return FALSE; + + return TRUE; +} +*/