diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s deleted file mode 100644 index d73293648..000000000 --- a/asm/contest_link_80F57C4.s +++ /dev/null @@ -1,2512 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_80F7364 -sub_80F7364: @ 80F7364 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - ldr r1, =gUnknown_02039F18 - lsls r0, r5, 1 - adds r0, r1 - movs r2, 0 - ldrsh r0, [r0, r2] - adds r7, r1, 0 - cmp r0, 0 - bge _080F7380 - negs r0, r0 -_080F7380: - lsls r4, r0, 16 - adds r0, r4, 0 - movs r1, 0x50 - bl __udivsi3 - adds r2, r0, 0 - ldr r0, =0x0000ffff - ands r0, r2 - cmp r0, 0 - beq _080F739A - movs r0, 0x80 - lsls r0, 9 - adds r2, r0 -_080F739A: - lsrs r2, 16 - cmp r2, 0 - bne _080F73A6 - cmp r4, 0 - beq _080F73A6 - movs r2, 0x1 -_080F73A6: - cmp r6, 0 - beq _080F73B0 - cmp r2, 0xA - bls _080F73B0 - movs r2, 0xA -_080F73B0: - lsls r0, r5, 1 - adds r0, r7 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _080F73CC - negs r0, r2 - lsls r0, 24 - b _080F73CE - .pool -_080F73CC: - lsls r0, r2, 24 -_080F73CE: - lsrs r0, 24 - lsls r0, 24 - asrs r0, 24 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80F7364 - - thumb_func_start sub_80F73DC -sub_80F73DC: @ 80F73DC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r7, r0, r1 - ldrh r2, [r7, 0x1C] - movs r0, 0x1C - ldrsh r6, [r7, r0] - cmp r6, 0 - bne _080F741C - movs r1, 0x8 - ldrsh r0, [r7, r1] - movs r1, 0x3 - subs r1, r0 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - strh r0, [r7, 0x1E] - adds r0, r2, 0x1 - strh r0, [r7, 0x1C] - b _080F74A4 - .pool -_080F741C: - cmp r6, 0x1 - bne _080F74A4 - ldrh r0, [r7, 0x1E] - subs r0, 0x1 - strh r0, [r7, 0x1E] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080F74A4 - movs r2, 0x8 - ldrsh r4, [r7, r2] - lsls r4, 17 - ldr r0, =0x50430000 - adds r4, r0 - lsrs r4, 16 - movs r1, 0xA - ldrsh r0, [r7, r1] - lsls r3, r0, 1 - adds r3, r0 - adds r3, 0x5 - lsls r3, 24 - lsrs r3, 24 - movs r2, 0x2 - mov r9, r2 - str r2, [sp] - str r6, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - str r6, [sp, 0xC] - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x1 - bl WriteSequenceToBgTilemapBuffer - adds r4, 0x10 - lsls r4, 16 - lsrs r4, 16 - movs r1, 0xA - ldrsh r0, [r7, r1] - lsls r3, r0, 1 - adds r3, r0 - adds r3, 0x6 - lsls r3, 24 - lsrs r3, 24 - mov r2, r9 - str r2, [sp] - str r6, [sp, 0x4] - str r5, [sp, 0x8] - str r6, [sp, 0xC] - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x1 - bl WriteSequenceToBgTilemapBuffer - ldr r0, =gUnknown_0203A034 - ldr r0, [r0] - ldr r1, [r0] - ldrb r0, [r1, 0x5] - adds r0, 0x1 - strb r0, [r1, 0x5] - mov r0, r8 - bl DestroyTask - movs r0, 0x18 - bl PlaySE -_080F74A4: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F73DC - - thumb_func_start sub_80F74BC -sub_80F74BC: @ 80F74BC - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r1, =gContestFinalStandings - ldrb r0, [r1] - ldr r6, =gUnknown_0203A034 - cmp r0, 0 - beq _080F74DE -_080F74D0: - adds r4, 0x1 - cmp r4, 0x3 - bgt _080F74DE - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080F74D0 -_080F74DE: - ldr r1, [r6] - lsls r3, r4, 1 - adds r3, r4 - lsls r0, r3, 6 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - ldr r1, [r1, 0x14] - adds r1, r0 - adds r3, 0x4 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x20 - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0x9 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r2, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x1C] - movs r1, 0x1 - strh r1, [r0, 0x20] - ldr r1, =sub_80F753C - str r1, [r0] - ldr r0, [r6] - ldr r0, [r0] - strb r5, [r0, 0x3] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F74BC - - thumb_func_start sub_80F753C -sub_80F753C: @ 80F753C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] - lsls r0, 16 - asrs r5, r0, 16 - cmp r5, 0x1 - bne _080F75A0 - movs r0, 0 - strh r0, [r4, 0x1E] - ldrh r2, [r4, 0x20] - lsls r2, 24 - lsrs r2, 24 - ldr r3, =0x00006f8d - movs r0, 0x91 - movs r1, 0x1 - bl BlendPalette - movs r1, 0x22 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080F7590 - ldrh r0, [r4, 0x20] - adds r0, 0x1 - strh r0, [r4, 0x20] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - bne _080F75A0 - strh r5, [r4, 0x22] - b _080F75A0 - .pool -_080F7590: - ldrh r0, [r4, 0x20] - subs r0, 0x1 - strh r0, [r4, 0x20] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _080F75A0 - strh r0, [r4, 0x22] -_080F75A0: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80F753C - - thumb_func_start sub_80F75A8 -sub_80F75A8: @ 80F75A8 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x2E] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0x9 - bgt _080F75D0 - adds r0, r1, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _080F7610 - ldrh r0, [r4, 0x30] - movs r1, 0 - bl PlayCry1 - movs r0, 0 - strh r0, [r4, 0x30] - b _080F7610 -_080F75D0: - movs r0, 0xC0 - lsls r0, 3 - adds r2, r0, 0 - ldrh r1, [r4, 0x30] - adds r2, r1 - lsls r1, r2, 16 - asrs r1, 24 - ldrh r0, [r4, 0x20] - subs r0, r1 - strh r0, [r4, 0x20] - movs r1, 0xFF - ands r2, r1 - strh r2, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x77 - bgt _080F75F6 - movs r0, 0x78 - strh r0, [r4, 0x20] -_080F75F6: - movs r2, 0x20 - ldrsh r0, [r4, r2] - cmp r0, 0x78 - bne _080F7610 - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x30] - ldr r0, =gUnknown_0203A034 - ldr r0, [r0] - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x6] -_080F7610: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F75A8 - - thumb_func_start sub_80F7620 -sub_80F7620: @ 80F7620 - push {lr} - adds r3, r0, 0 - movs r0, 0xC0 - lsls r0, 3 - adds r2, r0, 0 - ldrh r0, [r3, 0x30] - adds r2, r0 - lsls r1, r2, 16 - asrs r1, 24 - ldrh r0, [r3, 0x20] - subs r0, r1 - strh r0, [r3, 0x20] - movs r1, 0xFF - ands r2, r1 - strh r2, [r3, 0x30] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x20 - negs r1, r1 - cmp r0, r1 - bge _080F7664 - ldr r0, =SpriteCallbackDummy - str r0, [r3, 0x1C] - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, =gUnknown_0203A034 - ldr r0, [r0] - ldr r1, [r0] - movs r0, 0x2 - strb r0, [r1, 0x6] -_080F7664: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7620 - - thumb_func_start sub_80F7670 -sub_80F7670: @ 80F7670 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r1, r0, r1 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _080F7732 - movs r0, 0 - strh r0, [r1, 0x8] - ldr r0, =gUnknown_0203A034 - mov r8, r0 - ldr r0, [r0] - ldr r0, [r0] - ldrb r0, [r0, 0x7] - cmp r0, 0x27 - bhi _080F7732 - ldr r4, =gSpriteTemplate_858D860 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xF0 - bl __umodsi3 - adds r1, r0, 0 - subs r1, 0x14 - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - movs r2, 0x2C - movs r3, 0x5 - bl CreateSprite - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl Random - ldr r1, =gSprites - lsls r5, r4, 4 - adds r5, r4 - lsls r5, 2 - adds r5, r1 - lsls r0, 23 - lsrs r0, 23 - strh r0, [r5, 0x2E] - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x18 - bl __umodsi3 - adds r0, 0x10 - strh r0, [r5, 0x30] - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xFF - ands r0, r1 - adds r0, 0x30 - strh r0, [r5, 0x32] - bl Random - ldrh r6, [r5, 0x4] - lsls r4, r6, 22 - lsrs r4, 22 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x11 - bl __umodsi3 - adds r4, r0 - ldr r1, =0x000003ff - adds r0, r1, 0 - ands r4, r0 - ldr r0, =0xfffffc00 - ands r0, r6 - orrs r0, r4 - strh r0, [r5, 0x4] - mov r1, r8 - ldr r0, [r1] - ldr r1, [r0] - ldrb r0, [r1, 0x7] - adds r0, 0x1 - strb r0, [r1, 0x7] -_080F7732: - ldr r0, =gUnknown_0203A034 - ldr r0, [r0] - ldr r0, [r0] - ldrb r0, [r0, 0x9] - cmp r0, 0 - beq _080F7744 - adds r0, r7, 0 - bl DestroyTask -_080F7744: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7670 - - thumb_func_start sub_80F7768 -sub_80F7768: @ 80F7768 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x34] - adds r0, r1 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 24 - movs r2, 0x30 - ldrsh r1, [r4, r2] - bl Sin - strh r0, [r4, 0x24] - ldrh r1, [r4, 0x32] - ldrh r0, [r4, 0x36] - adds r1, r0 - lsls r0, r1, 16 - asrs r0, 24 - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - movs r0, 0xFF - ands r1, r0 - strh r1, [r4, 0x36] - ldrh r0, [r4, 0x22] - adds r0, 0x1 - strh r0, [r4, 0x22] - ldr r5, =gUnknown_0203A034 - ldr r0, [r5] - ldr r0, [r0] - ldrb r0, [r0, 0x9] - cmp r0, 0 - beq _080F77B6 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] -_080F77B6: - movs r1, 0x20 - ldrsh r0, [r4, r1] - cmp r0, 0xF8 - bgt _080F77C6 - movs r2, 0x22 - ldrsh r0, [r4, r2] - cmp r0, 0x74 - ble _080F77D6 -_080F77C6: - adds r0, r4, 0 - bl DestroySprite - ldr r0, [r5] - ldr r1, [r0] - ldrb r0, [r1, 0x7] - subs r0, 0x1 - strb r0, [r1, 0x7] -_080F77D6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7768 - - thumb_func_start sub_80F77E0 -sub_80F77E0: @ 80F77E0 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =sub_80F7824 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - strh r5, [r1, 0xA] - ldr r0, =gContestMons - lsls r4, 6 - adds r4, r0 - ldrh r0, [r4] - strh r0, [r1, 0xC] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F77E0 - - thumb_func_start sub_80F7824 -sub_80F7824: @ 80F7824 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 - ldrb r5, [r4, 0x8] - ldrh r0, [r4, 0x1C] - adds r1, r0, 0x1 - strh r1, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - movs r2, 0xA - ldrsh r1, [r4, r2] - cmp r0, r1 - bne _080F786E - movs r0, 0 - strh r0, [r4, 0x1C] - ldrh r0, [r4, 0xC] - ldrb r2, [r4, 0x1E] - ldr r1, =gContestMons - lsls r3, r5, 6 - adds r1, 0x38 - adds r3, r1 - ldr r1, [r3] - str r1, [sp] - adds r1, r5, 0 - movs r3, 0 - bl sub_80F69B8 - ldrh r0, [r4, 0x1E] - movs r1, 0x1 - eors r0, r1 - strh r0, [r4, 0x1E] -_080F786E: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7824 - - thumb_func_start sub_80F7880 -sub_80F7880: @ 80F7880 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r0, =gUnknown_02039F08 - ldrh r2, [r0] - adds r4, r0, 0 - adds r3, r4, 0x2 - movs r0, 0x2 - mov r8, r0 -_080F7898: - lsls r0, r2, 16 - asrs r0, 16 - movs r5, 0 - ldrsh r1, [r3, r5] - cmp r0, r1 - bge _080F78A6 - ldrh r2, [r3] -_080F78A6: - adds r3, 0x2 - movs r0, 0x1 - negs r0, r0 - add r8, r0 - mov r1, r8 - cmp r1, 0 - bge _080F7898 - lsls r0, r2, 16 - str r0, [sp] - cmp r0, 0 - bge _080F78E4 - ldrh r2, [r4] - adds r3, r4, 0x2 - movs r4, 0x2 - mov r8, r4 -_080F78C4: - lsls r0, r2, 16 - asrs r0, 16 - movs r5, 0 - ldrsh r1, [r3, r5] - cmp r0, r1 - ble _080F78D2 - ldrh r2, [r3] -_080F78D2: - adds r3, 0x2 - movs r0, 0x1 - negs r0, r0 - add r8, r0 - lsls r1, r2, 16 - str r1, [sp] - mov r4, r8 - cmp r4, 0 - bge _080F78C4 -_080F78E4: - movs r5, 0 - mov r8, r5 - mov r10, r5 -_080F78EA: - ldr r0, =gContestMonConditions - mov r1, r8 - lsls r7, r1, 1 - adds r0, r7, r0 - movs r2, 0 - ldrsh r1, [r0, r2] - lsls r0, r1, 5 - subs r0, r1 - lsls r0, 2 - adds r0, r1 - lsls r0, 3 - ldr r4, [sp] - asrs r5, r4, 16 - adds r1, r5, 0 - cmp r5, 0 - bge _080F790C - negs r1, r5 -_080F790C: - bl __divsi3 - adds r4, r0, 0 - movs r1, 0xA - bl __modsi3 - cmp r0, 0x4 - ble _080F791E - adds r4, 0xA -_080F791E: - ldr r0, =gUnknown_0203A034 - mov r9, r0 - ldr r0, [r0] - ldr r0, [r0, 0x4] - mov r1, r10 - adds r6, r1, r0 - adds r0, r4, 0 - movs r1, 0xA - bl __divsi3 - str r0, [r6] - ldr r0, =gUnknown_02039F18 - adds r7, r0 - movs r2, 0 - ldrsh r1, [r7, r2] - cmp r1, 0 - bge _080F7942 - negs r1, r1 -_080F7942: - lsls r0, r1, 5 - subs r0, r1 - lsls r0, 2 - adds r0, r1 - lsls r0, 3 - adds r1, r5, 0 - cmp r1, 0 - bge _080F7954 - negs r1, r1 -_080F7954: - bl __divsi3 - adds r4, r0, 0 - movs r1, 0xA - bl __modsi3 - cmp r0, 0x4 - ble _080F7966 - adds r4, 0xA -_080F7966: - adds r0, r4, 0 - movs r1, 0xA - bl __divsi3 - str r0, [r6, 0x4] - movs r4, 0 - ldrsh r0, [r7, r4] - cmp r0, 0 - bge _080F797C - movs r0, 0x1 - strb r0, [r6, 0x10] -_080F797C: - mov r5, r9 - ldr r0, [r5] - ldr r0, [r0, 0x4] - mov r1, r10 - adds r4, r1, r0 - ldr r1, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - subs r0, r1 - lsls r0, 11 - movs r1, 0x64 - bl __divsi3 - adds r1, r0, 0 - movs r5, 0xFF - ands r0, r5 - cmp r0, 0x7F - bls _080F79A8 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2 -_080F79A8: - lsrs r0, r1, 8 - str r0, [r4, 0x8] - ldr r1, [r4, 0x4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - subs r0, r1 - lsls r0, 11 - movs r1, 0x64 - bl __divsi3 - adds r1, r0, 0 - ands r0, r5 - cmp r0, 0x7F - bls _080F79CC - movs r5, 0x80 - lsls r5, 1 - adds r1, r5 -_080F79CC: - lsrs r0, r1, 8 - str r0, [r4, 0xC] - mov r0, r8 - lsls r4, r0, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80F7310 - mov r2, r9 - ldr r1, [r2] - ldr r1, [r1, 0x4] - add r1, r10 - strb r0, [r1, 0x11] - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80F7364 - mov r4, r9 - ldr r1, [r4] - ldr r1, [r1, 0x4] - add r1, r10 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bge _080F7A02 - negs r0, r0 -_080F7A02: - strb r0, [r1, 0x12] - ldr r0, =gContestFinalStandings - add r0, r8 - ldrb r0, [r0] - cmp r0, 0 - beq _080F7A60 - mov r5, r9 - ldr r0, [r5] - ldr r0, [r0, 0x4] - mov r2, r10 - adds r1, r2, r0 - ldr r5, [r1, 0x8] - ldrh r3, [r1, 0x8] - ldr r4, [r1, 0xC] - ldrh r2, [r1, 0xC] - ldrb r0, [r1, 0x10] - cmp r0, 0 - beq _080F7A2C - lsls r0, r2, 16 - negs r0, r0 - lsrs r2, r0, 16 -_080F7A2C: - lsls r0, r3, 16 - asrs r3, r0, 16 - lsls r0, r2, 16 - asrs r2, r0, 16 - adds r0, r3, r2 - cmp r0, 0x58 - bne _080F7A60 - cmp r2, 0 - ble _080F7A58 - subs r0, r4, 0x1 - str r0, [r1, 0xC] - b _080F7A60 - .pool -_080F7A58: - cmp r3, 0 - ble _080F7A60 - subs r0, r5, 0x1 - str r0, [r1, 0x8] -_080F7A60: - movs r4, 0x14 - add r10, r4 - movs r5, 0x1 - add r8, r5 - mov r0, r8 - cmp r0, 0x3 - bgt _080F7A70 - b _080F78EA -_080F7A70: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80F7880 - - thumb_func_start sub_80F7A80 -sub_80F7A80: @ 80F7A80 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r1, 0 - str r1, [sp, 0x8] - movs r3, 0 - str r3, [sp, 0xC] - cmp r0, 0 - bne _080F7B5C - mov r9, r3 - ldr r4, =gUnknown_0203A034 - mov r10, r4 - movs r7, 0xA0 - lsls r7, 19 - movs r6, 0 -_080F7AAC: - mov r1, r10 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r0, r6, r0 - ldrb r2, [r0, 0x11] - cmp r8, r2 - bcs _080F7B2E - adds r2, 0x13 - mov r3, r8 - subs r2, r3 - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - lsrs r3, r7, 24 - movs r0, 0x1 - str r0, [sp] - str r0, [sp, 0x4] - ldr r1, =0x000060b3 - bl FillBgTilemapBufferRect_Palette0 - ldr r0, =sub_80F7CA8 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r10 - ldr r4, [r0] - ldr r1, [r4, 0x4] - adds r1, r6, r1 - ldr r0, [r1, 0x8] - lsls r0, 16 - ldrb r1, [r1, 0x11] - bl __udivsi3 - mov r1, r8 - adds r1, 0x1 - adds r3, r0, 0 - muls r3, r1 - ldr r0, =0x0000ffff - ands r0, r3 - ldr r1, =0x00007fff - cmp r0, r1 - bls _080F7B0A - movs r1, 0x80 - lsls r1, 9 - adds r3, r1 -_080F7B0A: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - mov r1, r9 - strh r1, [r0, 0x8] - lsrs r1, r3, 16 - strh r1, [r0, 0xA] - ldr r1, [r4] - ldrb r0, [r1, 0x14] - adds r0, 0x1 - strb r0, [r1, 0x14] - ldr r0, [sp, 0x8] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] -_080F7B2E: - movs r3, 0xC0 - lsls r3, 18 - adds r7, r3 - adds r6, 0x14 - movs r4, 0x1 - add r9, r4 - mov r0, r9 - cmp r0, 0x3 - ble _080F7AAC - b _080F7C7E - .pool -_080F7B5C: - movs r1, 0 - mov r9, r1 - mov r10, r1 - movs r3, 0xC0 - lsls r3, 19 - str r3, [sp, 0x10] -_080F7B68: - ldr r4, =gUnknown_0203A034 - ldr r0, [r4] - ldr r0, [r0, 0x4] - add r0, r10 - ldrb r2, [r0, 0x12] - ldrb r0, [r0, 0x10] - ldr r1, =0x000060a3 - cmp r0, 0 - beq _080F7B7C - adds r1, 0x2 -_080F7B7C: - lsls r0, r2, 24 - asrs r0, 24 - cmp r8, r0 - bge _080F7C64 - mov r3, r8 - lsls r2, r3, 24 - asrs r2, 24 - subs r2, 0x13 - subs r2, r0, r2 - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r4, [sp, 0x10] - lsrs r3, r4, 24 - movs r7, 0x1 - str r7, [sp] - str r7, [sp, 0x4] - movs r0, 0x1 - bl FillBgTilemapBufferRect_Palette0 - ldr r0, =sub_80F7CA8 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203A034 - ldr r6, [r0] - ldr r1, [r6, 0x4] - add r1, r10 - ldr r0, [r1, 0xC] - lsls r0, 16 - ldrb r1, [r1, 0x12] - bl __udivsi3 - mov r1, r8 - adds r1, 0x1 - adds r3, r0, 0 - muls r3, r1 - ldr r0, =0x0000ffff - ands r0, r3 - ldr r1, =0x00007fff - cmp r0, r1 - bls _080F7BDA - movs r1, 0x80 - lsls r1, 9 - adds r3, r1 -_080F7BDA: - ldr r1, =gTasks - lsls r2, r5, 2 - adds r0, r2, r5 - lsls r0, 3 - adds r4, r0, r1 - mov r0, r9 - strh r0, [r4, 0x8] - ldr r0, [r6, 0x4] - add r0, r10 - ldrb r0, [r0, 0x10] - adds r6, r1, 0 - cmp r0, 0 - beq _080F7C1C - strh r7, [r4, 0xC] - ldr r0, [sp, 0xC] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - b _080F7C26 - .pool -_080F7C1C: - ldr r0, [sp, 0x8] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] -_080F7C26: - ldr r1, =gUnknown_0203A034 - ldr r0, [r1] - ldr r0, [r0, 0x4] - mov r4, r10 - adds r1, r4, r0 - ldrb r0, [r1, 0x10] - ldr r4, =gUnknown_0203A034 - cmp r0, 0 - beq _080F7C4C - adds r0, r2, r5 - lsls r0, 3 - adds r0, r6 - lsrs r2, r3, 16 - ldr r1, [r1, 0x8] - subs r1, r2 - b _080F7C58 - .pool -_080F7C4C: - adds r0, r2, r5 - lsls r0, 3 - adds r0, r6 - lsrs r2, r3, 16 - ldr r1, [r1, 0x8] - adds r1, r2 -_080F7C58: - strh r1, [r0, 0xA] - ldr r0, [r4] - ldr r1, [r0] - ldrb r0, [r1, 0x14] - adds r0, 0x1 - strb r0, [r1, 0x14] -_080F7C64: - movs r0, 0x14 - add r10, r0 - ldr r1, [sp, 0x10] - movs r3, 0xC0 - lsls r3, 18 - adds r1, r3 - str r1, [sp, 0x10] - movs r4, 0x1 - add r9, r4 - mov r0, r9 - cmp r0, 0x3 - bgt _080F7C7E - b _080F7B68 -_080F7C7E: - ldr r1, [sp, 0xC] - cmp r1, 0 - beq _080F7C8A - movs r0, 0x16 - bl PlaySE -_080F7C8A: - ldr r3, [sp, 0x8] - cmp r3, 0 - beq _080F7C96 - movs r0, 0x15 - bl PlaySE -_080F7C96: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80F7A80 - - thumb_func_start sub_80F7CA8 -sub_80F7CA8: @ 80F7CA8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r4, 0 - mov r9, r4 - ldr r1, =gTasks - lsls r0, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - ldrb r6, [r0, 0x8] - ldrh r7, [r0, 0xA] - ldrh r1, [r0, 0xC] - mov r12, r1 - movs r2, 0xC - ldrsh r0, [r0, r2] - cmp r0, 0 - beq _080F7CF8 - ldr r2, =gUnknown_0203A034 - ldr r0, [r2] - ldr r0, [r0] - lsls r1, r6, 1 - adds r0, 0xC - adds r0, r1 - movs r3, 0 - ldrsh r0, [r0, r3] - adds r5, r1, 0 - cmp r0, 0 - bgt _080F7D10 - b _080F7D0E - .pool -_080F7CF8: - ldr r2, =gUnknown_0203A034 - ldr r0, [r2] - ldr r0, [r0] - lsls r1, r6, 1 - adds r0, 0xC - adds r0, r1 - movs r3, 0 - ldrsh r0, [r0, r3] - adds r5, r1, 0 - cmp r0, 0x57 - ble _080F7D10 -_080F7D0E: - movs r4, 0x1 -_080F7D10: - ldr r0, [r2] - ldr r0, [r0] - adds r0, 0xC - adds r2, r0, r5 - ldrh r3, [r2] - movs r0, 0 - ldrsh r1, [r2, r0] - lsls r0, r7, 16 - asrs r0, 16 - cmp r1, r0 - bne _080F7D2A - movs r1, 0x1 - mov r9, r1 -_080F7D2A: - mov r0, r9 - cmp r0, 0 - bne _080F7D4A - cmp r4, 0 - beq _080F7D3C - strh r7, [r2] - b _080F7D4A - .pool -_080F7D3C: - mov r1, r12 - cmp r1, 0 - beq _080F7D46 - subs r0, r3, 0x1 - b _080F7D48 -_080F7D46: - adds r0, r3, 0x1 -_080F7D48: - strh r0, [r2] -_080F7D4A: - cmp r4, 0 - bne _080F7DC4 - mov r2, r9 - cmp r2, 0 - bne _080F7DCA - movs r2, 0 -_080F7D56: - ldr r0, =gUnknown_0203A034 - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0xC - adds r0, r5 - movs r1, 0 - ldrsh r3, [r0, r1] - adds r0, r2, 0x1 - lsls r1, r0, 3 - adds r4, r0, 0 - cmp r3, r1 - blt _080F7D78 - movs r0, 0x8 - b _080F7D94 - .pool -_080F7D78: - lsls r0, r2, 3 - cmp r3, r0 - blt _080F7D92 - adds r0, r3, 0 - cmp r3, 0 - bge _080F7D86 - adds r0, r3, 0x7 -_080F7D86: - asrs r0, 3 - lsls r0, 3 - subs r0, r3, r0 - lsls r0, 24 - lsrs r0, 24 - b _080F7D94 -_080F7D92: - movs r0, 0 -_080F7D94: - cmp r0, 0x3 - bhi _080F7DA0 - ldr r3, =0x0000504c - b _080F7DA2 - .pool -_080F7DA0: - ldr r3, =0x00005057 -_080F7DA2: - adds r1, r0, r3 - adds r2, 0x7 - lsls r2, 24 - lsrs r2, 24 - adds r3, r5, r6 - adds r3, 0x6 - lsls r3, 24 - movs r0, 0x1 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x2 - lsrs r3, 24 - bl FillBgTilemapBufferRect_Palette0 - adds r2, r4, 0 - cmp r2, 0xA - ble _080F7D56 -_080F7DC4: - mov r0, r9 - cmp r0, 0 - beq _080F7DDC -_080F7DCA: - ldr r0, =gUnknown_0203A034 - ldr r0, [r0] - ldr r1, [r0] - ldrb r0, [r1, 0x14] - subs r0, 0x1 - strb r0, [r1, 0x14] - mov r0, r8 - bl DestroyTask -_080F7DDC: - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7CA8 - - thumb_func_start sub_80F7DF4 -sub_80F7DF4: @ 80F7DF4 - push {r4,r5,lr} - ldr r4, =gUnknown_0203A034 - movs r0, 0x20 - bl AllocZeroed - str r0, [r4] - movs r0, 0x18 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1] - movs r0, 0x50 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x4] - movs r5, 0x80 - lsls r5, 4 - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x8] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0xC] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x10] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x14] - adds r0, r5, 0 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x18] - movs r0, 0x80 - lsls r0, 5 - bl AllocZeroed - ldr r1, [r4] - str r0, [r1, 0x1C] - bl AllocateMonSpritesGfx - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7DF4 - - thumb_func_start sub_80F7E64 -sub_80F7E64: @ 80F7E64 - push {r4,r5,lr} - ldr r5, =gUnknown_0203A034 - ldr r0, [r5] - ldr r0, [r0] - bl Free - ldr r0, [r5] - movs r4, 0 - str r4, [r0] - ldr r0, [r0, 0x4] - bl Free - ldr r0, [r5] - str r4, [r0, 0x4] - ldr r0, [r0, 0x8] - bl Free - ldr r0, [r5] - str r4, [r0, 0x8] - ldr r0, [r0, 0xC] - bl Free - ldr r0, [r5] - str r4, [r0, 0xC] - ldr r0, [r0, 0x10] - bl Free - ldr r0, [r5] - str r4, [r0, 0x10] - ldr r0, [r0, 0x14] - bl Free - ldr r0, [r5] - str r4, [r0, 0x14] - ldr r0, [r0, 0x18] - bl Free - ldr r0, [r5] - str r4, [r0, 0x18] - ldr r0, [r0, 0x1C] - bl Free - ldr r0, [r5] - str r4, [r0, 0x1C] - bl Free - str r4, [r5] - bl FreeMonSpritesGfx - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7E64 - - thumb_func_start sub_80F7ED0 -sub_80F7ED0: @ 80F7ED0 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - str r1, [sp] - mov r0, sp - movs r3, 0 - strb r4, [r0, 0x4] - mov r1, sp - movs r0, 0x7 - strb r0, [r1, 0x5] - mov r0, sp - strb r2, [r0, 0x6] - movs r1, 0x2 - strb r1, [r0, 0x7] - strb r2, [r0, 0x8] - strb r1, [r0, 0x9] - strb r3, [r0, 0xA] - strb r3, [r0, 0xB] - mov r3, sp - ldrb r2, [r3, 0xC] - subs r1, 0x12 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0xC] - mov r2, sp - movs r0, 0x10 - strb r0, [r2, 0xC] - ldrb r0, [r2, 0xD] - ands r1, r0 - strb r1, [r2, 0xD] - mov r1, sp - movs r0, 0x80 - strb r0, [r1, 0xD] - mov r0, sp - movs r1, 0 - movs r2, 0 - bl AddTextPrinter - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl PutWindowTilemap - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80F7ED0 - - thumb_func_start sub_80F7F30 -sub_80F7F30: @ 80F7F30 - push {r4,r5,lr} - ldr r0, =gContestMonPartyIndex - ldrb r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_80DAE0C - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - cmp r5, 0 - beq _080F7F5E - ldr r4, =gSpecialVar_ContestCategory - ldrb r0, [r4] - ldr r1, =gSpecialVar_ContestRank - ldrb r1, [r1] - bl sub_80DAB8C - ldrb r0, [r4] - bl sub_80DB09C -_080F7F5E: - ldr r0, =gSpecialVar_Result - strh r5, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7F30 - - thumb_func_start sub_80F7F7C -sub_80F7F7C: @ 80F7F7C - push {r4,lr} - movs r4, 0 - ldr r0, =gContestMonPartyIndex - ldrb r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r2, r1, r0 - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - cmp r0, 0x4 - bhi _080F7FEE - lsls r0, 2 - ldr r1, =_080F7FB0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080F7FB0: - .4byte _080F7FC4 - .4byte _080F7FCA - .4byte _080F7FD0 - .4byte _080F7FD6 - .4byte _080F7FDC -_080F7FC4: - adds r0, r2, 0 - movs r1, 0x32 - b _080F7FE0 -_080F7FCA: - adds r0, r2, 0 - movs r1, 0x33 - b _080F7FE0 -_080F7FD0: - adds r0, r2, 0 - movs r1, 0x34 - b _080F7FE0 -_080F7FD6: - adds r0, r2, 0 - movs r1, 0x35 - b _080F7FE0 -_080F7FDC: - adds r0, r2, 0 - movs r1, 0x36 -_080F7FE0: - bl GetMonData - ldr r1, =gSpecialVar_ContestRank - ldrh r1, [r1] - cmp r0, r1 - bls _080F7FEE - movs r4, 0x1 -_080F7FEE: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80F7F7C - - thumb_func_start sub_80F7FFC -sub_80F7FFC: @ 80F7FFC - push {r4-r7,lr} - sub sp, 0x4 - ldr r1, =gContestFinalStandings - ldr r0, =gContestPlayerMonIndex - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080F8010 - b _080F8250 -_080F8010: - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - cmp r0, 0x4 - bls _080F801A - b _080F8250 -_080F801A: - lsls r0, 2 - ldr r1, =_080F8034 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080F8034: - .4byte _080F8048 - .4byte _080F80B8 - .4byte _080F8124 - .4byte _080F8190 - .4byte _080F81F8 -_080F8048: - ldr r6, =gContestMonPartyIndex - ldrb r0, [r6] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x32 - bl GetMonData - lsls r0, 24 - lsrs r1, r0, 24 - mov r0, sp - strb r1, [r0] - ldr r0, =gSpecialVar_ContestRank - ldrh r0, [r0] - cmp r1, r0 - bls _080F806C - b _080F8250 -_080F806C: - adds r0, r1, 0 - cmp r0, 0x3 - bls _080F8074 - b _080F8250 -_080F8074: - adds r1, r0, 0x1 - mov r0, sp - strb r1, [r0] - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x32 - mov r2, sp - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - bl GetRibbonCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bhi _080F809C - b _080F8250 -_080F809C: - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x32 - bl sub_80EE4DC - b _080F8250 - .pool -_080F80B8: - mov r4, sp - ldr r7, =gContestMonPartyIndex - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x33 - bl GetMonData - strb r0, [r4] - mov r0, sp - ldrb r2, [r0] - ldr r0, =gSpecialVar_ContestRank - ldrh r0, [r0] - cmp r2, r0 - bls _080F80DC - b _080F8250 -_080F80DC: - cmp r2, 0x3 - bls _080F80E2 - b _080F8250 -_080F80E2: - mov r1, sp - adds r0, r2, 0x1 - strb r0, [r1] - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x33 - mov r2, sp - bl SetMonData - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - bl GetRibbonCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bhi _080F810A - b _080F8250 -_080F810A: - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x33 - bl sub_80EE4DC - b _080F8250 - .pool -_080F8124: - mov r4, sp - ldr r7, =gContestMonPartyIndex - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x34 - bl GetMonData - strb r0, [r4] - mov r0, sp - ldrb r2, [r0] - ldr r0, =gSpecialVar_ContestRank - ldrh r0, [r0] - cmp r2, r0 - bls _080F8148 - b _080F8250 -_080F8148: - cmp r2, 0x3 - bls _080F814E - b _080F8250 -_080F814E: - mov r1, sp - adds r0, r2, 0x1 - strb r0, [r1] - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x34 - mov r2, sp - bl SetMonData - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - bl GetRibbonCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080F8250 - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x34 - bl sub_80EE4DC - b _080F8250 - .pool -_080F8190: - mov r4, sp - ldr r7, =gContestMonPartyIndex - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x35 - bl GetMonData - strb r0, [r4] - mov r0, sp - ldrb r2, [r0] - ldr r0, =gSpecialVar_ContestRank - ldrh r0, [r0] - cmp r2, r0 - bhi _080F8250 - cmp r2, 0x3 - bhi _080F8250 - mov r1, sp - adds r0, r2, 0x1 - strb r0, [r1] - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x35 - mov r2, sp - bl SetMonData - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - bl GetRibbonCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080F8250 - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x35 - bl sub_80EE4DC - b _080F8250 - .pool -_080F81F8: - mov r4, sp - ldr r7, =gContestMonPartyIndex - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x36 - bl GetMonData - strb r0, [r4] - mov r0, sp - ldrb r2, [r0] - ldr r0, =gSpecialVar_ContestRank - ldrh r0, [r0] - cmp r2, r0 - bhi _080F8250 - cmp r2, 0x3 - bhi _080F8250 - mov r1, sp - adds r0, r2, 0x1 - strb r0, [r1] - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x36 - mov r2, sp - bl SetMonData - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - bl GetRibbonCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080F8250 - ldrb r0, [r7] - muls r0, r6 - adds r0, r5 - movs r1, 0x36 - bl sub_80EE4DC -_080F8250: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F7FFC - - thumb_func_start sub_80F8264 -sub_80F8264: @ 80F8264 - push {r4,lr} - ldr r4, =gStringVar1 - ldr r0, =gSpecialVar_0x8006 - ldrh r1, [r0] - lsls r1, 6 - ldr r0, =gContestMons + 13 - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - bl sub_81DB5AC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8264 - - thumb_func_start sub_80F8290 -sub_80F8290: @ 80F8290 - push {lr} - ldr r0, =gStringVar3 - ldr r1, =gSpecialVar_0x8006 - ldrh r1, [r1] - lsls r1, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8290 - - thumb_func_start sub_80F82B4 -sub_80F82B4: @ 80F82B4 - push {r4-r6,lr} - movs r1, 0 - movs r2, 0 - ldr r5, =gSpecialVar_0x8004 - ldr r4, =gContestMonConditions - ldr r0, =gSpecialVar_0x8006 - ldrh r0, [r0] - lsls r0, 1 - adds r0, r4 - movs r6, 0 - ldrsh r3, [r0, r6] -_080F82CA: - lsls r0, r1, 1 - adds r0, r4 - movs r6, 0 - ldrsh r0, [r0, r6] - cmp r3, r0 - bge _080F82DC - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080F82DC: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _080F82CA - strh r2, [r5] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F82B4 - - thumb_func_start sub_80F82FC -sub_80F82FC: @ 80F82FC - ldr r2, =gSpecialVar_0x8004 - ldr r1, =gContestMonConditions - ldr r0, =gSpecialVar_0x8006 - ldrh r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - bx lr - .pool - thumb_func_end sub_80F82FC - - thumb_func_start sub_80F831C -sub_80F831C: @ 80F831C - push {lr} - movs r1, 0 - ldr r2, =gContestFinalStandings - ldrb r0, [r2] - ldr r3, =gSpecialVar_0x8005 - cmp r0, 0 - beq _080F833C -_080F832A: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bhi _080F833C - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080F832A -_080F833C: - strh r1, [r3] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F831C - - thumb_func_start sub_80F834C -sub_80F834C: @ 80F834C - push {r4,lr} - movs r1, 0 - ldr r2, =gContestFinalStandings - ldrb r0, [r2] - ldr r4, =gStringVar3 - ldr r3, =gContestMons + 13 - cmp r0, 0 - beq _080F836E -_080F835C: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bhi _080F836E - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080F835C -_080F836E: - lsls r1, 6 - adds r1, r3 - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - bl sub_81DB5AC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F834C - - thumb_func_start sub_80F8390 -sub_80F8390: @ 80F8390 - push {r4,lr} - movs r1, 0 - ldr r2, =gContestFinalStandings - ldrb r0, [r2] - ldr r4, =gStringVar1 - ldr r3, =gContestMons + 2 - cmp r0, 0 - beq _080F83B2 -_080F83A0: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bhi _080F83B2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080F83A0 -_080F83B2: - lsls r1, 6 - adds r1, r3 - adds r0, r4, 0 - bl StringCopy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8390 - - thumb_func_start sub_80F83D0 -sub_80F83D0: @ 80F83D0 - push {lr} - ldr r0, =sub_80D7B24 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F83D0 - - thumb_func_start sub_80F83E0 -sub_80F83E0: @ 80F83E0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080F83FE - adds r0, r2, 0 - bl DestroyTask - ldr r0, =sub_80F83D0 - bl SetMainCallback2 -_080F83FE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F83E0 - - thumb_func_start sub_80F840C -sub_80F840C: @ 80F840C - push {lr} - sub sp, 0x4 - bl ScriptContext2_Enable - ldr r0, =sub_80F83E0 - movs r1, 0xA - bl CreateTask - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F840C - - thumb_func_start sub_80F8438 -sub_80F8438: @ 80F8438 - ldr r2, =gSpecialVar_0x8004 - ldr r1, =gContestMons - ldr r0, =gSpecialVar_0x8006 - ldrh r0, [r0] - lsls r0, 6 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - bx lr - .pool - thumb_func_end sub_80F8438 - - thumb_func_start sub_80F8458 -sub_80F8458: @ 80F8458 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080F8476 - adds r0, r2, 0 - bl DestroyTask - ldr r0, =sub_80F5B00 - bl SetMainCallback2 -_080F8476: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8458 - - thumb_func_start sub_80F8484 -sub_80F8484: @ 80F8484 - push {lr} - sub sp, 0x4 - bl ScriptContext2_Enable - ldr r0, =sub_80F8458 - movs r1, 0xA - bl CreateTask - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8484 - - thumb_func_start sub_80F84B0 -sub_80F84B0: @ 80F84B0 - ldr r0, =gSpecialVar_0x8004 - ldr r1, =gContestPlayerMonIndex - ldrb r1, [r1] - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_80F84B0 - - thumb_func_start sub_80F84C4 -sub_80F84C4: @ 80F84C4 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - bl ScriptContext2_Enable - ldr r6, =sub_80FC580 - adds r0, r6, 0 - movs r1, 0 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r2, =sub_80F8508 - adds r0, r4, 0 - adds r1, r6, 0 - bl SetTaskFuncWithFollowupFunc - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x1A] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F84C4 - - thumb_func_start sub_80F8508 -sub_80F8508: @ 80F8508 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gIsLinkContest - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080F8540 - ldr r0, =gContestMonPartyIndex - ldrb r0, [r0] - bl sub_80DA8C8 - ldr r1, =sub_80FC6BC - ldr r2, =sub_80F8568 - adds r0, r4, 0 - bl SetTaskFuncWithFollowupFunc - b _080F8556 - .pool -_080F8540: - ldr r0, =gContestMonPartyIndex - ldrb r0, [r0] - bl sub_80DA8C8 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81D9DE4 - str r1, [r0] -_080F8556: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8508 - - thumb_func_start sub_80F8568 -sub_80F8568: @ 80F8568 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sub_80FC804 - ldr r2, =sub_80F8584 - bl SetTaskFuncWithFollowupFunc - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8568 - - thumb_func_start sub_80F8584 -sub_80F8584: @ 80F8584 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sub_80FCE48 - ldr r2, =sub_80F85A0 - bl SetTaskFuncWithFollowupFunc - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8584 - - thumb_func_start sub_80F85A0 -sub_80F85A0: @ 80F85A0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sub_80FC894 - ldr r2, =sub_80F85BC - bl SetTaskFuncWithFollowupFunc - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F85A0 - - thumb_func_start sub_80F85BC -sub_80F85BC: @ 80F85BC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - movs r3, 0 - ldr r5, =gNumLinkContestPlayers - mov r12, r5 - ldr r0, =gSpecialVar_0x8004 - mov r9, r0 - add r1, sp, 0x4 - mov r8, r1 - ldrb r0, [r5] - cmp r3, r0 - bcs _080F8606 - lsls r0, r6, 2 - adds r0, r6 - lsls r4, r0, 3 - ldr r7, =gTasks + 0x8 -_080F85EC: - mov r1, sp - adds r2, r1, r3 - adds r1, r3, 0x1 - lsls r0, r1, 1 - adds r0, r4 - adds r0, r7 - ldrh r0, [r0] - strb r0, [r2] - lsls r1, 24 - lsrs r3, r1, 24 - ldrb r0, [r5] - cmp r3, r0 - bcc _080F85EC -_080F8606: - movs r3, 0 - mov r1, r12 - ldrb r0, [r1] - cmp r3, r0 - bcs _080F862A - adds r4, r0, 0 - mov r2, sp -_080F8614: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, r4 - bcs _080F862A - mov r0, sp - adds r1, r0, r3 - ldrb r0, [r2] - ldrb r1, [r1] - cmp r0, r1 - beq _080F8614 -_080F862A: - mov r1, r12 - ldrb r1, [r1] - cmp r3, r1 - bne _080F8644 - movs r0, 0 - b _080F8646 - .pool -_080F8644: - movs r0, 0x1 -_080F8646: - mov r1, r9 - strh r0, [r1] - movs r3, 0 - mov r4, r12 - ldrb r0, [r4] - cmp r3, r0 - bcs _080F8678 - mov r5, r8 - lsls r0, r6, 2 - adds r0, r6 - lsls r2, r0, 3 - ldr r7, =gTasks + 0x8 -_080F865E: - adds r1, r5, r3 - adds r0, r3, 0x5 - lsls r0, 1 - adds r0, r2 - adds r0, r7 - ldrh r0, [r0] - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - ldrb r1, [r4] - cmp r3, r1 - bcc _080F865E -_080F8678: - mov r0, r8 - bl sub_80F86E0 - ldr r1, =gUnknown_02039F2B - strb r0, [r1] - ldr r0, =gSpecialVar_ContestCategory - ldrb r0, [r0] - bl sub_80DB09C - ldr r1, =sub_80FCF40 - ldr r2, =sub_80F86B8 - adds r0, r6, 0 - bl SetTaskFuncWithFollowupFunc - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F85BC - - thumb_func_start sub_80F86B8 -sub_80F86B8: @ 80F86B8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - bl sub_80DCE58 - ldr r1, =sub_80FCFD0 - ldr r2, =sub_80F8714 - adds r0, r4, 0 - bl SetTaskFuncWithFollowupFunc - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F86B8 - - thumb_func_start sub_80F86E0 -sub_80F86E0: @ 80F86E0 - push {r4,r5,lr} - adds r3, r0, 0 - movs r4, 0 - movs r2, 0x1 - ldr r0, =gNumLinkContestPlayers - ldrb r0, [r0] - cmp r2, r0 - bge _080F8708 - adds r5, r0, 0 -_080F86F2: - adds r0, r3, r4 - adds r1, r3, r2 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bcs _080F8702 - lsls r0, r2, 24 - lsrs r4, r0, 24 -_080F8702: - adds r2, 0x1 - cmp r2, r5 - blt _080F86F2 -_080F8708: - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80F86E0 - - thumb_func_start sub_80F8714 -sub_80F8714: @ 80F8714 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0x1 - bne _080F8748 - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080F877E - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80F878C - str r0, [r1] - b _080F877E - .pool -_080F8748: - ldr r5, =gContestMons + 2 - movs r4, 0x3 -_080F874C: - adds r0, r5, 0 - bl StringGetEnd10 - adds r5, 0x40 - subs r4, 0x1 - cmp r4, 0 - bge _080F874C - adds r0, r6, 0 - bl DestroyTask - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0x4 - ldrsb r1, [r0, r1] - movs r2, 0x5 - ldrsb r2, [r0, r2] - movs r3, 0x1 - negs r3, r3 - movs r0, 0 - bl SetDynamicWarp - bl ScriptContext2_Disable - bl EnableBothScriptContexts -_080F877E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F8714 - - thumb_func_start sub_80F878C -sub_80F878C: @ 80F878C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_800AC34 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80F87B4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F878C - - thumb_func_start sub_80F87B4 -sub_80F87B4: @ 80F87B4 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080F87D0 - adds r0, r1, 0 - bl DestroyTask - bl ScriptContext2_Disable - bl EnableBothScriptContexts -_080F87D0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80F87B4 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/easy_chat.s b/asm/easy_chat.s index f6f09a87e..271d1bce1 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -5,2641 +5,6 @@ .text - thumb_func_start sub_811ACDC -sub_811ACDC: @ 811ACDC - push {r4-r6,lr} - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0811AD4A - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - beq _0811AD3E - b _0811AD24 - .pool -_0811AD04: - movs r0, 0x20 - ands r0, r2 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0 - bne _0811ADE0 - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - bne _0811ADD0 - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - bne _0811ADC0 - movs r0, 0 - b _0811AE32 -_0811AD24: - cmp r0, 0x1 - bgt _0811AD2E - cmp r0, 0 - beq _0811AD38 - b _0811AD4A -_0811AD2E: - cmp r0, 0x2 - beq _0811ADF6 - cmp r0, 0x3 - beq _0811AD44 - b _0811AD4A -_0811AD38: - bl sub_811B184 - b _0811ADFA -_0811AD3E: - bl sub_811B150 - b _0811ADFA -_0811AD44: - bl sub_811B264 - b _0811ADFA -_0811AD4A: - ldrh r2, [r2, 0x2E] - movs r0, 0x2 - ands r0, r2 - cmp r0, 0 - bne _0811ADF0 - movs r0, 0x8 - ands r0, r2 - cmp r0, 0 - bne _0811ADF6 - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - beq _0811AD04 - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - ldrb r0, [r1, 0x6] - subs r0, 0x1 - strb r0, [r1, 0x6] -_0811AD6E: - adds r6, r2, 0 -_0811AD70: - adds r5, r6, 0 - ldr r4, [r5] - movs r3, 0x6 - ldrsb r3, [r4, r3] - ldr r2, =gUnknown_08597550 - ldrb r1, [r4, 0x1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r1, r0, r2 - ldrb r0, [r1, 0x2] - cmp r3, r0 - bne _0811AE00 - bl sub_811BA3C - movs r2, 0x3 - cmp r0, 0 - beq _0811AD96 - movs r2, 0x4 -_0811AD96: - ldr r1, [r5] - movs r0, 0x5 - ldrsb r0, [r1, r0] - cmp r0, 0 - bge _0811ADA4 - subs r0, r2, 0x1 - strb r0, [r1, 0x5] -_0811ADA4: - ldr r1, [r5] - movs r0, 0x5 - ldrsb r0, [r1, r0] - cmp r0, r2 - blt _0811ADB2 - movs r0, 0 - strb r0, [r1, 0x5] -_0811ADB2: - movs r0, 0x3 - b _0811AE32 - .pool -_0811ADC0: - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - ldrb r0, [r1, 0x5] - adds r0, 0x1 - strb r0, [r1, 0x5] - b _0811AD6E - .pool -_0811ADD0: - ldr r1, =gUnknown_0203A118 - ldr r0, [r1] - strb r3, [r0, 0x6] - adds r6, r1, 0 - b _0811AD70 - .pool -_0811ADE0: - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - ldrb r0, [r1, 0x5] - subs r0, 0x1 - strb r0, [r1, 0x5] - b _0811AD6E - .pool -_0811ADF0: - bl sub_811B150 - b _0811ADFA -_0811ADF6: - bl sub_811B1B4 -_0811ADFA: - lsls r0, 16 - lsrs r0, 16 - b _0811AE32 -_0811AE00: - movs r0, 0x5 - ldrsb r0, [r4, r0] - ldrb r1, [r1, 0x1] - cmp r0, r1 - blt _0811AE0E - subs r0, r1, 0x1 - strb r0, [r4, 0x5] -_0811AE0E: - bl sub_811AB44 - cmp r0, 0 - beq _0811AE28 - ldr r2, [r6] - ldr r0, [r2, 0x4] - ldr r1, =0x00ffff00 - ands r0, r1 - ldr r1, =0x00040100 - cmp r0, r1 - bne _0811AE28 - movs r0, 0 - strb r0, [r2, 0x5] -_0811AE28: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0 - strb r0, [r1, 0x4] - movs r0, 0x2 -_0811AE32: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_811ACDC - - thumb_func_start sub_811AE44 -sub_811AE44: @ 811AE44 - push {lr} - ldr r1, =gMain - ldrh r2, [r1, 0x2E] - movs r0, 0x2 - ands r0, r2 - adds r3, r1, 0 - cmp r0, 0 - beq _0811AE60 - bl sub_811B32C - b _0811AEF6 - .pool -_0811AE60: - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _0811AEAE - ldr r0, =gUnknown_0203A118 - ldr r2, [r0] - movs r1, 0xA - ldrsb r1, [r2, r1] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0811AE84 - bl sub_811B2B0 - b _0811AEF6 - .pool -_0811AE84: - movs r0, 0xB - ldrsb r0, [r2, r0] - cmp r0, 0x1 - beq _0811AEA2 - cmp r0, 0x1 - bgt _0811AE96 - cmp r0, 0 - beq _0811AE9C - b _0811AEAE -_0811AE96: - cmp r0, 0x2 - beq _0811AEA8 - b _0811AEAE -_0811AE9C: - bl sub_811B33C - b _0811AEF6 -_0811AEA2: - bl sub_811B368 - b _0811AEF6 -_0811AEA8: - bl sub_811B32C - b _0811AEF6 -_0811AEAE: - ldrh r1, [r3, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0811AEBE - bl sub_811B33C - b _0811AEF6 -_0811AEBE: - ldrh r1, [r3, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0811AECC - movs r0, 0x2 - b _0811AEF2 -_0811AECC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0811AED8 - movs r0, 0x3 - b _0811AEF2 -_0811AED8: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0811AEE4 - movs r0, 0x1 - b _0811AEF2 -_0811AEE4: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0811AEF0 - movs r0, 0 - b _0811AEFA -_0811AEF0: - movs r0, 0 -_0811AEF2: - bl sub_811B528 -_0811AEF6: - lsls r0, 16 - lsrs r0, 16 -_0811AEFA: - pop {r1} - bx r1 - thumb_func_end sub_811AE44 - - thumb_func_start sub_811AF00 -sub_811AF00: @ 811AF00 - push {lr} - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0811AF24 - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0x2 - strb r0, [r1, 0x4] - movs r0, 0xE - b _0811AF86 - .pool -_0811AF24: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0811AF32 - bl sub_811B394 - b _0811AF82 -_0811AF32: - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0811AF3E - movs r0, 0x4 - b _0811AF7E -_0811AF3E: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0811AF4A - movs r0, 0x5 - b _0811AF7E -_0811AF4A: - ldrh r1, [r2, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0811AF58 - movs r0, 0x2 - b _0811AF7E -_0811AF58: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0811AF64 - movs r0, 0x3 - b _0811AF7E -_0811AF64: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0811AF70 - movs r0, 0x1 - b _0811AF7E -_0811AF70: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _0811AF7C - movs r0, 0 - b _0811AF86 -_0811AF7C: - movs r0, 0 -_0811AF7E: - bl sub_811B794 -_0811AF82: - lsls r0, 16 - lsrs r0, 16 -_0811AF86: - pop {r1} - bx r1 - thumb_func_end sub_811AF00 - - thumb_func_start sub_811AF8C -sub_811AF8C: @ 811AF8C - push {lr} - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0811AFC0 - cmp r1, 0 - bgt _0811AFA8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0811AFAC - b _0811AFE4 -_0811AFA8: - cmp r1, 0x1 - bne _0811AFE4 -_0811AFAC: - bl sub_811B2A4 - ldr r1, =gUnknown_0203A118 - ldr r1, [r1] - strb r0, [r1, 0x4] - movs r0, 0x7 - b _0811AFE6 - .pool -_0811AFC0: - ldr r0, =gSpecialVar_Result - strh r1, [r0] - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0] - subs r0, 0x11 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0811AFD8 - bl sub_811B3E4 -_0811AFD8: - movs r0, 0x18 - b _0811AFE6 - .pool -_0811AFE4: - movs r0, 0 -_0811AFE6: - pop {r1} - bx r1 - thumb_func_end sub_811AF8C - - thumb_func_start sub_811AFEC -sub_811AFEC: @ 811AFEC - push {r4,lr} - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0811B020 - cmp r1, 0 - bgt _0811B008 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0811B00C - b _0811B038 -_0811B008: - cmp r1, 0x1 - bne _0811B038 -_0811B00C: - bl sub_811B2A4 - ldr r1, =gUnknown_0203A118 - ldr r1, [r1] - strb r0, [r1, 0x4] - movs r0, 0x7 - b _0811B03A - .pool -_0811B020: - bl sub_811BE9C - ldr r4, =gSpecialVar_Result - bl sub_811B4EC - strh r0, [r4] - bl sub_811B3E4 - movs r0, 0x18 - b _0811B03A - .pool -_0811B038: - movs r0, 0 -_0811B03A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811AFEC - - thumb_func_start sub_811B040 -sub_811B040: @ 811B040 - push {lr} - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0811B070 - cmp r1, 0 - bgt _0811B05C - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0811B060 - b _0811B084 -_0811B05C: - cmp r1, 0x1 - bne _0811B084 -_0811B060: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x4] - movs r0, 0x7 - b _0811B086 - .pool -_0811B070: - bl sub_811B418 - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x4] - movs r0, 0x8 - b _0811B086 - .pool -_0811B084: - movs r0, 0 -_0811B086: - pop {r1} - bx r1 - thumb_func_end sub_811B040 - - thumb_func_start sub_811B08C -sub_811B08C: @ 811B08C - push {lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0811B0A4 - movs r0, 0x1A - b _0811B0B8 - .pool -_0811B0A4: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0811B0B0 - movs r0, 0 - b _0811B0B8 -_0811B0B0: - bl sub_811B150 - lsls r0, 16 - lsrs r0, 16 -_0811B0B8: - pop {r1} - bx r1 - thumb_func_end sub_811B08C - - thumb_func_start sub_811B0BC -sub_811B0BC: @ 811B0BC - push {lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _0811B0D4 - movs r0, 0 - b _0811B0E0 - .pool -_0811B0D4: - bl sub_811B2A4 - ldr r1, =gUnknown_0203A118 - ldr r1, [r1] - strb r0, [r1, 0x4] - movs r0, 0x7 -_0811B0E0: - pop {r1} - bx r1 - .pool - thumb_func_end sub_811B0BC - - thumb_func_start sub_811B0E8 -sub_811B0E8: @ 811B0E8 - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0xA - strb r0, [r1, 0x4] - movs r0, 0x6 - bx lr - .pool - thumb_func_end sub_811B0E8 - - thumb_func_start sub_811B0F8 -sub_811B0F8: @ 811B0F8 - push {r4,lr} - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0811B134 - cmp r1, 0 - bgt _0811B114 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0811B118 - b _0811B148 -_0811B114: - cmp r1, 0x1 - bne _0811B148 -_0811B118: - bl sub_811B454 - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - movs r0, 0 - strb r0, [r1, 0x8] - ldr r1, [r2] - movs r0, 0x8 - strb r0, [r1, 0x4] - movs r0, 0x1F - b _0811B14A - .pool -_0811B134: - ldr r4, =gSpecialVar_Result - bl sub_811B4EC - strh r0, [r4] - bl sub_811B3E4 - movs r0, 0x18 - b _0811B14A - .pool -_0811B148: - movs r0, 0 -_0811B14A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811B0F8 - - thumb_func_start sub_811B150 -sub_811B150: @ 811B150 - push {lr} - ldr r1, =gUnknown_0203A118 - ldr r2, [r1] - ldrb r0, [r2] - cmp r0, 0x13 - beq _0811B160 - cmp r0, 0xB - bne _0811B174 -_0811B160: - ldrb r0, [r2, 0x4] - strb r0, [r2, 0x8] - ldr r1, [r1] - movs r0, 0x8 - strb r0, [r1, 0x4] - movs r0, 0x22 - b _0811B180 - .pool -_0811B174: - ldrb r0, [r2, 0x4] - strb r0, [r2, 0x8] - ldr r1, [r1] - movs r0, 0x4 - strb r0, [r1, 0x4] - movs r0, 0x5 -_0811B180: - pop {r1} - bx r1 - thumb_func_end sub_811B150 - - thumb_func_start sub_811B184 -sub_811B184: @ 811B184 - push {lr} - ldr r2, =gUnknown_0203A118 - ldr r0, [r2] - ldrb r1, [r0, 0x4] - strb r1, [r0, 0x8] - ldr r1, [r2] - ldrb r0, [r1] - cmp r0, 0x6 - bne _0811B1A8 - ldrb r0, [r1, 0x4] - strb r0, [r1, 0x8] - ldr r1, [r2] - movs r0, 0x8 - strb r0, [r1, 0x4] - movs r0, 0x20 - b _0811B1AE - .pool -_0811B1A8: - movs r0, 0x5 - strb r0, [r1, 0x4] - movs r0, 0x4 -_0811B1AE: - pop {r1} - bx r1 - thumb_func_end sub_811B184 - - thumb_func_start sub_811B1B4 -sub_811B1B4: @ 811B1B4 - push {r4,lr} - ldr r4, =gUnknown_0203A118 - ldr r1, [r4] - ldrb r0, [r1, 0x4] - strb r0, [r1, 0x8] - ldr r1, [r4] - ldrb r0, [r1] - cmp r0, 0x11 - bne _0811B1DC - bl sub_811BD64 - cmp r0, 0 - bne _0811B1FA - bl sub_811BDB0 - cmp r0, 0 - bne _0811B1E8 - b _0811B256 - .pool -_0811B1DC: - cmp r0, 0x12 - bne _0811B204 - bl sub_811BDB0 - cmp r0, 0 - beq _0811B1F2 -_0811B1E8: - ldr r1, [r4] - movs r0, 0x8 - strb r0, [r1, 0x4] - movs r0, 0x1E - b _0811B25C -_0811B1F2: - bl sub_811BD64 - cmp r0, 0 - beq _0811B256 -_0811B1FA: - ldr r1, [r4] - movs r0, 0x8 - strb r0, [r1, 0x4] - movs r0, 0x1D - b _0811B25C -_0811B204: - cmp r0, 0x9 - beq _0811B20C - cmp r0, 0xD - bne _0811B21E -_0811B20C: - bl sub_811BD2C - cmp r0, 0 - bne _0811B256 - ldr r1, [r4] - movs r0, 0x8 - strb r0, [r1, 0x4] - movs r0, 0x21 - b _0811B25C -_0811B21E: - cmp r0, 0x13 - beq _0811B226 - cmp r0, 0xB - bne _0811B238 -_0811B226: - bl sub_811BCF4 - cmp r0, 0 - beq _0811B256 - ldr r1, [r4] - movs r0, 0x8 - strb r0, [r1, 0x4] - movs r0, 0x22 - b _0811B25C -_0811B238: - cmp r0, 0x14 - beq _0811B258 - bl sub_811BCF4 - cmp r0, 0x1 - beq _0811B24C - bl sub_811B4EC - cmp r0, 0 - bne _0811B256 -_0811B24C: - ldr r1, [r4] - movs r0, 0x4 - strb r0, [r1, 0x4] - movs r0, 0x5 - b _0811B25C -_0811B256: - ldr r1, [r4] -_0811B258: - movs r0, 0x6 - strb r0, [r1, 0x4] -_0811B25C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811B1B4 - - thumb_func_start sub_811B264 -sub_811B264: @ 811B264 - push {lr} - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - ldrb r0, [r1, 0x4] - strb r0, [r1, 0x8] - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0x11 - beq _0811B28E - cmp r0, 0x11 - bgt _0811B284 - cmp r0, 0xF - beq _0811B28A - b _0811B29E - .pool -_0811B284: - cmp r0, 0x12 - beq _0811B296 - b _0811B29E -_0811B28A: - movs r0, 0x19 - b _0811B2A0 -_0811B28E: - bl sub_811B3E4 - movs r0, 0x1C - b _0811B2A0 -_0811B296: - bl sub_811B3E4 - movs r0, 0x1B - b _0811B2A0 -_0811B29E: - movs r0, 0 -_0811B2A0: - pop {r1} - bx r1 - thumb_func_end sub_811B264 - - thumb_func_start sub_811B2A4 -sub_811B2A4: @ 811B2A4 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bx lr - .pool - thumb_func_end sub_811B2A4 - - thumb_func_start sub_811B2B0 -sub_811B2B0: @ 811B2B0 - push {lr} - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x9] - cmp r0, 0 - bne _0811B2DC - bl sub_811B8E8 - lsls r0, 24 - lsrs r0, 24 - bl sub_811F3B8 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_811F548 - b _0811B2EC - .pool -_0811B2DC: - bl sub_811B908 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1 - bl sub_811F548 -_0811B2EC: - bl sub_811F5B0 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - beq _0811B324 - ldr r2, =gUnknown_0203A118 - ldr r3, [r2] - subs r0, 0x1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - movs r1, 0 - strb r0, [r3, 0xF] - ldr r0, [r2] - strb r1, [r0, 0xE] - ldr r0, [r2] - strb r1, [r0, 0x10] - ldr r0, [r2] - strb r1, [r0, 0x11] - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1, 0x4] - movs r0, 0xB - b _0811B326 - .pool -_0811B324: - movs r0, 0 -_0811B326: - pop {r1} - bx r1 - thumb_func_end sub_811B2B0 - - thumb_func_start sub_811B32C -sub_811B32C: @ 811B32C - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0 - strb r0, [r1, 0x4] - movs r0, 0xA - bx lr - .pool - thumb_func_end sub_811B32C - - thumb_func_start sub_811B33C -sub_811B33C: @ 811B33C - push {lr} - ldr r1, =gUnknown_0203A118 - ldr r0, [r1] - movs r2, 0 - strb r2, [r0, 0xA] - ldr r0, [r1] - strb r2, [r0, 0xB] - ldr r0, [r1] - strb r2, [r0, 0xC] - ldr r1, [r1] - ldrb r0, [r1, 0x9] - cmp r0, 0 - bne _0811B360 - movs r0, 0x1 - strb r0, [r1, 0x9] - b _0811B362 - .pool -_0811B360: - strb r2, [r1, 0x9] -_0811B362: - movs r0, 0x17 - pop {r1} - bx r1 - thumb_func_end sub_811B33C - - thumb_func_start sub_811B368 -sub_811B368: @ 811B368 - push {lr} - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x6 - beq _0811B388 - ldr r0, =0x0000ffff - bl sub_811B488 - movs r0, 0x1 - b _0811B390 - .pool -_0811B388: - movs r0, 0x20 - bl PlaySE - movs r0, 0 -_0811B390: - pop {r1} - bx r1 - thumb_func_end sub_811B368 - - thumb_func_start sub_811B394 -sub_811B394: @ 811B394 - push {r4,r5,lr} - bl sub_811B940 - lsls r0, 16 - lsrs r0, 16 - bl sub_811F578 - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl sub_811BF88 - adds r5, r0, 0 - cmp r5, 0 - beq _0811B3BC - movs r0, 0x20 - bl PlaySE - movs r0, 0 - b _0811B3DC -_0811B3BC: - adds r0, r4, 0 - bl sub_811B488 - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r0, [r1] - cmp r0, 0x6 - bne _0811B3D8 - movs r0, 0x9 - strb r0, [r1, 0x4] - movs r0, 0xD - b _0811B3DC - .pool -_0811B3D8: - strb r5, [r1, 0x4] - movs r0, 0xC -_0811B3DC: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_811B394 - - thumb_func_start sub_811B3E4 -sub_811B3E4: @ 811B3E4 - push {r4,r5,lr} - movs r4, 0 - ldr r3, =gUnknown_0203A118 - ldr r0, [r3] - ldrb r0, [r0, 0x7] - cmp r4, r0 - bge _0811B40E - adds r5, r3, 0 -_0811B3F4: - ldr r3, [r5] - ldr r1, [r3, 0x38] - lsls r2, r4, 1 - adds r1, r2, r1 - adds r0, r3, 0 - adds r0, 0x3C - adds r0, r2 - ldrh r0, [r0] - strh r0, [r1] - adds r4, 0x1 - ldrb r3, [r3, 0x7] - cmp r4, r3 - blt _0811B3F4 -_0811B40E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811B3E4 - - thumb_func_start sub_811B418 -sub_811B418: @ 811B418 - push {r4,r5,lr} - movs r3, 0 - ldr r2, =gUnknown_0203A118 - ldr r0, [r2] - ldrb r0, [r0, 0x7] - cmp r3, r0 - bge _0811B444 - adds r5, r2, 0 - ldr r0, =0x0000ffff - adds r4, r0, 0 -_0811B42C: - ldr r2, [r5] - lsls r0, r3, 1 - adds r1, r2, 0 - adds r1, 0x3C - adds r1, r0 - ldrh r0, [r1] - orrs r0, r4 - strh r0, [r1] - adds r3, 0x1 - ldrb r2, [r2, 0x7] - cmp r3, r2 - blt _0811B42C -_0811B444: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811B418 - - thumb_func_start sub_811B454 -sub_811B454: @ 811B454 - push {r4,r5,lr} - movs r4, 0 - ldr r3, =gUnknown_0203A118 - ldr r0, [r3] - ldrb r0, [r0, 0x7] - cmp r4, r0 - bge _0811B47E - adds r5, r3, 0 -_0811B464: - ldr r3, [r5] - lsls r1, r4, 1 - adds r2, r3, 0 - adds r2, 0x3C - adds r2, r1 - ldr r0, [r3, 0x38] - adds r1, r0 - ldrh r0, [r1] - strh r0, [r2] - adds r4, 0x1 - ldrb r3, [r3, 0x7] - cmp r4, r3 - blt _0811B464 -_0811B47E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811B454 - - thumb_func_start sub_811B488 -sub_811B488: @ 811B488 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_811B8C8 - lsls r0, 16 - ldr r1, =gUnknown_0203A118 - ldr r1, [r1] - lsrs r0, 15 - adds r1, 0x3C - adds r1, r0 - strh r4, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811B488 - - thumb_func_start sub_811B4AC -sub_811B4AC: @ 811B4AC - push {r4,r5,lr} - movs r2, 0 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r1, [r0, 0x7] - cmp r2, r1 - bcs _0811B4E2 - adds r5, r1, 0 - adds r4, r0, 0 - adds r4, 0x3C - ldr r3, [r0, 0x38] -_0811B4C2: - lsls r0, r2, 1 - adds r1, r4, r0 - adds r0, r3 - ldrh r1, [r1] - ldrh r0, [r0] - cmp r1, r0 - beq _0811B4D8 - movs r0, 0x1 - b _0811B4E4 - .pool -_0811B4D8: - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, r5 - bcc _0811B4C2 -_0811B4E2: - movs r0, 0 -_0811B4E4: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_811B4AC - - thumb_func_start sub_811B4EC -sub_811B4EC: @ 811B4EC - push {lr} - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0] - subs r0, 0x11 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0811B51C - bl sub_811BD64 - cmp r0, 0 - bne _0811B50E - bl sub_811BDB0 - cmp r0, 0 - beq _0811B518 -_0811B50E: - movs r0, 0 - b _0811B524 - .pool -_0811B518: - movs r0, 0x1 - b _0811B524 -_0811B51C: - bl sub_811B4AC - lsls r0, 24 - lsrs r0, 24 -_0811B524: - pop {r1} - bx r1 - thumb_func_end sub_811B4EC - - thumb_func_start sub_811B528 -sub_811B528: @ 811B528 - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_0203A118 - ldr r3, [r0] - movs r1, 0xA - ldrsb r1, [r3, r1] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0811B558 - ldrb r0, [r3, 0x9] - cmp r0, 0 - bne _0811B550 - adds r0, r2, 0 - bl sub_811B568 - b _0811B55E - .pool -_0811B550: - adds r0, r2, 0 - bl sub_811B634 - b _0811B55E -_0811B558: - adds r0, r2, 0 - bl sub_811B6C4 -_0811B55E: - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_811B528 - - thumb_func_start sub_811B568 -sub_811B568: @ 811B568 - push {r4,lr} - cmp r0, 0x1 - beq _0811B5DE - cmp r0, 0x1 - bcc _0811B5FE - cmp r0, 0x2 - beq _0811B57C - cmp r0, 0x3 - beq _0811B5A4 - b _0811B62A -_0811B57C: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0xB - ldrsb r0, [r1, r0] - ldrb r3, [r1, 0xC] - cmn r0, r3 - beq _0811B62A - ldrb r2, [r1, 0xB] - cmp r0, 0 - beq _0811B59C - subs r0, r2, 0x1 - strb r0, [r1, 0xB] -_0811B594: - movs r0, 0xF - b _0811B62C - .pool -_0811B59C: - subs r0, r3, 0x1 - strb r0, [r1, 0xC] - movs r0, 0x11 - b _0811B62C -_0811B5A4: - ldr r0, =gUnknown_0203A118 - ldr r2, [r0] - movs r1, 0xB - ldrsb r1, [r2, r1] - ldrb r3, [r2, 0xC] - adds r1, r3 - ldrb r0, [r2, 0xD] - subs r0, 0x1 - cmp r1, r0 - bge _0811B62A - ldrb r1, [r2, 0xB] - movs r0, 0xB - ldrsb r0, [r2, r0] - cmp r0, 0x2 - bgt _0811B5D0 - adds r0, r1, 0x1 - strb r0, [r2, 0xB] - movs r4, 0xF - b _0811B5D6 - .pool -_0811B5D0: - adds r0, r3, 0x1 - strb r0, [r2, 0xC] - movs r4, 0x10 -_0811B5D6: - bl sub_811B978 - adds r0, r4, 0 - b _0811B62C -_0811B5DE: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0xA] - movs r0, 0xA - ldrsb r0, [r1, r0] - cmp r0, 0 - beq _0811B5F8 - subs r0, r2, 0x1 - strb r0, [r1, 0xA] - b _0811B594 - .pool -_0811B5F8: - bl sub_811B744 - b _0811B594 -_0811B5FE: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0xA] - movs r0, 0xA - ldrsb r0, [r1, r0] - cmp r0, 0 - bgt _0811B624 - adds r0, r2, 0x1 - strb r0, [r1, 0xA] - bl sub_811B9C8 - lsls r0, 24 - cmp r0, 0 - beq _0811B594 - bl sub_811B744 - b _0811B594 - .pool -_0811B624: - bl sub_811B744 - b _0811B594 -_0811B62A: - movs r0, 0 -_0811B62C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811B568 - - thumb_func_start sub_811B634 -sub_811B634: @ 811B634 - push {lr} - cmp r0, 0x1 - beq _0811B6A0 - cmp r0, 0x1 - bcc _0811B684 - cmp r0, 0x2 - beq _0811B64A - cmp r0, 0x3 - beq _0811B66A - movs r0, 0 - b _0811B6BC -_0811B64A: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0xB] - movs r0, 0xB - ldrsb r0, [r1, r0] - cmp r0, 0 - ble _0811B660 - subs r0, r2, 0x1 - b _0811B662 - .pool -_0811B660: - movs r0, 0x3 -_0811B662: - strb r0, [r1, 0xB] - bl sub_811B978 - b _0811B6BA -_0811B66A: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0xB] - movs r0, 0xB - ldrsb r0, [r1, r0] - cmp r0, 0x2 - bgt _0811B680 - adds r0, r2, 0x1 - b _0811B662 - .pool -_0811B680: - movs r0, 0 - b _0811B662 -_0811B684: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r0, [r1, 0xA] - adds r0, 0x1 - strb r0, [r1, 0xA] - bl sub_811B9C8 - lsls r0, 24 - cmp r0, 0 - beq _0811B6BA - b _0811B6B6 - .pool -_0811B6A0: - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - ldrb r0, [r1, 0xA] - subs r0, 0x1 - strb r0, [r1, 0xA] - ldr r0, [r2] - ldrb r0, [r0, 0xA] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bge _0811B6BA -_0811B6B6: - bl sub_811B744 -_0811B6BA: - movs r0, 0xF -_0811B6BC: - pop {r1} - bx r1 - .pool - thumb_func_end sub_811B634 - - thumb_func_start sub_811B6C4 -sub_811B6C4: @ 811B6C4 - push {lr} - adds r2, r0, 0 - cmp r2, 0x1 - beq _0811B714 - cmp r2, 0x1 - bcc _0811B728 - cmp r2, 0x2 - beq _0811B6DC - cmp r2, 0x3 - beq _0811B6F8 - movs r0, 0 - b _0811B73A -_0811B6DC: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r3, [r1, 0xB] - movs r0, 0xB - ldrsb r0, [r1, r0] - cmp r0, 0 - beq _0811B6F4 - subs r0, r3, 0x1 - b _0811B736 - .pool -_0811B6F4: - strb r2, [r1, 0xB] - b _0811B738 -_0811B6F8: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0xB] - movs r0, 0xB - ldrsb r0, [r1, r0] - cmp r0, 0x1 - bgt _0811B710 - adds r0, r2, 0x1 - b _0811B736 - .pool -_0811B710: - movs r0, 0 - b _0811B736 -_0811B714: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r0, [r1, 0xB] - adds r0, 0x1 - strb r0, [r1, 0xB] - bl sub_811B768 - b _0811B738 - .pool -_0811B728: - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - movs r0, 0 - strb r0, [r1, 0xA] - ldr r1, [r2] - ldrb r0, [r1, 0xB] - adds r0, 0x1 -_0811B736: - strb r0, [r1, 0xB] -_0811B738: - movs r0, 0xF -_0811B73A: - pop {r1} - bx r1 - .pool - thumb_func_end sub_811B6C4 - - thumb_func_start sub_811B744 -sub_811B744: @ 811B744 - push {lr} - ldr r2, =gUnknown_0203A118 - ldr r1, [r2] - movs r0, 0xFF - strb r0, [r1, 0xA] - ldr r2, [r2] - ldrb r1, [r2, 0xB] - movs r0, 0xB - ldrsb r0, [r2, r0] - cmp r0, 0 - beq _0811B75E - subs r0, r1, 0x1 - strb r0, [r2, 0xB] -_0811B75E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_811B744 - - thumb_func_start sub_811B768 -sub_811B768: @ 811B768 - push {r4,lr} - ldr r4, =gUnknown_0203A118 - ldr r1, [r4] - ldrb r0, [r1, 0x9] - cmp r0, 0 - bne _0811B784 - movs r0, 0x1 - strb r0, [r1, 0xA] - bl sub_811B978 - b _0811B78E - .pool -_0811B784: - ldrb r0, [r1, 0xB] - bl sub_811B960 - ldr r1, [r4] - strb r0, [r1, 0xA] -_0811B78E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_811B768 - - thumb_func_start sub_811B794 -sub_811B794: @ 811B794 - push {r4,lr} - cmp r0, 0x5 - bls _0811B79C - b _0811B8C0 -_0811B79C: - lsls r0, 2 - ldr r1, =_0811B7AC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0811B7AC: - .4byte _0811B848 - .4byte _0811B826 - .4byte _0811B7C4 - .4byte _0811B7F0 - .4byte _0811B870 - .4byte _0811B890 -_0811B7C4: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0x11 - ldrsb r0, [r1, r0] - ldrb r3, [r1, 0xE] - adds r0, r3 - cmp r0, 0 - bgt _0811B7D6 - b _0811B8C0 -_0811B7D6: - ldrb r2, [r1, 0x11] - movs r0, 0x11 - ldrsb r0, [r1, r0] - cmp r0, 0 - ble _0811B7E8 - subs r0, r2, 0x1 - b _0811B80E - .pool -_0811B7E8: - subs r0, r3, 0x1 - strb r0, [r1, 0xE] - movs r4, 0x13 - b _0811B81E -_0811B7F0: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0x11 - ldrsb r0, [r1, r0] - ldrb r3, [r1, 0xE] - adds r0, r3 - ldrb r2, [r1, 0xF] - cmp r0, r2 - bge _0811B8C0 - ldrb r2, [r1, 0x11] - movs r0, 0x11 - ldrsb r0, [r1, r0] - cmp r0, 0x2 - bgt _0811B818 - adds r0, r2, 0x1 -_0811B80E: - strb r0, [r1, 0x11] - movs r4, 0x12 - b _0811B81E - .pool -_0811B818: - adds r0, r3, 0x1 - strb r0, [r1, 0xE] - movs r4, 0x14 -_0811B81E: - bl sub_811B9A0 - adds r0, r4, 0 - b _0811B8C2 -_0811B826: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0x10] - movs r0, 0x10 - ldrsb r0, [r1, r0] - cmp r0, 0 - ble _0811B83C - subs r0, r2, 0x1 - b _0811B83E - .pool -_0811B83C: - movs r0, 0x1 -_0811B83E: - strb r0, [r1, 0x10] - bl sub_811B9A0 -_0811B844: - movs r0, 0x12 - b _0811B8C2 -_0811B848: - ldr r4, =gUnknown_0203A118 - ldr r1, [r4] - ldrb r2, [r1, 0x10] - movs r0, 0x10 - ldrsb r0, [r1, r0] - cmp r0, 0 - bgt _0811B866 - adds r0, r2, 0x1 - strb r0, [r1, 0x10] - bl sub_811BA1C - lsls r0, 24 - cmp r0, 0 - beq _0811B844 - ldr r1, [r4] -_0811B866: - movs r0, 0 - strb r0, [r1, 0x10] - b _0811B844 - .pool -_0811B870: - ldr r0, =gUnknown_0203A118 - ldr r2, [r0] - ldrb r0, [r2, 0xE] - adds r1, r0, 0 - cmp r1, 0 - beq _0811B8C0 - cmp r1, 0x3 - bls _0811B888 - subs r0, 0x4 - b _0811B88A - .pool -_0811B888: - movs r0, 0 -_0811B88A: - strb r0, [r2, 0xE] - movs r0, 0x15 - b _0811B8C2 -_0811B890: - ldr r3, =gUnknown_0203A118 - ldr r1, [r3] - ldrb r2, [r1, 0xE] - ldrb r0, [r1, 0xF] - subs r0, 0x4 - cmp r2, r0 - bgt _0811B8C0 - adds r0, r2, 0x4 - strb r0, [r1, 0xE] - ldr r2, [r3] - ldrb r1, [r2, 0xE] - ldrb r3, [r2, 0xF] - subs r0, r3, 0x3 - cmp r1, r0 - ble _0811B8B4 - adds r0, r3, 0 - adds r0, 0xFD - strb r0, [r2, 0xE] -_0811B8B4: - bl sub_811B9A0 - movs r0, 0x16 - b _0811B8C2 - .pool -_0811B8C0: - movs r0, 0 -_0811B8C2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811B794 - - thumb_func_start sub_811B8C8 -sub_811B8C8: @ 811B8C8 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - movs r2, 0x6 - ldrsb r2, [r0, r2] - ldrb r1, [r0, 0x2] - muls r1, r2 - ldrb r0, [r0, 0x5] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bx lr - .pool - thumb_func_end sub_811B8C8 - - thumb_func_start sub_811B8E8 -sub_811B8E8: @ 811B8E8 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - movs r1, 0xB - ldrsb r1, [r0, r1] - ldrb r2, [r0, 0xC] - adds r1, r2 - lsls r1, 1 - ldrb r0, [r0, 0xA] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bx lr - .pool - thumb_func_end sub_811B8E8 - - thumb_func_start sub_811B908 -sub_811B908: @ 811B908 - push {lr} - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r0, [r1, 0xA] - movs r3, 0 - cmp r0, 0x6 - bhi _0811B91A - movs r3, 0xA - ldrsb r3, [r1, r3] -_0811B91A: - ldrb r0, [r1, 0xB] - movs r2, 0 - cmp r0, 0x3 - bhi _0811B926 - movs r2, 0xB - ldrsb r2, [r1, r2] -_0811B926: - ldr r0, =gUnknown_08597748 - lsls r1, r2, 3 - subs r1, r2 - adds r1, r3, r1 - adds r1, r0 - ldrb r0, [r1] - pop {r1} - bx r1 - .pool - thumb_func_end sub_811B908 - - thumb_func_start sub_811B940 -sub_811B940: @ 811B940 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - movs r1, 0x11 - ldrsb r1, [r0, r1] - ldrb r2, [r0, 0xE] - adds r1, r2 - lsls r1, 1 - ldrb r0, [r0, 0x10] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bx lr - .pool - thumb_func_end sub_811B940 - - thumb_func_start sub_811B960 -sub_811B960: @ 811B960 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0811B96E - cmp r0, 0x1 - beq _0811B972 -_0811B96E: - movs r0, 0x6 - b _0811B974 -_0811B972: - movs r0, 0x5 -_0811B974: - pop {r1} - bx r1 - thumb_func_end sub_811B960 - - thumb_func_start sub_811B978 -sub_811B978: @ 811B978 - push {lr} - b _0811B98E -_0811B97C: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0xA] - movs r0, 0xA - ldrsb r0, [r1, r0] - cmp r0, 0 - beq _0811B998 - subs r0, r2, 0x1 - strb r0, [r1, 0xA] -_0811B98E: - bl sub_811B9C8 - lsls r0, 24 - cmp r0, 0 - bne _0811B97C -_0811B998: - pop {r0} - bx r0 - .pool - thumb_func_end sub_811B978 - - thumb_func_start sub_811B9A0 -sub_811B9A0: @ 811B9A0 - push {lr} - b _0811B9B6 -_0811B9A4: - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r2, [r1, 0x10] - movs r0, 0x10 - ldrsb r0, [r1, r0] - cmp r0, 0 - beq _0811B9C0 - subs r0, r2, 0x1 - strb r0, [r1, 0x10] -_0811B9B6: - bl sub_811BA1C - lsls r0, 24 - cmp r0, 0 - bne _0811B9A4 -_0811B9C0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_811B9A0 - - thumb_func_start sub_811B9C8 -sub_811B9C8: @ 811B9C8 - push {r4,lr} - ldr r4, =gUnknown_0203A118 - ldr r1, [r4] - ldrb r0, [r1, 0x9] - cmp r0, 0 - bne _0811B9F8 - bl sub_811B8E8 - adds r4, r0, 0 - bl sub_811F3AC - movs r1, 0 - lsls r0, 24 - lsls r4, 16 - lsrs r4, 16 - lsrs r0, 24 - cmp r4, r0 - bcc _0811B9EE - movs r1, 0x1 -_0811B9EE: - adds r0, r1, 0 - b _0811BA14 - .pool -_0811B9F8: - ldrb r0, [r1, 0xB] - bl sub_811B960 - movs r2, 0 - ldr r1, [r4] - ldrb r1, [r1, 0xA] - lsls r1, 24 - asrs r1, 24 - lsls r0, 24 - lsrs r0, 24 - cmp r1, r0 - ble _0811BA12 - movs r2, 0x1 -_0811BA12: - adds r0, r2, 0 -_0811BA14: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811B9C8 - - thumb_func_start sub_811BA1C -sub_811BA1C: @ 811BA1C - push {r4,lr} - bl sub_811B940 - adds r4, r0, 0 - bl sub_811F5B0 - movs r1, 0 - lsls r4, 16 - lsls r0, 16 - cmp r4, r0 - bcc _0811BA34 - movs r1, 0x1 -_0811BA34: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811BA1C - - thumb_func_start sub_811BA3C -sub_811BA3C: @ 811BA3C - ldr r2, =gUnknown_08597550 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r0, [r0, 0x3] - lsrs r0, 7 - bx lr - .pool - thumb_func_end sub_811BA3C - - thumb_func_start sub_811BA5C -sub_811BA5C: @ 811BA5C - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_811BA5C - - thumb_func_start sub_811BA68 -sub_811BA68: @ 811BA68 - ldr r2, =gUnknown_08597550 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - ldrb r0, [r0, 0x3] - lsls r0, 25 - lsrs r0, 25 - bx lr - .pool - thumb_func_end sub_811BA68 - - thumb_func_start sub_811BA88 -sub_811BA88: @ 811BA88 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldr r0, [r0, 0x34] - bx lr - .pool - thumb_func_end sub_811BA88 - - thumb_func_start sub_811BA94 -sub_811BA94: @ 811BA94 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - adds r0, 0x3C - bx lr - .pool - thumb_func_end sub_811BA94 - - thumb_func_start sub_811BAA0 -sub_811BAA0: @ 811BAA0 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - bx lr - .pool - thumb_func_end sub_811BAA0 - - thumb_func_start sub_811BAAC -sub_811BAAC: @ 811BAAC - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x2] - bx lr - .pool - thumb_func_end sub_811BAAC - - thumb_func_start sub_811BAB8 -sub_811BAB8: @ 811BAB8 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x5] - bx lr - .pool - thumb_func_end sub_811BAB8 - - thumb_func_start sub_811BAC4 -sub_811BAC4: @ 811BAC4 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x6] - bx lr - .pool - thumb_func_end sub_811BAC4 - - thumb_func_start sub_811BAD0 -sub_811BAD0: @ 811BAD0 - push {r4,r5,lr} - ldr r4, =gUnknown_08597550 - ldr r2, =gUnknown_0203A118 - ldr r5, [r2] - ldrb r3, [r5, 0x1] - lsls r2, r3, 1 - adds r2, r3 - lsls r2, 3 - adds r3, r4, 0 - adds r3, 0x8 - adds r2, r3 - ldr r2, [r2] - str r2, [r0] - ldrb r2, [r5, 0x1] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 3 - adds r4, 0xC - adds r0, r4 - ldr r0, [r0] - str r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811BAD0 - - thumb_func_start sub_811BB08 -sub_811BB08: @ 811BB08 - push {r4,r5,lr} - ldr r4, =gUnknown_08597550 - ldr r2, =gUnknown_0203A118 - ldr r5, [r2] - ldrb r3, [r5, 0x1] - lsls r2, r3, 1 - adds r2, r3 - lsls r2, 3 - adds r3, r4, 0 - adds r3, 0x10 - adds r2, r3 - ldr r2, [r2] - str r2, [r0] - ldrb r2, [r5, 0x1] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 3 - adds r4, 0x14 - adds r0, r4 - ldr r0, [r0] - str r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811BB08 - - thumb_func_start sub_811BB40 -sub_811BB40: @ 811BB40 - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x4 - bne _0811BB5C - ldr r0, =gText_StopGivingPkmnMail - b _0811BB7A - .pool -_0811BB5C: - cmp r0, 0x4 - blt _0811BB78 - cmp r0, 0x10 - bgt _0811BB78 - cmp r0, 0xF - blt _0811BB78 - ldr r0, =gText_LikeToQuitQuiz - str r0, [r2] - ldr r0, =gText_ChallengeQuestionMark - b _0811BB7E - .pool -_0811BB78: - ldr r0, =gText_QuitEditing -_0811BB7A: - str r0, [r2] - movs r0, 0 -_0811BB7E: - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_811BB40 - - thumb_func_start sub_811BB88 -sub_811BB88: @ 811BB88 - ldr r2, =gText_AllTextBeingEditedWill - str r2, [r0] - ldr r0, =gText_BeDeletedThatOkay - str r0, [r1] - bx lr - .pool - thumb_func_end sub_811BB88 - - thumb_func_start sub_811BB9C -sub_811BB9C: @ 811BB9C - ldr r2, =gUnknown_0203A118 - ldr r3, [r2] - ldrb r2, [r3, 0xA] - strb r2, [r0] - ldrb r0, [r3, 0xB] - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_811BB9C - - thumb_func_start sub_811BBB0 -sub_811BBB0: @ 811BBB0 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x9] - bx lr - .pool - thumb_func_end sub_811BBB0 - - thumb_func_start sub_811BBBC -sub_811BBBC: @ 811BBBC - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0xC] - bx lr - .pool - thumb_func_end sub_811BBBC - - thumb_func_start sub_811BBC8 -sub_811BBC8: @ 811BBC8 - ldr r2, =gUnknown_0203A118 - ldr r3, [r2] - ldrb r2, [r3, 0x10] - strb r2, [r0] - ldrb r0, [r3, 0x11] - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_811BBC8 - - thumb_func_start sub_811BBDC -sub_811BBDC: @ 811BBDC - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0xE] - bx lr - .pool - thumb_func_end sub_811BBDC - - thumb_func_start sub_811BBE8 -sub_811BBE8: @ 811BBE8 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0xF] - bx lr - .pool - thumb_func_end sub_811BBE8 - - thumb_func_start sub_811BBF4 -sub_811BBF4: @ 811BBF4 - movs r0, 0 - bx lr - thumb_func_end sub_811BBF4 - - thumb_func_start sub_811BBF8 -sub_811BBF8: @ 811BBF8 - push {lr} - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - ldrb r0, [r1, 0x4] - cmp r0, 0x2 - beq _0811BC10 - cmp r0, 0x3 - beq _0811BC1A - b _0811BC24 - .pool -_0811BC10: - ldrb r0, [r1, 0x9] - cmp r0, 0 - bne _0811BC24 - ldrb r0, [r1, 0xC] - b _0811BC1C -_0811BC1A: - ldrb r0, [r1, 0xE] -_0811BC1C: - cmp r0, 0 - beq _0811BC24 - movs r0, 0x1 - b _0811BC26 -_0811BC24: - movs r0, 0 -_0811BC26: - pop {r1} - bx r1 - thumb_func_end sub_811BBF8 - - thumb_func_start sub_811BC2C -sub_811BC2C: @ 811BC2C - push {lr} - ldr r0, =gUnknown_0203A118 - ldr r2, [r0] - ldrb r0, [r2, 0x4] - cmp r0, 0x2 - beq _0811BC44 - cmp r0, 0x3 - beq _0811BC5A - b _0811BC68 - .pool -_0811BC44: - ldrb r0, [r2, 0x9] - cmp r0, 0 - bne _0811BC68 - ldrb r1, [r2, 0xC] - adds r1, 0x4 - ldrb r0, [r2, 0xD] - subs r0, 0x1 - cmp r1, r0 - bgt _0811BC68 - movs r0, 0x1 - b _0811BC6A -_0811BC5A: - ldrb r0, [r2, 0xE] - adds r0, 0x4 - ldrb r2, [r2, 0xF] - cmp r0, r2 - bgt _0811BC68 - movs r0, 0x1 - b _0811BC6A -_0811BC68: - movs r0, 0 -_0811BC6A: - pop {r1} - bx r1 - thumb_func_end sub_811BC2C - - thumb_func_start sub_811BC70 -sub_811BC70: @ 811BC70 - push {lr} - bl sub_811BA3C - pop {r1} - bx r1 - thumb_func_end sub_811BC70 - - thumb_func_start sub_811BC7C -sub_811BC7C: @ 811BC7C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r3, r1, 24 - movs r2, 0 - cmp r2, r3 - bcs _0811BCB2 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - adds r4, r0, 0 - adds r4, 0x3C -_0811BC92: - lsls r0, r2, 1 - adds r1, r0, r5 - adds r0, r4, r0 - ldrh r1, [r1] - ldrh r0, [r0] - cmp r1, r0 - beq _0811BCA8 - movs r0, 0x1 - b _0811BCB4 - .pool -_0811BCA8: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r3 - bcc _0811BC92 -_0811BCB2: - movs r0, 0 -_0811BCB4: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_811BC7C - - thumb_func_start sub_811BCBC -sub_811BCBC: @ 811BCBC - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0, 0x12] - bx lr - .pool - thumb_func_end sub_811BCBC - - thumb_func_start sub_811BCC8 -sub_811BCC8: @ 811BCC8 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - movs r1, 0 - ldr r2, =gUnknown_08597550 -_0811BCD2: - ldrb r0, [r2] - cmp r0, r3 - bne _0811BCE4 - lsls r0, r1, 24 - lsrs r0, 24 - b _0811BCEE - .pool -_0811BCE4: - adds r2, 0x18 - adds r1, 0x1 - cmp r1, 0x14 - bls _0811BCD2 - movs r0, 0 -_0811BCEE: - pop {r1} - bx r1 - thumb_func_end sub_811BCC8 - - thumb_func_start sub_811BCF4 -sub_811BCF4: @ 811BCF4 - push {r4,lr} - movs r2, 0 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r1, [r0, 0x7] - cmp r2, r1 - bge _0811BD24 - ldr r4, =0x0000ffff - adds r3, r1, 0 - adds r1, r0, 0 - adds r1, 0x3C -_0811BD0A: - ldrh r0, [r1] - cmp r0, r4 - beq _0811BD1C - movs r0, 0 - b _0811BD26 - .pool -_0811BD1C: - adds r1, 0x2 - adds r2, 0x1 - cmp r2, r3 - blt _0811BD0A -_0811BD24: - movs r0, 0x1 -_0811BD26: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811BCF4 - - thumb_func_start sub_811BD2C -sub_811BD2C: @ 811BD2C - push {r4,lr} - movs r2, 0 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r1, [r0, 0x7] - cmp r2, r1 - bge _0811BD5C - ldr r4, =0x0000ffff - adds r3, r1, 0 - adds r1, r0, 0 - adds r1, 0x3C -_0811BD42: - ldrh r0, [r1] - cmp r0, r4 - bne _0811BD54 - movs r0, 0 - b _0811BD5E - .pool -_0811BD54: - adds r1, 0x2 - adds r2, 0x1 - cmp r2, r3 - blt _0811BD42 -_0811BD5C: - movs r0, 0x1 -_0811BD5E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811BD2C - - thumb_func_start sub_811BD64 -sub_811BD64: @ 811BD64 - push {r4,lr} - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x11 - bne _0811BD80 - bl sub_811BCF4 - b _0811BD9C - .pool -_0811BD7C: - movs r0, 0 - b _0811BD9C -_0811BD80: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r2, 0 - ldr r3, =0x0000ffff - ldr r4, =0x00003b5a - adds r1, r0, r4 -_0811BD8C: - ldrh r0, [r1] - cmp r0, r3 - bne _0811BD7C - adds r1, 0x2 - adds r2, 0x1 - cmp r2, 0x8 - ble _0811BD8C - movs r0, 0x1 -_0811BD9C: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_811BD64 - - thumb_func_start sub_811BDB0 -sub_811BDB0: @ 811BDB0 - push {lr} - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x12 - bne _0811BDC8 - bl sub_811BCF4 - b _0811BDDE - .pool -_0811BDC8: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003b58 - adds r0, r1 - movs r2, 0 - ldrh r1, [r0, 0x14] - ldr r0, =0x0000ffff - cmp r1, r0 - bne _0811BDDC - movs r2, 0x1 -_0811BDDC: - adds r0, r2, 0 -_0811BDDE: - pop {r1} - bx r1 - .pool - thumb_func_end sub_811BDB0 - - thumb_func_start sub_811BDF0 -sub_811BDF0: @ 811BDF0 - push {r4-r6,lr} - sub sp, 0x20 - adds r6, r0, 0 - ldr r0, =gSaveBlock1Ptr - ldr r4, [r0] - bl DynamicPlaceholderTextUtil_Reset - ldr r0, =0x00003b70 - adds r5, r4, r0 - adds r0, r5, 0 - bl StringLength - lsls r0, 16 - cmp r0, 0 - beq _0811BE34 - ldr r1, =0x00003b85 - adds r0, r4, r1 - ldrb r2, [r0] - mov r0, sp - adds r1, r5, 0 - bl TVShowConvertInternationalString - movs r0, 0 - mov r1, sp - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - b _0811BE3C - .pool -_0811BE34: - ldr r1, =gText_Lady - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr -_0811BE3C: - ldr r1, =gText_F700sQuiz - adds r0, r6, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - add sp, 0x20 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811BDF0 - - thumb_func_start sub_811BE54 -sub_811BE54: @ 811BE54 - push {r4,r5,lr} - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] - adds r4, r0, 0 - adds r4, 0x3C - ldr r2, =gStringVar2 - movs r5, 0 - b _0811BE86 - .pool -_0811BE6C: - ldrh r1, [r4] - adds r0, r2, 0 - movs r2, 0 - bl CopyEasyChatWordPadded - adds r2, r0, 0 - movs r0, 0 - strb r0, [r2] - adds r2, 0x1 - adds r4, 0x2 - adds r5, 0x1 - ldr r0, =gUnknown_0203A118 - ldr r0, [r0] -_0811BE86: - ldrb r0, [r0, 0x7] - cmp r5, r0 - blt _0811BE6C - subs r2, 0x1 - movs r0, 0xFF - strb r0, [r2] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811BE54 - - thumb_func_start sub_811BE9C -sub_811BE9C: @ 811BE9C - push {r4,r5,lr} - ldr r5, =gUnknown_0203A118 - ldr r0, [r5] - ldrb r0, [r0] - cmp r0, 0x9 - beq _0811BEF0 - cmp r0, 0x9 - bgt _0811BEB8 - cmp r0, 0 - beq _0811BEC2 - b _0811BF14 - .pool -_0811BEB8: - cmp r0, 0xD - beq _0811BF0C - cmp r0, 0x14 - beq _0811BED0 - b _0811BF14 -_0811BEC2: - ldr r0, =0x00000865 - bl FlagSet - b _0811BF14 - .pool -_0811BED0: - bl sub_811BF20 - adds r1, r0, 0 - cmp r1, 0 - beq _0811BEE4 - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x2 - b _0811BF12 - .pool -_0811BEE4: - ldr r0, =gSpecialVar_0x8004 - strh r1, [r0] - b _0811BF14 - .pool -_0811BEF0: - bl sub_811BE54 - ldr r4, =gSpecialVar_0x8004 - ldr r0, [r5] - adds r0, 0x3C - bl sub_81226D8 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - b _0811BF14 - .pool -_0811BF0C: - bl sub_811BF40 - ldr r1, =gSpecialVar_0x8004 -_0811BF12: - strh r0, [r1] -_0811BF14: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811BE9C - - thumb_func_start sub_811BF20 -sub_811BF20: @ 811BF20 - push {lr} - ldr r0, =gUnknown_08597764 - movs r1, 0x4 - bl sub_811BC7C - movs r1, 0 - lsls r0, 24 - cmp r0, 0 - bne _0811BF34 - movs r1, 0x1 -_0811BF34: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_811BF20 - - thumb_func_start sub_811BF40 -sub_811BF40: @ 811BF40 - push {r4,r5,lr} - movs r4, 0 - movs r5, 0x80 - lsls r5, 9 -_0811BF48: - lsls r0, r4, 2 - ldr r1, =gUnknown_0859776C - adds r0, r1 - movs r1, 0x2 - bl sub_811BC7C - lsls r0, 24 - cmp r0, 0 - bne _0811BF64 - lsrs r0, r5, 16 - b _0811BF72 - .pool -_0811BF64: - movs r0, 0x80 - lsls r0, 9 - adds r5, r0 - adds r4, 0x1 - cmp r4, 0x4 - ble _0811BF48 - movs r0, 0 -_0811BF72: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_811BF40 - - thumb_func_start sub_811BF78 -sub_811BF78: @ 811BF78 - ldr r0, =gUnknown_0203A118 - ldr r1, [r0] - movs r0, 0 - strb r0, [r1, 0x13] - bx lr - .pool - thumb_func_end sub_811BF78 - - thumb_func_start sub_811BF88 -sub_811BF88: @ 811BF88 - movs r0, 0 - bx lr - thumb_func_end sub_811BF88 - - thumb_func_start sub_811BF8C -sub_811BF8C: @ 811BF8C - push {lr} - bl sub_811CE94 - lsls r0, 24 - cmp r0, 0 - beq _0811BF9C - movs r0, 0x1 - b _0811BF9E -_0811BF9C: - movs r0, 0 -_0811BF9E: - pop {r1} - bx r1 - thumb_func_end sub_811BF8C - thumb_func_start sub_811BFA4 sub_811BFA4: @ 811BFA4 push {r4,lr} @@ -9869,10 +7234,18 @@ _0811F8AE: .pool thumb_func_end InitializeEasyChatWordArray +@void sub_811F8BC() { +@ s16* v; +@ s16* ptr; +@ v = GetSaveBlock1Field3564(); +@ for (ptr = v + 3; ptr >= v; ptr--) { +@ *ptr = -1; +@ } +@} thumb_func_start sub_811F8BC sub_811F8BC: @ 811F8BC push {lr} - bl sub_801B058 + bl GetSaveBlock1Field3564 ldr r1, =0x0000ffff adds r2, r1, 0 adds r1, r0, 0x6 diff --git a/asm/flying.s b/asm/flying.s index c8010106a..37873f17b 100644 --- a/asm/flying.s +++ b/asm/flying.s @@ -5,823 +5,6 @@ .text - thumb_func_start sub_810DE70 -sub_810DE70: @ 810DE70 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - bl InitSpritePosToAnimTarget - ldrh r0, [r4, 0x22] - adds r0, 0x14 - strh r0, [r4, 0x22] - movs r0, 0xBF - strh r0, [r4, 0x30] - ldr r1, =sub_810DE98 - str r1, [r4, 0x1C] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810DE70 - - thumb_func_start sub_810DE98 -sub_810DE98: @ 810DE98 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x20 - bl Sin - strh r0, [r4, 0x24] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x8 - bl Cos - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0x5 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x47 - bne _0810DED2 - adds r0, r4, 0 - bl DestroyAnimSprite -_0810DED2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810DE98 - - thumb_func_start sub_810DED8 -sub_810DED8: @ 810DED8 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x2] - strh r0, [r4, 0x8] - ldrh r0, [r1] - strh r0, [r4, 0xA] - ldr r0, =0x00002719 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0xC] - ldr r0, =sub_810DF18 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810DED8 - - thumb_func_start sub_810DF18 -sub_810DF18: @ 810DF18 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r3, r0, r2 - ldrh r0, [r3, 0x1C] - adds r1, r0, 0x1 - strh r1, [r3, 0x1C] - lsls r0, 16 - asrs r0, 16 - movs r4, 0xA - ldrsh r1, [r3, r4] - adds r7, r2, 0 - cmp r0, r1 - bne _0810DF76 - movs r0, 0 - strh r0, [r3, 0x1C] - ldrb r0, [r3, 0xC] - ldr r2, =gPlttBufferFaded - lsls r0, 4 - movs r3, 0x84 - lsls r3, 1 - adds r1, r0, r3 - lsls r1, 1 - adds r1, r2 - ldrh r6, [r1] - movs r4, 0x7 - mov r12, r0 - ldr r0, =0x00000107 - add r0, r12 - lsls r0, 1 - adds r3, r0, r2 -_0810DF5E: - ldrh r0, [r3] - strh r0, [r1] - subs r3, 0x2 - subs r1, 0x2 - subs r4, 0x1 - cmp r4, 0 - bgt _0810DF5E - ldr r0, =0x00000101 - add r0, r12 - lsls r0, 1 - adds r0, r2 - strh r6, [r0] -_0810DF76: - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r7 - ldrh r1, [r0, 0x8] - subs r1, 0x1 - strh r1, [r0, 0x8] - lsls r1, 16 - cmp r1, 0 - bne _0810DF90 - adds r0, r5, 0 - bl DestroyAnimVisualTask -_0810DF90: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810DF18 - - thumb_func_start sub_810DFA8 -sub_810DFA8: @ 810DFA8 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x1 - bl InitSpritePosToAnimAttacker - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810DFC8 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] -_0810DFC8: - ldr r4, =gBattleAnimArgs - ldrh r0, [r4, 0x8] - strh r0, [r6, 0x2E] - ldrh r0, [r6, 0x20] - strh r0, [r6, 0x30] - ldr r5, =gBattleAnimTarget - ldrb r0, [r5] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x4] - adds r0, r1 - strh r0, [r6, 0x32] - ldrh r0, [r6, 0x22] - strh r0, [r6, 0x34] - ldrb r0, [r5] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - ldrh r4, [r4, 0x6] - adds r0, r4 - strh r0, [r6, 0x36] - adds r0, r6, 0 - bl InitAnimLinearTranslation - ldr r0, =RunStoredCallbackWhenAffineAnimEnds - str r0, [r6, 0x1C] - ldr r1, =sub_810E028 - adds r0, r6, 0 - bl StoreSpriteCallbackInData6 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810DFA8 - - thumb_func_start sub_810E028 -sub_810E028: @ 810E028 - push {r4,lr} - adds r4, r0, 0 - bl AnimTranslateLinear - lsls r0, 24 - cmp r0, 0 - beq _0810E03C - adds r0, r4, 0 - bl DestroyAnimSprite -_0810E03C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_810E028 - - thumb_func_start sub_810E044 -sub_810E044: @ 810E044 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =gBattleAnimAttacker - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810E070 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - negs r0, r0 - strh r0, [r1] - ldrh r0, [r1, 0x2] - negs r0, r0 - strh r0, [r1, 0x2] - ldrh r0, [r1, 0x4] - negs r0, r0 - strh r0, [r1, 0x4] - ldrh r0, [r1, 0x6] - negs r0, r0 - strh r0, [r1, 0x6] -_0810E070: - bl IsContest - lsls r0, 24 - cmp r0, 0 - beq _0810E088 - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0x2] - negs r1, r1 - strh r1, [r0, 0x2] - ldrh r1, [r0, 0x6] - negs r1, r1 - strh r1, [r0, 0x6] -_0810E088: - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x20] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r2, =gBattleAnimArgs - ldrh r1, [r2] - ldrh r3, [r5, 0x20] - adds r1, r3 - strh r1, [r5, 0x20] - lsrs r0, 24 - ldrh r1, [r2, 0x2] - adds r0, r1 - strh r0, [r5, 0x22] - ldrh r0, [r2, 0x8] - strh r0, [r5, 0x2E] - movs r3, 0xC - ldrsh r0, [r2, r3] - cmp r0, 0 - bne _0810E0EC - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x32] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x36] - b _0810E0FE - .pool -_0810E0EC: - ldr r0, =gBattleAnimTarget - ldrb r0, [r0] - adds r2, r5, 0 - adds r2, 0x32 - adds r3, r5, 0 - adds r3, 0x36 - movs r1, 0x1 - bl SetAverageBattlerPositions -_0810E0FE: - ldr r4, =gBattleAnimArgs - ldrh r0, [r4, 0x4] - ldrh r1, [r5, 0x32] - adds r0, r1 - strh r0, [r5, 0x32] - ldrh r0, [r4, 0x6] - ldrh r3, [r5, 0x36] - adds r0, r3 - strh r0, [r5, 0x36] - ldr r0, =StartAnimLinearTranslation - str r0, [r5, 0x1C] - ldr r1, =DestroyAnimSprite - adds r0, r5, 0 - bl StoreSpriteCallbackInData6 - ldrb r1, [r4, 0xA] - adds r0, r5, 0 - bl SeekSpriteAnim - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810E044 - - thumb_func_start sub_810E13C -sub_810E13C: @ 810E13C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x1 - bl InitSpritePosToAnimAttacker - ldr r1, =gBattleAnimArgs - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x2E] - ldrh r0, [r1, 0x6] - strh r0, [r4, 0x30] - ldr r0, =sub_810E184 - str r0, [r4, 0x1C] - movs r0, 0 - bl GetAnimBattlerSpriteId - ldr r2, =gSprites - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810E13C - - thumb_func_start sub_810E184 -sub_810E184: @ 810E184 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x2E] - movs r3, 0x2E - ldrsh r0, [r2, r3] - cmp r0, 0 - ble _0810E198 - subs r0, r1, 0x1 - strh r0, [r2, 0x2E] - b _0810E1AA -_0810E198: - ldrh r0, [r2, 0x30] - ldrh r1, [r2, 0x32] - adds r0, r1 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 24 - ldrh r1, [r2, 0x26] - subs r1, r0 - strh r1, [r2, 0x26] -_0810E1AA: - movs r3, 0x22 - ldrsh r0, [r2, r3] - movs r3, 0x26 - ldrsh r1, [r2, r3] - adds r0, r1 - movs r1, 0x20 - negs r1, r1 - cmp r0, r1 - bge _0810E1C2 - adds r0, r2, 0 - bl DestroyAnimSprite -_0810E1C2: - pop {r0} - bx r0 - thumb_func_end sub_810E184 - - thumb_func_start sub_810E1C8 -sub_810E1C8: @ 810E1C8 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gBattleAnimAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - beq _0810E1F8 - movs r0, 0x88 - lsls r0, 1 - strh r0, [r5, 0x20] - ldr r0, =0x0000ffe0 - strh r0, [r5, 0x22] - adds r0, r5, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim - b _0810E1FE - .pool -_0810E1F8: - ldr r0, =0x0000ffe0 - strh r0, [r5, 0x20] - strh r0, [r5, 0x22] -_0810E1FE: - ldr r0, =gBattleAnimArgs - ldrh r0, [r0] - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x20] - strh r0, [r5, 0x30] - ldr r4, =gBattleAnimTarget - ldrb r0, [r4] - movs r1, 0x2 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x22] - strh r0, [r5, 0x34] - ldrb r0, [r4] - movs r1, 0x3 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl InitAnimLinearTranslation - ldr r0, =sub_810E24C - str r0, [r5, 0x1C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810E1C8 - - thumb_func_start sub_810E24C -sub_810E24C: @ 810E24C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - bl AnimTranslateLinear - ldrh r1, [r4, 0x34] - lsrs r0, r1, 8 - cmp r0, 0xC8 - bls _0810E274 - ldrh r0, [r4, 0x24] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - movs r0, 0 - strh r0, [r4, 0x24] - movs r0, 0xFF - ands r0, r1 - strh r0, [r4, 0x34] -_0810E274: - movs r1, 0x20 - ldrsh r0, [r4, r1] - movs r2, 0x24 - ldrsh r1, [r4, r2] - adds r0, r1 - adds r0, 0x20 - movs r1, 0x98 - lsls r1, 1 - cmp r0, r1 - bhi _0810E296 - movs r1, 0x22 - ldrsh r0, [r4, r1] - movs r2, 0x26 - ldrsh r1, [r4, r2] - adds r0, r1 - cmp r0, 0xA0 - ble _0810E2BC -_0810E296: - movs r0, 0 - bl GetAnimBattlerSpriteId - ldr r2, =gSprites - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - adds r0, r4, 0 - bl DestroyAnimSprite -_0810E2BC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810E24C - - thumb_func_start sub_810E2C8 -sub_810E2C8: @ 810E2C8 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - subs r1, r0, 0x1 - strh r1, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bgt _0810E308 - ldrb r0, [r4, 0x1] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0810E2FA - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x1] -_0810E2FA: - adds r0, r4, 0 - bl DestroySprite - ldr r1, =gAnimVisualTaskCount - ldrb r0, [r1] - subs r0, 0x1 - strb r0, [r1] -_0810E308: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810E2C8 - - thumb_func_start sub_810E314 -sub_810E314: @ 810E314 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - adds r5, r7, 0 - adds r5, 0x2E - ldr r0, =gBattleAnimArgs - ldrh r1, [r0, 0xE] - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _0810E33C - ldr r0, =gBattleAnimAttacker - b _0810E33E - .pool -_0810E33C: - ldr r0, =gBattleAnimTarget -_0810E33E: - ldrb r6, [r0] - adds r0, r6, 0 - bl GetBattlerSide - lsls r0, 24 - cmp r0, 0 - bne _0810E354 - ldr r1, =gBattleAnimArgs - ldrh r0, [r1] - negs r0, r0 - strh r0, [r1] -_0810E354: - adds r0, r6, 0 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldr r4, =gBattleAnimArgs - lsrs r0, 24 - ldrh r1, [r4] - adds r0, r1 - strh r0, [r7, 0x20] - adds r0, r6, 0 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - ldrh r1, [r4, 0x2] - lsrs r0, 24 - adds r1, r0, r1 - strh r1, [r7, 0x22] - lsls r1, 8 - strh r1, [r5, 0x8] - ldrh r1, [r4, 0xC] - adds r0, r1 - lsls r0, 1 - ldrh r2, [r5, 0xE] - movs r1, 0x1 - ands r1, r2 - orrs r1, r0 - strh r1, [r5, 0xE] - ldrb r0, [r5] - movs r2, 0x4 - mov r8, r2 - mov r1, r8 - orrs r0, r1 - strb r0, [r5] - ldrh r0, [r4, 0x4] - ldrb r1, [r4, 0x4] - strh r1, [r5, 0x2] - lsls r0, 16 - lsrs r0, 24 - strh r0, [r5, 0xA] - ldrh r0, [r4, 0x6] - strh r0, [r5, 0x4] - ldrh r0, [r4, 0x8] - strh r0, [r5, 0x6] - ldrh r0, [r4, 0xA] - strh r0, [r5, 0xC] - subs r1, 0x40 - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0x7F - bhi _0810E44A - bl IsContest - lsls r0, 24 - cmp r0, 0 - bne _0810E3F0 - adds r0, r6, 0 - bl GetBattlerSpriteBGPriority - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r7, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r7, 0x5] - b _0810E408 - .pool -_0810E3F0: - adds r0, r6, 0 - bl GetBattlerSpriteBGPriority - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r7, 0x5] -_0810E408: - ldrb r1, [r5, 0xE] - movs r4, 0x2 - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - strb r0, [r5, 0xE] - movs r2, 0x4 - ldrsh r0, [r5, r2] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - bne _0810E4AA - adds r3, r7, 0 - adds r3, 0x3F - ldrb r2, [r3] - lsls r0, r2, 31 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - adds r0, r4, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - lsls r0, 31 - lsrs r0, 31 - adds r1, r7, 0 - adds r1, 0x2A - strb r0, [r1] - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - b _0810E4A2 -_0810E44A: - adds r0, r6, 0 - bl GetBattlerSpriteBGPriority - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r7, 0x5] - ldrb r0, [r5, 0xE] - movs r4, 0x1 - orrs r0, r4 - strb r0, [r5, 0xE] - movs r1, 0x4 - ldrsh r0, [r5, r1] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0810E4AA - adds r3, r7, 0 - adds r3, 0x3F - ldrb r2, [r3] - lsls r1, r2, 31 - lsrs r1, 31 - movs r0, 0x1 - eors r1, r0 - ands r1, r4 - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - lsls r0, 31 - lsrs r0, 31 - adds r1, r7, 0 - adds r1, 0x2A - strb r0, [r1] - ldrb r0, [r3] - mov r2, r8 - orrs r0, r2 -_0810E4A2: - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - strb r0, [r3] -_0810E4AA: - ldrh r1, [r5, 0x2] - lsrs r1, 6 - lsls r1, 4 - ldrb r2, [r5] - movs r0, 0xF - ands r0, r2 - orrs r0, r1 - strb r0, [r5] - ldr r3, =gSineTable - ldrh r0, [r5, 0x2] - lsls r0, 1 - adds r0, r3 - movs r2, 0 - ldrsh r1, [r0, r2] - ldrb r0, [r5, 0xC] - muls r0, r1 - asrs r0, 8 - strh r0, [r7, 0x24] - ldrb r2, [r7, 0x3] - lsls r2, 26 - lsrs r2, 27 - movs r1, 0x24 - ldrsh r0, [r7, r1] - negs r0, r0 - asrs r0, 1 - ldrb r5, [r5, 0xA] - adds r0, r5 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r3 - ldrh r4, [r1] - ldr r1, =gOamMatrices - lsls r2, 3 - adds r2, r1 - adds r0, 0x40 - lsls r0, 1 - adds r0, r3 - ldrh r0, [r0] - strh r0, [r2, 0x6] - strh r0, [r2] - strh r4, [r2, 0x2] - lsls r0, r4, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r2, 0x4] - ldr r0, =sub_810E520 - str r0, [r7, 0x1C] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_810E314 - thumb_func_start sub_810E520 sub_810E520: @ 810E520 push {r4-r7,lr} diff --git a/asm/pokenav.s b/asm/pokenav.s index 337a296ad..01ba420aa 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -4,1604 +4,6 @@ .syntax unified .text - - - - thumb_func_start sub_81C7078 -sub_81C7078: @ 81C7078 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - bl IsUpdateLinkStateCBActive - cmp r0, 0 - bne _081C7090 - ldr r0, =sub_81C7170 - b _081C7092 - .pool -_081C7090: - ldr r0, =sub_81C71E4 -_081C7092: - lsls r1, r4, 24 - lsrs r1, 24 - bl CreateTask - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl SetWordTaskArg - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r2, =gUnknown_0203CF3C - ldrb r1, [r2] - strh r1, [r0, 0xE] - ldrb r0, [r2] - adds r1, r0, 0x1 - strb r1, [r2] - lsls r0, 24 - lsrs r0, 8 - orrs r0, r4 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C7078 - - thumb_func_start sub_81C70D8 -sub_81C70D8: @ 81C70D8 - push {lr} - ldr r1, =0x0000ffff - ands r1, r0 - lsrs r3, r0, 16 - ldr r2, =gTasks - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r1, r0, r2 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _081C711C - ldr r2, [r1] - ldr r0, =sub_81C7170 - cmp r2, r0 - beq _081C70FE - ldr r0, =sub_81C71E4 - cmp r2, r0 - bne _081C711C -_081C70FE: - movs r2, 0xE - ldrsh r0, [r1, r2] - cmp r0, r3 - bne _081C711C - movs r0, 0x1 - b _081C711E - .pool -_081C711C: - movs r0, 0 -_081C711E: - pop {r1} - bx r1 - thumb_func_end sub_81C70D8 - - thumb_func_start sub_81C7124 -sub_81C7124: @ 81C7124 - push {r4-r6,lr} - adds r6, r0, 0 - movs r5, 0 - ldr r4, =gTasks -_081C712C: - ldrb r0, [r4, 0x4] - cmp r0, 0 - beq _081C7160 - ldr r1, [r4] - ldr r0, =sub_81C7170 - cmp r1, r0 - beq _081C7140 - ldr r0, =sub_81C71E4 - cmp r1, r0 - bne _081C7160 -_081C7140: - lsls r0, r5, 24 - lsrs r0, 24 - movs r1, 0x1 - bl GetWordTaskArg - cmp r0, r6 - bne _081C7160 - movs r0, 0x1 - b _081C716A - .pool -_081C7160: - adds r4, 0x28 - adds r5, 0x1 - cmp r5, 0xF - ble _081C712C - movs r0, 0 -_081C716A: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81C7124 - - thumb_func_start sub_81C7170 -sub_81C7170: @ 81C7170 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - movs r1, 0x1 - bl GetWordTaskArg - adds r6, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r7, 0 -_081C718C: - movs r1, 0 - ldrsh r0, [r4, r1] - bl _call_via_r6 - cmp r0, 0x4 - bhi _081C71D6 - lsls r0, 2 - ldr r1, =_081C71AC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C71AC: - .4byte _081C71C6 - .4byte _081C71C0 - .4byte _081C71DE - .4byte _081C71DA - .4byte _081C71CE -_081C71C0: - ldrh r0, [r4] - adds r0, 0x1 - b _081C71D8 -_081C71C6: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _081C71DE -_081C71CE: - adds r0, r5, 0 - bl DestroyTask - b _081C71DE -_081C71D6: - subs r0, 0x5 -_081C71D8: - strh r0, [r4] -_081C71DA: - cmp r7, 0 - beq _081C718C -_081C71DE: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C7170 - - thumb_func_start sub_81C71E4 -sub_81C71E4: @ 81C71E4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_8087598 - cmp r0, 0 - bne _081C724A - adds r0, r5, 0 - movs r1, 0x1 - bl GetWordTaskArg - adds r2, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - bl _call_via_r2 - cmp r0, 0x4 - bhi _081C7246 - lsls r0, 2 - ldr r1, =_081C7224 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C7224: - .4byte _081C7238 - .4byte _081C7238 - .4byte _081C724A - .4byte _081C724A - .4byte _081C723E -_081C7238: - ldrh r0, [r4] - adds r0, 0x1 - b _081C7248 -_081C723E: - adds r0, r5, 0 - bl DestroyTask - b _081C724A -_081C7246: - subs r0, 0x5 -_081C7248: - strh r0, [r4] -_081C724A: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C71E4 - - thumb_func_start CB2_PokeNav -CB2_PokeNav: @ 81C7250 - push {r4,lr} - ldr r4, =gUnknown_0203CF40 - movs r0, 0x5C - bl Alloc - str r0, [r4] - cmp r0, 0 - bne _081C7270 - ldr r0, =CB2_ReturnToFieldWithOpenMenu - bl SetMainCallback2 - b _081C7292 - .pool -_081C7270: - bl sub_81C7360 - bl ResetTasks - movs r0, 0 - bl SetVBlankCallback - ldr r0, =sub_81C742C - movs r1, 0 - bl CreateTask - ldr r0, =sub_81C7400 - bl SetMainCallback2 - ldr r0, =sub_81C7418 - bl SetVBlankCallback -_081C7292: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end CB2_PokeNav - - thumb_func_start sub_81C72A4 -sub_81C72A4: @ 81C72A4 - push {lr} - ldr r0, =sub_81C72BC - bl SetMainCallback2 - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C72A4 - - thumb_func_start sub_81C72BC -sub_81C72BC: @ 81C72BC - push {r4,lr} - bl UpdatePaletteFade - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081C7320 - ldr r4, =gUnknown_0203CF40 - movs r0, 0x5C - bl Alloc - str r0, [r4] - cmp r0, 0 - bne _081C72F0 - ldr r0, =CB2_ReturnToFieldContinueScriptPlayMapMusic - bl SetMainCallback2 - b _081C7320 - .pool -_081C72F0: - bl sub_81C7360 - ldr r1, [r4] - movs r0, 0x1 - strh r0, [r1, 0x8] - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - movs r0, 0 - bl SetVBlankCallback - ldr r0, =sub_81C742C - movs r1, 0 - bl CreateTask - ldr r0, =sub_81C7400 - bl SetMainCallback2 - ldr r0, =sub_81C7418 - bl SetVBlankCallback -_081C7320: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C72BC - - thumb_func_start sub_81C7334 -sub_81C7334: @ 81C7334 - push {r4,lr} - movs r4, 0 -_081C7338: - adds r0, r4, 0 - bl sub_81C7650 - adds r4, 0x1 - cmp r4, 0x12 - ble _081C7338 - ldr r4, =gUnknown_0203CF40 - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - bl InitKeys - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7334 - - thumb_func_start sub_81C7360 -sub_81C7360: @ 81C7360 - push {r4,r5,lr} - adds r5, r0, 0 - movs r2, 0 - movs r1, 0x12 - adds r0, 0x58 -_081C736A: - str r2, [r0] - subs r0, 0x4 - subs r1, 0x1 - cmp r1, 0 - bge _081C736A - movs r4, 0 - strh r4, [r5, 0x8] - str r4, [r5, 0x4] - bl sub_81C7388 - str r0, [r5, 0xC] - str r4, [r5] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C7360 - - thumb_func_start sub_81C7388 -sub_81C7388: @ 81C7388 - push {r4-r6,lr} - movs r5, 0 -_081C738C: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _081C73BA - adds r0, r4, 0 - movs r1, 0x6 - bl GetMonData - cmp r0, 0 - bne _081C73BA - adds r0, r4, 0 - movs r1, 0x52 - bl GetMonData - cmp r0, 0 - bne _081C73E2 -_081C73BA: - adds r5, 0x1 - cmp r5, 0x5 - ble _081C738C - movs r4, 0 -_081C73C2: - movs r5, 0 - lsls r6, r4, 24 -_081C73C6: - adds r0, r4, 0 - adds r1, r5, 0 - bl CheckBoxMonSanityAt - cmp r0, 0 - beq _081C73EC - lsls r1, r5, 24 - lsrs r1, 24 - lsrs r0, r6, 24 - movs r2, 0x52 - bl GetBoxMonDataAt - cmp r0, 0 - beq _081C73EC -_081C73E2: - movs r0, 0x1 - b _081C73FA - .pool -_081C73EC: - adds r5, 0x1 - cmp r5, 0x1D - ble _081C73C6 - adds r4, 0x1 - cmp r4, 0xD - ble _081C73C2 - movs r0, 0 -_081C73FA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81C7388 - - thumb_func_start sub_81C7400 -sub_81C7400: @ 81C7400 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_81C7400 - - thumb_func_start sub_81C7418 -sub_81C7418: @ 81C7418 - push {lr} - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - pop {r0} - bx r0 - thumb_func_end sub_81C7418 - - thumb_func_start sub_81C742C -sub_81C742C: @ 81C742C - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r7, r1, r0 - movs r1, 0 - ldrsh r0, [r7, r1] - cmp r0, 0x5 - bls _081C7446 - b _081C7562 -_081C7446: - lsls r0, 2 - ldr r1, =_081C7458 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C7458: - .4byte _081C7470 - .4byte _081C747A - .4byte _081C7490 - .4byte _081C749C - .4byte _081C751E - .4byte _081C752C -_081C7470: - bl sub_81C76C4 - movs r0, 0x1 - strh r0, [r7] - b _081C7562 -_081C747A: - bl sub_81C76FC - cmp r0, 0 - bne _081C7562 - ldr r0, =0x000186a0 - bl sub_81C756C - b _081C74E8 - .pool -_081C7490: - bl sub_81C786C - cmp r0, 0 - bne _081C7562 - movs r0, 0x3 - strh r0, [r7] -_081C749C: - bl sub_81C75E0 - adds r6, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r6, r0 - beq _081C74FC - ldr r0, =0x0001869f - cmp r6, r0 - bls _081C7506 - ldr r4, =gUnknown_0861F3EC - ldr r5, =gUnknown_0203CF40 - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x18 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r4, 0x14 - adds r0, r4 - ldr r0, [r0] - bl _call_via_r0 - adds r0, r6, 0 - bl sub_81C756C - cmp r0, 0 - beq _081C74FC -_081C74E8: - movs r0, 0x4 - strh r0, [r7] - b _081C7562 - .pool -_081C74FC: - bl sub_81C7710 - movs r0, 0x5 - strh r0, [r7] - b _081C7562 -_081C7506: - cmp r6, 0 - beq _081C7562 - adds r0, r6, 0 - bl sub_81C7850 - bl sub_81C786C - cmp r0, 0 - beq _081C7562 - movs r0, 0x2 - strh r0, [r7] - b _081C7562 -_081C751E: - bl sub_81C75D4 - cmp r0, 0 - bne _081C7562 - movs r0, 0x3 - strh r0, [r7] - b _081C7562 -_081C752C: - bl sub_81C7738 - cmp r0, 0 - bne _081C7562 - ldr r0, =gUnknown_0203CF40 - ldr r0, [r0] - ldrh r0, [r0, 0x8] - negs r4, r0 - orrs r4, r0 - lsrs r4, 31 - bl sub_81C9430 - bl sub_81C7334 - cmp r4, 0 - beq _081C755C - ldr r0, =CB2_ReturnToFieldContinueScriptPlayMapMusic - bl SetMainCallback2 - b _081C7562 - .pool -_081C755C: - ldr r0, =CB2_ReturnToFieldWithOpenMenu - bl SetMainCallback2 -_081C7562: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C742C - - thumb_func_start sub_81C756C -sub_81C756C: @ 81C756C - push {r4-r6,lr} - ldr r1, =0xfffe7960 - adds r6, r0, r1 - bl sub_81C75F4 - ldr r5, =gUnknown_0861F3EC - lsls r0, r6, 3 - subs r0, r6 - lsls r4, r0, 2 - adds r0, r4, r5 - ldr r0, [r0] - bl _call_via_r0 - cmp r0, 0 - beq _081C75CC - adds r0, r5, 0 - adds r0, 0x8 - adds r0, r4, r0 - ldr r0, [r0] - bl _call_via_r0 - cmp r0, 0 - beq _081C75CC - adds r0, r5, 0 - adds r0, 0xC - adds r0, r4, r0 - ldr r0, [r0] - adds r1, r5, 0 - adds r1, 0x10 - adds r1, r4, r1 - ldr r1, [r1] - bl sub_81C7834 - ldr r0, =gUnknown_0203CF40 - ldr r1, [r0] - adds r0, r5, 0x4 - adds r0, r4, r0 - ldr r0, [r0] - str r0, [r1] - str r6, [r1, 0x4] - movs r0, 0x1 - b _081C75CE - .pool -_081C75CC: - movs r0, 0 -_081C75CE: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81C756C - - thumb_func_start sub_81C75D4 -sub_81C75D4: @ 81C75D4 - push {lr} - bl sub_81C786C - pop {r1} - bx r1 - thumb_func_end sub_81C75D4 - - thumb_func_start sub_81C75E0 -sub_81C75E0: @ 81C75E0 - push {lr} - ldr r0, =gUnknown_0203CF40 - ldr r0, [r0] - ldr r0, [r0] - bl _call_via_r0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C75E0 - - thumb_func_start sub_81C75F4 -sub_81C75F4: @ 81C75F4 - push {lr} - bl InitKeys - pop {r0} - bx r0 - thumb_func_end sub_81C75F4 - - thumb_func_start c3args_set_0toR1_1to0 -c3args_set_0toR1_1to0: @ 81C7600 - push {lr} - bl SetVBlankCallback - pop {r0} - bx r0 - thumb_func_end c3args_set_0toR1_1to0 - - thumb_func_start sub_81C760C -sub_81C760C: @ 81C760C - push {lr} - ldr r0, =sub_81C7418 - bl SetVBlankCallback - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C760C - - thumb_func_start sub_81C761C -sub_81C761C: @ 81C761C - push {r4,lr} - adds r4, r0, 0 - adds r0, r1, 0 - bl Alloc - ldr r1, =gUnknown_0203CF40 - ldr r1, [r1] - lsls r4, 2 - adds r1, 0x10 - adds r1, r4 - str r0, [r1] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C761C - - thumb_func_start sub_81C763C -sub_81C763C: @ 81C763C - ldr r1, =gUnknown_0203CF40 - ldr r1, [r1] - lsls r0, 2 - adds r1, 0x10 - adds r1, r0 - ldr r0, [r1] - bx lr - .pool - thumb_func_end sub_81C763C - - thumb_func_start sub_81C7650 -sub_81C7650: @ 81C7650 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CF40 - ldr r1, [r5] - lsls r4, r0, 2 - adds r1, 0x10 - adds r1, r4 - ldr r0, [r1] - cmp r0, 0 - beq _081C7670 - bl Free - ldr r0, [r5] - adds r0, 0x10 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_081C7670: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7650 - - thumb_func_start sub_81C767C -sub_81C767C: @ 81C767C - ldr r0, =gUnknown_0203CF40 - ldr r0, [r0] - ldrh r0, [r0, 0x8] - bx lr - .pool - thumb_func_end sub_81C767C - - thumb_func_start sub_81C7688 -sub_81C7688: @ 81C7688 - ldr r1, =gUnknown_0203CF40 - ldr r1, [r1] - strh r0, [r1, 0x8] - bx lr - .pool - thumb_func_end sub_81C7688 - - thumb_func_start sub_81C7694 -sub_81C7694: @ 81C7694 - push {lr} - adds r1, r0, 0 - cmp r1, 0x4 - bls _081C769E - movs r1, 0 -_081C769E: - ldr r0, =gUnknown_0203CF40 - ldr r0, [r0] - strh r1, [r0, 0xA] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7694 - - thumb_func_start sub_81C76AC -sub_81C76AC: @ 81C76AC - ldr r0, =gUnknown_0203CF40 - ldr r0, [r0] - ldrh r0, [r0, 0xA] - bx lr - .pool - thumb_func_end sub_81C76AC - - thumb_func_start sub_81C76B8 -sub_81C76B8: @ 81C76B8 - ldr r0, =gUnknown_0203CF40 - ldr r0, [r0] - ldr r0, [r0, 0xC] - bx lr - .pool - thumb_func_end sub_81C76B8 - - thumb_func_start sub_81C76C4 -sub_81C76C4: @ 81C76C4 - push {r4,lr} - ldr r1, =0x0000082c - movs r0, 0 - bl sub_81C761C - adds r4, r0, 0 - cmp r4, 0 - beq _081C76F4 - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r0, =sub_81C7764 - movs r1, 0x1 - bl sub_81C7078 - str r0, [r4, 0xC] - movs r0, 0x1 - b _081C76F6 - .pool -_081C76F4: - movs r0, 0 -_081C76F6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81C76C4 - - thumb_func_start sub_81C76FC -sub_81C76FC: @ 81C76FC - push {lr} - movs r0, 0 - bl sub_81C763C - ldr r0, [r0, 0xC] - bl sub_81C70D8 - pop {r1} - bx r1 - thumb_func_end sub_81C76FC - - thumb_func_start sub_81C7710 -sub_81C7710: @ 81C7710 - push {lr} - sub sp, 0x4 - movs r0, 0x6F - bl PlaySE - bl sub_81CAADC - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_81C7710 - - thumb_func_start sub_81C7738 -sub_81C7738: @ 81C7738 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081C7750 - movs r0, 0x1 - b _081C775E - .pool -_081C7750: - bl sub_81C99D4 - bl sub_81C7C94 - bl FreeAllWindowBuffers - movs r0, 0 -_081C775E: - pop {r1} - bx r1 - thumb_func_end sub_81C7738 - - thumb_func_start sub_81C7764 -sub_81C7764: @ 81C7764 - push {r4,lr} - sub sp, 0x4 - cmp r0, 0x1 - beq _081C77B0 - cmp r0, 0x1 - bgt _081C7776 - cmp r0, 0 - beq _081C7780 - b _081C782A -_081C7776: - cmp r0, 0x2 - beq _081C77FC - cmp r0, 0x3 - beq _081C780E - b _081C782A -_081C7780: - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - bl FreeAllWindowBuffers - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0861FA04 - movs r0, 0 - movs r2, 0x1 - bl InitBgsFromTemplates - bl sub_8199D98 - bl reset_temp_tile_data_buffers - movs r0, 0x1 - b _081C782C - .pool -_081C77B0: - movs r0, 0 - bl sub_81C763C - adds r4, r0, 0 - ldr r1, =gPokenavHeader_Gfx - movs r0, 0 - str r0, [sp] - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - adds r4, 0x2C - movs r0, 0 - adds r1, r4, 0 - bl SetBgTilemapBuffer - ldr r1, =gPokenavHeader_Tilemap - movs r0, 0 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r0, =gPokenavHeader_Pal - movs r1, 0 - movs r2, 0x20 - bl sub_81C7944 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - b _081C782C - .pool -_081C77FC: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - bne _081C7818 - bl sub_81C7B74 - movs r0, 0 - b _081C782C -_081C780E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - beq _081C781C -_081C7818: - movs r0, 0x2 - b _081C782C -_081C781C: - bl sub_81C7C28 - bl sub_81C7D28 - movs r0, 0 - bl ShowBg -_081C782A: - movs r0, 0x4 -_081C782C: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81C7764 - - thumb_func_start sub_81C7834 -sub_81C7834: @ 81C7834 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - movs r0, 0 - bl sub_81C763C - str r4, [r0] - str r5, [r0, 0x4] - movs r1, 0 - str r1, [r0, 0x8] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C7834 - - thumb_func_start sub_81C7850 -sub_81C7850: @ 81C7850 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - bl sub_81C763C - movs r1, 0 - str r1, [r0, 0x8] - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C7850 - - thumb_func_start sub_81C786C -sub_81C786C: @ 81C786C - push {lr} - movs r0, 0 - bl sub_81C763C - ldr r0, [r0, 0x4] - bl _call_via_r0 - pop {r1} - bx r1 - thumb_func_end sub_81C786C - - thumb_func_start sub_81C7880 -sub_81C7880: @ 81C7880 - push {r4,lr} - movs r0, 0 - bl sub_81C763C - adds r4, r0, 0 - ldr r0, =atk47_cmd47 - movs r1, 0x4 - bl sub_81C7078 - str r0, [r4, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7880 - - thumb_func_start sub_81C78A0 -sub_81C78A0: @ 81C78A0 - push {r4,lr} - movs r0, 0 - bl sub_81C763C - adds r4, r0, 0 - ldr r0, =sub_81C791C - movs r1, 0x4 - bl sub_81C7078 - str r0, [r4, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C78A0 - - thumb_func_start sub_81C78C0 -sub_81C78C0: @ 81C78C0 - push {lr} - movs r0, 0 - bl sub_81C763C - ldr r0, [r0, 0xC] - bl sub_81C70D8 - pop {r1} - bx r1 - thumb_func_end sub_81C78C0 - - thumb_func_start atk47_cmd47 -atk47_cmd47: @ 81C78D4 - push {lr} - cmp r0, 0x1 - beq _081C78EA - cmp r0, 0x1 - bgt _081C78E4 - cmp r0, 0 - beq _081C78EA - b _081C7914 -_081C78E4: - cmp r0, 0x2 - beq _081C78EE - b _081C7914 -_081C78EA: - movs r0, 0 - b _081C7916 -_081C78EE: - movs r1, 0xC0 - lsls r1, 1 - movs r0, 0 - movs r2, 0x1 - bl ChangeBgY - ldr r1, =0x00001fff - cmp r0, r1 - bhi _081C7908 - movs r0, 0x2 - b _081C7916 - .pool -_081C7908: - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - movs r2, 0 - bl ChangeBgY -_081C7914: - movs r0, 0x4 -_081C7916: - pop {r1} - bx r1 - thumb_func_end atk47_cmd47 - - thumb_func_start sub_81C791C -sub_81C791C: @ 81C791C - push {lr} - movs r1, 0xC0 - lsls r1, 1 - movs r0, 0 - movs r2, 0x2 - bl ChangeBgY - cmp r0, 0 - ble _081C7932 - movs r0, 0x2 - b _081C793E -_081C7932: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x4 -_081C793E: - pop {r1} - bx r1 - thumb_func_end sub_81C791C - - thumb_func_start sub_81C7944 -sub_81C7944: @ 81C7944 - push {lr} - lsls r1, 1 - ldr r3, =gPlttBufferUnfaded - adds r1, r3 - lsls r2, 10 - lsrs r2, 11 - bl CpuSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7944 - - thumb_func_start sub_81C795C -sub_81C795C: @ 81C795C - push {r4,lr} - adds r4, r0, 0 - b _081C7974 -_081C7962: - lsls r0, r1, 4 - movs r2, 0x80 - lsls r2, 1 - adds r1, r0, r2 - ldr r0, [r4] - movs r2, 0x20 - bl sub_81C7944 - adds r4, 0x8 -_081C7974: - ldr r0, [r4] - cmp r0, 0 - beq _081C7988 - ldrh r0, [r4, 0x4] - bl AllocSpritePalette - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - bne _081C7962 -_081C7988: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C795C - - thumb_func_start sub_81C7990 -sub_81C7990: @ 81C7990 - push {lr} - sub sp, 0x4 - adds r3, r0, 0 - lsls r1, 16 - lsrs r1, 16 - mov r0, sp - strh r1, [r0] - lsls r3, 5 - ldr r0, =gPlttBufferFaded + 0x200 - adds r3, r0 - ldr r2, =0x01000010 - mov r0, sp - adds r1, r3, 0 - bl CpuSet - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7990 - - thumb_func_start sub_81C79BC -sub_81C79BC: @ 81C79BC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - str r0, [sp] - str r1, [sp, 0x4] - mov r10, r2 - str r3, [sp, 0x8] - ldr r0, [sp, 0x2C] - cmp r0, 0 - bne _081C79E4 - ldr r2, =0x001fffff - mov r1, r10 - ands r2, r1 - ldr r0, [sp] - b _081C79F4 - .pool -_081C79E4: - ldr r2, [sp, 0x2C] - ldr r0, [sp, 0x8] - cmp r2, r0 - blt _081C7A00 - ldr r2, =0x001fffff - mov r1, r10 - ands r2, r1 - ldr r0, [sp, 0x4] -_081C79F4: - ldr r1, [sp, 0x30] - bl CpuSet - b _081C7AAE - .pool -_081C7A00: - movs r2, 0x1 - negs r2, r2 - add r10, r2 - b _081C7AA6 -_081C7A08: - ldr r1, [sp] - ldrh r0, [r1] - movs r2, 0x1F - mov r9, r2 - mov r1, r9 - ands r1, r0 - mov r9, r1 - lsls r0, 16 - lsrs r2, r0, 21 - movs r1, 0x1F - ands r1, r2 - mov r8, r1 - lsrs r7, r0, 26 - movs r2, 0x1F - ands r7, r2 - ldr r0, [sp, 0x4] - ldrh r4, [r0] - movs r0, 0x1F - ands r0, r4 - mov r1, r9 - subs r0, r1 - lsls r0, 8 - ldr r1, [sp, 0x8] - bl __divsi3 - ldr r2, [sp, 0x2C] - adds r6, r0, 0 - muls r6, r2 - asrs r6, 8 - lsls r4, 16 - lsrs r0, r4, 21 - movs r1, 0x1F - ands r0, r1 - mov r2, r8 - subs r0, r2 - lsls r0, 8 - ldr r1, [sp, 0x8] - bl __divsi3 - ldr r1, [sp, 0x2C] - adds r5, r0, 0 - muls r5, r1 - asrs r5, 8 - lsrs r4, 26 - movs r2, 0x1F - ands r4, r2 - subs r4, r7 - lsls r4, 8 - adds r0, r4, 0 - ldr r1, [sp, 0x8] - bl __divsi3 - ldr r1, [sp, 0x2C] - muls r0, r1 - asrs r0, 8 - add r6, r9 - movs r2, 0x1F - ands r6, r2 - add r5, r8 - ands r5, r2 - adds r0, r7, r0 - ands r0, r2 - lsls r0, 10 - lsls r5, 5 - orrs r0, r5 - orrs r0, r6 - ldr r1, [sp, 0x30] - strh r0, [r1] - ldr r2, [sp] - adds r2, 0x2 - str r2, [sp] - ldr r0, [sp, 0x4] - adds r0, 0x2 - str r0, [sp, 0x4] - adds r1, 0x2 - str r1, [sp, 0x30] - movs r1, 0x1 - negs r1, r1 - add r10, r1 -_081C7AA6: - movs r0, 0x1 - negs r0, r0 - cmp r10, r0 - bne _081C7A08 -_081C7AAE: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C79BC - - thumb_func_start sub_81C7AC0 -sub_81C7AC0: @ 81C7AC0 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r0, 0 - bl sub_81C763C - cmp r4, 0x1 - beq _081C7AF0 - cmp r4, 0x1 - bgt _081C7ADA - cmp r4, 0 - beq _081C7AE4 - b _081C7B2C -_081C7ADA: - cmp r4, 0x2 - beq _081C7B04 - cmp r4, 0x3 - beq _081C7B18 - b _081C7B2C -_081C7AE4: - ldr r0, [r0, 0x14] - movs r1, 0x2 - negs r1, r1 - str r4, [sp] - movs r2, 0 - b _081C7B10 -_081C7AF0: - ldr r0, [r0, 0x14] - movs r1, 0x2 - negs r1, r1 - movs r2, 0 - str r2, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _081C7B2C -_081C7B04: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x2 - negs r1, r1 - movs r2, 0 - str r2, [sp] -_081C7B10: - movs r3, 0x10 - bl BeginNormalPaletteFade - b _081C7B2C -_081C7B18: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x2 - negs r1, r1 - movs r2, 0 - str r2, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_081C7B2C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C7AC0 - - thumb_func_start sub_81C7B34 -sub_81C7B34: @ 81C7B34 - ldr r0, =gPaletteFade - ldrb r0, [r0, 0x7] - lsrs r0, 7 - bx lr - .pool - thumb_func_end sub_81C7B34 - - thumb_func_start sub_81C7B40 -sub_81C7B40: @ 81C7B40 - push {lr} - ldr r0, =0xfffefffe - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7B40 - - thumb_func_start sub_81C7B54 -sub_81C7B54: @ 81C7B54 - push {r4,r5,lr} - adds r5, r0, 0 - cmp r1, 0 - ble _081C7B6C - adds r4, r1, 0 -_081C7B5E: - adds r0, r5, 0 - adds r5, 0x4 - bl InitBgFromTemplate - subs r4, 0x1 - cmp r4, 0 - bne _081C7B5E -_081C7B6C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C7B54 - - thumb_func_start sub_81C7B74 -sub_81C7B74: @ 81C7B74 - push {r4,lr} - movs r0, 0 - bl sub_81C763C - adds r4, r0, 0 - ldr r0, =gUnknown_0861FA08 - bl InitWindows - movs r0, 0 - str r0, [r4, 0x10] - bl sub_81C7BF8 - ldrb r0, [r4, 0x10] - bl PutWindowTilemap - ldrb r0, [r4, 0x10] - movs r1, 0x3 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7B74 - - thumb_func_start sub_81C7BA4 -sub_81C7BA4: @ 81C7BA4 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - bl sub_81C763C - adds r5, r0, 0 - ldr r0, [r5, 0x10] - bl sub_81C7BF8 - ldrb r0, [r5, 0x10] - ldr r1, =gUnknown_0861FA48 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r1, =gUnknown_0861FA18 - lsls r4, 2 - adds r4, r1 - ldr r1, [r4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7BA4 - - thumb_func_start sub_81C7BE8 -sub_81C7BE8: @ 81C7BE8 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_81C7BE8 - - thumb_func_start sub_81C7BF8 -sub_81C7BF8: @ 81C7BF8 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x44 - bl FillWindowPixelBuffer - movs r0, 0x80 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - adds r0, r4, 0 - movs r1, 0x55 - movs r2, 0 - movs r3, 0 - bl FillWindowPixelRect - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C7BF8 - - thumb_func_start sub_81C7C28 -sub_81C7C28: @ 81C7C28 - push {r4-r6,lr} - movs r0, 0 - bl sub_81C763C - adds r6, r0, 0 - movs r5, 0 - ldr r4, =gUnknown_0861FA4C -_081C7C36: - adds r0, r4, 0 - bl LoadCompressedSpriteSheet - adds r4, 0x8 - adds r5, 0x1 - cmp r5, 0 - beq _081C7C36 - ldr r0, =gUnknown_0861FA54 - bl sub_81C795C - movs r0, 0 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x80 - lsls r1, 9 - lsls r1, r0 - movs r0, 0x2 - negs r0, r0 - bics r0, r1 - str r0, [r6, 0x14] - ldr r0, =gUnknown_0861FB04 - movs r1, 0xDC - movs r2, 0xC - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r6, 0x18] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C7C28 - - thumb_func_start sub_81C7C94 -sub_81C7C94: @ 81C7C94 - push {lr} - movs r0, 0 - bl sub_81C763C - ldr r0, [r0, 0x18] - bl DestroySprite - movs r0, 0 - bl FreeSpriteTilesByTag - movs r0, 0 - bl FreeSpritePaletteByTag - pop {r0} - bx r0 - thumb_func_end sub_81C7C94 - - thumb_func_start sub_81C7CB4 -sub_81C7CB4: @ 81C7CB4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - bl GetBgY - lsrs r0, 8 - negs r0, r0 - strh r0, [r4, 0x26] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C7CB4 - - thumb_func_start sub_81C7CCC -sub_81C7CCC: @ 81C7CCC - push {lr} - movs r0, 0 - bl sub_81C763C - ldr r0, [r0, 0x18] - ldr r1, =SpriteCallbackDummy - str r1, [r0, 0x1C] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C7CCC thumb_func_start sub_81C7CE4 sub_81C7CE4: @ 81C7CE4 @@ -5452,7 +3854,7 @@ _081C9A5C: ldr r0, =gPokenavMessageBox_Pal movs r1, 0x10 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0x1 movs r1, 0 movs r2, 0 @@ -5505,7 +3907,7 @@ _081C9AFA: ldr r0, =gUnknown_0861FD4C movs r1, 0x20 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded b _081C9AD6 .pool _081C9B30: @@ -5532,7 +3934,7 @@ _081C9B3E: ldr r0, =gUnknown_0861FC78 movs r1, 0x30 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded bl sub_81C9894 cmp r0, 0x3 beq _081C9B76 @@ -5602,7 +4004,7 @@ _081C9C06: bl sub_81C7DFC b _081C9AD6 _081C9C0E: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081C9C5C bl sub_81C9894 @@ -6066,7 +4468,7 @@ _081C9F96: movs r0, 0 b _081C9FBE _081C9FB0: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 beq _081C9FBC _081C9FB8: @@ -7203,7 +5605,7 @@ sub_81CA850: @ 81CA850 ldr r0, =gUnknown_0861FC78 + 0xE movs r1, 0x31 movs r2, 0x4 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded pop {r0} bx r0 .pool @@ -7336,7 +5738,7 @@ titlescreen_0: @ 81CA92C ldr r2, [r2, 0x8] bl ScanlineEffect_SetParams ldr r0, =sub_81CA914 - bl c3args_set_0toR1_1to0 + bl IndirectSetVBlankCallback ldr r0, =sub_81CA9EC movs r1, 0x3 bl CreateTask @@ -8687,7 +7089,7 @@ _081CB368: ldr r0, =gUnknown_08622510 movs r1, 0x20 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0x2 b _081CB418 .pool @@ -8720,7 +7122,7 @@ _081CB3E0: ldr r0, =gUnknown_086226E0 movs r1, 0x10 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0x1 _081CB418: bl CopyBgTilemapBufferToVram @@ -8744,11 +7146,11 @@ _081CB424: ldr r0, =gUnknown_08622700 movs r1, 0x30 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded ldr r0, =gUnknown_08622720 movs r1, 0x50 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0 b _081CB506 .pool @@ -8806,7 +7208,7 @@ _081CB4A6: movs r0, 0 b _081CB506 _081CB4EA: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CB4FA bl sub_81C8010 @@ -9699,7 +8101,7 @@ _081CBB80: movs r0, 0 b _081CBBB4 _081CBB9A: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CBBAA bl sub_81C78C0 @@ -10034,7 +8436,7 @@ sub_81CBE50: @ 81CBE50 movs r0, 0x9 bl GetGameStat adds r1, r0, 0 - ldr r0, =0x0001869f + ldr r0, =0x0001869f @ Note to decompiler: See UNKNOWN_OFFSET cmp r1, r0 ble _081CBE68 adds r1, r0, 0 @@ -11185,7 +9587,7 @@ _081CC714: .4byte _081CC82A _081CC734: movs r0, 0 - bl c3args_set_0toR1_1to0 + bl IndirectSetVBlankCallback movs r0, 0x1 bl HideBg movs r0, 0x2 @@ -11265,7 +9667,7 @@ _081CC7E2: movs r0, 0x2 bl ShowBg ldr r0, =sub_81CC6A4 - bl c3args_set_0toR1_1to0 + bl IndirectSetVBlankCallback b _081CC77C .pool _081CC804: @@ -11286,7 +9688,7 @@ _081CC812: bl sub_81C7AC0 b _081CC77C _081CC82A: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CC83A bl sub_81C8010 @@ -11472,7 +9874,7 @@ _081CC972: movs r0, 0 b _081CC9BA _081CC982: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CC99E bl sub_81C7FDC @@ -11606,11 +10008,11 @@ sub_81CCA1C: @ 81CCA1C ldr r0, =gUnknown_08622868 movs r1, 0x10 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded ldr r0, =gHoennMapZoomIcons_Pal movs r1, 0x30 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded bl sub_8124658 lsls r0, 24 cmp r0, 0 @@ -14231,11 +12633,11 @@ _081CDFF2: ldr r0, =gPokenavCondition_Pal movs r1, 0x10 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded ldr r0, =gUnknown_08623208 movs r1, 0xF0 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded ldr r0, =0x00001814 adds r1, r5, r0 ldr r0, =0x0000ffb0 @@ -14262,7 +12664,7 @@ _081CE03C: ldr r0, =gUnknown_086231E8 movs r1, 0x30 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0x2 bl sub_81D21DC b _081CDFB0 @@ -14440,7 +12842,7 @@ _081CE1FC: bl sub_81C7FA0 b _081CDFB0 _081CE218: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CE2C0 bl sub_81CDD5C @@ -14451,7 +12853,7 @@ _081CE218: bne _081CE2C0 _081CE230: ldr r0, =sub_81CEE44 - bl c3args_set_0toR1_1to0 + bl IndirectSetVBlankCallback b _081CDFB0 .pool _081CE23C: @@ -14569,7 +12971,7 @@ _081CE33A: movs r0, 0 b _081CE376 _081CE33E: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CE34E bl sub_81C78C0 @@ -16710,7 +15112,7 @@ _081CF454: ldr r0, =gUnknown_086233C4 movs r1, 0x10 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0x1 bl CopyBgTilemapBufferToVram _081CF498: @@ -16734,7 +15136,7 @@ _081CF4C0: ldr r0, =gUnknown_08623570 movs r1, 0x20 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded bl sub_81CF88C b _081CF498 .pool @@ -16789,7 +15191,7 @@ _081CF552: bl sub_81C7AC0 b _081CF498 _081CF55A: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CF56A bl sub_81C8010 @@ -17096,7 +15498,7 @@ _081CF764: movs r0, 0 b _081CF792 _081CF778: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CF788 bl sub_81C78C0 @@ -17130,7 +15532,7 @@ _081CF7A4: movs r0, 0 b _081CF7C2 _081CF7B4: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 beq _081CF7C0 movs r0, 0x2 @@ -18094,7 +16496,7 @@ _081CFEF4: ldr r0, =gUnknown_086235E4 movs r1, 0x10 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0x1 bl CopyBgTilemapBufferToVram _081CFF32: @@ -18128,7 +16530,7 @@ _081CFF76: ldr r0, =gUnknown_08623790 movs r1, 0x20 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded bl sub_81D0304 b _081CFF32 .pool @@ -18163,7 +16565,7 @@ _081CFFA4: bl sub_81C7FA0 b _081CFF32 _081CFFDE: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081CFFEE bl sub_81C8010 @@ -18470,7 +16872,7 @@ _081D01E8: movs r0, 0 b _081D0216 _081D01FC: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 bne _081D020C bl sub_81C78C0 @@ -18504,7 +16906,7 @@ _081D0228: movs r0, 0 b _081D0246 _081D0238: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 beq _081D0244 movs r0, 0x2 @@ -19631,7 +18033,7 @@ _081D0AB8: ldr r0, =gUnknown_08DDE010 movs r1, 0x10 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded b _081D0BBA .pool _081D0B04: @@ -19669,11 +18071,11 @@ _081D0B12: ldr r0, =gUnknown_08623FF8 movs r1, 0x20 movs r2, 0xA0 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded ldr r0, =gUnknown_08624098 movs r1, 0xA0 movs r2, 0x20 - bl sub_81C7944 + bl CopyPaletteIntoBufferUnfaded movs r0, 0x1 b _081D0BBC .pool @@ -19765,7 +18167,7 @@ _081D0BE8: movs r0, 0 b _081D0C4A _081D0C3C: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 beq _081D0C48 _081D0C44: @@ -19796,7 +18198,7 @@ _081D0C60: movs r0, 0 b _081D0C7E _081D0C70: - bl sub_81C7B34 + bl IsPaletteFadeActive cmp r0, 0 beq _081D0C7C movs r0, 0x2 diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index af7fdbf3d..fafedeeff 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -8315,6 +8315,11 @@ _0801AFC2: .pool thumb_func_end sub_801AC54 +@void sub_801AFD8() { +@ CpuFill32(0, &gSaveBlock1Ptr->field_322C, 219); +@ sub_801B180(); +@ sub_811F8BC(); +@} thumb_func_start sub_801AFD8 sub_801AFD8: @ 801AFD8 push {lr} @@ -8367,25 +8372,25 @@ sav1_get_mevent_buffer_2: @ 801B034 .pool thumb_func_end sav1_get_mevent_buffer_2 - thumb_func_start sub_801B044 -sub_801B044: @ 801B044 + thumb_func_start GetSaveBlock1Field356C +GetSaveBlock1Field356C: @ 801B044 ldr r0, =gSaveBlock1Ptr ldr r0, [r0] ldr r1, =0x0000356c adds r0, r1 bx lr .pool - thumb_func_end sub_801B044 + thumb_func_end GetSaveBlock1Field356C - thumb_func_start sub_801B058 -sub_801B058: @ 801B058 + thumb_func_start GetSaveBlock1Field3564 +GetSaveBlock1Field3564: @ 801B058 ldr r0, =gSaveBlock1Ptr ldr r0, [r0] ldr r1, =0x00003564 adds r0, r1 bx lr .pool - thumb_func_end sub_801B058 + thumb_func_end GetSaveBlock1Field3564 thumb_func_start sub_801B06C sub_801B06C: @ 801B06C @@ -8531,7 +8536,7 @@ sub_801B180: @ 801B180 sub sp, 0x4 movs r0, 0 str r0, [sp] - bl sub_801B044 + bl GetSaveBlock1Field356C adds r1, r0, 0 ldr r2, =0x05000001 mov r0, sp @@ -13795,7 +13800,7 @@ _0801DB60: sub_801DB68: @ 801DB68 push {r4,r5,lr} adds r4, r0, 0 - bl sub_801B044 + bl GetSaveBlock1Field356C adds r5, r0, 0 movs r0, 0x3 adds r1, r4, 0 @@ -13841,7 +13846,7 @@ _0801DBB8: thumb_func_start sub_801DBC0 sub_801DBC0: @ 801DBC0 push {lr} - bl sub_801B044 + bl GetSaveBlock1Field356C movs r1, 0 strb r1, [r0] strb r1, [r0, 0x1] @@ -13858,7 +13863,7 @@ sub_801DBDC: @ 801DBDC ldr r0, =0x0000402e bl GetVarPointer adds r4, r0, 0 - bl sub_801B044 + bl GetSaveBlock1Field356C adds r2, r0, 0 ldr r0, [r2] lsls r0, 24 @@ -13889,7 +13894,7 @@ _0801DC10: sub_801DC20: @ 801DC20 push {r4-r6,lr} ldr r6, =gSpecialVar_Result - bl sub_801B044 + bl GetSaveBlock1Field356C adds r4, r0, 0 bl IsMysteryEventEnabled cmp r0, 0 @@ -27181,7 +27186,7 @@ sub_8024700: @ 8024700 adds r0, r5, 0 bl sub_8024668 adds r1, r0, r4 - ldr r2, =0x0001869f + ldr r2, =0x0001869f @ Note to decompiler: See UNKNOWN_OFFSET cmp r1, r2 bhi _08024730 adds r0, r5, 0 diff --git a/common_syms/pokedex.txt b/common_syms/pokedex.txt index c982c9d3a..9aa48a74d 100644 --- a/common_syms/pokedex.txt +++ b/common_syms/pokedex.txt @@ -1,2 +1,2 @@ -gUnknown_030060B0 +gUnusedPokedexU8 gUnknown_030060B4 diff --git a/data/easy_chat.s b/data/easy_chat.s index ce416dfbc..4725f15d9 100644 --- a/data/easy_chat.s +++ b/data/easy_chat.s @@ -17,7 +17,7 @@ gUnknown_08597530:: @ 8597530 .4byte 0x0000001b .4byte sub_811A938 -gUnknown_08597550:: @ 8597550 +gEasyChatScreenTemplates:: @ 8597550 .byte 0x00, 0x02, 0x02, 0x00 .align 2 @@ -208,13 +208,20 @@ gUnknown_08597550:: @ 8597550 .4byte gText_IsAsShownOkay gUnknown_08597748:: @ 8597748 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a + .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00 + .byte 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x00 + .byte 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 + .byte 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a gUnknown_08597764:: @ 8597764 .2byte 0x0209, 0x140b, 0x1030, 0x102a gUnknown_0859776C:: @ 859776C - .2byte 0x1240, 0x0628, 0x061f, 0x2204, 0x1422, 0x0197, 0x0415, 0x0198, 0x2207, 0x0449 + .2byte 0x1240, 0x0628 + .2byte 0x061f, 0x2204 + .2byte 0x1422, 0x0197 + .2byte 0x0415, 0x0198 + .2byte 0x2207, 0x0449 .align 2 gUnknown_08597780:: @ 8597780 diff --git a/data/event_scripts.s b/data/event_scripts.s index 1d7d08808..3975fd361 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -940,7 +940,7 @@ EventScript_27149D:: @ 827149D setberrytree 82, 36, 5 return -EventScript_2715DE:: @ 82715DE +EventScript_ResetAllMapFlags:: @ 82715DE setflag FLAG_LINK_CONTEST_POKE_BALL setflag FLAG_HIDE_ROUTE_111_VICTORIA_WINSTRATE setflag FLAG_HIDE_ROUTE_111_VIVI_WINSTRATE diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 93fe33f8a..291d6abec 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -65,7 +65,7 @@ gFieldEffectScriptPointers:: @ 82DB9D4 .4byte gFieldEffectScript_Unknown57 .4byte gFieldEffectScript_Unknown58 .4byte gFieldEffectScript_FieldMoveShowMonInit - .4byte gFieldEffectScript_Unknown60 + .4byte gFieldEffectScript_UsePuzzleEffect .4byte gFieldEffectScript_Unknown61 .4byte gFieldEffectScript_Unknown62 .4byte gFieldEffectScript_Unknown63 @@ -315,7 +315,7 @@ gFieldEffectScript_FieldMoveShowMonInit:: @ 82DBCCC field_eff_callnative FldEff_FieldMoveShowMonInit field_eff_end -gFieldEffectScript_Unknown60:: @ 82DBCD2 +gFieldEffectScript_UsePuzzleEffect:: @ 82DBCD2 field_eff_callnative FldEff_UsePuzzleEffect field_eff_end diff --git a/data/maps/AncientTomb/scripts.inc b/data/maps/AncientTomb/scripts.inc index 45bb9e007..241cb50f1 100644 --- a/data/maps/AncientTomb/scripts.inc +++ b/data/maps/AncientTomb/scripts.inc @@ -25,7 +25,7 @@ AncientTomb_EventScript_238FEE:: @ 8238FEE return AncientTomb_MapScript1_238FF2: @ 8238FF2 - call_if_unset FLAG_SYS_BRAILLE_FLY, AncientTomb_EventScript_238FFC + call_if_unset FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED, AncientTomb_EventScript_238FFC end AncientTomb_EventScript_238FFC:: @ 8238FFC @@ -39,7 +39,7 @@ AncientTomb_EventScript_238FFC:: @ 8238FFC AncientTomb_EventScript_239033:: @ 8239033 lockall - goto_if_set FLAG_SYS_BRAILLE_FLY, AncientTomb_EventScript_239046 + goto_if_set FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED, AncientTomb_EventScript_239046 braillemessage AncientTomb_Braille_2A6D06 waitbuttonpress hidebox2 diff --git a/data/maps/DesertRuins/scripts.inc b/data/maps/DesertRuins/scripts.inc index 62828e971..34ae21224 100644 --- a/data/maps/DesertRuins/scripts.inc +++ b/data/maps/DesertRuins/scripts.inc @@ -16,7 +16,7 @@ DesertRuins_EventScript_22D975:: @ 822D975 return DesertRuins_MapScript1_22D989: @ 822D989 - call_if_unset FLAG_SYS_BRAILLE_STRENGTH, DesertRuins_EventScript_22D993 + call_if_unset FLAG_SYS_REGIROCK_PUZZLE_COMPLETED, DesertRuins_EventScript_22D993 end DesertRuins_EventScript_22D993:: @ 822D993 @@ -39,7 +39,7 @@ DesertRuins_EventScript_22D9D7:: @ 822D9D7 DesertRuins_EventScript_22D9DB:: @ 822D9DB lockall - goto_if_set FLAG_SYS_BRAILLE_STRENGTH, DesertRuins_EventScript_22D9EE + goto_if_set FLAG_SYS_REGIROCK_PUZZLE_COMPLETED, DesertRuins_EventScript_22D9EE braillemessage DesertRuins_Braille_2A6CA0 waitbuttonpress hidebox2 diff --git a/data/maps/IslandCave/scripts.inc b/data/maps/IslandCave/scripts.inc index 7b551b4a7..3d0efa1ca 100644 --- a/data/maps/IslandCave/scripts.inc +++ b/data/maps/IslandCave/scripts.inc @@ -16,7 +16,7 @@ IslandCave_EventScript_238E44:: @ 8238E44 return IslandCave_MapScript1_238E58: @ 8238E58 - call_if_unset FLAG_SYS_BRAILLE_WAIT, IslandCave_EventScript_238E62 + call_if_unset FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_238E62 end IslandCave_EventScript_238E62:: @ 8238E62 @@ -47,13 +47,13 @@ IslandCave_EventScript_238EAF:: @ 8238EAF setmetatile 9, 20, 564, 1 special DrawWholeMapView playse SE_BAN - setflag FLAG_SYS_BRAILLE_WAIT + setflag FLAG_SYS_BRAILLE_REGICE_COMPLETED end IslandCave_EventScript_238EEF:: @ 8238EEF lockall call_if_set FLAG_TEMP_3, IslandCave_EventScript_238F45 - goto_if_set FLAG_SYS_BRAILLE_WAIT, IslandCave_EventScript_238F13 + goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_238F13 braillemessage IslandCave_Braille_2A6CD4 setflag FLAG_TEMP_2 special ShouldDoBrailleRegicePuzzle @@ -69,7 +69,7 @@ IslandCave_EventScript_238F1D:: @ 8238F1D lockall call_if_set FLAG_TEMP_3, IslandCave_EventScript_238F45 braillemessage IslandCave_Braille_2A6CD4 - goto_if_set FLAG_SYS_BRAILLE_WAIT, IslandCave_EventScript_238F41 + goto_if_set FLAG_SYS_BRAILLE_REGICE_COMPLETED, IslandCave_EventScript_238F41 setflag FLAG_TEMP_2 special ShouldDoBrailleRegicePuzzle goto IslandCave_EventScript_238F41 @@ -82,9 +82,9 @@ IslandCave_EventScript_238F41:: @ 8238F41 end IslandCave_EventScript_238F45:: @ 8238F45 - setvar VAR_0x403B, 0 - setvar VAR_0x403C, 0 - setvar VAR_0x403D, 0 + setvar VAR_REGICE_STEPS_1, 0 + setvar VAR_REGICE_STEPS_2, 0 + setvar VAR_REGICE_STEPS_3, 0 clearflag FLAG_TEMP_3 return diff --git a/data/pokenav.s b/data/pokenav.s index 1a5e2bd99..cb5030b4b 100644 --- a/data/pokenav.s +++ b/data/pokenav.s @@ -3,162 +3,6 @@ .section .rodata -gUnknown_0861F3EC:: @ 861F3EC - .4byte sub_81C9298 - .4byte sub_81C941C - .4byte sub_81C9924 - .4byte sub_81C9990 - .4byte sub_81C99C0 - .4byte sub_81C9430 - .4byte sub_81C99D4 - .4byte sub_81C9298 - .4byte sub_81C941C - .4byte sub_81C9940 - .4byte sub_81C9990 - .4byte sub_81C99C0 - .4byte sub_81C9430 - .4byte sub_81C99D4 - .4byte sub_81C9338 - .4byte sub_81C941C - .4byte sub_81C9940 - .4byte sub_81C9990 - .4byte sub_81C99C0 - .4byte sub_81C9430 - .4byte sub_81C99D4 - .4byte sub_81C9368 - .4byte sub_81C941C - .4byte sub_81C9940 - .4byte sub_81C9990 - .4byte sub_81C99C0 - .4byte sub_81C9430 - .4byte sub_81C99D4 - .4byte sub_81C92CC - .4byte sub_81C941C - .4byte sub_81C9940 - .4byte sub_81C9990 - .4byte sub_81C99C0 - .4byte sub_81C9430 - .4byte sub_81C99D4 - .4byte sub_81C9304 - .4byte sub_81C941C - .4byte sub_81C9940 - .4byte sub_81C9990 - .4byte sub_81C99C0 - .4byte sub_81C9430 - .4byte sub_81C99D4 - .4byte sub_81CC4D4 - .4byte sub_81CC554 - .4byte sub_81CC5F4 - .4byte sub_81CC62C - .4byte sub_81CC65C - .4byte sub_81CC524 - .4byte sub_81CC670 - .4byte sub_81CCFD8 - .4byte sub_81CD070 - .4byte sub_81CDDD4 - .4byte sub_81CDE2C - .4byte sub_81CDE64 - .4byte sub_81CD1C0 - .4byte sub_81CECA0 - .4byte sub_81CEF3C - .4byte sub_81CEFDC - .4byte sub_81CF330 - .4byte sub_81CF3A0 - .4byte sub_81CF3D0 - .4byte sub_81CEFF0 - .4byte sub_81CF3F8 - .4byte sub_81CD024 - .4byte sub_81CD070 - .4byte sub_81CDDD4 - .4byte sub_81CDE2C - .4byte sub_81CDE64 - .4byte sub_81CD1C0 - .4byte sub_81CECA0 - .4byte sub_81CEF98 - .4byte sub_81CEFDC - .4byte sub_81CF368 - .4byte sub_81CF3A0 - .4byte sub_81CF3D0 - .4byte sub_81CEFF0 - .4byte sub_81CF3F8 - .4byte sub_81CAAE8 - .4byte sub_81CAB24 - .4byte sub_81CB260 - .4byte sub_81CB29C - .4byte sub_81CB2CC - .4byte sub_81CAB38 - .4byte sub_81CB2E0 - .4byte sub_81CF9BC - .4byte sub_81CFA34 - .4byte sub_81CFDD0 - .4byte sub_81CFE40 - .4byte sub_81CFE70 - .4byte sub_81CFA48 - .4byte sub_81CFE98 - .4byte sub_81D0450 - .4byte sub_81D04A0 - .4byte sub_81D0978 - .4byte sub_81D09B0 - .4byte sub_81D09E0 - .4byte sub_81D04B8 - .4byte sub_81D09F4 - .4byte sub_81CFA04 - .4byte sub_81CFA34 - .4byte sub_81CFE08 - .4byte sub_81CFE40 - .4byte sub_81CFE70 - .4byte sub_81CFA48 - .4byte sub_81CFE98 - -gUnknown_0861F590:: @ 861F590 - .incbin "graphics/pokenav/icon2.gbapal" - -gUnknown_0861F5B0:: @ 861F5B0 - .incbin "graphics/pokenav/icon2.4bpp.lz" - -gUnknown_0861F994:: @ 861F994 - .incbin "graphics/pokenav/icon2_unused.4bpp.lz" - -gUnknown_0861FA04:: @ 861FA04 - .byte 0x50 - .byte 0x0 - .byte 0x0 - .byte 0x0 - -gUnknown_0861FA08:: @ 861FA08 - window_template 0, 1, 0x16, 0x10, 0x2, 0x0, 0x36 - null_window_template - -gUnknown_0861FA18:: @ 861FA18 - .4byte gUnknown_085EBED5 - .4byte gUnknown_085EBED9 - .4byte gUnknown_085EBEE9 - .4byte gUnknown_085EBEF9 - .4byte gUnknown_085EBF0E - .4byte gUnknown_085EBF22 - .4byte gUnknown_085EBF39 - .4byte gUnknown_085EBF49 - .4byte gUnknown_085EBF57 - .4byte gUnknown_085EBF60 - .4byte gUnknown_085EBF73 - .4byte gUnknown_085EBF84 - -gUnknown_0861FA48:: @ 861FA48 - .byte 0x4 - .byte 0x1 - .byte 0x2 - .byte 0x0 - -gUnknown_0861FA4C:: @ 861FA4C - obj_tiles gUnknown_0861F5B0, 0x1000, 0 - -gUnknown_0861FA54:: @ 861FA54 - obj_pal gUnknown_0861F590, 0 - null_obj_pal - -gUnknown_0861FA64:: @ 861FA64 - obj_tiles gPokenavLeftHeaderHoennMap_Gfx, 0xC00, 2 - gUnknown_0861FA6C:: @ 861FA6C obj_tiles gPokenavLeftHeaderMainMenu_Gfx, 0x20, 3 obj_tiles gPokenavLeftHeaderCondition_Gfx, 0x20, 1 diff --git a/data/specials.inc b/data/specials.inc index e5f0b1f27..8437e5cd2 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -291,7 +291,7 @@ gSpecials:: @ 81DBA64 def_special GetPokeblockNameByMonNature def_special GetSecretBaseNearbyMapName def_special CheckRelicanthWailord - def_special ShouldDoBrailleStrengthEffectOld + def_special ShouldDoBrailleRegirockEffectOld def_special sub_80B0534 def_special sub_80B058C def_special WaitWeather diff --git a/include/braille_puzzles.h b/include/braille_puzzles.h index d4c5a24d8..1614c92e1 100644 --- a/include/braille_puzzles.h +++ b/include/braille_puzzles.h @@ -1,11 +1,11 @@ #ifndef GUARD_BRAILLE_PUZZLES_H #define GUARD_BRAILLE_PUZZLES_H -bool8 ShouldDoBrailleFlyEffect(void); -bool8 ShouldDoBrailleStrengthEffect(void); +bool8 ShouldDoBrailleRegisteelEffect(void); +bool8 ShouldDoBrailleRegirockEffect(void); bool8 ShouldDoBrailleDigEffect(void); void DoBrailleDigEffect(void); -void sub_8179918(void); -void sub_8179834(void); +void SetUpPuzzleEffectRegisteel(void); +void SetUpPuzzleEffectRegirock(void); #endif // GUARD_BRAILLE_PUZZLES_H diff --git a/include/constants/field_effects.h b/include/constants/field_effects.h index add195df8..282f9ce75 100644 --- a/include/constants/field_effects.h +++ b/include/constants/field_effects.h @@ -61,7 +61,7 @@ #define FLDEFF_SECRET_POWER_SHRUB 57 #define FLDEFF_CUT_GRASS 58 #define FLDEFF_FIELD_MOVE_SHOW_MON_INIT 59 -#define FLDEFF_USE_FLY_ANCIENT_TOMB 60 +#define FLDEFF_USE_TOMB_PUZZLE_EFFECT 60 #define FLDEFF_PCTURN_ON 61 #define FLDEFF_HALL_OF_FAME_RECORD 62 #define FLDEFF_USE_TELEPORT 63 diff --git a/include/constants/flags.h b/include/constants/flags.h index 5082014e7..b440ba78b 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1352,9 +1352,9 @@ #define FLAG_SYS_ENC_UP_ITEM (SYSTEM_FLAGS + 0x4D) #define FLAG_SYS_ENC_DOWN_ITEM (SYSTEM_FLAGS + 0x4E) #define FLAG_SYS_BRAILLE_DIG (SYSTEM_FLAGS + 0x4F) -#define FLAG_SYS_BRAILLE_STRENGTH (SYSTEM_FLAGS + 0x50) -#define FLAG_SYS_BRAILLE_WAIT (SYSTEM_FLAGS + 0x51) -#define FLAG_SYS_BRAILLE_FLY (SYSTEM_FLAGS + 0x52) +#define FLAG_SYS_REGIROCK_PUZZLE_COMPLETED (SYSTEM_FLAGS + 0x50) +#define FLAG_SYS_BRAILLE_REGICE_COMPLETED (SYSTEM_FLAGS + 0x51) +#define FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED (SYSTEM_FLAGS + 0x52) #define FLAG_SYS_HAS_EON_TICKET (SYSTEM_FLAGS + 0x53) #define FLAG_LANDMARK_POKEMON_LEAGUE (SYSTEM_FLAGS + 0x54) diff --git a/include/constants/vars.h b/include/constants/vars.h index c055c5baf..fedc85657 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -75,9 +75,9 @@ #define VAR_0x4038 0x4038 #define VAR_0x4039 0x4039 #define VAR_0x403A 0x403A -#define VAR_0x403B 0x403B -#define VAR_0x403C 0x403C -#define VAR_0x403D 0x403D +#define VAR_REGICE_STEPS_1 0x403B +#define VAR_REGICE_STEPS_2 0x403C +#define VAR_REGICE_STEPS_3 0x403D #define VAR_ALTERING_CAVE_WILD_SET 0x403E #define VAR_0x403F 0x403F #define VAR_DAYS 0x4040 diff --git a/include/contest_link_80FC4F4.h b/include/contest_link_80FC4F4.h index 6f3bab97d..a3f118798 100644 --- a/include/contest_link_80FC4F4.h +++ b/include/contest_link_80FC4F4.h @@ -4,5 +4,10 @@ void sub_80FCC88(u8); void sub_80FCC88(u8); void sub_80FCACC(u8); +void sub_80FC580(u8); +void sub_80FC6BC(u8); +void sub_80FC804(u8); +void sub_80FCE48(u8); +void sub_80FC894(u8); #endif //GUARD_CONTEST_LINK_80FC4F4_H diff --git a/include/dewford_trend.h b/include/dewford_trend.h index dac5ea6c9..608a925f5 100644 --- a/include/dewford_trend.h +++ b/include/dewford_trend.h @@ -4,5 +4,6 @@ void InitDewfordTrend(void); void UpdateDewfordTrendPerDay(u16); void UpdateDewfordTrendPerDay(u16 days); +bool8 sub_81226D8(u16 *a); #endif // GUARD_DEWFORDTREND_H diff --git a/include/field_specials.h b/include/field_specials.h index 981d65c0a..bff04a739 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -25,5 +25,7 @@ void UpdateFrontierManiac(u16 a0); void UpdateFrontierGambler(u16 a0); void ResetCyclingRoadChallengeData(void); bool8 warp0_in_pokecenter(void); +void ResetFanClub(void); + #endif // GUARD_FIELD_SPECIALS_H diff --git a/include/global.h b/include/global.h index 1b0b0afa3..2739d1a92 100644 --- a/include/global.h +++ b/include/global.h @@ -376,7 +376,7 @@ struct BattleFrontier /*0xEBC*/ u32 battlesCount; /*0xEC0*/ u16 field_EC0[16]; /*0xEE0*/ u8 field_EE0; - /*0xEE1*/ u8 field_EE1[2][PLAYER_NAME_LENGTH + 1]; + /*0xEE1*/ u8 opponentName[2][PLAYER_NAME_LENGTH + 1]; /*0xEF1*/ u8 field_EF1[2][4]; /*0xEF9*/ u8 field_EF9_0:7; /*0xEF9*/ u8 field_EF9_1:1; @@ -446,7 +446,7 @@ struct SaveBlock2 /*0x90*/ u8 filler_90[0x8]; /*0x98*/ struct Time localTimeOffset; /*0xA0*/ struct Time lastBerryTreeUpdate; - /*0xA8*/ u32 field_A8; + /*0xA8*/ u32 field_A8; // Written to, but never read. /*0xAC*/ u32 encryptionKey; /*0xB0*/ struct PlayersApprentice playerApprentice; /*0xDC*/ struct Apprentice apprentices[4]; // From record mixing. @@ -787,7 +787,7 @@ struct WaldaPhrase bool8 patternUnlocked; }; -struct UnkSaveSubstruct_3b98 +struct TrainerNameRecord { u32 trainerId; u8 trainerName[PLAYER_NAME_LENGTH + 1]; @@ -891,7 +891,7 @@ struct SaveBlock1 /*0x3B14*/ struct RecordMixingGift recordMixingGift; /*0x3B24*/ u8 seen2[DEX_FLAGS_NO]; /*0x3B58*/ LilycoveLady lilycoveLady; - /*0x3B98*/ struct UnkSaveSubstruct_3b98 unk_3B98[20]; + /*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20]; /*0x3C88*/ u8 filler_3C88[0xDC]; /*0x3D64*/ struct SaveTrainerHill trainerHill; /*0x3D70*/ struct WaldaPhrase waldaPhrase; diff --git a/include/graphics.h b/include/graphics.h index 58a9666a6..48c00943b 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4007,9 +4007,17 @@ extern const u32 gBerryPalette_Enigma[]; //credits extern const u32 gCreditsCopyrightEnd_Gfx[]; -//pokenav condition marker +//pokenav extern const u8 gPokenavConditionMarker_Gfx[]; extern const u16 gPokenavConditionMarker_Pal[]; +extern const u16 gPokenavHeader_Pal[]; +extern const u32 gPokenavHeader_Gfx[]; +extern const u32 gPokenavHeader_Tilemap[]; +extern const u32 gPokenavLeftHeaderHoennMap_Gfx[]; +extern const u32 gPokenavLeftHeaderMainMenu_Gfx[]; +extern const u32 gPokenavLeftHeaderCondition_Gfx[]; +extern const u32 gPokenavLeftHeaderRibbons_Gfx[]; +extern const u32 gPokenavLeftHeaderMatchCall_Gfx[]; extern const u32 gUnknown_08D9862C[]; extern const u32 gUnknown_08D98CC8[]; diff --git a/include/item_menu.h b/include/item_menu.h index d972cdf83..2ca1af200 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -79,5 +79,7 @@ bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); void DoWallyTutorialBagMenu(void); +void ResetBagScrollPositions(void); + #endif //GUARD_item_menu_H diff --git a/include/link.h b/include/link.h index 8c272699d..83deab88f 100644 --- a/include/link.h +++ b/include/link.h @@ -305,7 +305,7 @@ void sub_8009FAC(void); bool8 sub_800A4D8(u8 a0); u8 sub_800A9D8(void); u8 sub_800A0C8(s32, s32); -u16 *sub_801B058(void); +u16 *GetSaveBlock1Field3564(void); u8 sub_800A9A8(void); void sub_800AD10(void); void sub_800AB18(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index 435880e20..5b8ccd9fb 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -213,6 +213,7 @@ extern struct UnkRfuStruct_2 gUnknown_03005000; extern u8 gWirelessStatusIndicatorSpriteId; // Exported ROM declarations +void WipeTrainerNameRecords(void); u32 sub_800BEC0(void); void sub_800E700(void); void sub_800EDD4(void); @@ -263,7 +264,7 @@ void sub_800E084(void); void sub_801103C(void); void sub_8011C5C(void); void sub_80106D4(void); -void sub_800E3A8(void); +void RecordMixTrainerNames(void); void sub_800ED10(void); void sub_800ED28(void); void sub_8011090(u8 a0, u32 a1, u32 a2); diff --git a/include/main.h b/include/main.h index 2ed30307b..728064288 100644 --- a/include/main.h +++ b/include/main.h @@ -68,5 +68,7 @@ void ClearPokemonCrySongs(void); void RestoreSerialTimer3IntrHandlers(void); void StartTimer1(void); void SeedRngAndSetTrainerId(void); +extern u16 GetGeneratedTrainerIdLower(void); + #endif // GUARD_MAIN_H diff --git a/include/player_pc.h b/include/player_pc.h index 5a0b83683..53bb25c6b 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -85,5 +85,7 @@ extern const struct MenuAction gMailboxMailOptions[]; void ReshowPlayerPC(u8 taskId); void sub_816B31C(void); void Mailbox_ReturnToMailListAfterDeposit(void); +void NewGameInitPCItems(void); + #endif //GUARD_PLAYER_PC_H diff --git a/include/pokedex.h b/include/pokedex.h index 91e9e37d4..6136f7786 100644 --- a/include/pokedex.h +++ b/include/pokedex.h @@ -1,7 +1,7 @@ #ifndef GUARD_POKEDEX_H #define GUARD_POKEDEX_H -extern u8 gUnknown_030060B0; +extern u8 gUnusedPokedexU8; extern void (*gUnknown_030060B4)(void); #define HOENN_DEX_COUNT 202 @@ -42,5 +42,6 @@ u8 CreateDexDisplayMonDataTask(u16 dexNum, u32 trainerId, u32 personality); s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId); u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16); bool16 HasAllHoennMons(void); +void ResetPokedexScrollPositions(void); #endif // GUARD_POKEDEX_H diff --git a/include/secret_base.h b/include/secret_base.h index 57ad81fee..699158d0e 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -24,6 +24,7 @@ void sub_80EBB28(void); void WarpIntoSecretBase(const struct MapPosition *position, const struct MapEvents *events); bool8 sub_80E909C(void); void sub_80EB218(void); +void ResetSecretBases(void); // SetCurrentSecretBaseFromPosition void sub_80E9608(const struct MapPosition *position, const struct MapEvents *events); @@ -33,4 +34,5 @@ void sub_80E8BC8(void); void sub_80E8D4C(void); void EnableBothScriptContexts(void); + #endif //GUARD_SECRET_BASE_H diff --git a/include/strings.h b/include/strings.h index 9557dcca2..af1625140 100644 --- a/include/strings.h +++ b/include/strings.h @@ -986,6 +986,19 @@ extern const u8 gText_SomeonesPC[]; extern const u8 gText_PlayersPC[]; extern const u8 gText_WhichPCShouldBeAccessed[]; +extern const u8 gText_Navgear_ClearButtonList[]; +extern const u8 gText_NavgearMap_ZoomedOutButtons[]; +extern const u8 gText_NavgearMap_ZoomedInButtons[]; +extern const u8 gText_NavgearCondition_MonListButtons[]; +extern const u8 gText_NavgearCondition_MonStatusButtons[]; +extern const u8 gText_NavgearCondition_MarkingButtons[]; +extern const u8 gText_NavgearMatchCall_TrainerListButtons[]; +extern const u8 gText_NavgearMatchCall_CallMenuButtons[]; +extern const u8 gText_NavgearMatchCall_CheckTrainerButtons[]; +extern const u8 gText_NavgearRibbons_MonListButtons[]; +extern const u8 gText_NavgearRibbons_RibbonListButtons[]; +extern const u8 gText_NavgearRibbons_RibbonCheckButtons[]; + extern const u8 gUnknown_085EAD37[]; extern const u8 gUnknown_085EAD41[]; extern const u8 gUnknown_085EAD67[]; @@ -2400,5 +2413,14 @@ extern const u8 gUnknown_085EDC45[]; extern const u8 gUnknown_085EDB00[]; extern const u8 gUnknown_085EDC84[]; +// Easy Chat Entry +extern const u8 gText_StopGivingPkmnMail[]; +extern const u8 gText_LikeToQuitQuiz[]; +extern const u8 gText_ChallengeQuestionMark[]; +extern const u8 gText_QuitEditing[]; +extern const u8 gText_AllTextBeingEditedWill[]; +extern const u8 gText_BeDeletedThatOkay[]; +extern const u8 gText_Lady[]; +extern const u8 gText_F700sQuiz[]; #endif // GUARD_STRINGS_H diff --git a/include/tv.h b/include/tv.h index 760d87522..a7ef3daa8 100644 --- a/include/tv.h +++ b/include/tv.h @@ -61,5 +61,6 @@ void ContestLiveUpdates_BeforeInterview_2(u8 a0); void ContestLiveUpdates_BeforeInterview_3(u8 a0); void ContestLiveUpdates_BeforeInterview_4(u16 a0); void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1); +void ResetGabbyAndTy(void); #endif //GUARD_TV_H diff --git a/ld_script.txt b/ld_script.txt index 306a1f4b0..eaf75c3de 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -147,7 +147,6 @@ SECTIONS { src/secret_base.o(.text); src/tv.o(.text); src/contest_link_80F57C4.o(.text); - asm/contest_link_80F57C4.o(.text); src/script_pokemon_util_80F87D8.o(.text); src/field_poison.o(.text); src/pokemon_size_record.o(.text); @@ -165,6 +164,7 @@ SECTIONS { src/ice.o(.text); src/fight.o(.text); src/poison.o(.text); + src/flying.o(.text); asm/flying.o(.text); src/psychic.o(.text); src/bug.o(.text); @@ -289,6 +289,7 @@ SECTIONS { src/pokemon_summary_screen.o(.text); src/unk_pokedex_area_screen_helper.o(.text); src/battle_pyramid_bag.o(.text); + src/pokenav.o(.text); asm/pokenav.o(.text); src/pokenav_match_call.o(.text); asm/rom_81D1C44.o(.text); @@ -591,6 +592,7 @@ SECTIONS { src/pokemon_summary_screen.o(.rodata); src/unk_pokedex_area_screen_helper.o(.rodata); src/battle_pyramid_bag.o(.rodata); + src/pokenav.o(.rodata); data/pokenav.o(.rodata); src/pokenav_match_call.o(.rodata); data/rom_81D1C44.o(.rodata); diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 6be8ba4a4..07b941f11 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -10,21 +10,20 @@ #include "constants/maps.h" #include "constants/songs.h" #include "constants/species.h" - -extern void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatileId); // fieldmap -extern u8 GetCursorSelectionMonId(void); -extern u8 oei_task_add(void); +#include "fieldmap.h" +#include "party_menu.h" +#include "fldeff.h" // why do this, GF? enum { - STRENGTH_PUZZLE, - FLY_PUZZLE + REGIROCK_PUZZLE, + REGISTEEL_PUZZLE }; EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0; -static const u8 gUnknown_085EFE74[][2] = +static const u8 gRegicePathCoords[][2] = { {0x04, 0x15}, {0x05, 0x15}, @@ -65,14 +64,14 @@ static const u8 gUnknown_085EFE74[][2] = }; void SealedChamberShakingEffect(u8); -void sub_8179860(void); -void sub_8179944(void); +void DoBrailleRegirockEffect(void); +void DoBrailleRegisteelEffect(void); bool8 ShouldDoBrailleDigEffect(void) { if (!FlagGet(FLAG_SYS_BRAILLE_DIG) - && (gSaveBlock1Ptr->location.mapGroup == 0x18 - && gSaveBlock1Ptr->location.mapNum == 0x47)) + && (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SEALED_CHAMBER_OUTER_ROOM) + && gSaveBlock1Ptr->location.mapNum == MAP_NUM(SEALED_CHAMBER_OUTER_ROOM))) { if (gSaveBlock1Ptr->pos.x == 10 && gSaveBlock1Ptr->pos.y == 3) return TRUE; @@ -87,12 +86,12 @@ bool8 ShouldDoBrailleDigEffect(void) void DoBrailleDigEffect(void) { - MapGridSetMetatileIdAt(16, 8, 554); - MapGridSetMetatileIdAt(17, 8, 555); - MapGridSetMetatileIdAt(18, 8, 556); - MapGridSetMetatileIdAt(16, 9, 3634); - MapGridSetMetatileIdAt(17, 9, 563); - MapGridSetMetatileIdAt(18, 9, 3636); + MapGridSetMetatileIdAt(16, 8, 0x22A); + MapGridSetMetatileIdAt(17, 8, 0x22B); + MapGridSetMetatileIdAt(18, 8, 0x22C); + MapGridSetMetatileIdAt(16, 9, 0xE32); + MapGridSetMetatileIdAt(17, 9, 0x233); + MapGridSetMetatileIdAt(18, 9, 0xE34); DrawWholeMapView(); PlaySE(SE_BAN); FlagSet(FLAG_SYS_BRAILLE_DIG); @@ -115,10 +114,10 @@ bool8 CheckRelicanthWailord(void) // THEORY: this was caused by block commenting out all of the older R/S braille functions but leaving the call to it itself, which creates the nullsub. // the code is shown below to show what this might look like. -void ShouldDoBrailleStrengthEffectOld(void) +void ShouldDoBrailleRegirockEffectOld(void) { /* - if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) && (gSaveBlock1.location.mapGroup == MAP_GROUP_DESERT_RUINS && gSaveBlock1.location.mapNum == MAP_ID_DESERT_RUINS)) + if (!FlagGet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED) && (gSaveBlock1.location.mapGroup == MAP_GROUP_DESERT_RUINS && gSaveBlock1.location.mapNum == MAP_ID_DESERT_RUINS)) { if (gSaveBlock1.pos.x == 10 && gSaveBlock1.pos.y == 23) return TRUE; @@ -131,7 +130,7 @@ void ShouldDoBrailleStrengthEffectOld(void) return FALSE; } -void DoBrailleStrengthEffect(void) +void DoBrailleRegirockEffect(void) { FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH); MapGridSetMetatileIdAt(14, 26, 554); @@ -142,13 +141,13 @@ void DoBrailleStrengthEffect(void) MapGridSetMetatileIdAt(16, 27, 3636); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_STRENGTH); + FlagSet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED); ScriptContext2_Disable(); } -bool8 ShouldDoBrailleFlyEffect(void) +bool8 ShouldDoBrailleRegisteelEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_FLY) && (gSaveBlock1.location.mapGroup == MAP_GROUP_ANCIENT_TOMB && gSaveBlock1.location.mapNum == MAP_ID_ANCIENT_TOMB)) + if (!FlagGet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED) && (gSaveBlock1.location.mapGroup == MAP_GROUP_ANCIENT_TOMB && gSaveBlock1.location.mapNum == MAP_ID_ANCIENT_TOMB)) { if (gSaveBlock1.pos.x == 8 && gSaveBlock1.pos.y == 25) return TRUE; @@ -157,24 +156,24 @@ bool8 ShouldDoBrailleFlyEffect(void) return FALSE; } -void DoBrailleFlyEffect(void) +void DoBrailleRegisteelEffect(void) { gFieldEffectArguments[0] = gLastFieldPokeMenuOpened; - FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectStart(FLDEFF_USE_TOMB_PUZZLE_EFFECT); } bool8 FldEff_UseFlyAncientTomb(void) { u8 taskId = oei_task_add(); - gTasks[taskId].data[8] = (u32)UseFlyAncientTomb_Callback >> 16; - gTasks[taskId].data[9] = (u32)UseFlyAncientTomb_Callback; + gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 16; + gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback; return FALSE; } -void UseFlyAncientTomb_Callback(void) +void UseRegisteelHm_Callback(void) { - FieldEffectActiveListRemove(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT); UseFlyAncientTomb_Finish(); } @@ -188,7 +187,7 @@ void UseFlyAncientTomb_Finish(void) MapGridSetMetatileIdAt(16, 27, 3636); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_FLY); + FlagSet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED); ScriptContext2_Disable(); } */ @@ -240,25 +239,25 @@ void SealedChamberShakingEffect(u8 taskId) } // moved later in the function because it was rewritten. -bool8 ShouldDoBrailleStrengthEffect(void) +bool8 ShouldDoBrailleRegirockEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_STRENGTH) + if (!FlagGet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED) && gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(DESERT_RUINS) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(DESERT_RUINS)) { if (gSaveBlock1Ptr->pos.x == 6 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; + sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; return TRUE; } else if (gSaveBlock1Ptr->pos.x == 5 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; + sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; return TRUE; } else if (gSaveBlock1Ptr->pos.x == 7 && gSaveBlock1Ptr->pos.y == 23) { - sBraillePuzzleCallbackFlag = STRENGTH_PUZZLE; + sBraillePuzzleCallbackFlag = REGIROCK_PUZZLE; return TRUE; } } @@ -266,65 +265,68 @@ bool8 ShouldDoBrailleStrengthEffect(void) return FALSE; } -void sub_8179834(void) +void SetUpPuzzleEffectRegirock(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectStart(FLDEFF_USE_TOMB_PUZZLE_EFFECT); } -void UseStrengthDesertRuins_Callback(void) +void UseRegirockHm_Callback(void) { - FieldEffectActiveListRemove(FLDEFF_USE_FLY_ANCIENT_TOMB); - sub_8179860(); + FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT); + DoBrailleRegirockEffect(); } -void sub_8179860(void) +void DoBrailleRegirockEffect(void) { - MapGridSetMetatileIdAt(14, 26, 554); - MapGridSetMetatileIdAt(15, 26, 555); - MapGridSetMetatileIdAt(16, 26, 556); - MapGridSetMetatileIdAt(14, 27, 3634); - MapGridSetMetatileIdAt(15, 27, 563); - MapGridSetMetatileIdAt(16, 27, 3636); + MapGridSetMetatileIdAt(14, 26, 0x22A); + MapGridSetMetatileIdAt(15, 26, 0x22B); + MapGridSetMetatileIdAt(16, 26, 0x22C); + MapGridSetMetatileIdAt(14, 27, 0xE32); + MapGridSetMetatileIdAt(15, 27, 0x233); + MapGridSetMetatileIdAt(16, 27, 0xE34); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_STRENGTH); + FlagSet(FLAG_SYS_REGIROCK_PUZZLE_COMPLETED); ScriptContext2_Disable(); } -bool8 ShouldDoBrailleFlyEffect(void) +bool8 ShouldDoBrailleRegisteelEffect(void) { - if (!FlagGet(FLAG_SYS_BRAILLE_FLY) && (gSaveBlock1Ptr->location.mapGroup == 0x18 && gSaveBlock1Ptr->location.mapNum == 0x44)) + if (!FlagGet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED) && (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ANCIENT_TOMB) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(ANCIENT_TOMB))) { if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 25) - { sBraillePuzzleCallbackFlag = FLY_PUZZLE; return TRUE; } + { + sBraillePuzzleCallbackFlag = REGISTEEL_PUZZLE; + return TRUE; + } } return FALSE; } -void sub_8179918(void) +void SetUpPuzzleEffectRegisteel(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); - FieldEffectStart(FLDEFF_USE_FLY_ANCIENT_TOMB); + FieldEffectStart(FLDEFF_USE_TOMB_PUZZLE_EFFECT); } -void UseFlyAncientTomb_Callback(void) +void UseRegisteelHm_Callback(void) { - FieldEffectActiveListRemove(FLDEFF_USE_FLY_ANCIENT_TOMB); - sub_8179944(); + FieldEffectActiveListRemove(FLDEFF_USE_TOMB_PUZZLE_EFFECT); + DoBrailleRegisteelEffect(); } -void sub_8179944(void) +void DoBrailleRegisteelEffect(void) { - MapGridSetMetatileIdAt(14, 26, 554); - MapGridSetMetatileIdAt(15, 26, 555); - MapGridSetMetatileIdAt(16, 26, 556); - MapGridSetMetatileIdAt(14, 27, 3634); - MapGridSetMetatileIdAt(15, 27, 563); - MapGridSetMetatileIdAt(16, 27, 3636); + MapGridSetMetatileIdAt(14, 26, 0x22A); + MapGridSetMetatileIdAt(15, 26, 0x22B); + MapGridSetMetatileIdAt(16, 26, 0x22C); + MapGridSetMetatileIdAt(14, 27, 0xE32); + MapGridSetMetatileIdAt(15, 27, 0x233); + MapGridSetMetatileIdAt(16, 27, 0xE34); DrawWholeMapView(); PlaySE(SE_BAN); - FlagSet(FLAG_SYS_BRAILLE_FLY); + FlagSet(FLAG_SYS_REGISTEEL_PUZZLE_COMPLETED); ScriptContext2_Disable(); } @@ -332,7 +334,7 @@ void sub_8179944(void) void DoBrailleWait(void) { /* - if (!FlagGet(FLAG_SYS_BRAILLE_WAIT)) + if (!FlagGet(FLAG_SYS_BRAILLE_REGICE_COMPLETED)) CreateTask(Task_BrailleWait, 0x50); } @@ -410,15 +412,15 @@ bool8 FldEff_UsePuzzleEffect(void) { u8 taskId = oei_task_add(); - if (sBraillePuzzleCallbackFlag == FLY_PUZZLE) + if (sBraillePuzzleCallbackFlag == REGISTEEL_PUZZLE) { - gTasks[taskId].data[8] = (u32)UseFlyAncientTomb_Callback >> 16; - gTasks[taskId].data[9] = (u32)UseFlyAncientTomb_Callback; + gTasks[taskId].data[8] = (u32)UseRegisteelHm_Callback >> 16; + gTasks[taskId].data[9] = (u32)UseRegisteelHm_Callback; } else { - gTasks[taskId].data[8] = (u32)UseStrengthDesertRuins_Callback >> 16; - gTasks[taskId].data[9] = (u32)UseStrengthDesertRuins_Callback; + gTasks[taskId].data[8] = (u32)UseRegirockHm_Callback >> 16; + gTasks[taskId].data[9] = (u32)UseRegirockHm_Callback; } return FALSE; } @@ -427,10 +429,10 @@ bool8 ShouldDoBrailleRegicePuzzle(void) { u8 i; - if (gSaveBlock1Ptr->location.mapGroup == 0x18 - && gSaveBlock1Ptr->location.mapNum == 0x43) + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ISLAND_CAVE) + && gSaveBlock1Ptr->location.mapNum == MAP_NUM(ISLAND_CAVE)) { - if (FlagGet(FLAG_SYS_BRAILLE_WAIT) != FALSE) + if (FlagGet(FLAG_SYS_BRAILLE_REGICE_COMPLETED)) return FALSE; if (FlagGet(FLAG_TEMP_2) == FALSE) return FALSE; @@ -439,35 +441,36 @@ bool8 ShouldDoBrailleRegicePuzzle(void) for (i = 0; i < 36; i++) { - u8 xPos = gUnknown_085EFE74[i][0]; - u8 yPos = gUnknown_085EFE74[i][1]; + u8 xPos = gRegicePathCoords[i][0]; + u8 yPos = gRegicePathCoords[i][1]; if (gSaveBlock1Ptr->pos.x == xPos && gSaveBlock1Ptr->pos.y == yPos) { u16 varValue; if (i < 16) { - u16 val = VarGet(VAR_0x403B); + u16 val = VarGet(VAR_REGICE_STEPS_1); val |= 1 << i; - VarSet(VAR_0x403B, val); + VarSet(VAR_REGICE_STEPS_1, val); } else if (i < 32) { - u16 val = VarGet(VAR_0x403C); + u16 val = VarGet(VAR_REGICE_STEPS_2); val |= 1 << (i - 16); - VarSet(VAR_0x403C, val); + VarSet(VAR_REGICE_STEPS_2, val); } else { - u16 val = VarGet(VAR_0x403D); + u16 val = VarGet(VAR_REGICE_STEPS_3); val |= 1 << (i - 32); - VarSet(VAR_0x403D, val); + VarSet(VAR_REGICE_STEPS_3, val); } - varValue = VarGet(VAR_0x403B); - if (varValue != 0xFFFF || VarGet(VAR_0x403C) != varValue || VarGet(VAR_0x403D) != 0xF) + varValue = VarGet(VAR_REGICE_STEPS_1); + if (varValue != 0xFFFF || VarGet(VAR_REGICE_STEPS_2) != 0xFFFF || VarGet(VAR_REGICE_STEPS_3) != 0xF) return FALSE; + // This final check is redundant. if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21) return TRUE; else diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c index 381fb34fa..485065d71 100644 --- a/src/contest_link_80F57C4.c +++ b/src/contest_link_80F57C4.c @@ -1,8 +1,11 @@ #include "global.h" +#include "alloc.h" #include "battle.h" +#include "battle_gfx_sfx_util.h" #include "bg.h" #include "contest.h" #include "contest_link_80F57C4.h" +#include "contest_link_80FC4F4.h" #include "decompress.h" #include "dma3.h" #include "event_data.h" @@ -22,11 +25,13 @@ #include "random.h" #include "save.h" #include "scanline_effect.h" +#include "script.h" #include "sound.h" #include "string_util.h" #include "strings.h" #include "task.h" #include "text.h" +#include "trig.h" #include "tv.h" #include "util.h" #include "window.h" @@ -44,26 +49,38 @@ struct ContestLinkUnk0 u8 unk4; u8 unk5; u8 unk6; - u8 filler7[0x1]; + u8 unk7; u8 spriteId; u8 unk9; u8 unkA; - u8 fillerB[0x9]; + s16 unkC[4]; u8 unk14; u8 filler15[0x3]; }; +struct ContestLinkUnk14 +{ + int unk0; + int unk4; + u32 unk8; + u32 unkC; + u8 unk10; + u8 unk11; + u8 unk12; +}; + struct ContestLinkUnk4 { - u8 filler0[0x50]; + struct ContestLinkUnk14 unk0[4]; }; struct ContestLink80F57C4 { struct ContestLinkUnk0 *unk0; struct ContestLinkUnk4 *unk4; - u8 filler8[0x4]; + u8 *unk8; u8 *unkC[4]; + u8 *unk1C; }; EWRAM_DATA struct ContestLink80F57C4 *gUnknown_0203A034 = NULL; @@ -80,20 +97,23 @@ extern const u8 gUnknown_0858D6D0[]; extern const struct SpriteTemplate gSpriteTemplate_858D7F8; extern const struct SpriteSheet gUnknown_0858D810[]; extern const struct SpritePalette gUnknown_0858D850; +extern const struct SpriteTemplate gSpriteTemplate_858D860; + +extern void sub_81D9DE4(u8); static void sub_80F6A9C(void); static void sub_80F71C8(void); u8 sub_80F7310(u8, u8); s8 sub_80F7364(u8, u8); -void sub_80F7ED0(int, u8 *, int); -void sub_80F7DF4(void); -static void sub_80F6A64(u8, u8); +static void sub_80F7ED0(int, u8 *, int); +static void sub_80F7DF4(void); +static void LoadAllContestMonIcons(u8, u8); static void sub_80F6DC0(void); static void sub_80F6AE8(void); static void sub_80F5CE4(u8); static void sub_80F5C00(void); static void sub_80F68B4(u8); -void sub_80F7880(void); +static void sub_80F7880(void); static void sub_80F5C24(void); static void sub_80F707C(const u8 *); static void sub_80F5ED8(u8); @@ -105,27 +125,38 @@ static void sub_80F68F0(u8); s16 sub_80F6B78(const u8 *, u8); static void sub_80F6E9C(s16, u16, u16, u16); static void sub_80F6058(u8); -void sub_80F7A80(u8, u8); +static void sub_80F7A80(u8, u8); +void sub_80F7CA8(u8); static void sub_80F6EF4(u16); static void sub_80F60F0(u8); static void sub_80F616C(u8); static void sub_80F6204(u8); -void sub_80F73DC(u8); -void sub_80F74BC(u8); -void sub_80F77E0(u8, u8); +static void sub_80F73DC(u8); +static void sub_80F74BC(u8); +static void sub_80F753C(u8); +static void sub_80F77E0(u8, u8); +static void sub_80F7824(u8); static void sub_80F6404(u8); -void sub_80F75A8(struct Sprite *); -void sub_80F7670(u8); -void sub_80F7620(struct Sprite *); +static void sub_80F75A8(struct Sprite *); +static void sub_80F7670(u8); +static void sub_80F7620(struct Sprite *); static void sub_80F66B4(u8); static void sub_80F671C(u8); static void sub_80F677C(u8); static void sub_80F67C4(u8); static void sub_80F6820(u8); -void sub_80F7E64(void); +static void sub_80F7E64(void); static void sub_80F6F68(struct Sprite *); static void sub_80F7014(struct Sprite *); static void sub_80F6FDC(struct Sprite *); +static void sub_80F8508(u8); +static void sub_80F8568(u8); +static void sub_80F8584(u8); +static void sub_80F85A0(u8); +static void sub_80F85BC(u8); +static void sub_80F86B8(u8); +static void sub_80F878C(u8); +static void sub_80F87B4(u8); void sub_80F57C4(void) { @@ -265,7 +296,7 @@ void sub_80F5B00(void) FreeAllSpritePalettes(); sub_80F591C(); sub_80F6A9C(); - sub_80F6A64(0, 1); + LoadAllContestMonIcons(0, 1); sub_80F5AE0(); memset(gUnknown_0203A034->unk0, 0, sizeof(*gUnknown_0203A034->unk0)); memset(gUnknown_0203A034->unk4, 0, sizeof(*gUnknown_0203A034->unk4)); @@ -827,7 +858,7 @@ static void sub_80F68F0(u8 taskId) gUnknown_0203A034->unk0->unkA = 1; } -void sub_80F69B8(u16 species, u8 monIndex, u8 arg2, u8 arg3, u32 personality) +void sub_80F69B8(u16 species, u8 monIndex, u8 srcOffset, u8 useDmaNow, u32 personality) { u8 frameNum; const u8 *iconPtr; @@ -838,8 +869,8 @@ void sub_80F69B8(u16 species, u8 monIndex, u8 arg2, u8 arg3, u32 personality) frameNum = (monIndex == *contestPlayerMonIndex) ? 1 : 0; iconPtr = GetMonIconPtr(species, personality, frameNum); - iconPtr += arg2 * 0x200 + 0x80; - if (arg3) + iconPtr += srcOffset * 0x200 + 0x80; + if (useDmaNow) { RequestDma3Copy(iconPtr, (void *)BG_CHAR_ADDR(1) + monIndex * 0x200, 0x180, 1); var0 = ((monIndex + 10) << 12); @@ -852,12 +883,12 @@ void sub_80F69B8(u16 species, u8 monIndex, u8 arg2, u8 arg3, u32 personality) } } -static void sub_80F6A64(u8 arg0, u8 arg1) +static void LoadAllContestMonIcons(u8 srcOffset, u8 useDmaNow) { int i; for (i = 0; i < 4; i++) - sub_80F69B8(gContestMons[i].species, i, arg0, arg1, gContestMons[i].personality); + sub_80F69B8(gContestMons[i].species, i, srcOffset, useDmaNow, gContestMons[i].personality); } static void sub_80F6A9C(void) @@ -1439,3 +1470,1657 @@ u8 sub_80F7310(u8 monIndex, u8 arg1) return var1; } + +s8 sub_80F7364(u8 arg0, u8 arg1) +{ + u32 r4; + u32 r2; + s16 val; + s8 ret; + + val = gUnknown_02039F18[arg0]; + if (val < 0) + r4 = -val << 16; + else + r4 = val << 16; + + r2 = r4 / 80; + if (r2 & 0xFFFF) + r2 += 0x10000; + + r2 >>= 16; + if (r2 == 0 && r4 != 0) + r2 = 1; + + if (arg1 != 0 && r2 > 10) + r2 = 10; + + if (gUnknown_02039F18[arg0] < 0) + ret = -r2; + else + ret = r2; + + return ret; +} + +static void sub_80F73DC(u8 taskId) +{ + u16 firstTileNum; + + if (gTasks[taskId].data[10] == 0) + { + gTasks[taskId].data[11] = (3 - gTasks[taskId].data[0]) * 40; + gTasks[taskId].data[10]++; + } + else if (gTasks[taskId].data[10] == 1) + { + if (--gTasks[taskId].data[11] == -1) + { + firstTileNum = gTasks[taskId].data[0] * 2 + 0x5043; + WriteSequenceToBgTilemapBuffer(2, firstTileNum, 1, gTasks[taskId].data[1] * 3 + 5, 2, 1, 17, 1); + WriteSequenceToBgTilemapBuffer(2, firstTileNum + 0x10, 1, gTasks[taskId].data[1] * 3 + 6, 2, 1, 17, 1); + gUnknown_0203A034->unk0->unk5++; + DestroyTask(taskId); + PlaySE(SE_JYUNI); + } + } +} + +static void sub_80F74BC(u8 taskId) +{ + int i; + for (i = 0; i < 4 && gContestFinalStandings[i] != 0; i++) + ; + + CopyToBgTilemapBufferRect_ChangePalette(2, i * 0xC0 + 0x100 + gUnknown_0203A034->unkC[2], 0, i * 3 + 4, 32, 3, 9); + gTasks[taskId].data[10] = i; + gTasks[taskId].data[12] = 1; + gTasks[taskId].func = sub_80F753C; + gUnknown_0203A034->unk0->unk3 = taskId; +} + +static void sub_80F753C(u8 taskId) +{ + if (++gTasks[taskId].data[11] == 1) + { + gTasks[taskId].data[11] = 0; + BlendPalette(0x91, 1, gTasks[taskId].data[12], RGB(13, 28, 27)); + if (gTasks[taskId].data[13] == 0) + { + if (++gTasks[taskId].data[12] == 16) + gTasks[taskId].data[13] = 1; + } + else + { + if (--gTasks[taskId].data[12] == 0) + gTasks[taskId].data[13] = 0; + } + } +} + +static void sub_80F75A8(struct Sprite *sprite) +{ + if (sprite->data[0] < 10) + { + if (++sprite->data[0] == 10) + { + PlayCry1(sprite->data[1], 0); + sprite->data[1] = 0; + } + } + else + { + s16 delta = (u16)sprite->data[1] + 0x600; + sprite->pos1.x -= delta >> 8; + sprite->data[1] = (sprite->data[1] + 0x600) & 0xFF; + if (sprite->pos1.x < 120) + sprite->pos1.x = 120; + + if (sprite->pos1.x == 120) + { + sprite->callback = SpriteCallbackDummy; + sprite->data[1] = 0; + gUnknown_0203A034->unk0->unk6 = 1; + } + } +} + +static void sub_80F7620(struct Sprite *sprite) +{ + s16 delta = (u16)sprite->data[1] + 0x600; + sprite->pos1.x -= delta >> 8; + sprite->data[1] = (sprite->data[1] + 0x600) & 0xFF; + if (sprite->pos1.x < -32) + { + sprite->callback = SpriteCallbackDummy; + sprite->invisible = 1; + gUnknown_0203A034->unk0->unk6 = 2; + } +} + +static void sub_80F7670(u8 taskId) +{ + if (++gTasks[taskId].data[0] == 5) + { + gTasks[taskId].data[0] = 0; + if (gUnknown_0203A034->unk0->unk7 < 40) + { + u8 spriteId = CreateSprite(&gSpriteTemplate_858D860, (Random() % 240) - 20, 44, 5); + gSprites[spriteId].data[0] = Random() % 512; + gSprites[spriteId].data[1] = (Random() % 24) + 16; + gSprites[spriteId].data[2] = (Random() % 256) + 48; + gSprites[spriteId].oam.tileNum += Random() % 17; + gUnknown_0203A034->unk0->unk7++; + } + } + + if (gUnknown_0203A034->unk0->unk9) + DestroyTask(taskId); +} + +void sub_80F7768(struct Sprite *sprite) +{ + register s16 var0 asm("r1"); + + sprite->data[3] += sprite->data[0]; + sprite->pos2.x = Sin(sprite->data[3] >> 8, sprite->data[1]); + var0 = sprite->data[4] + sprite->data[2]; + sprite->pos1.x += var0 >> 8; + var0 = var0 & 0xFF; + sprite->data[4] = var0; + sprite->pos1.y++; + if (gUnknown_0203A034->unk0->unk9) + sprite->invisible = 1; + + if (sprite->pos1.x > 248 || sprite->pos1.y > 116) + { + DestroySprite(sprite); + gUnknown_0203A034->unk0->unk7--; + } +} + +static void sub_80F77E0(u8 monIndex, u8 numFrames) +{ + u8 taskId = CreateTask(sub_80F7824, 8); + gTasks[taskId].data[0] = monIndex; + gTasks[taskId].data[1] = numFrames; + gTasks[taskId].data[2] = gContestMons[monIndex].species; +} + +static void sub_80F7824(u8 taskId) +{ + u8 monIndex = gTasks[taskId].data[0]; + if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1]) + { + gTasks[taskId].data[10] = 0; + sub_80F69B8(gTasks[taskId].data[2], monIndex, gTasks[taskId].data[11], FALSE, gContestMons[monIndex].personality); + gTasks[taskId].data[11] ^= 1; + } +} + +// static void sub_80F7880(void) +// { +// int i; +// int var0; +// int var1; +// int var2; +// int var3; +// u32 var4; +// int var5; +// int var6; +// s16 var7; +// s16 var8; +// s16 r2; + +// r2 = gUnknown_02039F08[0]; +// for (i = 1; i < 4; i++) +// { +// if (r2 < gUnknown_02039F08[i]) +// r2 = gUnknown_02039F08[i]; +// } + +// if (r2 < 0) +// { +// r2 = gUnknown_02039F08[0]; +// for (i = 1; i < 4; i++) +// { +// if (r2 > gUnknown_02039F08[i]) +// r2 = gUnknown_02039F08[i]; +// } +// } + +// // _080F78E4 +// for (i = 0; i < 4; i++) +// { +// var0 = gContestMonConditions[i] * 1000; +// var1 = r2; +// if (r2 < 0) +// var1 = -var1; + +// var2 = var0 / var1; +// if (var2 % 10 > 4) +// var2 += 10; + +// gUnknown_0203A034->unk4->unk0[i].unk0 = var2 / 10; +// var3 = gUnknown_02039F18[i]; +// if (var3 < 0) +// var3 = -var3; + +// var0 = var3 * 1000; +// var1 = r2; +// if (r2 < 0) +// var1 = -var1; + +// var2 = var0 / var1; +// if (var2 % 10 > 4) +// var2 += 10; + +// // _080F7966 +// gUnknown_0203A034->unk4->unk0[i].unk4 = var2 / 10; +// if (gUnknown_02039F18[i] < 0) +// gUnknown_0203A034->unk4->unk0[i].unk10 = 1; + +// var4 = gUnknown_0203A034->unk4->unk0[i].unk0 * 22528 / 100; +// if ((var4 & 0xFF) > 0x7F) +// var4 += 0x100; + +// gUnknown_0203A034->unk4->unk0[i].unk8 = var4 >> 8; +// var4 = gUnknown_0203A034->unk4->unk0[i].unk4 * 22528 / 100; +// if ((var4 & 0xFF) > 0x7F) +// var4 += 0x100; + +// gUnknown_0203A034->unk4->unk0[i].unkC = var4 >> 8; +// gUnknown_0203A034->unk4->unk0[i].unk11 = sub_80F7310(i, 1); +// var5 = sub_80F7364(i, 1); +// if (var5 < 0) +// var5 = -var5; + +// gUnknown_0203A034->unk4->unk0[i].unk12 = var5; +// if (gContestFinalStandings[i]) +// { +// var7 = gUnknown_0203A034->unk4->unk0[i].unk8; +// var8 = gUnknown_0203A034->unk4->unk0[i].unkC; +// if (gUnknown_0203A034->unk4->unk0[i].unk10) +// var8 = -var8; + +// if (var7 + var8 == 88) +// { +// if (var8 > 0) +// gUnknown_0203A034->unk4->unk0[i].unkC--; +// else if (var7 > 0) +// gUnknown_0203A034->unk4->unk0[i].unk8--; +// } +// } +// } +// } + +NAKED +static void sub_80F7880(void) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x4\n\ + ldr r0, =gUnknown_02039F08\n\ + ldrh r2, [r0]\n\ + adds r4, r0, 0\n\ + adds r3, r4, 0x2\n\ + movs r0, 0x2\n\ + mov r8, r0\n\ +_080F7898:\n\ + lsls r0, r2, 16\n\ + asrs r0, 16\n\ + movs r5, 0\n\ + ldrsh r1, [r3, r5]\n\ + cmp r0, r1\n\ + bge _080F78A6\n\ + ldrh r2, [r3]\n\ +_080F78A6:\n\ + adds r3, 0x2\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + add r8, r0\n\ + mov r1, r8\n\ + cmp r1, 0\n\ + bge _080F7898\n\ + lsls r0, r2, 16\n\ + str r0, [sp]\n\ + cmp r0, 0\n\ + bge _080F78E4\n\ + ldrh r2, [r4]\n\ + adds r3, r4, 0x2\n\ + movs r4, 0x2\n\ + mov r8, r4\n\ +_080F78C4:\n\ + lsls r0, r2, 16\n\ + asrs r0, 16\n\ + movs r5, 0\n\ + ldrsh r1, [r3, r5]\n\ + cmp r0, r1\n\ + ble _080F78D2\n\ + ldrh r2, [r3]\n\ +_080F78D2:\n\ + adds r3, 0x2\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + add r8, r0\n\ + lsls r1, r2, 16\n\ + str r1, [sp]\n\ + mov r4, r8\n\ + cmp r4, 0\n\ + bge _080F78C4\n\ +_080F78E4:\n\ + movs r5, 0\n\ + mov r8, r5\n\ + mov r10, r5\n\ +_080F78EA:\n\ + ldr r0, =gContestMonConditions\n\ + mov r1, r8\n\ + lsls r7, r1, 1\n\ + adds r0, r7, r0\n\ + movs r2, 0\n\ + ldrsh r1, [r0, r2]\n\ + lsls r0, r1, 5\n\ + subs r0, r1\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + ldr r4, [sp]\n\ + asrs r5, r4, 16\n\ + adds r1, r5, 0\n\ + cmp r5, 0\n\ + bge _080F790C\n\ + negs r1, r5\n\ +_080F790C:\n\ + bl __divsi3\n\ + adds r4, r0, 0\n\ + movs r1, 0xA\n\ + bl __modsi3\n\ + cmp r0, 0x4\n\ + ble _080F791E\n\ + adds r4, 0xA\n\ +_080F791E:\n\ + ldr r0, =gUnknown_0203A034\n\ + mov r9, r0\n\ + ldr r0, [r0]\n\ + ldr r0, [r0, 0x4]\n\ + mov r1, r10\n\ + adds r6, r1, r0\n\ + adds r0, r4, 0\n\ + movs r1, 0xA\n\ + bl __divsi3\n\ + str r0, [r6]\n\ + ldr r0, =gUnknown_02039F18\n\ + adds r7, r0\n\ + movs r2, 0\n\ + ldrsh r1, [r7, r2]\n\ + cmp r1, 0\n\ + bge _080F7942\n\ + negs r1, r1\n\ +_080F7942:\n\ + lsls r0, r1, 5\n\ + subs r0, r1\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + adds r1, r5, 0\n\ + cmp r1, 0\n\ + bge _080F7954\n\ + negs r1, r1\n\ +_080F7954:\n\ + bl __divsi3\n\ + adds r4, r0, 0\n\ + movs r1, 0xA\n\ + bl __modsi3\n\ + cmp r0, 0x4\n\ + ble _080F7966\n\ + adds r4, 0xA\n\ +_080F7966:\n\ + adds r0, r4, 0\n\ + movs r1, 0xA\n\ + bl __divsi3\n\ + str r0, [r6, 0x4]\n\ + movs r4, 0\n\ + ldrsh r0, [r7, r4]\n\ + cmp r0, 0\n\ + bge _080F797C\n\ + movs r0, 0x1\n\ + strb r0, [r6, 0x10]\n\ +_080F797C:\n\ + mov r5, r9\n\ + ldr r0, [r5]\n\ + ldr r0, [r0, 0x4]\n\ + mov r1, r10\n\ + adds r4, r1, r0\n\ + ldr r1, [r4]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + subs r0, r1\n\ + lsls r0, 11\n\ + movs r1, 0x64\n\ + bl __divsi3\n\ + adds r1, r0, 0\n\ + movs r5, 0xFF\n\ + ands r0, r5\n\ + cmp r0, 0x7F\n\ + bls _080F79A8\n\ + movs r2, 0x80\n\ + lsls r2, 1\n\ + adds r1, r2\n\ +_080F79A8:\n\ + lsrs r0, r1, 8\n\ + str r0, [r4, 0x8]\n\ + ldr r1, [r4, 0x4]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + subs r0, r1\n\ + lsls r0, 11\n\ + movs r1, 0x64\n\ + bl __divsi3\n\ + adds r1, r0, 0\n\ + ands r0, r5\n\ + cmp r0, 0x7F\n\ + bls _080F79CC\n\ + movs r5, 0x80\n\ + lsls r5, 1\n\ + adds r1, r5\n\ +_080F79CC:\n\ + lsrs r0, r1, 8\n\ + str r0, [r4, 0xC]\n\ + mov r0, r8\n\ + lsls r4, r0, 24\n\ + lsrs r4, 24\n\ + adds r0, r4, 0\n\ + movs r1, 0x1\n\ + bl sub_80F7310\n\ + mov r2, r9\n\ + ldr r1, [r2]\n\ + ldr r1, [r1, 0x4]\n\ + add r1, r10\n\ + strb r0, [r1, 0x11]\n\ + adds r0, r4, 0\n\ + movs r1, 0x1\n\ + bl sub_80F7364\n\ + mov r4, r9\n\ + ldr r1, [r4]\n\ + ldr r1, [r1, 0x4]\n\ + add r1, r10\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0\n\ + bge _080F7A02\n\ + negs r0, r0\n\ +_080F7A02:\n\ + strb r0, [r1, 0x12]\n\ + ldr r0, =gContestFinalStandings\n\ + add r0, r8\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _080F7A60\n\ + mov r5, r9\n\ + ldr r0, [r5]\n\ + ldr r0, [r0, 0x4]\n\ + mov r2, r10\n\ + adds r1, r2, r0\n\ + ldr r5, [r1, 0x8]\n\ + ldrh r3, [r1, 0x8]\n\ + ldr r4, [r1, 0xC]\n\ + ldrh r2, [r1, 0xC]\n\ + ldrb r0, [r1, 0x10]\n\ + cmp r0, 0\n\ + beq _080F7A2C\n\ + lsls r0, r2, 16\n\ + negs r0, r0\n\ + lsrs r2, r0, 16\n\ +_080F7A2C:\n\ + lsls r0, r3, 16\n\ + asrs r3, r0, 16\n\ + lsls r0, r2, 16\n\ + asrs r2, r0, 16\n\ + adds r0, r3, r2\n\ + cmp r0, 0x58\n\ + bne _080F7A60\n\ + cmp r2, 0\n\ + ble _080F7A58\n\ + subs r0, r4, 0x1\n\ + str r0, [r1, 0xC]\n\ + b _080F7A60\n\ + .pool\n\ +_080F7A58:\n\ + cmp r3, 0\n\ + ble _080F7A60\n\ + subs r0, r5, 0x1\n\ + str r0, [r1, 0x8]\n\ +_080F7A60:\n\ + movs r4, 0x14\n\ + add r10, r4\n\ + movs r5, 0x1\n\ + add r8, r5\n\ + mov r0, r8\n\ + cmp r0, 0x3\n\ + bgt _080F7A70\n\ + b _080F78EA\n\ +_080F7A70:\n\ + add sp, 0x4\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0"); +} + +// static void sub_80F7A80(u8 arg0, u8 arg1) +// { +// int i; +// u8 taskId; +// u8 sp8, spC; + +// sp8 = 0; +// spC = 0; +// if (!arg0) +// { +// u32 var0; +// for (i = 0; i < 4; i++) +// { +// int var1 = gUnknown_0203A034->unk4->unk0[i].unk11; +// if (arg1 < var1) +// { +// int x = var1 + 19; +// x -= arg1; +// x--; +// FillBgTilemapBufferRect_Palette0(1, 0x60B3, x, i * 3 + 5, 1, 1); +// taskId = CreateTask(sub_80F7CA8, 10); +// var0 = ((gUnknown_0203A034->unk4->unk0[i].unk8 << 16) / gUnknown_0203A034->unk4->unk0[i].unk11) * (arg1 + 1); +// var0 &= 0xFFFF; +// if (var0 > 0x7FFF) +// var0 += 0x10000; + +// gTasks[taskId].data[0] = i; +// gTasks[taskId].data[1] = var0 >> 16; +// gUnknown_0203A034->unk0->unk14++; +// sp8++; +// } +// } +// } +// else +// { +// u32 var0; +// for (i = 0; i < 4; i++) +// { +// int tile; +// s8 var1 = gUnknown_0203A034->unk4->unk0[i].unk12; +// tile = gUnknown_0203A034->unk4->unk0[i].unk10 ? 0x60A5 : 0x60A3; +// if (arg1 < var1) +// { +// int thing = ((s8)arg1 - 19); +// int x = var1 - thing; +// x--; +// FillBgTilemapBufferRect_Palette0(1, tile, x, i * 3 + 6, 1, 1); +// taskId = CreateTask(sub_80F7CA8, 10); +// var0 = ((gUnknown_0203A034->unk4->unk0[i].unkC << 16) / gUnknown_0203A034->unk4->unk0[i].unk12) * (arg1 + 1); +// var0 &= 0xFFFF; +// if (var0 > 0x7FFF) +// var0 += 0x10000; + +// gTasks[taskId].data[0] = i; +// if (gUnknown_0203A034->unk4->unk0[i].unk10) +// { +// gTasks[taskId].data[2] = 1; +// spC++; +// } +// else +// { +// sp8++; +// } + +// if (gUnknown_0203A034->unk4->unk0[i].unk10) +// gTasks[taskId].data[1] = gUnknown_0203A034->unk4->unk0[i].unk8 - (var0 >> 16); +// else +// gTasks[taskId].data[1] = gUnknown_0203A034->unk4->unk0[i].unk8 + (var0 >> 16); + +// gUnknown_0203A034->unk0->unk14++; +// } +// } +// } + +// if (spC) +// PlaySE(SE_PIN); + +// if (sp8) +// PlaySE(SE_BAN); +// } + +NAKED +static void sub_80F7A80(u8 arg0, u8 arg1) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x14\n\ + lsls r0, 24\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r8, r1\n\ + movs r1, 0\n\ + str r1, [sp, 0x8]\n\ + movs r3, 0\n\ + str r3, [sp, 0xC]\n\ + cmp r0, 0\n\ + bne _080F7B5C\n\ + mov r9, r3\n\ + ldr r4, =gUnknown_0203A034\n\ + mov r10, r4\n\ + movs r7, 0xA0\n\ + lsls r7, 19\n\ + movs r6, 0\n\ +_080F7AAC:\n\ + mov r1, r10\n\ + ldr r0, [r1]\n\ + ldr r0, [r0, 0x4]\n\ + adds r0, r6, r0\n\ + ldrb r2, [r0, 0x11]\n\ + cmp r8, r2\n\ + bcs _080F7B2E\n\ + adds r2, 0x13\n\ + mov r3, r8\n\ + subs r2, r3\n\ + subs r2, 0x1\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + lsrs r3, r7, 24\n\ + movs r0, 0x1\n\ + str r0, [sp]\n\ + str r0, [sp, 0x4]\n\ + ldr r1, =0x000060b3\n\ + bl FillBgTilemapBufferRect_Palette0\n\ + ldr r0, =sub_80F7CA8\n\ + movs r1, 0xA\n\ + bl CreateTask\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + mov r0, r10\n\ + ldr r4, [r0]\n\ + ldr r1, [r4, 0x4]\n\ + adds r1, r6, r1\n\ + ldr r0, [r1, 0x8]\n\ + lsls r0, 16\n\ + ldrb r1, [r1, 0x11]\n\ + bl __udivsi3\n\ + mov r1, r8\n\ + adds r1, 0x1\n\ + adds r3, r0, 0\n\ + muls r3, r1\n\ + ldr r0, =0x0000ffff\n\ + ands r0, r3\n\ + ldr r1, =0x00007fff\n\ + cmp r0, r1\n\ + bls _080F7B0A\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + adds r3, r1\n\ +_080F7B0A:\n\ + ldr r1, =gTasks\n\ + lsls r0, r5, 2\n\ + adds r0, r5\n\ + lsls r0, 3\n\ + adds r0, r1\n\ + mov r1, r9\n\ + strh r1, [r0, 0x8]\n\ + lsrs r1, r3, 16\n\ + strh r1, [r0, 0xA]\n\ + ldr r1, [r4]\n\ + ldrb r0, [r1, 0x14]\n\ + adds r0, 0x1\n\ + strb r0, [r1, 0x14]\n\ + ldr r0, [sp, 0x8]\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x8]\n\ +_080F7B2E:\n\ + movs r3, 0xC0\n\ + lsls r3, 18\n\ + adds r7, r3\n\ + adds r6, 0x14\n\ + movs r4, 0x1\n\ + add r9, r4\n\ + mov r0, r9\n\ + cmp r0, 0x3\n\ + ble _080F7AAC\n\ + b _080F7C7E\n\ + .pool\n\ +_080F7B5C:\n\ + movs r1, 0\n\ + mov r9, r1\n\ + mov r10, r1\n\ + movs r3, 0xC0\n\ + lsls r3, 19\n\ + str r3, [sp, 0x10]\n\ +_080F7B68:\n\ + ldr r4, =gUnknown_0203A034\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x4]\n\ + add r0, r10\n\ + ldrb r2, [r0, 0x12]\n\ + ldrb r0, [r0, 0x10]\n\ + ldr r1, =0x000060a3\n\ + cmp r0, 0\n\ + beq _080F7B7C\n\ + adds r1, 0x2\n\ +_080F7B7C:\n\ + lsls r0, r2, 24\n\ + asrs r0, 24\n\ + cmp r8, r0\n\ + bge _080F7C64\n\ + mov r3, r8\n\ + lsls r2, r3, 24\n\ + asrs r2, 24\n\ + subs r2, 0x13\n\ + subs r2, r0, r2\n\ + subs r2, 0x1\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + ldr r4, [sp, 0x10]\n\ + lsrs r3, r4, 24\n\ + movs r7, 0x1\n\ + str r7, [sp]\n\ + str r7, [sp, 0x4]\n\ + movs r0, 0x1\n\ + bl FillBgTilemapBufferRect_Palette0\n\ + ldr r0, =sub_80F7CA8\n\ + movs r1, 0xA\n\ + bl CreateTask\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + ldr r0, =gUnknown_0203A034\n\ + ldr r6, [r0]\n\ + ldr r1, [r6, 0x4]\n\ + add r1, r10\n\ + ldr r0, [r1, 0xC]\n\ + lsls r0, 16\n\ + ldrb r1, [r1, 0x12]\n\ + bl __udivsi3\n\ + mov r1, r8\n\ + adds r1, 0x1\n\ + adds r3, r0, 0\n\ + muls r3, r1\n\ + ldr r0, =0x0000ffff\n\ + ands r0, r3\n\ + ldr r1, =0x00007fff\n\ + cmp r0, r1\n\ + bls _080F7BDA\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + adds r3, r1\n\ +_080F7BDA:\n\ + ldr r1, =gTasks\n\ + lsls r2, r5, 2\n\ + adds r0, r2, r5\n\ + lsls r0, 3\n\ + adds r4, r0, r1\n\ + mov r0, r9\n\ + strh r0, [r4, 0x8]\n\ + ldr r0, [r6, 0x4]\n\ + add r0, r10\n\ + ldrb r0, [r0, 0x10]\n\ + adds r6, r1, 0\n\ + cmp r0, 0\n\ + beq _080F7C1C\n\ + strh r7, [r4, 0xC]\n\ + ldr r0, [sp, 0xC]\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0xC]\n\ + b _080F7C26\n\ + .pool\n\ +_080F7C1C:\n\ + ldr r0, [sp, 0x8]\n\ + adds r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0x8]\n\ +_080F7C26:\n\ + ldr r1, =gUnknown_0203A034\n\ + ldr r0, [r1]\n\ + ldr r0, [r0, 0x4]\n\ + mov r4, r10\n\ + adds r1, r4, r0\n\ + ldrb r0, [r1, 0x10]\n\ + ldr r4, =gUnknown_0203A034\n\ + cmp r0, 0\n\ + beq _080F7C4C\n\ + adds r0, r2, r5\n\ + lsls r0, 3\n\ + adds r0, r6\n\ + lsrs r2, r3, 16\n\ + ldr r1, [r1, 0x8]\n\ + subs r1, r2\n\ + b _080F7C58\n\ + .pool\n\ +_080F7C4C:\n\ + adds r0, r2, r5\n\ + lsls r0, 3\n\ + adds r0, r6\n\ + lsrs r2, r3, 16\n\ + ldr r1, [r1, 0x8]\n\ + adds r1, r2\n\ +_080F7C58:\n\ + strh r1, [r0, 0xA]\n\ + ldr r0, [r4]\n\ + ldr r1, [r0]\n\ + ldrb r0, [r1, 0x14]\n\ + adds r0, 0x1\n\ + strb r0, [r1, 0x14]\n\ +_080F7C64:\n\ + movs r0, 0x14\n\ + add r10, r0\n\ + ldr r1, [sp, 0x10]\n\ + movs r3, 0xC0\n\ + lsls r3, 18\n\ + adds r1, r3\n\ + str r1, [sp, 0x10]\n\ + movs r4, 0x1\n\ + add r9, r4\n\ + mov r0, r9\n\ + cmp r0, 0x3\n\ + bgt _080F7C7E\n\ + b _080F7B68\n\ +_080F7C7E:\n\ + ldr r1, [sp, 0xC]\n\ + cmp r1, 0\n\ + beq _080F7C8A\n\ + movs r0, 0x16\n\ + bl PlaySE\n\ +_080F7C8A:\n\ + ldr r3, [sp, 0x8]\n\ + cmp r3, 0\n\ + beq _080F7C96\n\ + movs r0, 0x15\n\ + bl PlaySE\n\ +_080F7C96:\n\ + add sp, 0x14\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0"); +} + +#ifdef NONMATCHING +void sub_80F7CA8(u8 taskId) +{ + register int r4 asm("r4"); + int r9; + u8 r6; + s16 r7; + s16 r12; + int i; + u8 var0; + u16 tileNum; + + r4 = 0; + r9 = 0; + r6 = gTasks[taskId].data[0]; + r7 = gTasks[taskId].data[1]; + r12 = gTasks[taskId].data[2]; + if (r12) + { + if (gUnknown_0203A034->unk0->unkC[r6] <= 0) + r4 = 1; + } + else + { + if (gUnknown_0203A034->unk0->unkC[r6] > 87) + r4 = 1; + } + + if (gUnknown_0203A034->unk0->unkC[r6] == r7) + r9 = 1; + + if (!r9) + { + if (r4) + gUnknown_0203A034->unk0->unkC[r6] = r7; + else if (r12) + gUnknown_0203A034->unk0->unkC[r6] = gUnknown_0203A034->unk0->unkC[r6] - 1; + else + gUnknown_0203A034->unk0->unkC[r6] = gUnknown_0203A034->unk0->unkC[r6] + 1; + } + + if (!r4 && !r9) + { + for (i = 0; i < 11; i++) + { + if (gUnknown_0203A034->unk0->unkC[r6] >= (i + 1) * 8) + { + var0 = 8; + } + else if (gUnknown_0203A034->unk0->unkC[r6] >= i * 8) + { + int var2 = gUnknown_0203A034->unk0->unkC[r6]; + int var1 = var2; + if (var1 < 0) + var1 += 7; + + var0 = var2 - ((var1 >> 3) << 3); + } + else + { + var0 = 0; + } + + if (var0 < 4) + tileNum = 0x504C; + else + tileNum = 0x5057; + + FillBgTilemapBufferRect_Palette0(2, tileNum + var0, i + 7, r6 * 3 + 6, 1, 1); + } + } + + if (r9) + { + gUnknown_0203A034->unk0->unk14--; + DestroyTask(taskId); + } +} +#else +NAKED +void sub_80F7CA8(u8 taskId) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r9\n\ + mov r6, r8\n\ + push {r6,r7}\n\ + sub sp, 0x8\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + movs r4, 0\n\ + mov r9, r4\n\ + ldr r1, =gTasks\n\ + lsls r0, 2\n\ + add r0, r8\n\ + lsls r0, 3\n\ + adds r0, r1\n\ + ldrb r6, [r0, 0x8]\n\ + ldrh r7, [r0, 0xA]\n\ + ldrh r1, [r0, 0xC]\n\ + mov r12, r1\n\ + movs r2, 0xC\n\ + ldrsh r0, [r0, r2]\n\ + cmp r0, 0\n\ + beq _080F7CF8\n\ + ldr r2, =gUnknown_0203A034\n\ + ldr r0, [r2]\n\ + ldr r0, [r0]\n\ + lsls r1, r6, 1\n\ + adds r0, 0xC\n\ + adds r0, r1\n\ + movs r3, 0\n\ + ldrsh r0, [r0, r3]\n\ + adds r5, r1, 0\n\ + cmp r0, 0\n\ + bgt _080F7D10\n\ + b _080F7D0E\n\ + .pool\n\ +_080F7CF8:\n\ + ldr r2, =gUnknown_0203A034\n\ + ldr r0, [r2]\n\ + ldr r0, [r0]\n\ + lsls r1, r6, 1\n\ + adds r0, 0xC\n\ + adds r0, r1\n\ + movs r3, 0\n\ + ldrsh r0, [r0, r3]\n\ + adds r5, r1, 0\n\ + cmp r0, 0x57\n\ + ble _080F7D10\n\ +_080F7D0E:\n\ + movs r4, 0x1\n\ +_080F7D10:\n\ + ldr r0, [r2]\n\ + ldr r0, [r0]\n\ + adds r0, 0xC\n\ + adds r2, r0, r5\n\ + ldrh r3, [r2]\n\ + movs r0, 0\n\ + ldrsh r1, [r2, r0]\n\ + lsls r0, r7, 16\n\ + asrs r0, 16\n\ + cmp r1, r0\n\ + bne _080F7D2A\n\ + movs r1, 0x1\n\ + mov r9, r1\n\ +_080F7D2A:\n\ + mov r0, r9\n\ + cmp r0, 0\n\ + bne _080F7D4A\n\ + cmp r4, 0\n\ + beq _080F7D3C\n\ + strh r7, [r2]\n\ + b _080F7D4A\n\ + .pool\n\ +_080F7D3C:\n\ + mov r1, r12\n\ + cmp r1, 0\n\ + beq _080F7D46\n\ + subs r0, r3, 0x1\n\ + b _080F7D48\n\ +_080F7D46:\n\ + adds r0, r3, 0x1\n\ +_080F7D48:\n\ + strh r0, [r2]\n\ +_080F7D4A:\n\ + cmp r4, 0\n\ + bne _080F7DC4\n\ + mov r2, r9\n\ + cmp r2, 0\n\ + bne _080F7DCA\n\ + movs r2, 0\n\ +_080F7D56:\n\ + ldr r0, =gUnknown_0203A034\n\ + ldr r0, [r0]\n\ + ldr r0, [r0]\n\ + adds r0, 0xC\n\ + adds r0, r5\n\ + movs r1, 0\n\ + ldrsh r3, [r0, r1]\n\ + adds r0, r2, 0x1\n\ + lsls r1, r0, 3\n\ + adds r4, r0, 0\n\ + cmp r3, r1\n\ + blt _080F7D78\n\ + movs r0, 0x8\n\ + b _080F7D94\n\ + .pool\n\ +_080F7D78:\n\ + lsls r0, r2, 3\n\ + cmp r3, r0\n\ + blt _080F7D92\n\ + adds r0, r3, 0\n\ + cmp r3, 0\n\ + bge _080F7D86\n\ + adds r0, r3, 0x7\n\ +_080F7D86:\n\ + asrs r0, 3\n\ + lsls r0, 3\n\ + subs r0, r3, r0\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + b _080F7D94\n\ +_080F7D92:\n\ + movs r0, 0\n\ +_080F7D94:\n\ + cmp r0, 0x3\n\ + bhi _080F7DA0\n\ + ldr r3, =0x0000504c\n\ + b _080F7DA2\n\ + .pool\n\ +_080F7DA0:\n\ + ldr r3, =0x00005057\n\ +_080F7DA2:\n\ + adds r1, r0, r3\n\ + adds r2, 0x7\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + adds r3, r5, r6\n\ + adds r3, 0x6\n\ + lsls r3, 24\n\ + movs r0, 0x1\n\ + str r0, [sp]\n\ + str r0, [sp, 0x4]\n\ + movs r0, 0x2\n\ + lsrs r3, 24\n\ + bl FillBgTilemapBufferRect_Palette0\n\ + adds r2, r4, 0\n\ + cmp r2, 0xA\n\ + ble _080F7D56\n\ +_080F7DC4:\n\ + mov r0, r9\n\ + cmp r0, 0\n\ + beq _080F7DDC\n\ +_080F7DCA:\n\ + ldr r0, =gUnknown_0203A034\n\ + ldr r0, [r0]\n\ + ldr r1, [r0]\n\ + ldrb r0, [r1, 0x14]\n\ + subs r0, 0x1\n\ + strb r0, [r1, 0x14]\n\ + mov r0, r8\n\ + bl DestroyTask\n\ +_080F7DDC:\n\ + add sp, 0x8\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NONMATCHING + +static void sub_80F7DF4(void) +{ + gUnknown_0203A034 = AllocZeroed(sizeof(*gUnknown_0203A034)); + gUnknown_0203A034->unk0 = AllocZeroed(sizeof(*gUnknown_0203A034->unk0)); + gUnknown_0203A034->unk4 = AllocZeroed(sizeof(*gUnknown_0203A034->unk4)); + gUnknown_0203A034->unk8 = AllocZeroed(BG_SCREEN_SIZE); + gUnknown_0203A034->unkC[0] = AllocZeroed(BG_SCREEN_SIZE); + gUnknown_0203A034->unkC[1] = AllocZeroed(BG_SCREEN_SIZE); + gUnknown_0203A034->unkC[2] = AllocZeroed(BG_SCREEN_SIZE); + gUnknown_0203A034->unkC[3] = AllocZeroed(BG_SCREEN_SIZE); + gUnknown_0203A034->unk1C = AllocZeroed(0x1000); + AllocateMonSpritesGfx(); +} + +static void sub_80F7E64(void) +{ + FREE_AND_SET_NULL(gUnknown_0203A034->unk0); + FREE_AND_SET_NULL(gUnknown_0203A034->unk4); + FREE_AND_SET_NULL(gUnknown_0203A034->unk8); + FREE_AND_SET_NULL(gUnknown_0203A034->unkC[0]); + FREE_AND_SET_NULL(gUnknown_0203A034->unkC[1]); + FREE_AND_SET_NULL(gUnknown_0203A034->unkC[2]); + FREE_AND_SET_NULL(gUnknown_0203A034->unkC[3]); + FREE_AND_SET_NULL(gUnknown_0203A034->unk1C); + FREE_AND_SET_NULL(gUnknown_0203A034); + FreeMonSpritesGfx(); +} + +static void sub_80F7ED0(int windowId, u8 *str, int arg2) +{ + struct TextPrinterTemplate textPrinter; + textPrinter.currentChar = str; + textPrinter.windowId = windowId; + textPrinter.fontId = 7; + textPrinter.x = arg2; + textPrinter.y = 2; + textPrinter.currentX = arg2; + textPrinter.currentY = 2; + textPrinter.letterSpacing = 0; + textPrinter.lineSpacing = 0; + textPrinter.unk = 0; + textPrinter.fgColor = 1; + textPrinter.bgColor = 0; + textPrinter.shadowColor = 8; + AddTextPrinter(&textPrinter, 0, NULL); + PutWindowTilemap(windowId); +} + +void sub_80F7F30(void) +{ + u8 result = sub_80DAE0C(&gPlayerParty[gContestMonPartyIndex]); + if (result) + { + sub_80DAB8C(gSpecialVar_ContestCategory, gSpecialVar_ContestRank); + sub_80DB09C(gSpecialVar_ContestCategory); + } + + gSpecialVar_Result = result; +} + +u16 sub_80F7F7C(void) +{ + u16 result = 0; + struct Pokemon *mon = &gPlayerParty[gContestMonPartyIndex]; + switch (gSpecialVar_ContestCategory) + { + case CONTEST_CATEGORY_COOL: + if (GetMonData(mon, MON_DATA_COOL_RIBBON) > gSpecialVar_ContestRank) + result = 1; + break; + case CONTEST_CATEGORY_BEAUTY: + if (GetMonData(mon, MON_DATA_BEAUTY_RIBBON) > gSpecialVar_ContestRank) + result = 1; + break; + case CONTEST_CATEGORY_CUTE: + if (GetMonData(mon, MON_DATA_CUTE_RIBBON) > gSpecialVar_ContestRank) + result = 1; + break; + case CONTEST_CATEGORY_SMART: + if (GetMonData(mon, MON_DATA_SMART_RIBBON) > gSpecialVar_ContestRank) + result = 1; + break; + case CONTEST_CATEGORY_TOUGH: + if (GetMonData(mon, MON_DATA_TOUGH_RIBBON) > gSpecialVar_ContestRank) + result = 1; + break; + } + + return result; +} + +void sub_80F7FFC(void) +{ + u8 ribbonData; + + if (gContestFinalStandings[gContestPlayerMonIndex] != 0) + return; + + switch (gSpecialVar_ContestCategory) + { + case CONTEST_CATEGORY_COOL: + ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON); + if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + { + ribbonData++; + SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON, &ribbonData); + if (GetRibbonCount(&gPlayerParty[gContestMonPartyIndex]) > 4) + sub_80EE4DC(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON); + } + break; + case CONTEST_CATEGORY_BEAUTY: + ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON); + if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + { + ribbonData++; + SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON, &ribbonData); + if (GetRibbonCount(&gPlayerParty[gContestMonPartyIndex]) > 4) + sub_80EE4DC(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON); + } + break; + case CONTEST_CATEGORY_CUTE: + ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON); + if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + { + ribbonData++; + SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON, &ribbonData); + if (GetRibbonCount(&gPlayerParty[gContestMonPartyIndex]) > 4) + sub_80EE4DC(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON); + } + break; + case CONTEST_CATEGORY_SMART: + ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON); + if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + { + ribbonData++; + SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON, &ribbonData); + if (GetRibbonCount(&gPlayerParty[gContestMonPartyIndex]) > 4) + sub_80EE4DC(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON); + } + break; + case CONTEST_CATEGORY_TOUGH: + ribbonData = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON); + if (ribbonData <= gSpecialVar_ContestRank && ribbonData < 4) + { + ribbonData++; + SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON, &ribbonData); + if (GetRibbonCount(&gPlayerParty[gContestMonPartyIndex]) > 4) + sub_80EE4DC(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON); + } + break; + } +} + +void sub_80F8264(void) +{ + StringCopy(gStringVar1, gContestMons[gSpecialVar_0x8006].trainerName); + sub_81DB5AC(gStringVar1); +} + +void sub_80F8290(void) +{ + StringCopy(gStringVar3, gContestMons[gSpecialVar_0x8006].nickname); +} + +void sub_80F82B4(void) +{ + u8 i; + u8 count; + + for (i = 0, count = 0; i < 4; i++) + { + if (gContestMonConditions[gSpecialVar_0x8006] < gContestMonConditions[i]) + count++; + } + + gSpecialVar_0x8004 = count; +} + +void sub_80F82FC(void) +{ + gSpecialVar_0x8004 = gContestMonConditions[gSpecialVar_0x8006]; +} + +void sub_80F831C(void) +{ + u8 i; + + for (i = 0; i < 4 && gContestFinalStandings[i] != 0; i++) + ; + + gSpecialVar_0x8005 = i; +} + +void sub_80F834C(void) +{ + u8 i; + + for (i = 0; i < 4 && gContestFinalStandings[i] != 0; i++) + ; + + StringCopy(gStringVar3, gContestMons[i].trainerName); + sub_81DB5AC(gStringVar3); +} + +void sub_80F8390(void) +{ + u8 i; + + for (i = 0; i < 4 && gContestFinalStandings[i] != 0; i++) + ; + + StringCopy(gStringVar1, gContestMons[i].nickname); +} + +void sub_80F83D0(void) +{ + SetMainCallback2(sub_80D7B24); +} + +static void sub_80F83E0(u8 taskId) +{ + if (!gPaletteFade.active) + { + DestroyTask(taskId); + SetMainCallback2(sub_80F83D0); + } +} + +void sub_80F840C(void) +{ + ScriptContext2_Enable(); + CreateTask(sub_80F83E0, 10); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); +} + +void sub_80F8438(void) +{ + gSpecialVar_0x8004 = gContestMons[gSpecialVar_0x8006].species; +} + +static void sub_80F8458(u8 taskId) +{ + if (!gPaletteFade.active) + { + DestroyTask(taskId); + SetMainCallback2(sub_80F5B00); + } +} + +void sub_80F8484(void) +{ + ScriptContext2_Enable(); + CreateTask(sub_80F8458, 10); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); +} + +void sub_80F84B0(void) +{ + gSpecialVar_0x8004 = gContestPlayerMonIndex; +} + +void sub_80F84C4(u8 taskId) +{ + u8 newTaskId; + ScriptContext2_Enable(); + newTaskId = CreateTask(sub_80FC580, 0); + SetTaskFuncWithFollowupFunc(newTaskId, sub_80FC580, sub_80F8508); + gTasks[newTaskId].data[9] = taskId; +} + +static void sub_80F8508(u8 taskId) +{ + if (gIsLinkContest & 0x4) + { + sub_80DA8C8(gContestMonPartyIndex); + SetTaskFuncWithFollowupFunc(taskId, sub_80FC6BC, sub_80F8568); + } + else + { + sub_80DA8C8(gContestMonPartyIndex); + gTasks[taskId].func = sub_81D9DE4; + } +} + +static void sub_80F8568(u8 taskId) +{ + SetTaskFuncWithFollowupFunc(taskId, sub_80FC804, sub_80F8584); +} + +static void sub_80F8584(u8 taskId) +{ + SetTaskFuncWithFollowupFunc(taskId, sub_80FCE48, sub_80F85A0); +} + +static void sub_80F85A0(u8 taskId) +{ + SetTaskFuncWithFollowupFunc(taskId, sub_80FC894, sub_80F85BC); +} + +#ifdef NONMATCHING +static void sub_80F85BC(u8 taskId) +{ + u32 i; + u8 sp0[4]; + u8 sp4[4]; + + memset(sp0, 0, sizeof(sp0)); + memset(sp4, 0, sizeof(sp4)); + + for (i = 0; i < gNumLinkContestPlayers; i++) + sp0[i] = gTasks[taskId].data[i + 1]; + + for (i = 0; i < gNumLinkContestPlayers; i++) + { + if (sp0[0] != sp0[i + 1]) + break; + } + + if (i == gNumLinkContestPlayers) + gSpecialVar_0x8004 = 0; + else + gSpecialVar_0x8004 = 1; + + for (i = 0; i < gNumLinkContestPlayers; i++) + sp4[i] = gTasks[taskId].data[i + 5]; + + gUnknown_02039F2B = sub_80F86E0(sp4); + sub_80DB09C(gSpecialVar_ContestCategory); + SetTaskFuncWithFollowupFunc(taskId, sub_80FCF40, sub_80F86B8); +} +#else +NAKED +static void sub_80F85BC(u8 taskId) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r9\n\ + mov r6, r8\n\ + push {r6,r7}\n\ + sub sp, 0x8\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + movs r0, 0\n\ + str r0, [sp]\n\ + str r0, [sp, 0x4]\n\ + movs r3, 0\n\ + ldr r5, =gNumLinkContestPlayers\n\ + mov r12, r5\n\ + ldr r0, =gSpecialVar_0x8004\n\ + mov r9, r0\n\ + add r1, sp, 0x4\n\ + mov r8, r1\n\ + ldrb r0, [r5]\n\ + cmp r3, r0\n\ + bcs _080F8606\n\ + lsls r0, r6, 2\n\ + adds r0, r6\n\ + lsls r4, r0, 3\n\ + ldr r7, =gTasks + 0x8\n\ +_080F85EC:\n\ + mov r1, sp\n\ + adds r2, r1, r3\n\ + adds r1, r3, 0x1\n\ + lsls r0, r1, 1\n\ + adds r0, r4\n\ + adds r0, r7\n\ + ldrh r0, [r0]\n\ + strb r0, [r2]\n\ + lsls r1, 24\n\ + lsrs r3, r1, 24\n\ + ldrb r0, [r5]\n\ + cmp r3, r0\n\ + bcc _080F85EC\n\ +_080F8606:\n\ + movs r3, 0\n\ + mov r1, r12\n\ + ldrb r0, [r1]\n\ + cmp r3, r0\n\ + bcs _080F862A\n\ + adds r4, r0, 0\n\ + mov r2, sp\n\ +_080F8614:\n\ + adds r0, r3, 0x1\n\ + lsls r0, 24\n\ + lsrs r3, r0, 24\n\ + cmp r3, r4\n\ + bcs _080F862A\n\ + mov r0, sp\n\ + adds r1, r0, r3\n\ + ldrb r0, [r2]\n\ + ldrb r1, [r1]\n\ + cmp r0, r1\n\ + beq _080F8614\n\ +_080F862A:\n\ + mov r1, r12\n\ + ldrb r1, [r1]\n\ + cmp r3, r1\n\ + bne _080F8644\n\ + movs r0, 0\n\ + b _080F8646\n\ + .pool\n\ +_080F8644:\n\ + movs r0, 0x1\n\ +_080F8646:\n\ + mov r1, r9\n\ + strh r0, [r1]\n\ + movs r3, 0\n\ + mov r4, r12\n\ + ldrb r0, [r4]\n\ + cmp r3, r0\n\ + bcs _080F8678\n\ + mov r5, r8\n\ + lsls r0, r6, 2\n\ + adds r0, r6\n\ + lsls r2, r0, 3\n\ + ldr r7, =gTasks + 0x8\n\ +_080F865E:\n\ + adds r1, r5, r3\n\ + adds r0, r3, 0x5\n\ + lsls r0, 1\n\ + adds r0, r2\n\ + adds r0, r7\n\ + ldrh r0, [r0]\n\ + strb r0, [r1]\n\ + adds r0, r3, 0x1\n\ + lsls r0, 24\n\ + lsrs r3, r0, 24\n\ + ldrb r1, [r4]\n\ + cmp r3, r1\n\ + bcc _080F865E\n\ +_080F8678:\n\ + mov r0, r8\n\ + bl sub_80F86E0\n\ + ldr r1, =gUnknown_02039F2B\n\ + strb r0, [r1]\n\ + ldr r0, =gSpecialVar_ContestCategory\n\ + ldrb r0, [r0]\n\ + bl sub_80DB09C\n\ + ldr r1, =sub_80FCF40\n\ + ldr r2, =sub_80F86B8\n\ + adds r0, r6, 0\n\ + bl SetTaskFuncWithFollowupFunc\n\ + add sp, 0x8\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NONMATCHING + +static void sub_80F86B8(u8 taskId) +{ + sub_80DCE58(0); + SetTaskFuncWithFollowupFunc(taskId, sub_80FCFD0, sub_80F8714); +} + +u8 sub_80F86E0(u8 *arg0) +{ + int i; + u8 result = 0; + + for (i = 1; i < gNumLinkContestPlayers; i++) + { + if (arg0[result] < arg0[i]) + result = i; + } + + return result; +} + +void sub_80F8714(u8 taskId) +{ + int i; + + if (gSpecialVar_0x8004 == 1) + { + if (IsLinkTaskFinished()) + gTasks[taskId].func = sub_80F878C; + } + else + { + for (i = 0; i < 4; i++) + StringGetEnd10(gContestMons[i].nickname); + + DestroyTask(taskId); + SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); + ScriptContext2_Disable(); + EnableBothScriptContexts(); + } +} + +static void sub_80F878C(u8 taskId) +{ + sub_800AC34(); + gTasks[taskId].func = sub_80F87B4; +} + +static void sub_80F87B4(u8 taskId) +{ + if (!gReceivedRemoteLinkPlayers) + { + DestroyTask(taskId); + ScriptContext2_Disable(); + EnableBothScriptContexts(); + } +} diff --git a/src/easy_chat.c b/src/easy_chat.c index 2dce4de0d..5eb3f5ccd 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -2,20 +2,24 @@ // Includes #include "global.h" #include "alloc.h" -#include "constants/songs.h" -#include "sound.h" -#include "overworld.h" -#include "task.h" -#include "main.h" -#include "link.h" -#include "field_weather.h" -#include "window.h" -#include "palette.h" -#include "event_data.h" +#include "dewford_trend.h" +#include "dynamic_placeholder_text_util.h" #include "easy_chat.h" +#include "event_data.h" +#include "field_weather.h" +#include "international_string_util.h" +#include "link.h" +#include "main.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "sound.h" #include "string_util.h" - -// Static type declarations +#include "strings.h" +#include "task.h" +#include "window.h" +#include "constants/flags.h" +#include "constants/songs.h" #define EZCHAT_TASK_STATE 0 #define EZCHAT_TASK_KIND 1 @@ -24,38 +28,52 @@ #define EZCHAT_TASK_UNK06 6 #define EZCHAT_TASK_SIZE 7 -// Static RAM declarations - -EWRAM_DATA struct +struct EasyChatScreenTemplate { - u8 kind; - u8 unk_01; - u8 unk_02; - u8 unk_03; - u8 unk_04; - s8 unk_05; - s8 unk_06; - u8 unk_07; - u8 unk_08; - u8 unk_09; - u8 unk_0a; - u8 unk_0b; - u8 unk_0c; - u8 unk_0d; - u8 unk_0e[0x4]; - u8 sizeParam; - u8 unk_13; - u8 unk_14[0x20]; - const u8 *src; - const u16 *words; - u16 ecWordBuffer[9]; -} *gUnknown_0203A118 = NULL; + u8 unk_00; + u8 numColumns; + u8 numRows; + u8 unk_03_0:7; + u8 unk_03_7:1; + const u8 *titleText; + const u8 *instructionsText1; + const u8 *instructionsText2; + const u8 *confirmText1; + const u8 *confirmText2; +}; +struct EasyChatScreen +{ + /*0x00*/ u8 kind; + /*0x01*/ u8 templateId; + /*0x02*/ u8 numColumns; + /*0x03*/ u8 numRows; + /*0x04*/ u8 state; + /*0x05*/ s8 mainCursorColumn; + /*0x06*/ s8 mainCursorRow; + /*0x07*/ u8 unk_07; + /*0x08*/ u8 unk_08; + /*0x09*/ u8 unk_09; + /*0x0A*/ s8 unk_0a; + /*0x0B*/ s8 unk_0b; + /*0x0C*/ u8 unk_0c; + /*0x0D*/ u8 unk_0d; + /*0x0E*/ u8 unk_0e; + /*0x0F*/ u8 unk_0f; + /*0x10*/ s8 unk_10; + /*0x11*/ s8 unk_11; + /*0x12*/ u8 sizeParam; + /*0x13*/ u8 unk_13; + /*0x14*/ u8 unk_14[0x20]; + /*0x34*/ const u8 *titleText; + /*0x38*/ u16 *words; + /*0x3C*/ u16 ecWordBuffer[9]; +}; + +EWRAM_DATA struct EasyChatScreen *gEasyChatScreen = NULL; EWRAM_DATA void *gUnknown_0203A11C = 0; EWRAM_DATA void *gUnknown_0203A120 = 0; -// Static ROM declarations - static void sub_811A2C0(u8); static void sub_811A278(void); static bool8 sub_811A428(u8); @@ -68,23 +86,23 @@ static bool8 EasyChat_AllocateResources(u8, u16 *, u8); static void EasyChat_FreeResources(void); static u16 sub_811AAAC(void); static u16 sub_811AB68(void); -u16 sub_811ACDC(void); -u16 sub_811AE44(void); -u16 sub_811AF00(void); -u16 sub_811AF8C(void); -u16 sub_811AFEC(void); -u16 sub_811B040(void); -u16 sub_811B08C(void); -u16 sub_811B0BC(void); -u16 sub_811B0E8(void); -u16 sub_811B0F8(void); -u16 sub_811B150(void); +static u16 sub_811ACDC(void); +static u16 sub_811AE44(void); +static u16 sub_811AF00(void); +static u16 sub_811AF8C(void); +static u16 sub_811AFEC(void); +static u16 sub_811B040(void); +static u16 sub_811B08C(void); +static u16 sub_811B0BC(void); +static u16 sub_811B0E8(void); +static u16 sub_811B0F8(void); +static u16 sub_811B150(void); u16 sub_811B1B4(void); u8 sub_811BA68(void); -u8 sub_811BCC8(u8); -void sub_811BDF0(u8 *); +static u8 sub_811BCC8(u8); +static void sub_811BDF0(u8 *); void sub_811BF78(void); -bool8 sub_811BF8C(void); +static bool8 sub_811BF8C(void); bool8 sub_811BFA4(void); void sub_811C13C(void); /*static*/ void sub_811C158(u16); @@ -92,23 +110,60 @@ void sub_811C13C(void); bool8 sub_811F28C(void); void sub_811F2B8(void); u8 sub_811F3AC(void); - -// .rodata +int sub_811BA3C(void); +int sub_811B184(void); +int sub_811B264(void); +static int sub_811B32C(void); +static int sub_811B2B0(void); +static int sub_811B33C(void); +static int sub_811B368(void); +static u16 sub_811B528(int); +static u16 sub_811B794(u32); +static int sub_811B394(void); +static u8 sub_811B2A4(void); +static void sub_811B3E4(void); +static void sub_811BE9C(void); +static int sub_811B4EC(void); +static void sub_811B418(void); +static void sub_811B454(void); +static int sub_811BD64(void); +static int sub_811BDB0(void); +static int sub_811BD2C(void); +int sub_811BCF4(void); +static u16 sub_811B8E8(void); +int sub_811F3B8(u8); +void sub_811F548(int, u16); +static int sub_811B908(void); +u16 sub_811F5B0(void); +static void sub_811B488(u16); +u16 sub_811B940(void); +u16 sub_811F578(u16); +int sub_811BF88(int); +static u16 sub_811B8C8(void); +static int sub_811B568(u32); +static int sub_811B634(u32); +static int sub_811B6C4(u32); +static void sub_811B978(void); +static void sub_811B744(void); +static u8 sub_811B9C8(void); +static void sub_811B768(void); +static u8 sub_811B960(u8); +static void sub_811B9A0(void); +static u8 sub_811BA1C(void); +static int sub_811BF20(void); +static u16 sub_811BF40(void); +u8 sub_811CE94(void); +u8 *CopyEasyChatWordPadded(u8 *, u16, u16); extern const struct { u16 word; MainCallback callback; } gUnknown_08597530[4]; -extern const struct { - u8 unk_00; - u8 unk_01; - u8 unk_02; - u8 unk_03; - u8 *data; - u8 filler_08[16]; -} gUnknown_08597550[]; -// .text +extern const struct EasyChatScreenTemplate gEasyChatScreenTemplates[21]; +extern const u8 gUnknown_08597748[][7]; +extern const u16 gUnknown_08597764[]; +extern const u16 gUnknown_0859776C[][2]; void sub_811A20C(u8 kind, u16 *words, MainCallback callback, u8 sizeParam) { @@ -359,7 +414,7 @@ void easy_chat_input_maybe(void) words = gSaveBlock2Ptr->apprentices[0].easyChatWords; break; case 20: - words = sub_801B058(); + words = GetSaveBlock1Field3564(); break; default: return; @@ -444,66 +499,66 @@ void sub_811A938(void) static bool8 EasyChat_AllocateResources(u8 kind, u16 *words, u8 sizeParam) { - u8 r6; + u8 templateId; int i; - gUnknown_0203A118 = malloc(sizeof(*gUnknown_0203A118)); - if (gUnknown_0203A118 == NULL) + gEasyChatScreen = malloc(sizeof(*gEasyChatScreen)); + if (gEasyChatScreen == NULL) { return FALSE; } - gUnknown_0203A118->kind = kind; - gUnknown_0203A118->words = words; - gUnknown_0203A118->unk_05 = 0; - gUnknown_0203A118->unk_06 = 0; - gUnknown_0203A118->unk_09 = 0; - gUnknown_0203A118->sizeParam = sizeParam; - gUnknown_0203A118->unk_13 = 0; - r6 = sub_811BCC8(kind); + gEasyChatScreen->kind = kind; + gEasyChatScreen->words = words; + gEasyChatScreen->mainCursorColumn = 0; + gEasyChatScreen->mainCursorRow = 0; + gEasyChatScreen->unk_09 = 0; + gEasyChatScreen->sizeParam = sizeParam; + gEasyChatScreen->unk_13 = 0; + templateId = sub_811BCC8(kind); if (kind == 0x10) { - sub_811BDF0(gUnknown_0203A118->unk_14); - gUnknown_0203A118->src = gUnknown_0203A118->unk_14; - gUnknown_0203A118->unk_04 = 7; + sub_811BDF0(gEasyChatScreen->unk_14); + gEasyChatScreen->titleText = gEasyChatScreen->unk_14; + gEasyChatScreen->state = 7; } else { - gUnknown_0203A118->unk_04 = 0; - gUnknown_0203A118->src = gUnknown_08597550[r6].data; + gEasyChatScreen->state = 0; + gEasyChatScreen->titleText = gEasyChatScreenTemplates[templateId].titleText; } - gUnknown_0203A118->unk_02 = gUnknown_08597550[r6].unk_01; - gUnknown_0203A118->unk_03 = gUnknown_08597550[r6].unk_02; - gUnknown_0203A118->unk_07 = gUnknown_0203A118->unk_02 * gUnknown_0203A118->unk_03; - gUnknown_0203A118->unk_01 = r6; - if (gUnknown_0203A118->unk_07 > 9) + gEasyChatScreen->numColumns = gEasyChatScreenTemplates[templateId].numColumns; + gEasyChatScreen->numRows = gEasyChatScreenTemplates[templateId].numRows; + gEasyChatScreen->unk_07 = gEasyChatScreen->numColumns * gEasyChatScreen->numRows; + gEasyChatScreen->templateId = templateId; + if (gEasyChatScreen->unk_07 > 9) { - gUnknown_0203A118->unk_07 = 9; + gEasyChatScreen->unk_07 = 9; } if (words != NULL) { - CpuCopy16(words, gUnknown_0203A118->ecWordBuffer, gUnknown_0203A118->unk_07 * sizeof(u16)); + CpuCopy16(words, gEasyChatScreen->ecWordBuffer, gEasyChatScreen->unk_07 * sizeof(u16)); } else { - for (i = 0; i < gUnknown_0203A118->unk_07; i ++) + for (i = 0; i < gEasyChatScreen->unk_07; i ++) { - gUnknown_0203A118->ecWordBuffer[i] = -1; + gEasyChatScreen->ecWordBuffer[i] = -1; } - gUnknown_0203A118->words = gUnknown_0203A118->ecWordBuffer; + gEasyChatScreen->words = gEasyChatScreen->ecWordBuffer; } - gUnknown_0203A118->unk_0d = (sub_811F3AC() - 1) / 2 + 1; + gEasyChatScreen->unk_0d = (sub_811F3AC() - 1) / 2 + 1; return TRUE; } static void EasyChat_FreeResources(void) { - if (gUnknown_0203A118 != NULL) - FREE_AND_SET_NULL(gUnknown_0203A118); + if (gEasyChatScreen != NULL) + FREE_AND_SET_NULL(gEasyChatScreen); } static u16 sub_811AAAC(void) { - switch (gUnknown_0203A118->unk_04) + switch (gEasyChatScreen->state) { case 0: return sub_811AB68(); @@ -549,263 +604,1612 @@ static u16 sub_811AB68(void) if (gMain.newKeys & A_BUTTON) { sub_811BF78(); - gUnknown_0203A118->unk_04 = 2; - gUnknown_0203A118->unk_0a = 0; - gUnknown_0203A118->unk_0b = 0; - gUnknown_0203A118->unk_0c = 0; + gEasyChatScreen->state = 2; + gEasyChatScreen->unk_0a = 0; + gEasyChatScreen->unk_0b = 0; + gEasyChatScreen->unk_0c = 0; return 9; } else if (gMain.newKeys & B_BUTTON) - { // FIXME: See note below + { return sub_811B150(); } else if (gMain.newKeys & START_BUTTON) - { // FIXME: See note below + { return sub_811B1B4(); } else if (gMain.newKeys & DPAD_UP) { - gUnknown_0203A118->unk_06--; + gEasyChatScreen->mainCursorRow--; } else if (gMain.newKeys & DPAD_LEFT) - { // FIXME: See note below - gUnknown_0203A118->unk_05--; + { + gEasyChatScreen->mainCursorColumn--; } else if (gMain.newKeys & DPAD_DOWN) - { // FIXME: See note below - gUnknown_0203A118->unk_06++; + { + gEasyChatScreen->mainCursorRow++; } else if (gMain.newKeys & DPAD_RIGHT) - { // FIXME: See note below - gUnknown_0203A118->unk_05++; + { + gEasyChatScreen->mainCursorColumn++; } else { return 0; } - if (gUnknown_0203A118->unk_06 < 0) + + if (gEasyChatScreen->mainCursorRow < 0) + gEasyChatScreen->mainCursorRow = gEasyChatScreenTemplates[gEasyChatScreen->templateId].numRows; + + if (gEasyChatScreen->mainCursorRow > gEasyChatScreenTemplates[gEasyChatScreen->templateId].numRows) + gEasyChatScreen->mainCursorRow = 0; + + if (gEasyChatScreen->mainCursorRow == gEasyChatScreenTemplates[gEasyChatScreen->templateId].numRows) { - gUnknown_0203A118->unk_06 = gUnknown_08597550[gUnknown_0203A118->unk_01].unk_02; - } - if (gUnknown_0203A118->unk_06 > gUnknown_08597550[gUnknown_0203A118->unk_01].unk_02) - { - gUnknown_0203A118->unk_06 = 0; - } - if (gUnknown_0203A118->unk_06 == gUnknown_08597550[gUnknown_0203A118->unk_01].unk_02) - { - if (gUnknown_0203A118->unk_05 > 2) - { - gUnknown_0203A118->unk_05 = 2; - } - gUnknown_0203A118->unk_04 = 1; + if (gEasyChatScreen->mainCursorColumn > 2) + gEasyChatScreen->mainCursorColumn = 2; + + gEasyChatScreen->state = 1; return 3; } - /* - * FIXME: right, down, left, b, and start - * should be inserted here, but aren't - */ - if (gUnknown_0203A118->unk_05 < 0) - { - gUnknown_0203A118->unk_05 = gUnknown_08597550[gUnknown_0203A118->unk_01].unk_01 - 1; - } - if (gUnknown_0203A118->unk_05 >= gUnknown_08597550[gUnknown_0203A118->unk_01].unk_01) - { - gUnknown_0203A118->unk_05 = 0; - } - if (sub_811AB44() && gUnknown_0203A118->unk_05 == 1 && gUnknown_0203A118->unk_06 == 4) - { - gUnknown_0203A118->unk_05 = 0; - } + + if (gEasyChatScreen->mainCursorColumn < 0) + gEasyChatScreen->mainCursorColumn = gEasyChatScreenTemplates[gEasyChatScreen->templateId].numColumns - 1; + + if (gEasyChatScreen->mainCursorColumn >= gEasyChatScreenTemplates[gEasyChatScreen->templateId].numColumns) + gEasyChatScreen->mainCursorColumn = 0; + + if (sub_811AB44() && gEasyChatScreen->mainCursorColumn == 1 && gEasyChatScreen->mainCursorRow == 4) + gEasyChatScreen->mainCursorColumn = 0; + return 2; } #else -__attribute__((naked)) static u16 sub_811AB68(void) +NAKED +static u16 sub_811AB68(void) { - asm_unified("\tpush {r4-r7,lr}\n" - "\tldr r0, =gMain\n" - "\tldrh r1, [r0, 0x2E]\n" - "\tmovs r0, 0x1\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbeq _0811ABB8\n" - "\tbl sub_811BF78\n" - "\tldr r1, =gUnknown_0203A118\n" - "\tldr r3, [r1]\n" - "\tmovs r2, 0\n" - "\tmovs r0, 0x2\n" - "\tstrb r0, [r3, 0x4]\n" - "\tldr r0, [r1]\n" - "\tstrb r2, [r0, 0xA]\n" - "\tldr r0, [r1]\n" - "\tstrb r2, [r0, 0xB]\n" - "\tldr r0, [r1]\n" - "\tstrb r2, [r0, 0xC]\n" - "\tmovs r0, 0x9\n" - "\tb _0811ACCC_return_r0\n" - "\t.pool\n" - "_0811AB9C:\n" - "\tmovs r0, 0x20\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbne _0811AC68_dpad_left\n" - "\tmovs r0, 0x80\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbne _0811AC58_dpad_down\n" - "\tmovs r0, 0x10\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbne _0811AC48_dpad_right\n" - "\tmovs r0, 0\n" - "\tb _0811ACCC_return_r0\n" - "_0811ABB8:\n" - "\tmovs r0, 0x2\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbne _0811AC78_b_button\n" - "\tmovs r0, 0x8\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbne _0811AC7E_start_button\n" - "\tmovs r0, 0x40\n" - "\tands r0, r1\n" - "\tcmp r0, 0\n" - "\tbeq _0811AB9C\n" - "\tldr r2, =gUnknown_0203A118\n" - "\tldr r1, [r2]\n" - "\tldrb r0, [r1, 0x6]\n" - "\tsubs r0, 0x1\n" - "_0811ABD8:\n" - "\tstrb r0, [r1, 0x6]\n" - "_0811ABDA:\n" - "\tadds r7, r2, 0\n" - "\tadds r4, r7, 0\n" - "\tldr r2, [r4]\n" - "\tmovs r0, 0x6\n" - "\tldrsb r0, [r2, r0]\n" - "\tldr r6, =gUnknown_08597550\n" - "\tcmp r0, 0\n" - "\tbge _0811ABF8\n" - "\tldrb r0, [r2, 0x1]\n" - "\tlsls r1, r0, 1\n" - "\tadds r1, r0\n" - "\tlsls r1, 3\n" - "\tadds r1, r6\n" - "\tldrb r0, [r1, 0x2]\n" - "\tstrb r0, [r2, 0x6]\n" - "_0811ABF8:\n" - "\tldr r3, [r4]\n" - "\tmovs r2, 0x6\n" - "\tldrsb r2, [r3, r2]\n" - "\tadds r5, r6, 0\n" - "\tldrb r1, [r3, 0x1]\n" - "\tlsls r0, r1, 1\n" - "\tadds r0, r1\n" - "\tlsls r0, 3\n" - "\tadds r0, r5\n" - "\tldrb r0, [r0, 0x2]\n" - "\tcmp r2, r0\n" - "\tble _0811AC14\n" - "\tmovs r0, 0\n" - "\tstrb r0, [r3, 0x6]\n" - "_0811AC14:\n" - "\tldr r3, [r4]\n" - "\tmovs r2, 0x6\n" - "\tldrsb r2, [r3, r2]\n" - "\tldrb r1, [r3, 0x1]\n" - "\tlsls r0, r1, 1\n" - "\tadds r0, r1\n" - "\tlsls r0, 3\n" - "\tadds r1, r0, r5\n" - "\tldrb r0, [r1, 0x2]\n" - "\tcmp r2, r0\n" - "\tbne _0811AC88\n" - "\tmovs r0, 0x5\n" - "\tldrsb r0, [r3, r0]\n" - "\tcmp r0, 0x2\n" - "\tble _0811AC36\n" - "\tmovs r0, 0x2\n" - "\tstrb r0, [r3, 0x5]\n" - "_0811AC36:\n" - "\tldr r1, [r4]\n" - "\tmovs r0, 0x1\n" - "\tstrb r0, [r1, 0x4]\n" - "\tmovs r0, 0x3\n" - "\tb _0811ACCC_return_r0\n" - "\t.pool\n" - "_0811AC48_dpad_right:\n" - "\tldr r2, =gUnknown_0203A118\n" - "\tldr r1, [r2]\n" - "\tldrb r0, [r1, 0x5]\n" - "\tadds r0, 0x1\n" - "\tstrb r0, [r1, 0x5]\n" - "\tb _0811ABDA\n" - "\t.pool\n" - "_0811AC58_dpad_down:\n" - "\tldr r2, =gUnknown_0203A118\n" - "\tldr r1, [r2]\n" - "\tldrb r0, [r1, 0x6]\n" - "\tadds r0, 0x1\n" - "\tb _0811ABD8\n" - "\t.pool\n" - "_0811AC68_dpad_left:\n" - "\tldr r2, =gUnknown_0203A118\n" - "\tldr r1, [r2]\n" - "\tldrb r0, [r1, 0x5]\n" - "\tsubs r0, 0x1\n" - "\tstrb r0, [r1, 0x5]\n" - "\tb _0811ABDA\n" - "\t.pool\n" - "_0811AC78_b_button:\n" - "\tbl sub_811B150\n" - "\tb _0811AC82\n" - "_0811AC7E_start_button:\n" - "\tbl sub_811B1B4\n" - "_0811AC82:\n" - "\tlsls r0, 16\n" - "\tlsrs r0, 16\n" - "\tb _0811ACCC_return_r0\n" - "_0811AC88:\n" - "\tmovs r0, 0x5\n" - "\tldrsb r0, [r3, r0]\n" - "\tcmp r0, 0\n" - "\tbge _0811AC96\n" - "\tldrb r0, [r1, 0x1]\n" - "\tsubs r0, 0x1\n" - "\tstrb r0, [r3, 0x5]\n" - "_0811AC96:\n" - "\tldr r3, [r4]\n" - "\tmovs r2, 0x5\n" - "\tldrsb r2, [r3, r2]\n" - "\tldrb r1, [r3, 0x1]\n" - "\tlsls r0, r1, 1\n" - "\tadds r0, r1\n" - "\tlsls r0, 3\n" - "\tadds r0, r6\n" - "\tldrb r0, [r0, 0x1]\n" - "\tcmp r2, r0\n" - "\tblt _0811ACB0\n" - "\tmovs r0, 0\n" - "\tstrb r0, [r3, 0x5]\n" - "_0811ACB0:\n" - "\tbl sub_811AB44\n" - "\tcmp r0, 0\n" - "\tbeq _0811ACCA\n" - "\tldr r2, [r7]\n" - "\tldr r0, [r2, 0x4]\n" - "\tldr r1, =0x00ffff00\n" - "\tands r0, r1\n" - "\tldr r1, =0x00040100\n" - "\tcmp r0, r1\n" - "\tbne _0811ACCA\n" - "\tmovs r0, 0\n" - "\tstrb r0, [r2, 0x5]\n" - "_0811ACCA:\n" - "\tmovs r0, 0x2\n" - "_0811ACCC_return_r0:\n" - "\tpop {r4-r7}\n" - "\tpop {r1}\n" - "\tbx r1\n" - "\t.pool"); + asm_unified("\n\ + push {r4-r7,lr}\n\ + ldr r0, =gMain\n\ + ldrh r1, [r0, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _0811ABB8\n\ + bl sub_811BF78\n\ + ldr r1, =gEasyChatScreen\n\ + ldr r3, [r1]\n\ + movs r2, 0\n\ + movs r0, 0x2\n\ + strb r0, [r3, 0x4]\n\ + ldr r0, [r1]\n\ + strb r2, [r0, 0xA]\n\ + ldr r0, [r1]\n\ + strb r2, [r0, 0xB]\n\ + ldr r0, [r1]\n\ + strb r2, [r0, 0xC]\n\ + movs r0, 0x9\n\ + b RETURN\n\ + .pool\n\ +_0811AB9C:\n\ + movs r0, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0811AC68_dpad_left\n\ + movs r0, 0x80\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0811AC58_dpad_down\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0811AC48_dpad_right\n\ + movs r0, 0\n\ + b RETURN\n\ +_0811ABB8:\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0811AC78_b_button\n\ + movs r0, 0x8\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0811AC7E_start_button\n\ + movs r0, 0x40\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _0811AB9C\n\ + ldr r2, =gEasyChatScreen\n\ + ldr r1, [r2]\n\ + ldrb r0, [r1, 0x6]\n\ + subs r0, 0x1\n\ +_0811ABD8:\n\ + strb r0, [r1, 0x6]\n\ +_0811ABDA:\n\ + adds r7, r2, 0\n\ + adds r4, r7, 0\n\ + ldr r2, [r4]\n\ + movs r0, 0x6\n\ + ldrsb r0, [r2, r0]\n\ + ldr r6, =gEasyChatScreenTemplates\n\ + cmp r0, 0\n\ + bge _0811ABF8\n\ + ldrb r0, [r2, 0x1]\n\ + lsls r1, r0, 1\n\ + adds r1, r0\n\ + lsls r1, 3\n\ + adds r1, r6\n\ + ldrb r0, [r1, 0x2]\n\ + strb r0, [r2, 0x6]\n\ +_0811ABF8:\n\ + ldr r3, [r4]\n\ + movs r2, 0x6\n\ + ldrsb r2, [r3, r2]\n\ + adds r5, r6, 0\n\ + ldrb r1, [r3, 0x1]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + adds r0, r5\n\ + ldrb r0, [r0, 0x2]\n\ + cmp r2, r0\n\ + ble _0811AC14\n\ + movs r0, 0\n\ + strb r0, [r3, 0x6]\n\ +_0811AC14:\n\ + ldr r3, [r4]\n\ + movs r2, 0x6\n\ + ldrsb r2, [r3, r2]\n\ + ldrb r1, [r3, 0x1]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + adds r1, r0, r5\n\ + ldrb r0, [r1, 0x2]\n\ + cmp r2, r0\n\ + bne _0811AC88\n\ + movs r0, 0x5\n\ + ldrsb r0, [r3, r0]\n\ + cmp r0, 0x2\n\ + ble _0811AC36\n\ + movs r0, 0x2\n\ + strb r0, [r3, 0x5]\n\ +_0811AC36:\n\ + ldr r1, [r4]\n\ + movs r0, 0x1\n\ + strb r0, [r1, 0x4]\n\ + movs r0, 0x3\n\ + b RETURN\n\ + .pool\n\ +_0811AC48_dpad_right:\n\ + ldr r2, =gEasyChatScreen\n\ + ldr r1, [r2]\n\ + ldrb r0, [r1, 0x5]\n\ + adds r0, 0x1\n\ + strb r0, [r1, 0x5]\n\ + b _0811ABDA\n\ + .pool\n\ +_0811AC58_dpad_down:\n\ + ldr r2, =gEasyChatScreen\n\ + ldr r1, [r2]\n\ + ldrb r0, [r1, 0x6]\n\ + adds r0, 0x1\n\ + b _0811ABD8\n\ + .pool\n\ +_0811AC68_dpad_left:\n\ + ldr r2, =gEasyChatScreen\n\ + ldr r1, [r2]\n\ + ldrb r0, [r1, 0x5]\n\ + subs r0, 0x1\n\ + strb r0, [r1, 0x5]\n\ + b _0811ABDA\n\ + .pool\n\ +_0811AC78_b_button:\n\ + bl sub_811B150\n\ + b _0811AC82\n\ +_0811AC7E_start_button:\n\ + bl sub_811B1B4\n\ +_0811AC82:\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + b RETURN\n\ +_0811AC88:\n\ + movs r0, 0x5\n\ + ldrsb r0, [r3, r0]\n\ + cmp r0, 0\n\ + bge _0811AC96\n\ + ldrb r0, [r1, 0x1]\n\ + subs r0, 0x1\n\ + strb r0, [r3, 0x5]\n\ +_0811AC96:\n\ + ldr r3, [r4]\n\ + movs r2, 0x5\n\ + ldrsb r2, [r3, r2]\n\ + ldrb r1, [r3, 0x1]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + adds r0, r6\n\ + ldrb r0, [r0, 0x1]\n\ + cmp r2, r0\n\ + blt _0811ACB0\n\ + movs r0, 0\n\ + strb r0, [r3, 0x5]\n\ +_0811ACB0:\n\ + bl sub_811AB44\n\ + cmp r0, 0\n\ + beq _0811ACCA\n\ + ldr r2, [r7]\n\ + ldr r0, [r2, 0x4]\n\ + ldr r1, =0x00ffff00\n\ + ands r0, r1\n\ + ldr r1, =0x00040100\n\ + cmp r0, r1\n\ + bne _0811ACCA\n\ + movs r0, 0\n\ + strb r0, [r2, 0x5]\n\ +_0811ACCA:\n\ + movs r0, 0x2\n\ +RETURN:\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .pool"); +} +#endif // NONMATCHING + +#ifdef NONMATCHING +static u16 sub_811ACDC(void) +{ + int numFooterColumns; + + if (gMain.newKeys & A_BUTTON) + { + switch (gEasyChatScreen->mainCursorColumn) + { + case 0: + return sub_811B184(); + case 1: + return sub_811B150(); + case 2: + return sub_811B1B4(); + case 3: + return sub_811B264(); + } + } + + if (gMain.newKeys & B_BUTTON) + return sub_811B150(); + else if (gMain.newKeys & START_BUTTON) + return sub_811B1B4(); + else if (gMain.newKeys & DPAD_UP) + gEasyChatScreen->mainCursorRow--; + else if (gMain.newKeys & DPAD_LEFT) + gEasyChatScreen->mainCursorColumn--; + else if (gMain.newKeys & DPAD_DOWN) + gEasyChatScreen->mainCursorRow = 0; + else if (gMain.newKeys & DPAD_RIGHT) + gEasyChatScreen->mainCursorColumn++; + else + return 0; + + if (gEasyChatScreen->mainCursorRow == gEasyChatScreenTemplates[gEasyChatScreen->templateId].numRows) + { + numFooterColumns = sub_811BA3C() ? 4 : 3; + if (gEasyChatScreen->mainCursorColumn < 0) + gEasyChatScreen->mainCursorColumn = numFooterColumns - 1; + + if (gEasyChatScreen->mainCursorColumn >= numFooterColumns) + gEasyChatScreen->mainCursorColumn = 0; + + return 3; + } + + if (gEasyChatScreen->mainCursorColumn >= gEasyChatScreenTemplates[gEasyChatScreen->templateId].numColumns) + gEasyChatScreen->mainCursorColumn = gEasyChatScreenTemplates[gEasyChatScreen->templateId].numColumns - 1; + + if (sub_811AB44() && gEasyChatScreen->mainCursorColumn == 1 && gEasyChatScreen->mainCursorRow == 4) + gEasyChatScreen->mainCursorColumn = 0; + + gEasyChatScreen->state = 0; + return 2; +} +#else +NAKED +static u16 sub_811ACDC(void) +{ + asm_unified("\n\ + push {r4-r6,lr}\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _0811AD4A\n\ + ldr r0, =gEasyChatScreen\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x5]\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0x1\n\ + beq _0811AD3E\n\ + b _0811AD24\n\ + .pool\n\ +_0811AD04:\n\ + movs r0, 0x20\n\ + ands r0, r2\n\ + lsls r0, 16\n\ + lsrs r3, r0, 16\n\ + cmp r3, 0\n\ + bne _0811ADE0\n\ + movs r0, 0x80\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _0811ADD0\n\ + movs r0, 0x10\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _0811ADC0\n\ + movs r0, 0\n\ + b _0811AE32\n\ +_0811AD24:\n\ + cmp r0, 0x1\n\ + bgt _0811AD2E\n\ + cmp r0, 0\n\ + beq _0811AD38\n\ + b _0811AD4A\n\ +_0811AD2E:\n\ + cmp r0, 0x2\n\ + beq _0811ADF6\n\ + cmp r0, 0x3\n\ + beq _0811AD44\n\ + b _0811AD4A\n\ +_0811AD38:\n\ + bl sub_811B184\n\ + b _0811ADFA\n\ +_0811AD3E:\n\ + bl sub_811B150\n\ + b _0811ADFA\n\ +_0811AD44:\n\ + bl sub_811B264\n\ + b _0811ADFA\n\ +_0811AD4A:\n\ + ldrh r2, [r2, 0x2E]\n\ + movs r0, 0x2\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _0811ADF0\n\ + movs r0, 0x8\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _0811ADF6\n\ + movs r0, 0x40\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _0811AD04\n\ + ldr r2, =gEasyChatScreen\n\ + ldr r1, [r2]\n\ + ldrb r0, [r1, 0x6]\n\ + subs r0, 0x1\n\ + strb r0, [r1, 0x6]\n\ +_0811AD6E:\n\ + adds r6, r2, 0\n\ +_0811AD70:\n\ + adds r5, r6, 0\n\ + ldr r4, [r5]\n\ + movs r3, 0x6\n\ + ldrsb r3, [r4, r3]\n\ + ldr r2, =gEasyChatScreenTemplates\n\ + ldrb r1, [r4, 0x1]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + adds r1, r0, r2\n\ + ldrb r0, [r1, 0x2]\n\ + cmp r3, r0\n\ + bne _0811AE00\n\ + bl sub_811BA3C\n\ + movs r2, 0x3\n\ + cmp r0, 0\n\ + beq _0811AD96\n\ + movs r2, 0x4\n\ +_0811AD96:\n\ + ldr r1, [r5]\n\ + movs r0, 0x5\n\ + ldrsb r0, [r1, r0]\n\ + cmp r0, 0\n\ + bge _0811ADA4\n\ + subs r0, r2, 0x1\n\ + strb r0, [r1, 0x5]\n\ +_0811ADA4:\n\ + ldr r1, [r5]\n\ + movs r0, 0x5\n\ + ldrsb r0, [r1, r0]\n\ + cmp r0, r2\n\ + blt _0811ADB2\n\ + movs r0, 0\n\ + strb r0, [r1, 0x5]\n\ +_0811ADB2:\n\ + movs r0, 0x3\n\ + b _0811AE32\n\ + .pool\n\ +_0811ADC0:\n\ + ldr r2, =gEasyChatScreen\n\ + ldr r1, [r2]\n\ + ldrb r0, [r1, 0x5]\n\ + adds r0, 0x1\n\ + strb r0, [r1, 0x5]\n\ + b _0811AD6E\n\ + .pool\n\ +_0811ADD0:\n\ + ldr r1, =gEasyChatScreen\n\ + ldr r0, [r1]\n\ + strb r3, [r0, 0x6]\n\ + adds r6, r1, 0\n\ + b _0811AD70\n\ + .pool\n\ +_0811ADE0:\n\ + ldr r2, =gEasyChatScreen\n\ + ldr r1, [r2]\n\ + ldrb r0, [r1, 0x5]\n\ + subs r0, 0x1\n\ + strb r0, [r1, 0x5]\n\ + b _0811AD6E\n\ + .pool\n\ +_0811ADF0:\n\ + bl sub_811B150\n\ + b _0811ADFA\n\ +_0811ADF6:\n\ + bl sub_811B1B4\n\ +_0811ADFA:\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + b _0811AE32\n\ +_0811AE00:\n\ + movs r0, 0x5\n\ + ldrsb r0, [r4, r0]\n\ + ldrb r1, [r1, 0x1]\n\ + cmp r0, r1\n\ + blt _0811AE0E\n\ + subs r0, r1, 0x1\n\ + strb r0, [r4, 0x5]\n\ +_0811AE0E:\n\ + bl sub_811AB44\n\ + cmp r0, 0\n\ + beq _0811AE28\n\ + ldr r2, [r6]\n\ + ldr r0, [r2, 0x4]\n\ + ldr r1, =0x00ffff00\n\ + ands r0, r1\n\ + ldr r1, =0x00040100\n\ + cmp r0, r1\n\ + bne _0811AE28\n\ + movs r0, 0\n\ + strb r0, [r2, 0x5]\n\ +_0811AE28:\n\ + ldr r0, =gEasyChatScreen\n\ + ldr r1, [r0]\n\ + movs r0, 0\n\ + strb r0, [r1, 0x4]\n\ + movs r0, 0x2\n\ +_0811AE32:\n\ + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1\n\ + .pool"); +} +#endif // NONMATCHING + +static u16 sub_811AE44(void) +{ + if (gMain.newKeys & B_BUTTON) + return sub_811B32C(); + + if (gMain.newKeys & A_BUTTON) + { + if (gEasyChatScreen->unk_0a != -1) + return sub_811B2B0(); + + switch (gEasyChatScreen->unk_0b) + { + case 0: + return sub_811B33C(); + case 1: + return sub_811B368(); + case 2: + return sub_811B32C(); + } + } + + if (gMain.newKeys & SELECT_BUTTON) + return sub_811B33C(); + + if (gMain.newAndRepeatedKeys & DPAD_UP) + return sub_811B528(2); + + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + return sub_811B528(3); + + if (gMain.newAndRepeatedKeys & DPAD_LEFT) + return sub_811B528(1); + + if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + return sub_811B528(0); + + return 0; +} + +static u16 sub_811AF00(void) +{ + if (gMain.newKeys & B_BUTTON) + { + gEasyChatScreen->state = 2; + return 14; + } + + if (gMain.newKeys & A_BUTTON) + return sub_811B394(); + + if (gMain.newKeys & START_BUTTON) + return sub_811B794(4); + + if (gMain.newKeys & SELECT_BUTTON) + return sub_811B794(5); + + if (gMain.newAndRepeatedKeys & DPAD_UP) + return sub_811B794(2); + + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + return sub_811B794(3); + + if (gMain.newAndRepeatedKeys & DPAD_LEFT) + return sub_811B794(1); + + if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + return sub_811B794(0); + + return 0; +} + +static u16 sub_811AF8C(void) +{ + u8 var0; + + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case MENU_B_PRESSED: // B Button + case 1: // No + gEasyChatScreen->state = sub_811B2A4(); + return 7; + case 0: // Yes + gSpecialVar_Result = 0; + var0 = gEasyChatScreen->kind - 17; + if (var0 < 2) + sub_811B3E4(); + + return 24; + default: + return 0; + } +} + +static u16 sub_811AFEC(void) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case MENU_B_PRESSED: // B Button + case 1: // No + gEasyChatScreen->state = sub_811B2A4(); + return 7; + case 0: // Yes + sub_811BE9C(); + gSpecialVar_Result = sub_811B4EC(); + sub_811B3E4(); + return 24; + default: + return 0; + } +} + +static u16 sub_811B040(void) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case MENU_B_PRESSED: // B Button + case 1: // No + gEasyChatScreen->state = 1; + return 7; + case 0: // Yes + sub_811B418(); + gEasyChatScreen->state = 1; + return 8; + default: + return 0; + } +} + +static u16 sub_811B08C(void) +{ + if (gMain.newKeys & A_BUTTON) + return 26; + + if (gMain.newKeys & B_BUTTON) + return sub_811B150(); + + return 0; +} + +static u16 sub_811B0BC(void) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + gEasyChatScreen->state = sub_811B2A4(); + return 7; + } + + return 0; +} + +static u16 sub_811B0E8(void) +{ + gEasyChatScreen->state = 10; + return 6; +} + +static u16 sub_811B0F8(void) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case MENU_B_PRESSED: // B Button + case 1: // No + sub_811B454(); + gEasyChatScreen->unk_08 = 0; + gEasyChatScreen->state = 8; + return 31; + case 0: // Yes + gSpecialVar_Result = sub_811B4EC(); + sub_811B3E4(); + return 24; + default: + return 0; + } +} + +static u16 sub_811B150(void) +{ + if (gEasyChatScreen->kind == 19 || gEasyChatScreen->kind == 11) + { + gEasyChatScreen->unk_08 = gEasyChatScreen->state; + gEasyChatScreen->state = 8; + return 34; + } + else + { + gEasyChatScreen->unk_08 = gEasyChatScreen->state; + gEasyChatScreen->state = 4; + return 5; + } +} + +int sub_811B184(void) +{ + gEasyChatScreen->unk_08 = gEasyChatScreen->state; + if (gEasyChatScreen->kind != 6) + { + gEasyChatScreen->state = 5; + return 4; + } + else + { + gEasyChatScreen->unk_08 = gEasyChatScreen->state; + gEasyChatScreen->state = 8; + return 32; + } +} + +u16 sub_811B1B4(void) +{ + gEasyChatScreen->unk_08 = gEasyChatScreen->state; + if (gEasyChatScreen->kind == 17) + { + if (sub_811BD64()) + { + gEasyChatScreen->state = 8; + return 29; + } + + if (sub_811BDB0()) + { + gEasyChatScreen->state = 8; + return 30; + } + + gEasyChatScreen->state = 6; + return 6; + } + else if (gEasyChatScreen->kind == 18) + { + if (sub_811BDB0()) + { + gEasyChatScreen->state = 8; + return 30; + } + + if (sub_811BD64()) + { + gEasyChatScreen->state = 8; + return 29; + } + + gEasyChatScreen->state = 6; + return 6; + } + else if (gEasyChatScreen->kind == 9 || gEasyChatScreen->kind == 13) + { + if (!sub_811BD2C()) + { + gEasyChatScreen->state = 8; + return 33; + } + + gEasyChatScreen->state = 6; + return 6; + } + else if (gEasyChatScreen->kind == 19 || gEasyChatScreen->kind == 11) + { + if (sub_811BCF4()) + { + gEasyChatScreen->state = 8; + return 34; + } + + gEasyChatScreen->state = 6; + return 6; + } + else if (gEasyChatScreen->kind == 20) + { + gEasyChatScreen->state = 6; + return 6; + } + else + { + if (sub_811BCF4() == 1 || !sub_811B4EC()) + { + gEasyChatScreen->state = 4; + return 5; + } + + gEasyChatScreen->state = 6; + return 6; + } +} + +int sub_811B264(void) +{ + gEasyChatScreen->unk_08 = gEasyChatScreen->state; + switch (gEasyChatScreen->kind) + { + case 15: + return 25; + case 17: + sub_811B3E4(); + return 28; + case 18: + sub_811B3E4(); + return 27; + default: + return 0; + } +} + +static u8 sub_811B2A4(void) +{ + return gEasyChatScreen->unk_08; +} + +static int sub_811B2B0(void) +{ + u16 var1; + + if (gEasyChatScreen->unk_09 == 0) + { + u8 var0 = sub_811F3B8(sub_811B8E8()); + sub_811F548(0, var0); + } + else + { + sub_811F548(1, sub_811B908()); + } + + var1 = sub_811F5B0(); + if (var1 == 0) + return 0; + + gEasyChatScreen->unk_0f = (var1 - 1) / 2; + gEasyChatScreen->unk_0e = 0; + gEasyChatScreen->unk_10 = 0; + gEasyChatScreen->unk_11 = 0; + gEasyChatScreen->state = 3; + return 11; +} + +static int sub_811B32C(void) +{ + gEasyChatScreen->state = 0; + return 10; +} + +static int sub_811B33C(void) +{ + gEasyChatScreen->unk_0a = 0; + gEasyChatScreen->unk_0b = 0; + gEasyChatScreen->unk_0c = 0; + if (!gEasyChatScreen->unk_09) + gEasyChatScreen->unk_09 = 1; + else + gEasyChatScreen->unk_09 = 0; + + return 23; +} + +static int sub_811B368(void) +{ + if (gEasyChatScreen->kind == 6) + { + PlaySE(SE_HAZURE); + return 0; + } + else + { + sub_811B488(0xFFFF); + return 1; + } +} + +static int sub_811B394(void) +{ + u16 easyChatWord = sub_811F578(sub_811B940()); + if (sub_811BF88(easyChatWord)) + { + PlaySE(SE_HAZURE); + return 0; + } + else + { + sub_811B488(easyChatWord); + if (gEasyChatScreen->kind != 6) + { + gEasyChatScreen->state = 0; + return 12; + } + else + { + gEasyChatScreen->state = 9; + return 13; + } + } +} + +static void sub_811B3E4(void) +{ + int i; + for (i = 0; i < gEasyChatScreen->unk_07; i++) + gEasyChatScreen->words[i] = gEasyChatScreen->ecWordBuffer[i]; +} + +static void sub_811B418(void) +{ + int i; + for (i = 0; i < gEasyChatScreen->unk_07; i++) + gEasyChatScreen->ecWordBuffer[i] = 0xFFFF; +} + +static void sub_811B454(void) +{ + int i; + for (i = 0; i < gEasyChatScreen->unk_07; i++) + gEasyChatScreen->ecWordBuffer[i] = gEasyChatScreen->words[i]; +} + +static void sub_811B488(u16 easyChatWord) +{ + u16 index = sub_811B8C8(); + gEasyChatScreen->ecWordBuffer[index] = easyChatWord; +} + +static u8 sub_811B4AC(void) +{ + u16 i; + for (i = 0; i < gEasyChatScreen->unk_07; i++) + { + if (gEasyChatScreen->ecWordBuffer[i] != gEasyChatScreen->words[i]) + return 1; + } + + return 0; +} + +static int sub_811B4EC(void) +{ + u8 var0 = gEasyChatScreen->kind - 17; + if (var0 < 2) + { + if (sub_811BD64()) + return 0; + + if (sub_811BDB0()) + return 0; + + return 1; + } + else + { + return sub_811B4AC(); + } +} + +static u16 sub_811B528(int arg0) +{ + if (gEasyChatScreen->unk_0a != -1) + { + if (gEasyChatScreen->unk_09 == 0) + return sub_811B568(arg0); + else + return sub_811B634(arg0); + } + else + { + return sub_811B6C4(arg0); + } +} + +static int sub_811B568(u32 arg0) +{ + switch (arg0) + { + case 2: + if (gEasyChatScreen->unk_0b != -gEasyChatScreen->unk_0c) + { + if (gEasyChatScreen->unk_0b) + { + gEasyChatScreen->unk_0b--; + return 15; + } + else + { + gEasyChatScreen->unk_0c--; + return 17; + } + } + break; + case 3: + if (gEasyChatScreen->unk_0b + gEasyChatScreen->unk_0c < gEasyChatScreen->unk_0d - 1) + { + int var0; + if (gEasyChatScreen->unk_0b < 3) + { + gEasyChatScreen->unk_0b++; + var0 = 15; + } + else + { + gEasyChatScreen->unk_0c++; + var0 = 16; + } + + sub_811B978(); + return var0; + } + break; + case 1: + if (gEasyChatScreen->unk_0a) + gEasyChatScreen->unk_0a--; + else + sub_811B744(); + + return 15; + case 0: + if (gEasyChatScreen->unk_0a < 1) + { + gEasyChatScreen->unk_0a++; + if (sub_811B9C8()) + sub_811B744(); + } + else + { + sub_811B744(); + } + return 15; + } + + return 0; +} + +static int sub_811B634(u32 arg0) +{ + switch (arg0) + { + case 2: + if (gEasyChatScreen->unk_0b > 0) + gEasyChatScreen->unk_0b--; + else + gEasyChatScreen->unk_0b = 3; + + sub_811B978(); + return 15; + case 3: + if (gEasyChatScreen->unk_0b < 3) + gEasyChatScreen->unk_0b++; + else + gEasyChatScreen->unk_0b = 0; + + sub_811B978(); + return 15; + case 0: + gEasyChatScreen->unk_0a++; + if (sub_811B9C8()) + sub_811B744(); + + return 15; + case 1: + gEasyChatScreen->unk_0a--; + if (gEasyChatScreen->unk_0a < 0) + sub_811B744(); + + return 15; + } + + return 0; +} + +static int sub_811B6C4(u32 arg0) +{ + switch (arg0) + { + case 2: + if (gEasyChatScreen->unk_0b) + gEasyChatScreen->unk_0b--; + else + gEasyChatScreen->unk_0b = 2; + + return 15; + case 3: + if (gEasyChatScreen->unk_0b < 2) + gEasyChatScreen->unk_0b++; + else + gEasyChatScreen->unk_0b = 0; + + return 15; + case 1: + gEasyChatScreen->unk_0b++; + sub_811B768(); + return 15; + case 0: + gEasyChatScreen->unk_0a = 0; + gEasyChatScreen->unk_0b++; + return 15; + } + + return 0; +} + +static void sub_811B744(void) +{ + gEasyChatScreen->unk_0a = 0xFF; + if (gEasyChatScreen->unk_0b) + gEasyChatScreen->unk_0b--; +} + +static void sub_811B768(void) +{ + if (gEasyChatScreen->unk_09 == 0) + { + gEasyChatScreen->unk_0a = 1; + sub_811B978(); + } + else + { + gEasyChatScreen->unk_0a = sub_811B960(gEasyChatScreen->unk_0b); + } +} + +static u16 sub_811B794(u32 arg0) +{ + u16 result; + switch (arg0) + { + case 2: + if (gEasyChatScreen->unk_11 + gEasyChatScreen->unk_0e > 0) + { + if (gEasyChatScreen->unk_11 > 0) + { + gEasyChatScreen->unk_11--; + result = 18; + } + else + { + gEasyChatScreen->unk_0e--; + result = 19; + } + + sub_811B9A0(); + return result; + } + break; + case 3: + if (gEasyChatScreen->unk_11 + gEasyChatScreen->unk_0e < gEasyChatScreen->unk_0f) + { + if (gEasyChatScreen->unk_11 < 3) + { + gEasyChatScreen->unk_11++; + result = 18; + } + else + { + gEasyChatScreen->unk_0e++; + result = 20; + } + + sub_811B9A0(); + return result; + } + break; + case 1: + if (gEasyChatScreen->unk_10 > 0) + gEasyChatScreen->unk_10--; + else + gEasyChatScreen->unk_10 = 1; + + sub_811B9A0(); + return 18; + case 0: + if (gEasyChatScreen->unk_10 < 1) + { + gEasyChatScreen->unk_10++; + if (sub_811BA1C()) + gEasyChatScreen->unk_10 = 0; + } + else + { + gEasyChatScreen->unk_10 = 0; + } + return 18; + case 4: + if (gEasyChatScreen->unk_0e) + { + if (gEasyChatScreen->unk_0e > 3) + gEasyChatScreen->unk_0e -= 4; + else + gEasyChatScreen->unk_0e = 0; + + return 21; + } + break; + case 5: + if (gEasyChatScreen->unk_0e <= gEasyChatScreen->unk_0f - 4) + { + gEasyChatScreen->unk_0e += 4; + if (gEasyChatScreen->unk_0e > gEasyChatScreen->unk_0f - 3) + gEasyChatScreen->unk_0e = gEasyChatScreen->unk_0f + 0xFD; + + sub_811B9A0(); + return 22; + } + break; + } + + return 0; +} + +static u16 sub_811B8C8(void) +{ + return (gEasyChatScreen->mainCursorRow * gEasyChatScreen->numColumns) + gEasyChatScreen->mainCursorColumn; +} + +static u16 sub_811B8E8(void) +{ + return 2 * (gEasyChatScreen->unk_0b + gEasyChatScreen->unk_0c) + gEasyChatScreen->unk_0a; +} + +static int sub_811B908(void) +{ + int var0 = (u8)gEasyChatScreen->unk_0a < 7 ? gEasyChatScreen->unk_0a : 0; + int var1 = (u8)gEasyChatScreen->unk_0b < 4 ? gEasyChatScreen->unk_0b : 0; + return gUnknown_08597748[var1][var0]; +} + +u16 sub_811B940(void) +{ + return 2 * (gEasyChatScreen->unk_11 + gEasyChatScreen->unk_0e) + gEasyChatScreen->unk_10; +} + +static u8 sub_811B960(u8 arg0) +{ + switch (arg0) + { + case 0: + default: + return 6; + case 1: + return 5; + } +} + +static void sub_811B978(void) +{ + while (sub_811B9C8()) + { + if (gEasyChatScreen->unk_0a) + gEasyChatScreen->unk_0a--; + else + break; + } +} + +static void sub_811B9A0(void) +{ + while (sub_811BA1C()) + { + if (gEasyChatScreen->unk_10) + gEasyChatScreen->unk_10--; + else + break; + } +} + +static u8 sub_811B9C8(void) +{ + if (gEasyChatScreen->unk_09 == 0) + return sub_811B8E8() >= sub_811F3AC() ? 1 : 0; + else + return gEasyChatScreen->unk_0a > sub_811B960(gEasyChatScreen->unk_0b) ? 1 : 0; +} + +static u8 sub_811BA1C(void) +{ + return sub_811B940() >= sub_811F5B0() ? 1 : 0; +} + +int sub_811BA3C(void) +{ + return gEasyChatScreenTemplates[gEasyChatScreen->templateId].unk_03_7; +} + +u8 sub_811BA5C(void) +{ + return gEasyChatScreen->kind; +} + +u8 sub_811BA68(void) +{ + return gEasyChatScreenTemplates[gEasyChatScreen->templateId].unk_03_0; +} + +const u8 *sub_811BA88(void) +{ + return gEasyChatScreen->titleText; +} + +u16 *sub_811BA94(void) +{ + return gEasyChatScreen->ecWordBuffer; +} + +u8 sub_811BAA0(void) +{ + return gEasyChatScreen->numRows; +} + +u8 sub_811BAAC(void) +{ + return gEasyChatScreen->numColumns; +} + +u8 sub_811BAB8(void) +{ + return gEasyChatScreen->mainCursorColumn; +} + +u8 sub_811BAC4(void) +{ + return gEasyChatScreen->mainCursorRow; +} + +void sub_811BAD0(const u8 **str1, const u8 **str2) +{ + *str1 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].instructionsText1; + *str2 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].instructionsText2; +} + +void sub_811BB08(const u8 **str1, const u8 **str2) +{ + *str1 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].confirmText1; + *str2 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].confirmText2; +} + +void sub_811BB40(const u8 **str1, const u8 **str2) +{ + switch (gEasyChatScreen->kind) + { + case 4: + *str1 = gText_StopGivingPkmnMail; + *str2 = NULL; + break; + case 15: + case 16: + *str1 = gText_LikeToQuitQuiz; + *str2 = gText_ChallengeQuestionMark; + break; + default: + *str1 = gText_QuitEditing; + *str2 = NULL; + break; + } + +} + +void sub_811BB88(const u8 **str1, const u8 **str2) +{ + *str1 = gText_AllTextBeingEditedWill; + *str2 = gText_BeDeletedThatOkay; +} + +void sub_811BB9C(u8 *arg0, u8 *arg1) +{ + *arg0 = gEasyChatScreen->unk_0a; + *arg1 = gEasyChatScreen->unk_0b; +} + +u8 sub_811BBB0(void) +{ + return gEasyChatScreen->unk_09; +} + +u8 sub_811BBBC(void) +{ + return gEasyChatScreen->unk_0c; +} + +void sub_811BBC8(u8 *arg0, u8 *arg1) +{ + *arg0 = gEasyChatScreen->unk_10; + *arg1 = gEasyChatScreen->unk_11; +} + +u8 sub_811BBDC(void) +{ + return gEasyChatScreen->unk_0e; +} + +u8 sub_811BBE8(void) +{ + return gEasyChatScreen->unk_0f; +} + +static u8 unref_sub_811BBF4(void) +{ + return 0; +} + +int sub_811BBF8(void) +{ + switch (gEasyChatScreen->state) + { + case 2: + if (gEasyChatScreen->unk_09 == 0 && gEasyChatScreen->unk_0c) + return 1; + break; + case 3: + if (gEasyChatScreen->unk_0e) + return 1; + break; + } + + return 0; +} + +int sub_811BC2C(void) +{ + switch (gEasyChatScreen->state) + { + case 2: + if (gEasyChatScreen->unk_09 == 0 && gEasyChatScreen->unk_0c + 4 <= gEasyChatScreen->unk_0d - 1) + return 1; + break; + case 3: + if (gEasyChatScreen->unk_0e + 4 <= gEasyChatScreen->unk_0f) + return 1; + break; + } + + return 0; +} + +int sub_811BC70(void) +{ + return sub_811BA3C(); +} + +u8 sub_811BC7C(const u16 *arg0, u8 arg1) +{ + u8 i; + + for (i = 0; i < arg1; i++) + { + if (arg0[i] != gEasyChatScreen->ecWordBuffer[i]) + return 1; + } + + return 0; +} + +u8 sub_811BCBC(void) +{ + return gEasyChatScreen->sizeParam; +} + +static u8 sub_811BCC8(u8 entryType) +{ + u32 i; + + for (i = 0; i < ARRAY_COUNT(gEasyChatScreenTemplates); i++) + { + if (gEasyChatScreenTemplates[i].unk_00 == entryType) + return i; + } + + return 0; +} + +int sub_811BCF4(void) +{ + int i; + + for (i = 0; i < gEasyChatScreen->unk_07; i++) + { + if (gEasyChatScreen->ecWordBuffer[i] != 0xFFFF) + return 0; + } + + return 1; +} + +static int sub_811BD2C(void) +{ + int i; + + for (i = 0; i < gEasyChatScreen->unk_07; i++) + { + if (gEasyChatScreen->ecWordBuffer[i] == 0xFFFF) + return 0; + } + + return 1; +} + +static int sub_811BD64(void) +{ + int i; + struct SaveBlock1 *saveBlock1; + + if (gEasyChatScreen->kind == 17) + return sub_811BCF4(); + + saveBlock1 = gSaveBlock1Ptr; + for (i = 0; i < 9; i++) + { + if (saveBlock1->lilycoveLady.quiz.unk_002[i] != 0xFFFF) + return 0; + } + + return 1; +} + +static int sub_811BDB0(void) +{ + struct LilycoveLadyQuiz *quiz; + if (gEasyChatScreen->kind == 18) + return sub_811BCF4(); + + quiz = &gSaveBlock1Ptr->lilycoveLady.quiz; + return quiz->unk_014 == 0xFFFF ? 1 : 0; +} + +static void sub_811BDF0(u8 *arg0) +{ + u8 name[32]; + struct SaveBlock1 *saveBlock1 = gSaveBlock1Ptr; + DynamicPlaceholderTextUtil_Reset(); + if (StringLength(saveBlock1->lilycoveLady.quiz.playerName) != 0) + { + TVShowConvertInternationalString(name, saveBlock1->lilycoveLady.quiz.playerName, saveBlock1->lilycoveLady.quiz.language); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, name); + } + else + { + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gText_Lady); + } + + DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700sQuiz); +} + +static void sub_811BE54(void) +{ + int i; + u16 *ecWord; + u8 *str; + + ecWord = gEasyChatScreen->ecWordBuffer; + str = gStringVar2; + i = 0; + while (i < gEasyChatScreen->unk_07) + { + str = CopyEasyChatWordPadded(str, *ecWord, 0); + *str = 0; + str++; + ecWord++; + i++; + } + + str--; + str[0] = 0xFF; +} + +static void sub_811BE9C(void) +{ + switch (gEasyChatScreen->kind) + { + case 0: + FlagSet(FLAG_SYS_CHAT_USED); + break; + case 20: + if (sub_811BF20()) + gSpecialVar_0x8004 = 2; + else + gSpecialVar_0x8004 = 0; + break; + case 9: + sub_811BE54(); + gSpecialVar_0x8004 = sub_81226D8(gEasyChatScreen->ecWordBuffer); + break; + case 13: + gSpecialVar_0x8004 = sub_811BF40(); + break; + } +} + +static int sub_811BF20(void) +{ + return sub_811BC7C(gUnknown_08597764, 4) == 0; +} + +static u16 sub_811BF40(void) +{ + int i; + for (i = 0; i < 5; i++) + { + if (!sub_811BC7C(gUnknown_0859776C[i], 2)) + return i + 1; + } + + return 0; +} + +void sub_811BF78(void) +{ + gEasyChatScreen->unk_13 = 0; +} + +int sub_811BF88(int easyChatWord) +{ + return 0; +} + +static bool8 sub_811BF8C(void) +{ + if (!sub_811CE94()) + return 0; + else + return 1; } -#endif diff --git a/src/event_data.c b/src/event_data.c index a9da142e5..e75c37773 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -28,8 +28,6 @@ EWRAM_DATA static u8 gUnknown_020375FC[16] = {0}; extern u16 *const gSpecialVars[]; -extern void sub_80BB358(void); - void InitEventData(void) { memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags)); @@ -69,7 +67,7 @@ void EnableNationalPokedex(void) FlagSet(FLAG_SYS_NATIONAL_DEX); gSaveBlock2Ptr->pokedex.mode = DEX_MODE_NATIONAL; gSaveBlock2Ptr->pokedex.order = 0; - sub_80BB358(); + ResetPokedexScrollPositions(); } bool32 IsNationalPokedexEnabled(void) diff --git a/src/fldeff_flash.c b/src/fldeff_flash.c index f3bd76cbf..c002f700f 100644 --- a/src/fldeff_flash.c +++ b/src/fldeff_flash.c @@ -74,11 +74,13 @@ static const u32 gCaveTransitionTiles[] = INCBIN_U32("graphics/misc/cave_transit // text bool8 SetUpFieldMove_Flash(void) { - if (ShouldDoBrailleFlyEffect()) + // In Ruby and Sapphire, Registeel's tomb is opened by using Fly. In Emerald, + // Flash is used instead. + if (ShouldDoBrailleRegisteelEffect()) { gSpecialVar_Result = GetCursorSelectionMonId(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_8179918; + gPostMenuFieldCallback = SetUpPuzzleEffectRegisteel; return TRUE; } else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH)) diff --git a/src/fldeff_rocksmash.c b/src/fldeff_rocksmash.c index 9181b5532..86df8e943 100644 --- a/src/fldeff_rocksmash.c +++ b/src/fldeff_rocksmash.c @@ -119,11 +119,13 @@ static void sub_813561C(u8 taskId) bool8 SetUpFieldMove_RockSmash(void) { - if (ShouldDoBrailleStrengthEffect()) + // In Ruby and Sapphire, Regirock's tomb is opened by using Strength. In Emerald, + // it is opened by using Rock Smash. + if (ShouldDoBrailleRegirockEffect()) { gSpecialVar_Result = GetCursorSelectionMonId(); gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu; - gPostMenuFieldCallback = sub_8179834; + gPostMenuFieldCallback = SetUpPuzzleEffectRegirock; return TRUE; } else if (CheckObjectGraphicsInFrontOfPlayer(EVENT_OBJ_GFX_BREAKABLE_ROCK) == TRUE) diff --git a/src/flying.c b/src/flying.c index d3ea3f11b..48df12a06 100644 --- a/src/flying.c +++ b/src/flying.c @@ -1,13 +1,16 @@ #include "global.h" #include "battle_anim.h" +#include "palette.h" +#include "trig.h" +#include "constants/battle_anim.h" #include "constants/rgb.h" -extern void sub_810DE70(struct Sprite *); -extern void sub_810DFA8(struct Sprite *); -extern void sub_810E044(struct Sprite *); -extern void sub_810E13C(struct Sprite *); -extern void sub_810E1C8(struct Sprite *); -extern void sub_810E314(struct Sprite *); +void sub_810DE70(struct Sprite *); +void sub_810DFA8(struct Sprite *); +void sub_810E044(struct Sprite *); +void sub_810E13C(struct Sprite *); +void sub_810E1C8(struct Sprite *); +void sub_810E314(struct Sprite *); extern void sub_810EA4C(struct Sprite *); extern void sub_810EAA0(struct Sprite *); extern void sub_810EC34(struct Sprite *); @@ -18,6 +21,13 @@ extern void sub_810EEF8(struct Sprite *); extern void sub_810F004(struct Sprite *); extern void sub_810F084(struct Sprite *); +static void sub_810DE98(struct Sprite *); +static void sub_810DF18(u8); +static void sub_810E028(struct Sprite *); +static void sub_810E184(struct Sprite *); +static void sub_810E24C(struct Sprite *); +void sub_810E520(struct Sprite *); + const struct SpriteTemplate gUnknown_08596270 = { .tileTag = ANIM_TAG_GUST, @@ -326,3 +336,293 @@ const struct SpriteTemplate gUnknown_08596514 = .affineAnims = gDummySpriteAffineAnimTable, .callback = sub_810F084, }; + + +void sub_810DE70(struct Sprite *sprite) +{ + InitSpritePosToAnimTarget(sprite, FALSE); + sprite->pos1.y += 20; + sprite->data[1] = 191; + sprite->callback = sub_810DE98; + sprite->callback(sprite); +} + +static void sub_810DE98(struct Sprite *sprite) { + sprite->pos2.x = Sin(sprite->data[1], 32); + sprite->pos2.y = Cos(sprite->data[1], 8); + sprite->data[1] += 5; + sprite->data[1] &= 0xFF; + if (++sprite->data[0] == 71) + DestroyAnimSprite(sprite); +} + +void sub_810DED8(u8 taskId) +{ + gTasks[taskId].data[0] = gBattleAnimArgs[1]; + gTasks[taskId].data[1] = gBattleAnimArgs[0]; + gTasks[taskId].data[2] = IndexOfSpritePaletteTag(ANIM_TAG_GUST); + gTasks[taskId].func = sub_810DF18; +} + +static void sub_810DF18(u8 taskId) +{ + u8 data2; + u16 temp; + int i, base; + + if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1]) + { + gTasks[taskId].data[10] = 0; + data2 = gTasks[taskId].data[2]; + temp = gPlttBufferFaded[16 * data2 + 0x108]; + i = 7; + base = data2 * 16; + + do + { + gPlttBufferFaded[base + 0x101 + i] = gPlttBufferFaded[base + 0x100 + i]; + i--; + } + while (i > 0); + + gPlttBufferFaded[base + 0x101] = temp; + } + + if (--gTasks[taskId].data[0] == 0) + DestroyAnimVisualTask(taskId); +} + +void sub_810DFA8(struct Sprite *sprite) +{ + InitSpritePosToAnimAttacker(sprite, TRUE); + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + + sprite->data[0] = gBattleAnimArgs[4]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; + InitAnimLinearTranslation(sprite); + sprite->callback = RunStoredCallbackWhenAffineAnimEnds; + StoreSpriteCallbackInData6(sprite, sub_810E028); +} + +static void sub_810E028(struct Sprite *sprite) +{ + if (AnimTranslateLinear(sprite)) + DestroyAnimSprite(sprite); +} + +void sub_810E044(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + gBattleAnimArgs[0] = -gBattleAnimArgs[0]; + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + gBattleAnimArgs[2] = -gBattleAnimArgs[2]; + gBattleAnimArgs[3] = -gBattleAnimArgs[3]; + } + + if (IsContest()) + { + gBattleAnimArgs[1] = -gBattleAnimArgs[1]; + gBattleAnimArgs[3] = -gBattleAnimArgs[3]; + } + + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); + sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); + sprite->pos1.x += gBattleAnimArgs[0]; + sprite->pos1.y += gBattleAnimArgs[1]; + sprite->data[0] = gBattleAnimArgs[4]; + + if (gBattleAnimArgs[6] == 0) + { + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); + } + else + { + SetAverageBattlerPositions(gBattleAnimTarget, 1, &sprite->data[2], &sprite->data[4]); + } + + sprite->data[2] = sprite->data[2] + gBattleAnimArgs[2]; + sprite->data[4] = sprite->data[4] + gBattleAnimArgs[3]; + sprite->callback = StartAnimLinearTranslation; + + StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); + SeekSpriteAnim(sprite, gBattleAnimArgs[5]); +} + +void sub_810E13C(struct Sprite *sprite) +{ + InitSpritePosToAnimAttacker(sprite, TRUE); + sprite->data[0] = gBattleAnimArgs[2]; + sprite->data[1] = gBattleAnimArgs[3]; + sprite->callback = sub_810E184; + gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = 1; +} + +static void sub_810E184(struct Sprite *sprite) +{ + if (sprite->data[0] > 0) + { + sprite->data[0]--; + } + else + { + sprite->data[2] += sprite->data[1]; + sprite->pos2.y -= (sprite->data[2] >> 8); + } + + if (sprite->pos1.y + sprite->pos2.y < -32) + DestroyAnimSprite(sprite); +} + +void sub_810E1C8(struct Sprite *sprite) +{ + if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + { + sprite->pos1.x = 272; + sprite->pos1.y = -32; + StartSpriteAffineAnim(sprite, 1); + } + else + { + sprite->pos1.x = -32; + sprite->pos1.y = -32; + } + + sprite->data[0] = gBattleAnimArgs[0]; + sprite->data[1] = sprite->pos1.x; + sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + sprite->data[3] = sprite->pos1.y; + sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); + + InitAnimLinearTranslation(sprite); + sprite->callback = sub_810E24C; +} + +static void sub_810E24C(struct Sprite *sprite) +{ + sprite->data[0] = 1; + AnimTranslateLinear(sprite); + if (((u16)sprite->data[3] >> 8) > 200) + { + sprite->pos1.x += sprite->pos2.x; + sprite->pos2.x = 0; + sprite->data[3] &= 0xFF; + } + + if ((u32)(sprite->pos1.x + sprite->pos2.x + 32) > 304 || sprite->pos1.y + sprite->pos2.y > 160) + { + gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = 0; + DestroyAnimSprite(sprite); + } +} + +void sub_810E2C8(struct Sprite *sprite) +{ + if (sprite->data[0]-- <= 0) + { + if (sprite->oam.affineMode & ST_OAM_AFFINE_ON_MASK) + { + FreeOamMatrix(sprite->oam.matrixNum); + sprite->oam.affineMode = 0; + } + + DestroySprite(sprite); + gAnimVisualTaskCount--; + } +} + +// FAKEMATCHING +void sub_810E314(struct Sprite *sprite) +{ + s16 *data; + u8 slot; + s16 spriteCoord; + int t1, t2; + u32 arg2; + u32 matrixNum; + u8 sinIndex; + register s16 sinVal asm ("r4"); + register int sinVal2 asm ("r0"); + + data = sprite->data; + + if (gBattleAnimArgs[7] & 0x100) + slot = gBattleAnimAttacker; + else + slot = gBattleAnimTarget; + + if (GetBattlerSide(slot) == B_SIDE_PLAYER) + gBattleAnimArgs[0] = -gBattleAnimArgs[0]; + + sprite->pos1.x = GetBattlerSpriteCoord(slot, 0) + gBattleAnimArgs[0]; + spriteCoord = GetBattlerSpriteCoord(slot, 1); + sprite->pos1.y = spriteCoord + gBattleAnimArgs[1]; + data[4] = sprite->pos1.y << 8; + + t1 = (spriteCoord + (u16) gBattleAnimArgs[6]) << 1; + data[7] = (data[7] & 1) | t1; + ((u8 *) data)[0] |= 4; + + arg2 = (u16) gBattleAnimArgs[2]; + data[1] = (u8) gBattleAnimArgs[2]; + arg2 <<= 16; + data[5] = arg2 >> 24; + data[2] = gBattleAnimArgs[3]; + data[3] = gBattleAnimArgs[4]; + data[6] = gBattleAnimArgs[5]; + + if ((u16) (data[1] - 64) <= 0x7f) + { + if (!IsContest()) + sprite->oam.priority = GetBattlerSpriteBGPriority(slot) + 1; + else + sprite->oam.priority = GetBattlerSpriteBGPriority(slot); + + ((u8 *) data)[14] = data[7] & -2; + + if (!(data[2] & 0x8000)) + { + sprite->hFlip ^= 1; + sprite->animNum = sprite->hFlip; + + sprite->animBeginning = 1; + sprite->animEnded = 0; + } + } + else + { + sprite->oam.priority = GetBattlerSpriteBGPriority(slot); + ((u8 *) data)[14] |= 1; + + if (data[2] & 0x8000) + { + sprite->hFlip ^= 1; + sprite->animNum = sprite->hFlip; + + sprite->animBeginning = 1; + sprite->animEnded = 0; + } + } + + t2 = (u16) data[1] >> 6 << 4; + ((u8 *) data)[0] = (15 & data[0]) | t2; + + sprite->pos2.x = (gSineTable[(u16) data[1]] * (u8) data[6]) >> 8; + + matrixNum = sprite->oam.matrixNum; + + sinIndex = (-sprite->pos2.x >> 1) + data[5]; + sinVal = gSineTable[sinIndex]; + + gOamMatrices[matrixNum].a = gOamMatrices[matrixNum].d = gSineTable[sinIndex + 64]; + gOamMatrices[matrixNum].b = sinVal; + sinVal2 = -sinVal; + gOamMatrices[matrixNum].c = sinVal2; + + sprite->callback = sub_810E520; +} diff --git a/src/frontier_util.c b/src/frontier_util.c index e6954c356..6fcbd4ffb 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -1528,7 +1528,7 @@ static void ShowLinkContestResultsWindow(void) static void sub_81A31FC(void) { - u8 text[32]; + u8 name[32]; s32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; s32 facility = VarGet(VAR_FRONTIER_FACILITY); s32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE); @@ -1541,9 +1541,9 @@ static void sub_81A31FC(void) gSaveBlock2Ptr->frontier.towerRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode]; if (battleMode == FRONTIER_MODE_LINK_MULTIS) { - StringCopy(text, gLinkPlayers[gBattleScripting.multiplayerId ^ 1].name); - StripExtCtrlCodes(text); - StringCopy(gSaveBlock2Ptr->frontier.field_EE1[lvlMode], text); + StringCopy(name, gLinkPlayers[gBattleScripting.multiplayerId ^ 1].name); + StripExtCtrlCodes(name); + StringCopy(gSaveBlock2Ptr->frontier.opponentName[lvlMode], name); SetTrainerId(gLinkPlayers[gBattleScripting.multiplayerId ^ 1].trainerId, gSaveBlock2Ptr->frontier.field_EF1[lvlMode]); } if (gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] > 1 @@ -2336,8 +2336,8 @@ static void PrintHallRecords(s32 hallFacilityId, s32 lvlMode) AddTextPrinterParameterized(gRecordsWindowId, 1, gLevelModeText[lvlMode], x, 1, TEXT_SPEED_FF, NULL); if (hallFacilityId == HALL_FACILITIES_COUNT) { - gSaveBlock2Ptr->frontier.field_EE1[0][PLAYER_NAME_LENGTH] = EOS; - gSaveBlock2Ptr->frontier.field_EE1[1][PLAYER_NAME_LENGTH] = EOS; + gSaveBlock2Ptr->frontier.opponentName[0][PLAYER_NAME_LENGTH] = EOS; + gSaveBlock2Ptr->frontier.opponentName[1][PLAYER_NAME_LENGTH] = EOS; Fill2PRecords(records2P, lvlMode); for (i = 0; i < 3; i++) Print2PRecord(i, 1, 4, &records2P[i]); diff --git a/src/link_rfu.c b/src/link_rfu.c index f13d15337..8da6b166a 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -16,6 +16,7 @@ #include "task.h" #include "text.h" #include "constants/species.h" +#include "save.h" extern u16 gHeldKeyCodeToSend; extern void nullsub_89(u8 taskId); @@ -2347,17 +2348,17 @@ void sub_800E174(void) } } -void sub_800E378(struct UnkSaveSubstruct_3b98 *dest, u32 trainerId, const u8 *name) +void CopyTrainerRecord(struct TrainerNameRecord *dest, u32 trainerId, const u8 *name) { dest->trainerId = trainerId; StringCopy(dest->trainerName, name); } -bool32 sub_800E388(const u8 *name) +bool32 NameIsNotEmpty(const u8 *name) { s32 i; - for (i = 0; i < 8; i++) + for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) { if (name[i] != 0) { @@ -2367,52 +2368,64 @@ bool32 sub_800E388(const u8 *name) return FALSE; } -void sub_800E3A8(void) +// Save the currently connected players into the trainer records, shifting all previous records down. +void RecordMixTrainerNames(void) { if (gWirelessCommType != 0) { s32 i; s32 j; - s32 cnt; - s32 sp0[5]; - struct UnkSaveSubstruct_3b98 *sp14 = calloc(20, sizeof(struct UnkSaveSubstruct_3b98)); + s32 nextSpace; + s32 connectedTrainerRecordIndices[5]; + struct TrainerNameRecord *newRecords = calloc(20, sizeof(struct TrainerNameRecord)); + + // Check if we already have a record saved for connected trainers. for (i = 0; i < GetLinkPlayerCount(); i++) { - sp0[i] = -1; + connectedTrainerRecordIndices[i] = -1; for (j = 0; j < 20; j++) { - if ((u16)gLinkPlayers[i].trainerId == gSaveBlock1Ptr->unk_3B98[j].trainerId && StringCompare(gLinkPlayers[i].name, gSaveBlock1Ptr->unk_3B98[j].trainerName) == 0) + if ((u16)gLinkPlayers[i].trainerId == gSaveBlock1Ptr->trainerNameRecords[j].trainerId && StringCompare(gLinkPlayers[i].name, gSaveBlock1Ptr->trainerNameRecords[j].trainerName) == 0) { - sp0[i] = j; + connectedTrainerRecordIndices[i] = j; } } } - cnt = 0; + + // Save the connected trainers first, at the top of the list. + nextSpace = 0; for (i = 0; i < GetLinkPlayerCount(); i++) { if (i != GetMultiplayerId() && gLinkPlayers[i].language != LANGUAGE_JAPANESE) { - sub_800E378(&sp14[cnt], (u16)gLinkPlayers[i].trainerId, gLinkPlayers[i].name); - if (sp0[i] >= 0) + CopyTrainerRecord(&newRecords[nextSpace], (u16)gLinkPlayers[i].trainerId, gLinkPlayers[i].name); + + // If we already had a record for this trainer, wipe it so that the next step doesn't duplicate it. + if (connectedTrainerRecordIndices[i] >= 0) { - memset(gSaveBlock1Ptr->unk_3B98[sp0[i]].trainerName, 0, 8); + memset(gSaveBlock1Ptr->trainerNameRecords[connectedTrainerRecordIndices[i]].trainerName, 0, 8); } - cnt++; + nextSpace++; } } + + // Copy all non-empty records to the new list, in the order they appear on the old list. If the list is full, + // the last (oldest) records will be dropped. for (i = 0; i < 20; i++) { - if (sub_800E388(gSaveBlock1Ptr->unk_3B98[i].trainerName)) + if (NameIsNotEmpty(gSaveBlock1Ptr->trainerNameRecords[i].trainerName)) { - sub_800E378(&sp14[cnt], gSaveBlock1Ptr->unk_3B98[i].trainerId, gSaveBlock1Ptr->unk_3B98[i].trainerName); - if (++cnt >= 20) + CopyTrainerRecord(&newRecords[nextSpace], gSaveBlock1Ptr->trainerNameRecords[i].trainerId, gSaveBlock1Ptr->trainerNameRecords[i].trainerName); + if (++nextSpace >= 20) { break; } } } - memcpy(gSaveBlock1Ptr->unk_3B98, sp14, 20 * sizeof(struct UnkSaveSubstruct_3b98)); - free(sp14); + + // Finalize the new list, and clean up. + memcpy(gSaveBlock1Ptr->trainerNameRecords, newRecords, 20 * sizeof(struct TrainerNameRecord)); + free(newRecords); } } @@ -2422,11 +2435,11 @@ bool32 sub_800E540(u16 id, u8 *name) for (i = 0; i < 20; i++) { - if (StringCompare(gSaveBlock1Ptr->unk_3B98[i].trainerName, name) == 0 && gSaveBlock1Ptr->unk_3B98[i].trainerId == id) + if (StringCompare(gSaveBlock1Ptr->trainerNameRecords[i].trainerName, name) == 0 && gSaveBlock1Ptr->trainerNameRecords[i].trainerId == id) { return TRUE; } - if (!sub_800E388(gSaveBlock1Ptr->unk_3B98[i].trainerName)) + if (!NameIsNotEmpty(gSaveBlock1Ptr->trainerNameRecords[i].trainerName)) { return FALSE; } @@ -2434,14 +2447,14 @@ bool32 sub_800E540(u16 id, u8 *name) return FALSE; } -void sub_800E5AC(void) +void WipeTrainerNameRecords(void) { s32 i; for (i = 0; i < 20; i++) { - gSaveBlock1Ptr->unk_3B98[i].trainerId = 0; - CpuFill16(0, gSaveBlock1Ptr->unk_3B98[i].trainerName, 8); + gSaveBlock1Ptr->trainerNameRecords[i].trainerId = 0; + CpuFill16(0, gSaveBlock1Ptr->trainerNameRecords[i].trainerName, 8); } } diff --git a/src/new_game.c b/src/new_game.c index a4bf2951f..2e8930f7c 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -30,31 +30,25 @@ #include "apprentice.h" #include "frontier_util.h" #include "constants/maps.h" +#include "pokedex.h" +#include "save.h" +#include "link_rfu.h" +#include "main.h" +#include "contest.h" +#include "item_menu.h" +#include "pokemon_storage_system.h" +#include "decoration_inventory.h" +#include "secret_base.h" +#include "player_pc.h" +#include "field_specials.h" -extern u16 gSaveFileStatus; -extern u8 gUnknown_030060B0; -// TODO: replace those declarations with file headers -extern u16 GetGeneratedTrainerIdLower(void); -extern void ClearContestWinnerPicsInContestHall(void); -extern void sub_80BB358(void); -extern void ResetBagScrollPositions(void); -extern void ResetGabbyAndTy(void); -extern void ResetSecretBases(void); -extern void ResetLinkContestBoolean(void); -extern void sub_8052DA8(void); -extern void ResetPokemonStorageSystem(void); -extern void NewGameInitPCItems(void); -extern void ClearDecorationInventories(void); -extern void ResetFanClub(void); extern void copy_strings_to_sav1(void); extern void sub_801AFD8(void); -extern void sub_800E5AC(void); -extern void ResetContestLinkResults(void); extern void ResetPokeJumpResults(void); extern void SetBerryPowder(u32* powder, u32 newValue); -extern const u8 EventScript_2715DE[]; +extern const u8 EventScript_ResetAllMapFlags[]; // this file's functions static void ClearFrontierRecord(void); @@ -112,7 +106,7 @@ static void SetDefaultOptions(void) static void ClearPokedexFlags(void) { - gUnknown_030060B0 = 0; + gUnusedPokedexU8 = 0; memset(&gSaveBlock2Ptr->pokedex.owned, 0, sizeof(gSaveBlock2Ptr->pokedex.owned)); memset(&gSaveBlock2Ptr->pokedex.seen, 0, sizeof(gSaveBlock2Ptr->pokedex.seen)); } @@ -130,8 +124,8 @@ static void ClearFrontierRecord(void) { CpuFill32(0, &gSaveBlock2Ptr->frontier, sizeof(gSaveBlock2Ptr->frontier)); - gSaveBlock2Ptr->frontier.field_EE1[0][0] = EOS; - gSaveBlock2Ptr->frontier.field_EE1[1][0] = EOS; + gSaveBlock2Ptr->frontier.opponentName[0][0] = EOS; + gSaveBlock2Ptr->frontier.opponentName[1][0] = EOS; } static void WarpToTruck(void) @@ -149,7 +143,7 @@ void Sav2_ClearSetDefault(void) void ResetMenuAndMonGlobals(void) { gDifferentSaveFile = 0; - sub_80BB358(); + ResetPokedexScrollPositions(); ZeroPlayerPartyMons(); ZeroEnemyPartyMons(); ResetBagScrollPositions(); @@ -203,7 +197,7 @@ void NewGameInitData(void) ResetFanClub(); ResetLotteryCorner(); WarpToTruck(); - ScriptContext2_RunNewScript(EventScript_2715DE); + ScriptContext2_RunNewScript(EventScript_ResetAllMapFlags); ResetMiniGamesResults(); copy_strings_to_sav1(); SetLilycoveLady(); @@ -211,7 +205,7 @@ void NewGameInitData(void) ClearRankingHallRecords(); InitMatchCallCounters(); sub_801AFD8(); - sub_800E5AC(); + WipeTrainerNameRecords(); ResetTrainerHillResults(); ResetContestLinkResults(); } diff --git a/src/pokedex.c b/src/pokedex.c index ac38bdc98..805412c85 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -37,7 +37,8 @@ static EWRAM_DATA u8 gUnknown_02039B52 = 0; static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL; // IWRAM common -u8 gUnknown_030060B0; +// This is written to, but never read. +u8 gUnusedPokedexU8; void (*gUnknown_030060B4)(void); struct PokedexOption @@ -1225,7 +1226,7 @@ void ResetPokedex(void) gUnknown_02039B50 = 0; gUnknown_02039B52 = 64; - gUnknown_030060B0 = 0; + gUnusedPokedexU8 = 0; gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN; gSaveBlock2Ptr->pokedex.order = 0; gSaveBlock2Ptr->pokedex.nationalMagic = 0; @@ -1243,7 +1244,7 @@ void ResetPokedex(void) } } -void sub_80BB358(void) +void ResetPokedexScrollPositions(void) { gUnknown_02039B50 = 0; gUnknown_02039B52 = 64; @@ -4041,7 +4042,7 @@ void sub_80C0460(u16 weight, u8 left, u8 top) lsls r2, 24\n\ lsrs r2, 24\n\ str r2, [sp, 0x10]\n\ - ldr r5, =0x000186a0\n\ + ldr r5, =0x000186a0 @ Note to decompiler: See UNKNOWN_OFFSET\n\ muls r0, r5\n\ ldr r1, =0x000011b8\n\ bl __divsi3\n\ @@ -4075,7 +4076,7 @@ _080C04C0:\n\ mov r8, r1\n\ movs r6, 0x1\n\ _080C04C6:\n\ - ldr r1, =0x000186a0\n\ + ldr r1, =0x000186a0 @ Note to decompiler: See UNKNOWN_OFFSET\n\ adds r0, r7, 0\n\ bl __umodsi3\n\ adds r7, r0, 0\n\ diff --git a/src/pokenav.c b/src/pokenav.c new file mode 100644 index 000000000..7b0cb52fc --- /dev/null +++ b/src/pokenav.c @@ -0,0 +1,1211 @@ +#include "global.h" +#include "alloc.h" +#include "task.h" +#include "main.h" +#include "overworld.h" +#include "field_weather.h" +#include "palette.h" +#include "pokemon_storage_system.h" +#include "sound.h" +#include "constants/songs.h" +#include "window.h" +#include "gpu_regs.h" +#include "bg.h" +#include "menu.h" +#include "graphics.h" +#include "gba/macro.h" +#include "decompress.h" +#include "strings.h" +#include "constants/rgb.h" + +#define UNKNOWN_OFFSET 100000 + +struct UnknownStruct_0203CF40 +{ + u32 (*field0)(void); + u32 field4; + u16 field8; + u16 fieldA; + u32 fieldC; + void *field10[19]; +}; + +struct UnknownStruct_sub_81C76C4 +{ + u32 data[523]; +}; + +extern u32 sub_81C9430(void); +extern void sub_81CAADC(void); +extern u32 sub_81C99D4(void); +extern void sub_8199D98(void); +extern void sub_81C7D28(void); +extern u32 sub_81C9298(void); +extern u32 sub_81C941C(void); +extern u32 sub_81C9924(void); +extern u32 sub_81C99C0(void); +extern u32 sub_81C9990(void); +extern u32 sub_81C9940(void); +extern u32 sub_81C9338(void); +extern u32 sub_81C9368(void); +extern u32 sub_81C92CC(void); +extern u32 sub_81C9304(void); +extern u32 sub_81CC4D4(void); +extern u32 sub_81CC554(void); +extern u32 sub_81CC5F4(void); +extern u32 sub_81CC62C(void); +extern u32 sub_81CC65C(void); +extern u32 sub_81CC524(void); +extern u32 sub_81CC670(void); +extern u32 sub_81CCFD8(void); +extern u32 sub_81CD070(void); +extern u32 sub_81CDDD4(void); +extern u32 sub_81CDE2C(void); +extern u32 sub_81CDE64(void); +extern u32 sub_81CD1C0(void); +extern u32 sub_81CECA0(void); +extern u32 sub_81CEF3C(void); +extern u32 sub_81CEFDC(void); +extern u32 sub_81CF330(void); +extern u32 sub_81CF3A0(void); +extern u32 sub_81CF3D0(void); +extern u32 sub_81CEFF0(void); +extern u32 sub_81CF3F8(void); +extern u32 sub_81CD024(void); +extern u32 sub_81CEF98(void); +extern u32 sub_81CF368(void); +extern u32 sub_81CAAE8(void); +extern u32 sub_81CAB24(void); +extern u32 sub_81CB260(void); +extern u32 sub_81CB29C(void); +extern u32 sub_81CB2CC(void); +extern u32 sub_81CAB38(void); +extern u32 sub_81CB2E0(void); +extern u32 sub_81CF9BC(void); +extern u32 sub_81CFA34(void); +extern u32 sub_81CFDD0(void); +extern u32 sub_81CFE40(void); +extern u32 sub_81CFE70(void); +extern u32 sub_81CFA48(void); +extern u32 sub_81CFE98(void); +extern u32 sub_81D0450(void); +extern u32 sub_81D04A0(void); +extern u32 sub_81D0978(void); +extern u32 sub_81D09B0(void); +extern u32 sub_81D09E0(void); +extern u32 sub_81D04B8(void); +extern u32 sub_81D09F4(void); +extern u32 sub_81CFA04(void); +extern u32 sub_81CFE08(void); + +u32 sub_81C791C(s32 a0); +bool32 sub_81C756C(u32 a0); +bool32 sub_81C76C4(void); +u32 AnyMonHasRibbon(void); +u32 sub_81C75E0(void); +u32 sub_81C75D4(void); +u32 sub_81C76FC(void); +u32 sub_81C786C(void); +u32 sub_81C7764(s32 a0); +u32 atk47_cmd47(s32 a0); +bool32 sub_81C7738(void); +void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 a1, u32 a2); +void sub_81C7834(u32 (*a0)(void), u32(*a1)(void)); +void sub_81C7360(struct UnknownStruct_0203CF40 *a0); +void sub_81C7650(u32 index); +void sub_81C7850(u32 a0); +void sub_81C7BF8(u32 a0); +void sub_81C71E4(u8 a0); +void sub_81C7170(u8 a0); +void sub_81C742C(u8 taskId); +void sub_81C7710(void); +void sub_81C75F4(void); +void sub_81C7334(void); +void sub_81C7418(void); +void sub_81C7400(void); +void sub_81C7C28(void); +void sub_81C72BC(void); +void sub_81C7B74(void); +void sub_81C7C94(void); + + +u32 (*const gUnknown_0861F3EC[15][7])(void) = +{ + { + sub_81C9298, + sub_81C941C, + sub_81C9924, + sub_81C9990, + sub_81C99C0, + sub_81C9430, + sub_81C99D4, + }, + { + sub_81C9298, + sub_81C941C, + sub_81C9940, + sub_81C9990, + sub_81C99C0, + sub_81C9430, + sub_81C99D4, + }, + { + sub_81C9338, + sub_81C941C, + sub_81C9940, + sub_81C9990, + sub_81C99C0, + sub_81C9430, + sub_81C99D4, + }, + { + sub_81C9368, + sub_81C941C, + sub_81C9940, + sub_81C9990, + sub_81C99C0, + sub_81C9430, + sub_81C99D4, + }, + { + sub_81C92CC, + sub_81C941C, + sub_81C9940, + sub_81C9990, + sub_81C99C0, + sub_81C9430, + sub_81C99D4, + }, + { + sub_81C9304, + sub_81C941C, + sub_81C9940, + sub_81C9990, + sub_81C99C0, + sub_81C9430, + sub_81C99D4, + }, + { + sub_81CC4D4, + sub_81CC554, + sub_81CC5F4, + sub_81CC62C, + sub_81CC65C, + sub_81CC524, + sub_81CC670, + }, + { + sub_81CCFD8, + sub_81CD070, + sub_81CDDD4, + sub_81CDE2C, + sub_81CDE64, + sub_81CD1C0, + sub_81CECA0, + }, + { + sub_81CEF3C, + sub_81CEFDC, + sub_81CF330, + sub_81CF3A0, + sub_81CF3D0, + sub_81CEFF0, + sub_81CF3F8, + }, + { + sub_81CD024, + sub_81CD070, + sub_81CDDD4, + sub_81CDE2C, + sub_81CDE64, + sub_81CD1C0, + sub_81CECA0, + }, + { + sub_81CEF98, + sub_81CEFDC, + sub_81CF368, + sub_81CF3A0, + sub_81CF3D0, + sub_81CEFF0, + sub_81CF3F8, + }, + { + sub_81CAAE8, + sub_81CAB24, + sub_81CB260, + sub_81CB29C, + sub_81CB2CC, + sub_81CAB38, + sub_81CB2E0, + }, + { + sub_81CF9BC, + sub_81CFA34, + sub_81CFDD0, + sub_81CFE40, + sub_81CFE70, + sub_81CFA48, + sub_81CFE98, + }, + { + sub_81D0450, + sub_81D04A0, + sub_81D0978, + sub_81D09B0, + sub_81D09E0, + sub_81D04B8, + sub_81D09F4, + }, + { + sub_81CFA04, + sub_81CFA34, + sub_81CFE08, + sub_81CFE40, + sub_81CFE70, + sub_81CFA48, + sub_81CFE98, + }, +}; + +const u16 gUnknown_0861F590[] = INCBIN_U16("graphics/pokenav/icon2.gbapal"); +const u32 gUnknown_0861F5B0[] = INCBIN_U32("graphics/pokenav/icon2.4bpp.lz"); +const u32 gUnknown_0861F994[] = INCBIN_U32("graphics/pokenav/icon2_unused.4bpp.lz"); + +const struct BgTemplate gUnknown_0861FA04 = +{ + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 5, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0, +}; + +const struct WindowTemplate gUnknown_0861FA08[2] = +{ + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 22, + .width = 16, + .height = 2, + .paletteNum = 0, + .baseBlock = 0x36, + }, + { + .bg = 0xFF, + .tilemapLeft = 0, + .tilemapTop = 0, + .width = 0, + .height = 0, + .paletteNum = 0, + .baseBlock = 0, + }, +}; + +const u8 *const (MenuButtonReminders[12]) = +{ + gText_Navgear_ClearButtonList, + gText_NavgearMap_ZoomedOutButtons, + gText_NavgearMap_ZoomedInButtons, + gText_NavgearCondition_MonListButtons, + gText_NavgearCondition_MonStatusButtons, + gText_NavgearCondition_MarkingButtons, + gText_NavgearMatchCall_TrainerListButtons, + gText_NavgearMatchCall_CallMenuButtons, + gText_NavgearMatchCall_CheckTrainerButtons, + gText_NavgearRibbons_MonListButtons, + gText_NavgearRibbons_RibbonListButtons, + gText_NavgearRibbons_RibbonCheckButtons, +}; + +const u8 gMenuButtonReminderColor[4] = +{ + 4, 1, 2, 0 +}; + +const struct CompressedSpriteSheet gUnknown_0861FA4C[] = +{ + { + .data = gUnknown_0861F5B0, + .size = 0x1000, + .tag = 0, + } +}; + +const struct SpritePalette gUnknown_0861FA54[2] = +{ + { + .data = gUnknown_0861F590, + .tag = 0, + }, + { + .data = NULL, + .tag = 0, + } +}; + +const struct CompressedSpriteSheet gUnknown_0861FA64 = +{ + .data = gPokenavLeftHeaderHoennMap_Gfx, + .size = 0xC00, + .tag = 2 +}; + +extern struct UnknownStruct_0203CF40 *gUnknown_0203CF40; +extern u8 gUnknown_0203CF3C; +extern const struct SpriteTemplate gUnknown_0861FB04; + +u32 sub_81C7078(u32 (*a0)(s32), u32 a1) +{ + u16 taskId; + + if (!IsUpdateLinkStateCBActive()) + taskId = CreateTask(sub_81C7170, a1); + else + taskId = CreateTask(sub_81C71E4, a1); + + SetWordTaskArg(taskId, 1, (u32)a0); + + gTasks[taskId].data[3] = gUnknown_0203CF3C; + return ((gUnknown_0203CF3C++) << 16) | taskId; +} + +bool32 sub_81C70D8(u32 a0) +{ + u32 v1 = a0 & 0xFFFF; + u32 v2 = a0 >> 16; + if (gTasks[v1].isActive + && (gTasks[v1].func == sub_81C7170 || gTasks[v1].func == sub_81C71E4) + && gTasks[v1].data[3] == v2) + { + + return TRUE; + } + else + { + return FALSE; + } +} + +bool32 sub_81C7124(u32 a0) +{ + s32 i; + for (i = 0; i < 16; i++) + { + if (gTasks[i].isActive + && (gTasks[i].func == sub_81C7170 || gTasks[i].func == sub_81C71E4)) + { + u32 arg = GetWordTaskArg((u8)i, 1); + if (arg == a0) + return TRUE; + } + } + return FALSE; +} + +void sub_81C7170(u8 taskId) +{ + s16 *dataPtr; + u32 (*func)(u32); + bool32 exitLoop; + + func = (u32 (*)(u32))GetWordTaskArg(taskId, 1); + dataPtr = gTasks[taskId].data; + exitLoop = FALSE; + while (!exitLoop) + { + u32 v1 =((u32 (*)(u32))func)(dataPtr[0]); + switch (v1) + { + case 1: + dataPtr[0] = dataPtr[0] + 1; + break; + case 0: + dataPtr[0]++; + return; + case 4: + DestroyTask(taskId); + return; + default: + dataPtr[0] = v1 - 5; + break; + case 3: + break; + case 2: + return; + } + } +} + +void sub_81C71E4(u8 taskId) +{ + u32 (*func)(u32); + s16 *data; + u32 v1; + + if (sub_8087598()) + return; + func = (u32 (*)(u32))GetWordTaskArg(taskId, 1); + data = gTasks[taskId].data; + v1 = func(data[0]); + switch (v1) + { + case 0: + case 1: + data[0]++; + break; + case 4: + DestroyTask(taskId); + break; + default: + data[0] = v1 - 5; + break; + case 2: + case 3: + break; + } +} + +void CB2_PokeNav(void) +{ + gUnknown_0203CF40 = Alloc(sizeof(struct UnknownStruct_0203CF40)); + if (gUnknown_0203CF40 == NULL) + { + SetMainCallback2(CB2_ReturnToFieldWithOpenMenu); + } + else + { + sub_81C7360(gUnknown_0203CF40); + ResetTasks(); + SetVBlankCallback(NULL); + CreateTask(sub_81C742C, 0); + SetMainCallback2(sub_81C7400); + SetVBlankCallback(sub_81C7418); + } +} + +void sub_81C72A4() +{ + SetMainCallback2(sub_81C72BC); + FadeScreen(1, 0); +} + +void sub_81C72BC() +{ + UpdatePaletteFade(); + if (!gPaletteFade.active) + { + gUnknown_0203CF40 = Alloc(sizeof(struct UnknownStruct_0203CF40)); + if (gUnknown_0203CF40 == NULL) + { + SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); + } + else + { + sub_81C7360(gUnknown_0203CF40); + gUnknown_0203CF40->field8 = 1; + ResetTasks(); + ResetSpriteData(); + FreeAllSpritePalettes(); + SetVBlankCallback(NULL); + CreateTask(sub_81C742C, 0); + SetMainCallback2(sub_81C7400); + SetVBlankCallback(sub_81C7418); + } + } +} + +void sub_81C7334() +{ + s32 i; + for (i = 0; i < 19; i++) + { + sub_81C7650(i); + } + + Free(gUnknown_0203CF40); + gUnknown_0203CF40 = NULL; + InitKeys(); +} + +// Clears UnknownStruct_0203CF40 +void sub_81C7360(struct UnknownStruct_0203CF40 *a0) +{ + s32 i; + void **arrayPtr; + void *fill; + + fill = NULL; + i = 18; + arrayPtr = &(a0->field10[18]); + for (i; i >= 0; i--) + { + *arrayPtr = fill; + arrayPtr -= 1; + } + a0->field8 = 0; + a0->field4 = 0; + a0->fieldC = AnyMonHasRibbon(); + a0->field0 = NULL; +} + +bool32 AnyMonHasRibbon() +{ + s32 i; + s32 j; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) + && !GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG) + && GetMonData(&gPlayerParty[i], MON_DATA_RIBBON_COUNT) != 0) + { + return TRUE; + } + } + + for (j = 0; j < TOTAL_BOXES_COUNT; j++) + { + for (i = 0; i < IN_BOX_COUNT; i++) + { + if (CheckBoxMonSanityAt(j, i) + && GetBoxMonDataAt(j, i, MON_DATA_RIBBON_COUNT) != 0) + { + return TRUE; + } + } + } + + return FALSE; +} + +void sub_81C7400() +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void sub_81C7418() +{ + TransferPlttBuffer(); + LoadOam(); + ProcessSpriteCopyRequests(); +} + +void sub_81C742C(u8 taskId) +{ + s16 *dataPtr; + u32 v1; + bool32 v2; + + dataPtr = gTasks[taskId].data; + + switch (dataPtr[0]) + { + case 0: + sub_81C76C4(); + dataPtr[0] = 1; + break; + case 1: + if (sub_81C76FC()) + break; + sub_81C756C(UNKNOWN_OFFSET); + dataPtr[0] = 4; + break; + case 2: + if (sub_81C786C()) + break; + dataPtr[0] = 3; + case 3: + v1 = sub_81C75E0(); + if (v1 == -1) + { + sub_81C7710(); + dataPtr[0] = 5; + } + else if (v1 >= UNKNOWN_OFFSET) + { + gUnknown_0861F3EC[gUnknown_0203CF40->field4][6](); + gUnknown_0861F3EC[gUnknown_0203CF40->field4][5](); + if (sub_81C756C(v1)) + { + dataPtr[0] = 4; + } + else + { + sub_81C7710(); + dataPtr[0] = 5; + } + } + else if (v1 != 0) + { + sub_81C7850(v1); + if (sub_81C786C()) + dataPtr[0] = 2; + } + break; + case 4: + if (!sub_81C75D4()) + dataPtr[0] = 3; + break; + case 5: + if (!sub_81C7738()) + { + v2 = gUnknown_0203CF40->field8 != 0; + sub_81C9430(); + sub_81C7334(); + if (v2) + SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); + else + SetMainCallback2(CB2_ReturnToFieldWithOpenMenu); + } + break; + } +} + +bool32 sub_81C756C(u32 a0) +{ + u32 index; + + index = a0 - UNKNOWN_OFFSET; + sub_81C75F4(); + if (!gUnknown_0861F3EC[index][0]()) + return FALSE; + if (!gUnknown_0861F3EC[index][2]()) + return FALSE; + sub_81C7834(gUnknown_0861F3EC[index][3], gUnknown_0861F3EC[index][4]); + gUnknown_0203CF40->field0 = gUnknown_0861F3EC[index][1]; + gUnknown_0203CF40->field4 = index; + return TRUE; +} + +u32 sub_81C75D4(void) +{ + return sub_81C786C(); +} + +u32 sub_81C75E0(void) +{ + return gUnknown_0203CF40->field0(); +} + +void sub_81C75F4(void) +{ + InitKeys(); +} + +void IndirectSetVBlankCallback(IntrCallback callback) +{ + SetVBlankCallback(callback); +} + +void sub_81C760C(void) +{ + SetVBlankCallback(sub_81C7418); +} + +void *sub_81C761C(u32 index, u32 size) +{ + return gUnknown_0203CF40->field10[index] = (void*)Alloc(size); +} + +void *sub_81C763C(u32 index) +{ + return gUnknown_0203CF40->field10[index]; +} + +void sub_81C7650(u32 index) +{ + if (gUnknown_0203CF40->field10[index] != NULL) + FREE_AND_SET_NULL(gUnknown_0203CF40->field10[index]); +} + +u16 sub_81C767C(void) +{ + return gUnknown_0203CF40->field8; +} + +void sub_81C7688(u16 a0) +{ + gUnknown_0203CF40->field8 = a0; +} + +void sub_81C7694(u32 a0) +{ + u32 value; + value = a0; + if (a0 > 4) + value = 0; + gUnknown_0203CF40->fieldA = value; +} + +u16 sub_81C76AC(void) +{ + return gUnknown_0203CF40->fieldA; +} + +u32 sub_81C76B8(void) +{ + return gUnknown_0203CF40->fieldC; +} + +bool32 sub_81C76C4(void) +{ + struct UnknownStruct_sub_81C76C4 *v1; + + v1 = (struct UnknownStruct_sub_81C76C4*)sub_81C761C(0, sizeof(struct UnknownStruct_sub_81C76C4)); + if (v1 == NULL) + { + return FALSE; + } + else + { + ResetSpriteData(); + FreeAllSpritePalettes(); + v1->data[3] = sub_81C7078(sub_81C7764, 1); + return TRUE; + } +} + +u32 sub_81C76FC(void) +{ + u32 *v1; + v1 = sub_81C763C(0); + return sub_81C70D8(v1[3]); +} + +void sub_81C7710(void) +{ + PlaySE(SE_PN_OFF); + sub_81CAADC(); + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); +} + +bool32 sub_81C7738(void) +{ + if (!gPaletteFade.active) + { + sub_81C99D4(); + sub_81C7C94(); + FreeAllWindowBuffers(); + return FALSE; + } else + { + return TRUE; + } +} + +u32 sub_81C7764(s32 a0) +{ + u32 *v1; + + switch (a0) + { + case 0: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + FreeAllWindowBuffers(); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, &gUnknown_0861FA04, 1); + sub_8199D98(); + reset_temp_tile_data_buffers(); + return 1; + case 1: + v1 = sub_81C763C(0); + decompress_and_copy_tile_data_to_vram(0, &gPokenavHeader_Gfx, 0, 0, 0); + SetBgTilemapBuffer(0, &v1[11]); + CopyToBgTilemapBuffer(0, &gPokenavHeader_Tilemap, 0, 0); + CopyPaletteIntoBufferUnfaded(gPokenavHeader_Pal, 0, 0x20); + CopyBgTilemapBufferToVram(0); + return 0; + case 2: + if (free_temp_tile_data_buffers_if_possible()) + return 2; + + sub_81C7B74(); + return 0; + case 3: + if (IsDma3ManagerBusyWithBgCopy()) + return 2; + + sub_81C7C28(); + sub_81C7D28(); + ShowBg(0); + return 4; + default: + return 4; + } +} + +void sub_81C7834(u32 (*a0)(void), u32(*a1)(void)) +{ + u32 (**v1)(void); + + v1 = sub_81C763C(0); + v1[0] = a0; + v1[1] = a1; + v1[2] = NULL; +} + +void sub_81C7850(u32 a0) +{ + void (**v1)(u32); + + v1 = sub_81C763C(0); + v1[2] = NULL; + v1[0](a0); +} + +u32 sub_81C786C(void) +{ + u32 (**v1)(void); + + v1 = sub_81C763C(0); + return v1[1](); +} + +void sub_81C7880(void) +{ + u32 *v1; + + v1 = sub_81C763C(0); + v1[3] = sub_81C7078(atk47_cmd47, 4); +} + +void sub_81C78A0(void) +{ + u32 *v1; + + v1 = sub_81C763C(0); + v1[3] = sub_81C7078(sub_81C791C, 4); +} + +bool32 sub_81C78C0(void) +{ + u32 *v1; + + v1 = sub_81C763C(0); + return sub_81C70D8(v1[3]); +} + +u32 atk47_cmd47(s32 a0) +{ + switch (a0) + { + default: + return 4; + case 1: + return 0; + case 0: + return 0; + case 2: + if ((u32)ChangeBgY(0, 384, 1) >= 0x2000) + { + ChangeBgY(0, 0x2000, 0); + return 4; + } + + return 2; + } +} + +u32 sub_81C791C(s32 a0) +{ + if (ChangeBgY(0, 384, 2) <= 0) + { + ChangeBgY(0, 0, 0); + return 4; + } + return 2; +} + +void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size) { + CpuCopy16(palette, gPlttBufferUnfaded + bufferOffset, size); +} + +void sub_81C795C(const struct SpritePalette *palettes) +{ + const struct SpritePalette *current; + u32 index; + + for (current = palettes; current->data != NULL; current++) + { + index = AllocSpritePalette(current->tag); + if (index == 0xFF) + { + break; + } + else + { + index = (index * 16) + 0x100; + CopyPaletteIntoBufferUnfaded(current->data, index, 0x20); + } + } +} + +void sub_81C7990(u32 a0, u16 a1) +{ + CpuFill16(a1, gPlttBufferFaded + 0x100 + (a0 * 16), 16 * sizeof(u16)); +} + +__attribute__((naked)) +void sub_81C79BC(u16 *a0, u16 *a1, u32 a2, u32 a3, u32 unused, u32 a5, u32 a6) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0xC\n\ + str r0, [sp]\n\ + str r1, [sp, 0x4]\n\ + mov r10, r2\n\ + str r3, [sp, 0x8]\n\ + ldr r0, [sp, 0x2C]\n\ + cmp r0, 0\n\ + bne _081C79E4\n\ + ldr r2, =0x001fffff\n\ + mov r1, r10\n\ + ands r2, r1\n\ + ldr r0, [sp]\n\ + b _081C79F4\n\ + .pool\n\ +_081C79E4:\n\ + ldr r2, [sp, 0x2C]\n\ + ldr r0, [sp, 0x8]\n\ + cmp r2, r0\n\ + blt _081C7A00\n\ + ldr r2, =0x001fffff\n\ + mov r1, r10\n\ + ands r2, r1\n\ + ldr r0, [sp, 0x4]\n\ +_081C79F4:\n\ + ldr r1, [sp, 0x30]\n\ + bl CpuSet\n\ + b _081C7AAE\n\ + .pool\n\ +_081C7A00:\n\ + movs r2, 0x1\n\ + negs r2, r2\n\ + add r10, r2\n\ + b _081C7AA6\n\ +_081C7A08:\n\ + ldr r1, [sp]\n\ + ldrh r0, [r1]\n\ + movs r2, 0x1F\n\ + mov r9, r2\n\ + mov r1, r9\n\ + ands r1, r0\n\ + mov r9, r1\n\ + lsls r0, 16\n\ + lsrs r2, r0, 21\n\ + movs r1, 0x1F\n\ + ands r1, r2\n\ + mov r8, r1\n\ + lsrs r7, r0, 26\n\ + movs r2, 0x1F\n\ + ands r7, r2\n\ + ldr r0, [sp, 0x4]\n\ + ldrh r4, [r0]\n\ + movs r0, 0x1F\n\ + ands r0, r4\n\ + mov r1, r9\n\ + subs r0, r1\n\ + lsls r0, 8\n\ + ldr r1, [sp, 0x8]\n\ + bl __divsi3\n\ + ldr r2, [sp, 0x2C]\n\ + adds r6, r0, 0\n\ + muls r6, r2\n\ + asrs r6, 8\n\ + lsls r4, 16\n\ + lsrs r0, r4, 21\n\ + movs r1, 0x1F\n\ + ands r0, r1\n\ + mov r2, r8\n\ + subs r0, r2\n\ + lsls r0, 8\n\ + ldr r1, [sp, 0x8]\n\ + bl __divsi3\n\ + ldr r1, [sp, 0x2C]\n\ + adds r5, r0, 0\n\ + muls r5, r1\n\ + asrs r5, 8\n\ + lsrs r4, 26\n\ + movs r2, 0x1F\n\ + ands r4, r2\n\ + subs r4, r7\n\ + lsls r4, 8\n\ + adds r0, r4, 0\n\ + ldr r1, [sp, 0x8]\n\ + bl __divsi3\n\ + ldr r1, [sp, 0x2C]\n\ + muls r0, r1\n\ + asrs r0, 8\n\ + add r6, r9\n\ + movs r2, 0x1F\n\ + ands r6, r2\n\ + add r5, r8\n\ + ands r5, r2\n\ + adds r0, r7, r0\n\ + ands r0, r2\n\ + lsls r0, 10\n\ + lsls r5, 5\n\ + orrs r0, r5\n\ + orrs r0, r6\n\ + ldr r1, [sp, 0x30]\n\ + strh r0, [r1]\n\ + ldr r2, [sp]\n\ + adds r2, 0x2\n\ + str r2, [sp]\n\ + ldr r0, [sp, 0x4]\n\ + adds r0, 0x2\n\ + str r0, [sp, 0x4]\n\ + adds r1, 0x2\n\ + str r1, [sp, 0x30]\n\ + movs r1, 0x1\n\ + negs r1, r1\n\ + add r10, r1\n\ +_081C7AA6:\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + cmp r10, r0\n\ + bne _081C7A08\n\ +_081C7AAE:\n\ + add sp, 0xC\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided"); +} + +void sub_81C7AC0(s32 a0) +{ + u32 *v1; + v1 = sub_81C763C(0); + switch (a0) + { + case 0: + BeginNormalPaletteFade(v1[5], -2, 0, 16, RGB_BLACK); + break; + case 1: + BeginNormalPaletteFade(v1[5], -2, 16, 0, RGB_BLACK); + break; + case 2: + BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 16, RGB_BLACK); + break; + case 3: + BeginNormalPaletteFade(0xFFFFFFFF, -2, 16, 0, RGB_BLACK); + break; + } +} + +bool32 IsPaletteFadeActive(void) +{ + return gPaletteFade.active; +} + +void sub_81C7B40(void) +{ + BlendPalettes(0xFFFEFFFE, 16, RGB_BLACK); +} + +void sub_81C7B54(const struct BgTemplate *a0, s32 a1) +{ + s32 i; + if (a1 <= 0) + return; + for (i = a1; i != 0; i--) + { + InitBgFromTemplate(a0++); + } +} + +void sub_81C7B74(void) +{ + u32 *v1; + + v1 = sub_81C763C(0); + InitWindows(&gUnknown_0861FA08[0]); + v1[4] = 0; + sub_81C7BF8(0); + PutWindowTilemap(v1[4]); + CopyWindowToVram(v1[4], 3); // TODO: Use a defined constant here. +} + +void sub_81C7BA4(u32 a0) +{ + u32 *v1; + + v1 = sub_81C763C(0); + sub_81C7BF8(v1[4]); + AddTextPrinterParameterized3(v1[4], 1, 0, 1, gMenuButtonReminderColor, 0, MenuButtonReminders[a0]); +} + +bool8 sub_81C7BE8(void) +{ + return IsDma3ManagerBusyWithBgCopy(); +} + +void sub_81C7BF8(u32 a0) +{ + FillWindowPixelBuffer(a0, 0x44); + FillWindowPixelRect(a0, 0x55, 0, 0, 0x80, 1); +} + +void sub_81C7C28(void) +{ + u32 *v1; + u32 i; + u8 v2; + u32 v3; + u32 v4; + u8 spriteId; + + v1 = sub_81C763C(0); + for (i = 0; i < ARRAY_COUNT(gUnknown_0861FA4C); i++) + { + LoadCompressedSpriteSheet(&gUnknown_0861FA4C[i]); + } + + sub_81C795C(gUnknown_0861FA54); + v2 = IndexOfSpritePaletteTag(0); + v1[5] = ~1 & ~(0x10000 << v2); + spriteId = CreateSprite(&gUnknown_0861FB04, 220, 12, 0); + v1[6] = (u32)(&gSprites[spriteId]); +} + +void sub_81C7C94(void) +{ + void **v1; + v1 = sub_81C763C(0); + DestroySprite(v1[6]); + FreeSpriteTilesByTag(0); + FreeSpritePaletteByTag(0); +} + +void sub_81C7CB4(u16 *a0) +{ + u32 v1; + v1 = GetBgY(0); + a0[19] = (v1 >> 8) * -1; +} + +struct Sprite *sub_81C7CCC(void) +{ + struct Sprite **v1; + struct Sprite *v2; + v1 = sub_81C763C(0); + v2 = v1[6]; + v2->callback = SpriteCallbackDummy; + return v2; +} diff --git a/src/record_mixing.c b/src/record_mixing.c index 7bbb4286d..aafd7284b 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -1095,7 +1095,7 @@ void GetPlayerHallRecords(struct PlayerHallRecords *dst) CopyTrainerId(dst->twoPlayers[j].id1, gSaveBlock2Ptr->playerTrainerId); CopyTrainerId(dst->twoPlayers[j].id2, gSaveBlock2Ptr->frontier.field_EF1[j]); StringCopy(dst->twoPlayers[j].name1, gSaveBlock2Ptr->playerName); - StringCopy(dst->twoPlayers[j].name2, gSaveBlock2Ptr->frontier.field_EE1[j]); + StringCopy(dst->twoPlayers[j].name2, gSaveBlock2Ptr->frontier.opponentName[j]); } for (i = 0; i < 2; i++) diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index 19f032fd0..0f3ebe633 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -1687,7 +1687,7 @@ void sub_801440C(u8 taskId) case 9 ... 11: case 13: case 15: - sub_800E3A8(); + RecordMixTrainerNames(); break; } @@ -1800,12 +1800,12 @@ void sub_8014790(u8 taskId) sendBuff[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL); gMain.savedCallback = NULL; data[0] = 4; - sub_800E3A8(); + RecordMixTrainerNames(); ResetBlockReceivedFlags(); break; case 16: case 23 ... 27: - sub_800E3A8(); + RecordMixTrainerNames(); DestroyTask(taskId); default: EnableBothScriptContexts(); diff --git a/src/strings.c b/src/strings.c index b0eb048ba..f81a19083 100644 --- a/src/strings.c +++ b/src/strings.c @@ -965,18 +965,18 @@ const u8 gUnknown_085EBE8E[] = _("Can't call opponent here."); const u8 gUnknown_085EBEA8[] = _("STRATEGY"); const u8 gUnknown_085EBEB1[] = _("TRAINER'S POKéMON"); const u8 gUnknown_085EBEC3[] = _("SELF-INTRODUCTION"); -const u8 gUnknown_085EBED5[] = _("{CLEAR 0x80}"); -const u8 gUnknown_085EBED9[] = _("{A_BUTTON}ZOOM {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBEE9[] = _("{A_BUTTON}FULL {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBEF9[] = _("{A_BUTTON}CONDITION {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF0E[] = _("{A_BUTTON}MARKINGS {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF22[] = _("{A_BUTTON}SELECT MARK {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF39[] = _("{A_BUTTON}MENU {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF49[] = _("{A_BUTTON}OK {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF57[] = _("{B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF60[] = _("{A_BUTTON}RIBBONS {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF73[] = _("{A_BUTTON}CHECK {B_BUTTON}CANCEL"); -const u8 gUnknown_085EBF84[] = _("{B_BUTTON}CANCEL"); +const u8 gText_Navgear_ClearButtonList[] = _("{CLEAR 0x80}"); +const u8 gText_NavgearMap_ZoomedOutButtons[] = _("{A_BUTTON}ZOOM {B_BUTTON}CANCEL"); +const u8 gText_NavgearMap_ZoomedInButtons[] = _("{A_BUTTON}FULL {B_BUTTON}CANCEL"); +const u8 gText_NavgearCondition_MonListButtons[] = _("{A_BUTTON}CONDITION {B_BUTTON}CANCEL"); +const u8 gText_NavgearCondition_MonStatusButtons[] = _("{A_BUTTON}MARKINGS {B_BUTTON}CANCEL"); +const u8 gText_NavgearCondition_MarkingButtons[] = _("{A_BUTTON}SELECT MARK {B_BUTTON}CANCEL"); +const u8 gText_NavgearMatchCall_TrainerListButtons[] = _("{A_BUTTON}MENU {B_BUTTON}CANCEL"); +const u8 gText_NavgearMatchCall_CallMenuButtons[] = _("{A_BUTTON}OK {B_BUTTON}CANCEL"); +const u8 gText_NavgearMatchCall_CheckTrainerButtons[] = _("{B_BUTTON}CANCEL"); +const u8 gText_NavgearRibbons_MonListButtons[] = _("{A_BUTTON}RIBBONS {B_BUTTON}CANCEL"); +const u8 gText_NavgearRibbons_RibbonListButtons[] = _("{A_BUTTON}CHECK {B_BUTTON}CANCEL"); +const u8 gText_NavgearRibbons_RibbonCheckButtons[] = _("{B_BUTTON}CANCEL"); const u8 gText_NatureSlash[] = _("NATURE/"); const u8 gText_TrainerCloseBy[] = _("That TRAINER is close by.\nTalk to the TRAINER in person!"); const u8 gText_InParty[] = _("IN PARTY");