diff --git a/asm/pokemon_jump.s b/asm/pokemon_jump.s deleted file mode 100755 index 73582cb06..000000000 --- a/asm/pokemon_jump.s +++ /dev/null @@ -1,2866 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - thumb_func_start sub_802DA44 -sub_802DA44: @ 802DA44 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r1, [r4] - ldrh r0, [r1, 0x12] - cmp r0, 0xFF - bne _0802DA58 -_0802DA50: - movs r0, 0 - b _0802DA84 - .pool -_0802DA58: - ldrb r0, [r1, 0xD] - cmp r0, 0 - bne _0802DA7E - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802DA82 - ldr r0, [r4] - ldrb r0, [r0, 0x12] - bl RemoveWindow - ldr r1, [r4] - movs r0, 0xFF - strh r0, [r1, 0x12] - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] - b _0802DA50 -_0802DA7E: - cmp r0, 0x1 - beq _0802DA50 -_0802DA82: - movs r0, 0x1 -_0802DA84: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802DA44 - - thumb_func_start sub_802DA8C -sub_802DA8C: @ 802DA8C - push {lr} - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_802DA8C - - thumb_func_start sub_802DA9C -sub_802DA9C: @ 802DA9C - push {r4-r6,lr} - sub sp, 0x8 - ldr r6, =0xffffff00 - ldr r4, [sp] - ands r4, r6 - lsls r0, 24 - lsrs r0, 16 - ldr r5, =0xffff00ff - ands r4, r5 - orrs r4, r0 - lsls r1, 24 - lsrs r1, 8 - ldr r0, =0xff00ffff - ands r4, r0 - orrs r4, r1 - lsls r2, 24 - ldr r0, =0x00ffffff - ands r4, r0 - orrs r4, r2 - str r4, [sp] - lsls r3, 24 - lsrs r3, 24 - ldr r0, [sp, 0x4] - ands r0, r6 - orrs r0, r3 - ands r0, r5 - movs r1, 0xF0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0x86 - lsls r1, 15 - orrs r0, r1 - str r0, [sp, 0x4] - mov r0, sp - bl AddWindow - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r4, 0 - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DA9C - - thumb_func_start sub_802DB18 -sub_802DB18: @ 802DB18 - push {r4,r5,lr} - sub sp, 0x8 - adds r3, r2, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r5, =0xffffff00 - ldr r2, [sp] - ands r2, r5 - lsls r0, 24 - lsrs r0, 16 - ldr r4, =0xffff00ff - ands r2, r4 - orrs r2, r0 - lsls r1, 24 - lsrs r1, 8 - ldr r0, =0xff00ffff - ands r2, r0 - orrs r2, r1 - ldr r0, =0x00ffffff - ands r2, r0 - movs r0, 0xC0 - lsls r0, 19 - orrs r2, r0 - str r2, [sp] - ldr r0, [sp, 0x4] - ands r0, r5 - movs r1, 0x4 - orrs r0, r1 - ands r0, r4 - movs r1, 0x80 - lsls r1, 2 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xAC - lsls r1, 14 - orrs r0, r1 - str r0, [sp, 0x4] - mov r0, sp - movs r1, 0x1 - movs r2, 0xD - bl CreateYesNoMenu - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DB18 - - thumb_func_start sub_802DB8C -sub_802DB8C: @ 802DB8C - push {r4,lr} - sub sp, 0x10 - ldr r1, =gUnknown_082FE1DC - add r0, sp, 0xC - movs r2, 0x3 - bl memcpy - movs r0, 0 - bl PutWindowTilemap - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - add r0, sp, 0xC - str r0, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r0, =gText_SpacePoints2 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - add r0, sp, 0xC - str r0, [sp] - str r4, [sp, 0x4] - ldr r0, =gText_SpaceTimes3 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DB8C - - thumb_func_start sub_802DBF8 -sub_802DBF8: @ 802DBF8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - bl sub_802C8AC - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - ldr r1, =gUnknown_082FE260 - subs r0, 0x2 - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - movs r6, 0 - cmp r6, r10 - bge _0802DC62 - ldr r0, =gMonFrontPicCoords - mov r9, r0 - ldr r1, =gUnknown_02022D00 - mov r8, r1 -_0802DC26: - lsls r4, r6, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_802C8C8 - adds r1, r0, 0 - ldrh r0, [r1] - lsls r0, 2 - add r0, r9 - ldrb r3, [r0, 0x1] - mov r2, r8 - ldr r0, [r2] - movs r7, 0 - ldrsh r2, [r5, r7] - adds r3, 0x70 - str r4, [sp] - bl sub_802C9D4 - mov r1, r8 - ldr r0, [r1] - movs r2, 0 - ldrsh r1, [r5, r2] - movs r2, 0x70 - adds r3, r4, 0 - bl sub_802CE48 - adds r5, 0x2 - adds r6, 0x1 - cmp r6, r10 - blt _0802DC26 -_0802DC62: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DBF8 - - thumb_func_start sub_802DC80 -sub_802DC80: @ 802DC80 - ldr r2, =gUnknown_02022D00 - ldr r2, [r2] - lsls r0, 2 - ldr r3, =0x000081a8 - adds r2, r3 - adds r2, r0 - ldr r0, [r2] - strh r1, [r0, 0x26] - bx lr - .pool - thumb_func_end sub_802DC80 - - thumb_func_start sub_802DC9C -sub_802DC9C: @ 802DC9C - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - adds r1, r4, 0 - bl sub_802CF50 - ldr r0, =gUnknown_082FE1DF - adds r4, r0 - ldrb r0, [r4] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 13 - movs r0, 0x2 - movs r2, 0 - bl ChangeBgY - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DC9C - - thumb_func_start sub_802DCCC -sub_802DCCC: @ 802DCCC - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - movs r6, 0 -_0802DCD6: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0802DCEA - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - adds r1, r5, 0 - bl sub_802CB14 - adds r6, 0x1 -_0802DCEA: - lsrs r4, 1 - adds r5, 0x1 - cmp r5, 0x4 - ble _0802DCD6 - subs r0, r6, 0x2 - lsls r0, 24 - lsrs r0, 24 - bl sub_802E00C - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DCCC - - thumb_func_start sub_802DD08 -sub_802DD08: @ 802DD08 - push {r4,lr} - sub sp, 0x10 - mov r1, sp - movs r0, 0x40 - strb r0, [r1] - movs r0, 0x5 - strb r0, [r1, 0x1] - movs r0, 0x8 - strb r0, [r1, 0x2] - movs r0, 0x6C - strh r0, [r1, 0x4] - movs r4, 0x6 - strh r4, [r1, 0x6] - ldr r0, =gUnknown_082FE1EC - str r0, [sp, 0x8] - ldr r0, =gUnknown_082FE1F4 - str r0, [sp, 0xC] - movs r0, 0x2 - bl sub_8034C54 - movs r0, 0 - movs r1, 0 - mov r2, sp - bl sub_8034D14 - mov r1, sp - movs r0, 0x4 - strb r0, [r1, 0x1] - movs r0, 0x1E - strh r0, [r1, 0x4] - mov r0, sp - strh r4, [r0, 0x6] - movs r0, 0x1 - movs r1, 0 - mov r2, sp - bl sub_8034D14 - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DD08 - - thumb_func_start sub_802DD64 -sub_802DD64: @ 802DD64 - push {lr} - adds r1, r0, 0 - movs r0, 0 - bl sub_8035044 - pop {r0} - bx r0 - thumb_func_end sub_802DD64 - - thumb_func_start sub_802DD74 -sub_802DD74: @ 802DD74 - push {lr} - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x1 - bl sub_8035044 - pop {r0} - bx r0 - thumb_func_end sub_802DD74 - - thumb_func_start sub_802DD88 -sub_802DD88: @ 802DD88 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CBF0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DD88 - - thumb_func_start sub_802DDA0 -sub_802DDA0: @ 802DDA0 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CC88 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDA0 - - thumb_func_start sub_802DDB8 -sub_802DDB8: @ 802DDB8 - push {lr} - adds r1, r0, 0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CC18 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DDB8 - - thumb_func_start sub_802DDCC -sub_802DDCC: @ 802DDCC - push {lr} - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CCB0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDCC - - thumb_func_start sub_802DDE0 -sub_802DDE0: @ 802DDE0 - push {lr} - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CD3C - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDE0 - - thumb_func_start sub_802DDF4 -sub_802DDF4: @ 802DDF4 - push {lr} - adds r1, r0, 0 - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CD70 - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DDF4 - - thumb_func_start sub_802DE08 -sub_802DE08: @ 802DE08 - push {lr} - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - bl sub_802CD98 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802DE08 - - thumb_func_start sub_802DE1C -sub_802DE1C: @ 802DE1C - push {r4-r7,lr} - sub sp, 0x8 - bl sub_802C8AC - lsls r0, 16 - lsrs r7, r0, 16 - ldr r1, =gUnknown_082FE234 - subs r0, r7, 0x2 - lsls r0, 2 - adds r0, r1 - ldr r4, [r0] - ldr r2, =0xffffff00 - ldr r0, [sp] - ands r0, r2 - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0x80 - lsls r1, 20 - orrs r0, r1 - str r0, [sp] - ldr r0, [sp, 0x4] - ands r0, r2 - movs r1, 0x2 - orrs r0, r1 - ldr r1, =0xffff00ff - ands r0, r1 - movs r1, 0x80 - lsls r1, 2 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xAC - lsls r1, 14 - orrs r0, r1 - str r0, [sp, 0x4] - movs r5, 0 - cmp r5, r7 - bge _0802DEAC - mov r6, sp -_0802DE6A: - ldrb r0, [r4] - lsls r0, 8 - ldr r2, =0xffff00ff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - ldrb r2, [r4, 0x2] - lsls r2, 16 - ldr r0, =0xff00ffff - ands r0, r1 - orrs r0, r2 - str r0, [sp] - mov r0, sp - bl AddWindow - ldr r1, =gUnknown_02022D00 - ldr r1, [r1] - lsls r2, r5, 1 - adds r1, 0x1C - adds r1, r2 - strh r0, [r1] - lsls r0, 24 - lsrs r0, 24 - bl ClearWindowTilemap - ldrh r0, [r6, 0x6] - adds r0, 0x10 - strh r0, [r6, 0x6] - adds r4, 0x4 - adds r5, 0x1 - cmp r5, r7 - blt _0802DE6A -_0802DEAC: - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DE1C - - thumb_func_start sub_802DED8 -sub_802DED8: @ 802DED8 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x10 - adds r5, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - add r0, sp, 0xC - strb r1, [r0] - strb r2, [r0, 0x1] - strb r3, [r0, 0x2] - ldr r6, =gUnknown_02022D00 - ldr r0, [r6] - lsls r1, r5, 1 - mov r8, r1 - adds r0, 0x1C - add r0, r8 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - lsls r5, 24 - lsrs r5, 24 - adds r0, r5, 0 - bl sub_802C8E8 - adds r1, r0, 0 - movs r2, 0x1 - negs r2, r2 - mov r9, r2 - movs r0, 0x1 - bl GetStringWidth - movs r4, 0x40 - subs r4, r0 - lsrs r4, 1 - adds r0, r5, 0 - bl sub_802C8E8 - adds r1, r0, 0 - ldr r0, [r6] - adds r0, 0x1C - add r0, r8 - ldrb r0, [r0] - lsls r4, 24 - lsrs r4, 24 - add r2, sp, 0xC - str r2, [sp] - mov r2, r9 - str r2, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - ldr r0, [r6] - adds r0, 0x1C - add r0, r8 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DED8 - - thumb_func_start sub_802DF70 -sub_802DF70: @ 802DF70 - push {r4-r6,lr} - adds r4, r0, 0 - bl sub_802C8AC - lsls r0, 16 - lsrs r5, r0, 16 - cmp r4, 0 - bne _0802DF9A - movs r4, 0 - cmp r4, r5 - bge _0802DFCC -_0802DF86: - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0x3 - bl sub_802DED8 - adds r4, 0x1 - cmp r4, r5 - blt _0802DF86 - b _0802DFCC -_0802DF9A: - bl sub_802C8BC - lsls r0, 16 - lsrs r6, r0, 16 - movs r4, 0 - cmp r4, r5 - bge _0802DFCC -_0802DFA8: - cmp r6, r4 - beq _0802DFBA - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0x3 - bl sub_802DED8 - b _0802DFC6 -_0802DFBA: - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x4 - movs r3, 0x5 - bl sub_802DED8 -_0802DFC6: - adds r4, 0x1 - cmp r4, r5 - blt _0802DFA8 -_0802DFCC: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802DF70 - - thumb_func_start sub_802DFD4 -sub_802DFD4: @ 802DFD4 - push {r4,r5,lr} - bl sub_802C8AC - lsls r0, 16 - lsrs r5, r0, 16 - movs r4, 0 - cmp r4, r5 - bge _0802DFFA -_0802DFE4: - ldr r0, =gUnknown_02022D00 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x1C - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - adds r4, 0x1 - cmp r4, r5 - blt _0802DFE4 -_0802DFFA: - movs r0, 0 - bl CopyBgTilemapBufferToVram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802DFD4 - - thumb_func_start sub_802E00C -sub_802E00C: @ 802E00C - push {r4,lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - ldr r0, =gUnknown_02022D00 - ldr r2, [r0] - movs r0, 0 - str r0, [r2, 0x18] - lsrs r1, 25 - lsls r1, 16 - movs r0, 0x1 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - ands r4, r0 - lsls r4, 8 - subs r4, 0x28 - lsls r4, 8 - adds r1, r4, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - bl ShowBg - ldr r0, =sub_802E090 - movs r1, 0x4 - bl CreateTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E00C - - thumb_func_start sub_802E058 -sub_802E058: @ 802E058 - push {r4,lr} - ldr r4, =gUnknown_02022D00 - ldr r0, [r4] - ldr r0, [r0, 0x18] - cmp r0, 0x1F - bls _0802E06C - movs r0, 0 - b _0802E08A - .pool -_0802E06C: - movs r0, 0x1 - movs r1, 0x80 - movs r2, 0x1 - bl ChangeBgY - ldr r1, [r4] - ldr r0, [r1, 0x18] - adds r0, 0x1 - str r0, [r1, 0x18] - cmp r0, 0x1F - bls _0802E088 - movs r0, 0x1 - bl HideBg -_0802E088: - movs r0, 0x1 -_0802E08A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802E058 - - thumb_func_start sub_802E090 -sub_802E090: @ 802E090 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_802E058 - cmp r0, 0 - bne _0802E0A4 - adds r0, r4, 0 - bl DestroyTask -_0802E0A4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802E090 - - thumb_func_start sub_802E0AC -sub_802E0AC: @ 802E0AC - push {lr} - sub sp, 0xC - mov r2, sp - movs r1, 0x1 - strb r1, [r2] - ldrh r1, [r0] - strh r1, [r2, 0x2] - ldr r1, [r0, 0x4] - str r1, [sp, 0x8] - ldr r0, [r0, 0x8] - str r0, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_802E0AC - - thumb_func_start sub_802E0D0 -sub_802E0D0: @ 802E0D0 - push {r4,lr} - sub sp, 0xC - adds r4, r1, 0 - ldr r3, =gRecvCmds - lsls r2, r0, 4 - adds r0, r2, r3 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - movs r1, 0xBC - lsls r1, 6 - cmp r0, r1 - bne _0802E100 - adds r1, r3, 0x2 - adds r1, r2, r1 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x1 - beq _0802E108 -_0802E100: - movs r0, 0 - b _0802E118 - .pool -_0802E108: - mov r0, sp - ldrh r0, [r0, 0x2] - strh r0, [r4] - ldr r0, [sp, 0x8] - str r0, [r4, 0x4] - ldr r0, [sp, 0x4] - str r0, [r4, 0x8] - movs r0, 0x1 -_0802E118: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802E0D0 - - thumb_func_start sub_802E120 -sub_802E120: @ 802E120 - push {lr} - sub sp, 0xC - mov r2, sp - movs r1, 0x2 - strb r1, [r2] - str r0, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_802E120 - - thumb_func_start sub_802E138 -sub_802E138: @ 802E138 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - mov r3, sp - movs r2, 0x3 - strb r2, [r3] - ldr r3, [r1, 0x8] - lsls r3, 15 - ldr r2, [sp, 0x8] - ldr r4, =0x00007fff - mov r8, r4 - ands r2, r4 - orrs r2, r3 - str r2, [sp, 0x8] - mov r6, sp - ldrb r2, [r1, 0x1] - movs r5, 0x1F - adds r3, r5, 0 - ands r3, r2 - ldrb r4, [r6, 0x3] - movs r2, 0x20 - negs r2, r2 - ands r2, r4 - orrs r2, r3 - strb r2, [r6, 0x3] - mov r3, sp - ldrb r2, [r1] - strb r2, [r3, 0x1] - ldrh r2, [r1, 0x2] - strh r2, [r3, 0x6] - mov r4, sp - ldrh r2, [r1, 0x4] - mov r1, r8 - ands r2, r1 - ldrh r3, [r4, 0x8] - ldr r1, =0xffff8000 - ands r1, r3 - orrs r1, r2 - strh r1, [r4, 0x8] - mov r2, sp - ldrh r1, [r0, 0x10] - strb r1, [r2, 0x2] - mov r3, sp - ldr r1, [r0, 0x14] - lsls r1, 5 - ldrb r2, [r3, 0x3] - ands r5, r2 - orrs r5, r1 - strb r5, [r3, 0x3] - mov r1, sp - ldrh r0, [r0, 0xE] - strh r0, [r1, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E138 - - thumb_func_start sub_802E1BC -sub_802E1BC: @ 802E1BC - push {r4,r5,lr} - sub sp, 0xC - adds r5, r0, 0 - adds r4, r1, 0 - ldr r2, =gRecvCmds - ldrh r0, [r2] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _0802E228 - adds r1, r2, 0x2 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x3 - bne _0802E228 - ldr r0, [sp, 0x8] - lsrs r0, 15 - str r0, [r4, 0x8] - mov r0, sp - ldrb r1, [r0, 0x3] - lsls r0, r1, 27 - lsrs r0, 27 - strb r0, [r4, 0x1] - mov r0, sp - ldrb r0, [r0, 0x1] - strb r0, [r4] - mov r0, sp - ldrh r0, [r0, 0x6] - strh r0, [r4, 0x2] - mov r0, sp - ldrh r0, [r0, 0x8] - lsls r0, 17 - lsrs r0, 17 - strh r0, [r4, 0x4] - mov r0, sp - ldrb r0, [r0, 0x2] - strh r0, [r5, 0x10] - lsls r1, 24 - lsrs r1, 29 - str r1, [r5, 0x14] - mov r0, sp - ldrh r0, [r0, 0x4] - strh r0, [r5, 0xE] - movs r0, 0x1 - b _0802E22A - .pool -_0802E228: - movs r0, 0 -_0802E22A: - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_802E1BC - - thumb_func_start sub_802E234 -sub_802E234: @ 802E234 - push {r4,lr} - sub sp, 0xC - mov r4, sp - movs r3, 0x4 - strb r3, [r4] - ldrh r3, [r0, 0x10] - strb r3, [r4, 0x1] - ldr r3, [r0, 0x14] - strb r3, [r4, 0x2] - ldr r3, [r0, 0x18] - strb r3, [r4, 0x3] - mov r3, sp - ldrh r0, [r0, 0xE] - strh r0, [r3, 0x4] - mov r0, sp - strb r1, [r0, 0x6] - strh r2, [r0, 0x8] - bl sub_800FE50 - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_802E234 - - thumb_func_start sub_802E264 -sub_802E264: @ 802E264 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r3, =gRecvCmds - lsls r2, r1, 4 - adds r0, r2, r3 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - movs r1, 0xBC - lsls r1, 6 - cmp r0, r1 - bne _0802E2C4 - adds r1, r3, 0x2 - adds r1, r2, r1 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x4 - bne _0802E2C4 - mov r0, sp - ldrb r0, [r0, 0x1] - strh r0, [r4, 0x10] - mov r0, sp - ldrb r0, [r0, 0x2] - str r0, [r4, 0x14] - mov r0, sp - ldrb r0, [r0, 0x3] - str r0, [r4, 0x18] - mov r0, sp - ldrh r0, [r0, 0x4] - strh r0, [r4, 0xE] - mov r0, sp - ldrb r0, [r0, 0x6] - strb r0, [r5] - mov r0, sp - ldrh r0, [r0, 0x8] - strh r0, [r6] - movs r0, 0x1 - b _0802E2C6 - .pool -_0802E2C4: - movs r0, 0 -_0802E2C6: - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_802E264 - - thumb_func_start sub_802E2D0 -sub_802E2D0: @ 802E2D0 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - ldr r3, =gRecvCmds - lsls r2, r1, 4 - adds r0, r2, r3 - ldrh r1, [r0] - movs r0, 0xFF - lsls r0, 8 - ands r0, r1 - movs r1, 0xBC - lsls r1, 6 - cmp r0, r1 - bne _0802E320 - adds r1, r3, 0x2 - adds r1, r2, r1 - mov r0, sp - movs r2, 0xC - bl memcpy - mov r0, sp - ldrb r0, [r0] - cmp r0, 0x4 - bne _0802E320 - mov r0, sp - ldrb r0, [r0, 0x1] - strh r0, [r4, 0x10] - mov r0, sp - ldrb r0, [r0, 0x2] - str r0, [r4, 0x14] - mov r0, sp - ldrb r0, [r0, 0x3] - str r0, [r4, 0x18] - mov r0, sp - ldrh r0, [r0, 0x4] - strh r0, [r4, 0xE] - movs r0, 0x1 - b _0802E322 - .pool -_0802E320: - movs r0, 0 -_0802E322: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802E2D0 - - thumb_func_start sub_802E32C -sub_802E32C: @ 802E32C - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r1, 0xFE - lsls r1, 1 - adds r0, r1 - bx lr - .pool - thumb_func_end sub_802E32C - - thumb_func_start ResetPokeJumpResults -ResetPokeJumpResults: @ 802E33C - push {lr} - bl sub_802E32C - movs r1, 0 - strh r1, [r0] - str r1, [r0, 0xC] - strh r1, [r0, 0x4] - strh r1, [r0, 0x6] - str r1, [r0, 0x8] - strh r1, [r0, 0x2] - pop {r0} - bx r0 - thumb_func_end ResetPokeJumpResults - - thumb_func_start sub_802E354 -sub_802E354: @ 802E354 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 16 - lsrs r5, r1, 16 - lsls r2, 16 - lsrs r6, r2, 16 - bl sub_802E32C - adds r1, r0, 0 - movs r2, 0 - ldr r0, [r1, 0xC] - cmp r0, r4 - bcs _0802E378 - ldr r0, =0x00018696 - cmp r4, r0 - bhi _0802E378 - str r4, [r1, 0xC] - movs r2, 0x1 -_0802E378: - ldrh r0, [r1] - cmp r0, r5 - bcs _0802E388 - ldr r0, =0x0000270f - cmp r5, r0 - bhi _0802E388 - strh r5, [r1] - movs r2, 0x1 -_0802E388: - ldrh r0, [r1, 0x4] - cmp r0, r6 - bcs _0802E398 - ldr r0, =0x0000270f - cmp r6, r0 - bhi _0802E398 - strh r6, [r1, 0x4] - movs r2, 0x1 -_0802E398: - adds r0, r2, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802E354 - - thumb_func_start sub_802E3A8 -sub_802E3A8: @ 802E3A8 - push {lr} - bl sub_802E32C - adds r2, r0, 0 - ldrh r1, [r2, 0x6] - ldr r0, =0x0000270e - cmp r1, r0 - bhi _0802E3BC - adds r0, r1, 0x1 - strh r0, [r2, 0x6] -_0802E3BC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E3A8 - - thumb_func_start sub_802E3C4 -sub_802E3C4: @ 802E3C4 - push {r4,lr} - ldr r4, =sub_802E3E4 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E3C4 - - thumb_func_start sub_802E3E4 -sub_802E3E4: @ 802E3E4 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - movs r1, 0 - ldrsh r0, [r7, r1] - cmp r0, 0x1 - beq _0802E4A8 - cmp r0, 0x1 - bgt _0802E40C - cmp r0, 0 - beq _0802E416 - b _0802E4F6 - .pool -_0802E40C: - cmp r0, 0x2 - beq _0802E4B4 - cmp r0, 0x3 - beq _0802E4DC - b _0802E4F6 -_0802E416: - ldr r0, =gUnknown_082FE270 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - ldr r1, =gText_PkmnJumpRecords - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0 - movs r6, 0 - ldr r5, =gUnknown_082FE278 -_0802E430: - ldr r1, [r5] - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r0, 0x26 - cmp r0, r4 - ble _0802E442 - adds r4, r0, 0 -_0802E442: - adds r5, 0x4 - adds r6, 0x1 - cmp r6, 0x2 - bls _0802E430 - adds r0, r4, 0x7 - cmp r0, 0 - bge _0802E452 - adds r0, 0x7 -_0802E452: - asrs r4, r0, 3 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0802E45E - adds r4, 0x1 -_0802E45E: - movs r1, 0x1E - subs r1, r4 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - lsls r1, 24 - lsrs r1, 16 - ldr r2, =0xffff00ff - ldr r0, [sp] - ands r0, r2 - orrs r0, r1 - lsls r2, r4, 24 - ldr r1, =0x00ffffff - ands r0, r1 - orrs r0, r2 - str r0, [sp] - mov r0, sp - bl AddWindow - strh r0, [r7, 0x2] - ldrh r0, [r7, 0x2] - adds r1, r4, 0 - bl sub_802E500 - ldrb r0, [r7, 0x2] - movs r1, 0x3 - b _0802E4CA - .pool -_0802E4A8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802E4F6 - b _0802E4CE -_0802E4B4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0802E4F6 - ldrb r0, [r7, 0x2] - bl rbox_fill_rectangle - ldrb r0, [r7, 0x2] - movs r1, 0x1 -_0802E4CA: - bl CopyWindowToVram -_0802E4CE: - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - b _0802E4F6 - .pool -_0802E4DC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802E4F6 - ldrb r0, [r7, 0x2] - bl RemoveWindow - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts -_0802E4F6: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_802E3E4 - - thumb_func_start sub_802E500 -sub_802E500: @ 802E500 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - str r1, [sp, 0x1C] - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x18] - bl sub_802E32C - ldrh r1, [r0] - str r1, [sp, 0xC] - ldr r1, [r0, 0xC] - str r1, [sp, 0x10] - ldrh r0, [r0, 0x4] - str r0, [sp, 0x14] - ldr r0, [sp, 0x18] - lsls r4, r0, 24 - lsrs r4, 24 - ldr r5, =0x0000021d - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0xD0 - bl LoadUserWindowBorderGfx_ - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0xD - bl DrawTextBorderOuter - adds r0, r4, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r5, =gText_PkmnJumpRecords - ldr r1, [sp, 0x1C] - lsls r2, r1, 3 - movs r0, 0x1 - adds r1, r5, 0 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - movs r6, 0 - adds r7, r4, 0 - movs r0, 0xFF - mov r10, r0 - mov r9, r6 - mov r1, sp - adds r1, 0xC - str r1, [sp, 0x20] - movs r0, 0xC8 - lsls r0, 21 - mov r8, r0 - ldr r5, =gStringVar1 -_0802E58A: - ldr r1, =gUnknown_082FE278 - lsls r0, r6, 2 - adds r0, r1 - ldr r2, [r0] - mov r1, r8 - lsrs r4, r1, 24 - str r4, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [sp, 0x20] - ldm r0!, {r1} - str r0, [sp, 0x20] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - adds r0, r5, 0 - bl sub_802E620 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0 - bl GetStringWidth - ldr r1, [sp, 0x1C] - lsls r3, r1, 3 - subs r3, r0 - lsls r3, 24 - lsrs r3, 24 - str r4, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - movs r0, 0x80 - lsls r0, 21 - add r8, r0 - adds r6, 0x1 - ldr r1, [sp, 0x18] - lsls r0, r1, 24 - cmp r6, 0x2 - bls _0802E58A - lsrs r0, 24 - bl PutWindowTilemap - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E500 - - thumb_func_start sub_802E620 -sub_802E620: @ 802E620 - push {lr} - adds r1, r0, 0 - b _0802E628 -_0802E626: - adds r1, 0x1 -_0802E628: - ldrb r0, [r1] - cmp r0, 0xFF - beq _0802E636 - cmp r0, 0 - bne _0802E626 - movs r0, 0xFF - strb r0, [r1] -_0802E636: - pop {r0} - bx r0 - thumb_func_end sub_802E620 - - thumb_func_start sub_802E63C -sub_802E63C: @ 802E63C - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =sub_802E6D0 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x8] - strh r5, [r0, 0xA] - ldr r0, =gUnknown_082FE748 - lsls r5, 4 - adds r5, r0 - ldr r1, [r5] - adds r0, r4, 0 - bl _call_via_r1 - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802E63C - - thumb_func_start sub_802E688 -sub_802E688: @ 802E688 - push {lr} - ldr r0, =sub_802E6D0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0802E6B4 - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x2 - strh r0, [r1, 0x8] - movs r0, 0x1 - b _0802E6B6 - .pool -_0802E6B4: - movs r0, 0 -_0802E6B6: - pop {r1} - bx r1 - thumb_func_end sub_802E688 - - thumb_func_start sub_802E6BC -sub_802E6BC: @ 802E6BC - push {lr} - ldr r0, =sub_802E6D0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802E6BC - - thumb_func_start sub_802E6D0 -sub_802E6D0: @ 802E6D0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x3 - beq _0802E71C - cmp r0, 0x3 - bgt _0802E6F8 - cmp r0, 0x2 - beq _0802E6FE - b _0802E752 - .pool -_0802E6F8: - cmp r0, 0x4 - beq _0802E738 - b _0802E752 -_0802E6FE: - ldr r1, =gUnknown_082FE748 - movs r2, 0x2 - ldrsh r0, [r4, r2] - lsls r0, 4 - adds r1, 0x8 - adds r0, r1 - ldr r1, [r0] - adds r0, r5, 0 - bl _call_via_r1 - movs r0, 0x3 - strh r0, [r4] - b _0802E752 - .pool -_0802E71C: - ldr r0, =gUnknown_082FE748 - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 4 - adds r0, 0xC - adds r1, r0 - ldr r1, [r1] - adds r0, r5, 0 - bl _call_via_r1 - b _0802E752 - .pool -_0802E738: - ldr r0, =gUnknown_082FE748 - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 4 - adds r0, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r5, 0 - bl _call_via_r1 - adds r0, r5, 0 - bl DestroyTask -_0802E752: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E6D0 - - thumb_func_start sub_802E75C -sub_802E75C: @ 802E75C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r1, 0x6 - ldrsh r0, [r4, r1] - lsls r0, 3 - ldr r1, =gUnknown_082FE6C8 - adds r0, r1 - bl LoadCompressedSpriteSheet - movs r2, 0x8 - ldrsh r0, [r4, r2] - lsls r0, 3 - ldr r1, =gUnknown_082FE6D8 - adds r0, r1 - bl LoadSpritePalette - movs r5, 0 - movs r3, 0x10 - ldrsh r0, [r4, r3] - cmp r5, r0 - bge _0802E7C4 -_0802E790: - movs r0, 0x4 - ldrsh r1, [r4, r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - ldr r1, =gUnknown_082FE730 - adds r0, r1 - movs r2, 0x12 - ldrsh r1, [r4, r2] - movs r3, 0x14 - ldrsh r2, [r4, r3] - ldrb r3, [r4, 0xE] - bl CreateSprite - lsls r1, r5, 1 - adds r1, r4 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x1A] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r5, r0 - blt _0802E790 -_0802E7C4: - movs r5, 0 - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r5, r0 - bge _0802E820 - movs r7, 0x3 - movs r3, 0xD - negs r3, r3 - mov r12, r3 - ldr r6, =gSprites -_0802E7D8: - lsls r0, r5, 1 - adds r0, r4 - movs r1, 0x1A - ldrsh r0, [r0, r1] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldrb r1, [r4, 0xC] - ands r1, r7 - lsls r1, 2 - ldrb r3, [r2, 0x5] - mov r0, r12 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x5] - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldrh r0, [r4, 0xA] - strh r0, [r2, 0x30] - mov r3, r8 - strh r3, [r2, 0x34] - strh r5, [r2, 0x36] - ldrh r0, [r4, 0x1A] - strh r0, [r2, 0x38] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r5, r0 - blt _0802E7D8 -_0802E820: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E75C - - thumb_func_start sub_802E83C -sub_802E83C: @ 802E83C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r1, =gTasks + 0x8 - adds r4, r1 - movs r5, 0 - strh r5, [r4, 0x4] - strh r5, [r4, 0x6] - strh r5, [r4, 0x8] - movs r1, 0x3C - strh r1, [r4, 0xA] - strh r5, [r4, 0xC] - strh r5, [r4, 0xE] - movs r1, 0x3 - strh r1, [r4, 0x10] - movs r1, 0x78 - strh r1, [r4, 0x12] - movs r1, 0x58 - strh r1, [r4, 0x14] - adds r1, r4, 0 - bl sub_802E75C - movs r0, 0x1C - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - movs r1, 0x4 - bl StartSpriteAnim - movs r0, 0x1C - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldr r1, =0x0000ffe0 - strh r1, [r0, 0x24] - movs r0, 0x1E - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x5 - bl StartSpriteAnim - movs r0, 0x1E - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x20 - strh r1, [r0, 0x24] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E83C - - thumb_func_start sub_802E8C8 -sub_802E8C8: @ 802E8C8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - b _0802E8FC - .pool -_0802E8E0: - lsls r0, r5, 1 - adds r0, r4 - movs r2, 0x1A - ldrsh r1, [r0, r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0802E8FC: - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r5, r0 - blt _0802E8E0 - ldr r1, =gUnknown_082FE6C8 - movs r2, 0x6 - ldrsh r0, [r4, r2] - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x6] - bl FreeSpriteTilesByTag - ldr r1, =gUnknown_082FE6D8 - movs r2, 0x8 - ldrsh r0, [r4, r2] - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x4] - bl FreeSpritePaletteByTag - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802E8C8 - - thumb_func_start sub_802E938 -sub_802E938: @ 802E938 - push {r4-r6,lr} - adds r6, r0, 0 - movs r0, 0x34 - ldrsh r1, [r6, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r1, 0x16 - ldrsh r0, [r5, r1] - movs r2, 0xA - ldrsh r1, [r5, r2] - bl __modsi3 - cmp r0, 0 - bne _0802EA4A - ldrh r2, [r5, 0x16] - movs r3, 0x16 - ldrsh r1, [r5, r3] - movs r3, 0x14 - ldrsh r0, [r5, r3] - cmp r1, r0 - beq _0802EA4A - strh r2, [r5, 0x14] - movs r1, 0x32 - ldrsh r0, [r6, r1] - cmp r0, 0x4 - bhi _0802EA44 - lsls r0, 2 - ldr r1, =_0802E984 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802E984: - .4byte _0802E998 - .4byte _0802E9A6 - .4byte _0802E9A6 - .4byte _0802E9BA - .4byte _0802EA04 -_0802E998: - adds r2, r6, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_0802E9A6: - movs r0, 0x38 - bl PlaySE - ldrh r1, [r6, 0x32] - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl StartSpriteAnim - b _0802EA44 -_0802E9BA: - movs r0, 0x15 - bl PlaySE - ldrh r1, [r6, 0x32] - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl StartSpriteAnim - ldr r4, =gSprites - movs r2, 0x1C - ldrsh r0, [r5, r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - strb r0, [r1] - movs r3, 0x1E - ldrsh r1, [r5, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - ands r2, r1 - strb r2, [r0] - b _0802EA44 - .pool -_0802EA04: - adds r1, r6, 0 - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - ldr r3, =gSprites - movs r0, 0x1C - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - movs r0, 0x1E - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - movs r0, 0x4 - strh r0, [r5] - b _0802EA4A - .pool -_0802EA44: - ldrh r0, [r6, 0x32] - adds r0, 0x1 - strh r0, [r6, 0x32] -_0802EA4A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802E938 - - thumb_func_start sub_802EA50 -sub_802EA50: @ 802EA50 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r5, =gTasks + 0x8 - adds r6, r4, r5 - movs r0, 0x38 - bl PlaySE - ldr r2, =gSprites - movs r0, 0x1A - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r2, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_802E938 - str r1, [r0] - movs r0, 0x1A - ldrsh r1, [r6, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - subs r5, 0x8 - adds r4, r5 - movs r0, 0x3 - strh r0, [r4, 0x8] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EA50 - - thumb_func_start sub_802EAB0 -sub_802EAB0: @ 802EAB0 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0802EB14 - ldr r1, =gRecvCmds - ldrh r0, [r1, 0x2] - ldr r5, =0x00007fff - cmp r0, r5 - bne _0802EAD8 - ldrh r0, [r1, 0x4] - strh r0, [r4, 0x16] -_0802EAD8: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0802EB1A - ldrh r0, [r4, 0x18] - adds r0, 0x1 - strh r0, [r4, 0x18] - mov r0, sp - movs r1, 0 - movs r2, 0xC - bl memset - mov r0, sp - strh r5, [r0] - mov r1, sp - ldrh r0, [r4, 0x18] - strh r0, [r1, 0x2] - mov r0, sp - bl sub_800FE50 - b _0802EB1A - .pool -_0802EB14: - ldrh r0, [r4, 0x16] - adds r0, 0x1 - strh r0, [r4, 0x16] -_0802EB1A: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_802EAB0 - - thumb_func_start sub_802EB24 -sub_802EB24: @ 802EB24 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - ldr r0, [sp, 0x18] - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =sub_802EB98 - movs r1, 0x50 - str r3, [sp] - 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, 0xC] - strh r5, [r1, 0xE] - strh r6, [r1, 0x10] - ldr r3, [sp] - strh r3, [r1, 0x12] - mov r0, r8 - strh r0, [r1, 0x14] - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EB24 - - thumb_func_start sub_802EB84 -sub_802EB84: @ 802EB84 - push {lr} - ldr r0, =sub_802EB98 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802EB84 - - thumb_func_start sub_802EB98 -sub_802EB98: @ 802EB98 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _0802EC08 - cmp r0, 0x1 - bgt _0802EBC0 - cmp r0, 0 - beq _0802EBC6 - b _0802EC8A - .pool -_0802EBC0: - cmp r0, 0x2 - beq _0802EC4C - b _0802EC8A -_0802EBC6: - ldrh r0, [r5, 0x4] - ldrh r1, [r5, 0x6] - bl sub_802EF50 - ldrh r0, [r5, 0x4] - ldrh r1, [r5, 0x6] - movs r3, 0x8 - ldrsh r2, [r5, r3] - movs r4, 0xA - ldrsh r3, [r5, r4] - ldrb r4, [r5, 0xC] - str r4, [sp] - bl sub_802EFA8 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0xE] - ldrh r0, [r5, 0x4] - ldrh r1, [r5, 0x6] - movs r3, 0x8 - ldrsh r2, [r5, r3] - movs r4, 0xA - ldrsh r3, [r5, r4] - ldrb r4, [r5, 0xC] - str r4, [sp] - adds r4, r5, 0 - adds r4, 0x10 - str r4, [sp, 0x4] - adds r4, 0x2 - str r4, [sp, 0x8] - bl sub_802EFFC - b _0802EC3E -_0802EC08: - ldrb r0, [r5, 0xE] - bl sub_802EC98 - cmp r0, 0 - bne _0802EC8A - ldrb r0, [r5, 0xE] - ldrb r1, [r5, 0x10] - ldrb r2, [r5, 0x12] - bl sub_802EDCC - movs r0, 0xE - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl FreeSpriteOamMatrix - movs r3, 0xE - ldrsh r1, [r5, r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite -_0802EC3E: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _0802EC8A - .pool -_0802EC4C: - ldrb r0, [r5, 0x10] - bl sub_802EE30 - cmp r0, 0 - bne _0802EC8A - movs r4, 0x10 - ldrsh r1, [r5, r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - movs r0, 0x12 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldrh r0, [r5, 0x4] - bl FreeSpriteTilesByTag - ldrh r0, [r5, 0x6] - bl FreeSpritePaletteByTag - adds r0, r6, 0 - bl DestroyTask -_0802EC8A: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EB98 - - thumb_func_start sub_802EC98 -sub_802EC98: @ 802EC98 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r4, r1, r0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x7 - bls _0802ECB2 - b _0802EDC4 -_0802ECB2: - lsls r0, 2 - ldr r1, =_0802ECC4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802ECC4: - .4byte _0802ECE4 - .4byte _0802ECF6 - .4byte _0802ED1C - .4byte _0802ED2C - .4byte _0802ED4E - .4byte _0802ED86 - .4byte _0802EDAC - .4byte _0802ED82 -_0802ECE4: - movs r1, 0x80 - lsls r1, 4 - adds r0, r4, 0 - movs r2, 0x1A - bl sub_8007E18 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_0802ECF6: - movs r2, 0x32 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _0802ED04 - movs r0, 0x39 - bl PlaySE -_0802ED04: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0802EDC4 - movs r0, 0 - strh r0, [r4, 0x32] - adds r0, r4, 0 - movs r1, 0x1 - b _0802EDA2 -_0802ED1C: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0802EDC4 - b _0802EDA6 -_0802ED2C: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _0802EDC4 - movs r0, 0 - strh r0, [r4, 0x32] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - adds r0, r4, 0 - movs r1, 0x2 - bl StartSpriteAffineAnim - b _0802EDC4 -_0802ED4E: - ldrh r0, [r4, 0x22] - subs r0, 0x4 - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _0802EDC4 - ldrh r1, [r4, 0x36] - movs r2, 0x36 - ldrsh r0, [r4, r2] - cmp r0, 0x1 - bgt _0802ED7E - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - movs r0, 0 - strh r0, [r4, 0x32] - b _0802EDA6 -_0802ED7E: - movs r0, 0x7 - strh r0, [r4, 0x2E] -_0802ED82: - movs r0, 0 - b _0802EDC6 -_0802ED86: - ldrh r0, [r4, 0x22] - adds r0, 0x4 - strh r0, [r4, 0x22] - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _0802EDC4 - movs r0, 0 - strh r0, [r4, 0x32] - adds r0, r4, 0 - movs r1, 0x3 -_0802EDA2: - bl StartSpriteAffineAnim -_0802EDA6: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - b _0802EDC2 -_0802EDAC: - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0802EDC4 - ldrh r0, [r4, 0x36] - adds r0, 0x1 - strh r0, [r4, 0x36] - movs r0, 0x1 -_0802EDC2: - strh r0, [r4, 0x2E] -_0802EDC4: - movs r0, 0x1 -_0802EDC6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802EC98 - - thumb_func_start sub_802EDCC -sub_802EDCC: @ 802EDCC - push {r4-r6,lr} - mov r6, r8 - push {r6} - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gSprites - mov r8, r0 - lsls r4, r1, 4 - adds r4, r1 - lsls r4, 2 - adds r5, r4, r0 - ldr r0, =0x0000ffd8 - strh r0, [r5, 0x26] - lsls r3, r2, 4 - adds r3, r2 - lsls r3, 2 - mov r1, r8 - adds r2, r3, r1 - strh r0, [r2, 0x26] - adds r5, 0x3E - ldrb r6, [r5] - movs r1, 0x5 - negs r1, r1 - adds r0, r1, 0 - ands r0, r6 - strb r0, [r5] - adds r2, 0x3E - ldrb r0, [r2] - ands r1, r0 - strb r1, [r2] - movs r0, 0x1C - add r8, r0 - add r4, r8 - ldr r0, =sub_802EE5C - str r0, [r4] - add r3, r8 - str r0, [r3] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EDCC - - thumb_func_start sub_802EE30 -sub_802EE30: @ 802EE30 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r2, 0x1C - adds r1, r2 - ldr r1, [r1] - ldr r0, =sub_802EE5C - cmp r1, r0 - bne _0802EE4E - movs r3, 0x1 -_0802EE4E: - adds r0, r3, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802EE30 - - thumb_func_start sub_802EE5C -sub_802EE5C: @ 802EE5C - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r5, 0 - adds r4, 0x2E - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0x4 - bhi _0802EF46 - lsls r0, 2 - ldr r1, =_0802EE7C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802EE7C: - .4byte _0802EE90 - .4byte _0802EEA0 - .4byte _0802EEC8 - .4byte _0802EEFC - .4byte _0802EF34 -_0802EE90: - movs r0, 0x40 - strh r0, [r4, 0x8] - ldrh r0, [r5, 0x26] - lsls r0, 4 - strh r0, [r4, 0xA] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_0802EEA0: - ldrh r1, [r4, 0x8] - ldrh r2, [r4, 0xA] - adds r0, r1, r2 - strh r0, [r4, 0xA] - adds r1, 0x1 - strh r1, [r4, 0x8] - lsls r0, 16 - asrs r0, 20 - strh r0, [r5, 0x26] - cmp r0, 0 - blt _0802EF46 - movs r0, 0x39 - bl PlaySE - movs r0, 0 - strh r0, [r5, 0x26] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _0802EF46 -_0802EEC8: - ldrh r0, [r4, 0x2] - adds r0, 0xC - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7F - ble _0802EEE6 - movs r0, 0x39 - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_0802EEE6: - ldr r0, =gSineTable - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 1 - adds r1, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - asrs r0, 4 - b _0802EF2A - .pool -_0802EEFC: - ldrh r0, [r4, 0x2] - adds r0, 0x10 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7F - ble _0802EF1A - movs r0, 0x39 - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2] - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_0802EF1A: - ldr r1, =gSineTable - movs r2, 0x2 - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 16 - asrs r0, 21 -_0802EF2A: - negs r0, r0 - strh r0, [r5, 0x26] - b _0802EF46 - .pool -_0802EF34: - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x28 - ble _0802EF46 - ldr r0, =SpriteCallbackDummy - str r0, [r5, 0x1C] -_0802EF46: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EE5C - - thumb_func_start sub_802EF50 -sub_802EF50: @ 802EF50 - push {r4,lr} - sub sp, 0x10 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =gUnknown_082FEBCC - ldr r3, [r2, 0x4] - ldr r2, [r2] - str r2, [sp] - str r3, [sp, 0x4] - ldr r2, =gUnknown_082FEBD4 - ldr r3, [r2, 0x4] - ldr r2, [r2] - str r2, [sp, 0x8] - str r3, [sp, 0xC] - lsls r0, 16 - ldr r3, =0x0000ffff - ldr r2, [sp, 0x4] - ands r2, r3 - orrs r2, r0 - str r2, [sp, 0x4] - ldr r2, =0xffff0000 - add r4, sp, 0x8 - ldr r0, [r4, 0x4] - ands r0, r2 - orrs r0, r1 - str r0, [r4, 0x4] - mov r0, sp - bl LoadCompressedSpriteSheet - adds r0, r4, 0 - bl LoadSpritePalette - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EF50 - - thumb_func_start sub_802EFA8 -sub_802EFA8: @ 802EFA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - mov r12, r3 - ldr r3, [sp, 0x30] - lsls r1, 16 - lsrs r1, 16 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - mov r5, sp - ldr r4, =gUnknown_082FEC90 - ldm r4!, {r3,r6,r7} - stm r5!, {r3,r6,r7} - ldm r4!, {r3,r6,r7} - stm r5!, {r3,r6,r7} - mov r4, sp - strh r0, [r4] - mov r0, sp - strh r1, [r0, 0x2] - lsls r2, 16 - asrs r2, 16 - mov r0, r12 - lsls r6, r0, 16 - asrs r6, 16 - mov r0, sp - adds r1, r2, 0 - adds r2, r6, 0 - mov r3, r8 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802EFA8 - - thumb_func_start sub_802EFFC -sub_802EFFC: @ 802EFFC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - mov r12, r3 - ldr r6, [sp, 0x38] - ldr r3, [sp, 0x3C] - mov r9, r3 - ldr r4, [sp, 0x40] - mov r8, r4 - lsls r1, 16 - lsrs r1, 16 - lsls r6, 24 - lsrs r6, 24 - mov r10, r6 - mov r4, sp - ldr r3, =gUnknown_082FECA8 - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - ldm r3!, {r5-r7} - stm r4!, {r5-r7} - mov r3, sp - strh r0, [r3] - mov r0, sp - strh r1, [r0, 0x2] - lsls r2, 16 - asrs r4, r2, 16 - ldr r0, =0xffe00000 - adds r2, r0 - asrs r2, 16 - mov r1, r12 - lsls r5, r1, 16 - asrs r5, 16 - mov r0, sp - adds r1, r2, 0 - adds r2, r5, 0 - mov r3, r10 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r3, r9 - strh r0, [r3] - adds r4, 0x20 - lsls r4, 16 - asrs r4, 16 - mov r0, sp - adds r1, r4, 0 - adds r2, r5, 0 - mov r3, r10 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r4, r8 - strh r0, [r4] - ldr r2, =gSprites - mov r5, r9 - movs r6, 0 - ldrsh r1, [r5, r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r3, 0x4 - orrs r1, r3 - strb r1, [r0] - movs r7, 0 - ldrsh r1, [r4, r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r3 - strb r1, [r0] - movs r0, 0 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x1 - bl StartSpriteAnim - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802EFFC - - .align 2, 0 @ don't pad with nop diff --git a/data/pokemon_jump.s b/data/pokemon_jump.s deleted file mode 100755 index b10c37600..000000000 --- a/data/pokemon_jump.s +++ /dev/null @@ -1,573 +0,0 @@ -#include "constants/species.h" - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_082FB63C:: @ 82FB63C - .2byte 0x001a, 0x001f, 0x0024, 0x0029, 0x002e, 0x0033, 0x0038, 0x003d - - .align 2 -gUnknown_082FB64C:: @ 82FB64C - .2byte 0x0000, 0x0001, 0x0001, 0x0002 - - .align 2 -gUnknown_082FB654:: @ 82FB654 - .2byte 0x005f, 0x0066, 0x00e4, 0x0105 - - .align 2 -gUnknown_082FB65C:: @ 82FB65C - .byte 0xfd, 0xfa, 0xf8, 0xf6, 0xf3, 0xf1, 0xef, 0xed - .byte 0xeb, 0xe9, 0xe7, 0xe5, 0xe4, 0xe3, 0xe2, 0xe2 - .byte 0xe2, 0xe4, 0xe5, 0xe6, 0xe7, 0xe9, 0xea, 0xec - .byte 0xee, 0xef, 0xf1, 0xf3, 0xf5, 0xf8, 0xfa, 0xfc - .byte 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf2, 0xf0, 0xee, 0xec - .byte 0xea, 0xe8, 0xe6, 0xe4, 0xe3, 0xe2, 0xe2, 0xe4 - .byte 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf5 - .byte 0xf7, 0xfa, 0xfc, 0xff, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .byte 0xfd, 0xfa, 0xf7, 0xf5, 0xf3, 0xf1, 0xef, 0xed - .byte 0xeb, 0xe9, 0xe7, 0xe5, 0xe4, 0xe3, 0xe2, 0xe2 - .byte 0xe2, 0xe2, 0xe3, 0xe3, 0xe4, 0xe4, 0xe5, 0xe5 - .byte 0xe6, 0xe7, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2 - .byte 0xf4, 0xf5, 0xf7, 0xfa, 0xfc, 0xff, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FB6EC:: @ 82FB6EC - .4byte 0x00000000, 0x00000000, 0x00000032, 0x00000064 - .4byte 0x000000c8, 0x000001f4 - - .align 2 -gUnknown_082FB704:: @ 82FB704 - .2byte 0x008a, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, 0x0093 - - .align 2 -gUnknown_082FB714:: @ 82FB714 - .4byte 0x00001388, 0x00000001, 0x00001f40, 0x00000002 - .4byte 0x00002ee0, 0x00000003, 0x00003e80, 0x00000004 - .4byte 0x00004e20, 0x00000005 - - .align 2 -gPkmnJumpPal1:: @ 82FB73C - .incbin "graphics/link_games/pkmnjump_pal1.gbapal" - - .align 2 -gPkmnJumpPal2:: @ 82FB75C - .incbin "graphics/link_games/pkmnjump_pal2.gbapal" - - .align 2 -gPkmnJumpRopeGfx1:: @ 82FB77C - .incbin "graphics/link_games/pkmnjump_rope1.4bpp.lz" - - .align 2 -gPkmnJumpRopeGfx2:: @ 82FB89C - .incbin "graphics/link_games/pkmnjump_rope2.4bpp.lz" - - .align 2 -gPkmnJumpRopeGfx3:: @ 82FBA70 - .incbin "graphics/link_games/pkmnjump_rope3.4bpp.lz" - - .align 2 -gPkmnJumpRopeGfx4:: @ 82FBBA0 - .incbin "graphics/link_games/pkmnjump_rope4.4bpp.lz" - - .align 2 -gPkmnJumpStarGfx:: @ 82FBC9C - .incbin "graphics/link_games/pkmnjump_star.4bpp.lz" - - .align 2 -gUnknown_082FBE08:: @ 82FBE08 - obj_tiles gPkmnJumpRopeGfx1, 0x0600, 0x0005 - - .align 2 - obj_tiles gPkmnJumpRopeGfx2, 0x0c00, 0x0006 - - .align 2 - obj_tiles gPkmnJumpRopeGfx3, 0x0600, 0x0007 - - .align 2 - obj_tiles gPkmnJumpRopeGfx4, 0x0600, 0x0008 - - .align 2 - obj_tiles gPkmnJumpStarGfx, 0x0200, 0x000a - - .align 2 -gUnknown_082FBE30:: @ 82FBE30 - obj_pal gPkmnJumpPal1, 0x0005 - - .align 2 - obj_pal gPkmnJumpPal2, 0x0006 - - .align 2 -gUnknown_082FBE40:: @ 82FBE40 - spr_template 0x0000, 0x0000, gUnknown_082FBEC8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_082FBE58:: @ 82FBE58 - .2byte 0x0060, 0x0060, 0x0060, 0x0072, 0x0078, 0x0078, 0x0078, 0x0072 - .2byte 0x0060, 0x0060, 0x0046, 0x0050, 0x0060, 0x0072, 0x0078, 0x0080 - .2byte 0x0078, 0x0072, 0x0060, 0x0050, 0x0032, 0x0048, 0x0060, 0x0072 - .2byte 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048, 0x002a, 0x0048 - .2byte 0x0060, 0x0072, 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048 - -gUnknown_082FBEA8:: @ 82FBEA8 - .2byte 0x0010, 0x0028, 0x0048, 0x0068, 0x0088, 0x00a8, 0x00c8, 0x00e0 - - .align 2 -gUnknown_082FBEB8:: @ 82FBEB8 - .4byte gUnknown_082FBF78 - .4byte gUnknown_082FBF90 - .4byte gUnknown_082FBFA8 - .4byte gUnknown_082FBFC0 - - .align 2 -gUnknown_082FBEC8:: @ 82FBED0 - .byte 0x00, 0x00, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBED0:: @ 82FBED0 - .byte 0x00, 0x80, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBED8:: @ 82FBED8 - .byte 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBEE0:: @ 82FBEE0 - .byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FBEE8:: @ 82FBEE8 - .2byte 0x0000, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBEF0:: @ 82FBEF0 - .2byte 0x0008, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBEF8:: @ 82FBEF8 - .2byte 0x0010, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF00:: @ 82FBF00 - .2byte 0x0018, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF08:: @ 82FBF08 - .2byte 0x0020, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF10:: @ 82FBF10 - .2byte 0x0028, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF18:: @ 82FBF18 - .2byte 0x0000, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF20:: @ 82FBF20 - .2byte 0x0010, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF28:: @ 82FBF28 - .2byte 0x0020, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF30:: @ 82FBF30 - .2byte 0x0030, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF38:: @ 82FBF38 - .2byte 0x0040, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF40:: @ 82FBF40 - .2byte 0x0050, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBF48:: @ 82FBF48 - .4byte gUnknown_082FBEE8 - .4byte gUnknown_082FBEF0 - .4byte gUnknown_082FBEF8 - .4byte gUnknown_082FBF00 - .4byte gUnknown_082FBF08 - .4byte gUnknown_082FBF10 - - .align 2 -gUnknown_082FBF60:: @ 82FBF60 - .4byte gUnknown_082FBF18 - .4byte gUnknown_082FBF20 - .4byte gUnknown_082FBF28 - .4byte gUnknown_082FBF30 - .4byte gUnknown_082FBF38 - .4byte gUnknown_082FBF40 - - .align 2 -gUnknown_082FBF78:: @ 82FBF78 - spr_template 0x0005, 0x0005, gUnknown_082FBED0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBF90:: @ 82FBF90 - spr_template 0x0006, 0x0005, gUnknown_082FBED8, gUnknown_082FBF60, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBFA8:: @ 82FBFA8 - spr_template 0x0007, 0x0005, gUnknown_082FBEE0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBFC0:: @ 82FBFC0 - spr_template 0x0008, 0x0005, gUnknown_082FBEE0, gUnknown_082FBF48, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FBFD8:: @ 82FBFD8 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x04, 0x00, 0x00 - - .align 2 -gUnknown_082FBFE0:: @ 82FBFE0 - .2byte 0x0000, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FBFE8:: @ 82FBFE8 - .2byte 0x0000, 0x0004 - .2byte 0x0004, 0x0004 - .2byte 0x0008, 0x0004 - .2byte 0x000c, 0x0004 - .2byte 0xfffd, 0x0001 - .2byte 0x0000, 0x0004 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FC004:: @ 82FC004 - .4byte gUnknown_082FBFE0 - .4byte gUnknown_082FBFE8 - - .align 2 -gUnknown_082FC00C:: @ 82FC00C - spr_template 0x000a, 0x0005, gUnknown_082FBFD8, gUnknown_082FC004, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gPkmnJumpPal3:: @ 82FC024 - .incbin "graphics/link_games/pkmnjump_pal3.gbapal" - - .align 2 -gPkmnJumpBgPal:: @ 82FC044 - .incbin "graphics/link_games/pkmnjump_bg.gbapal" - - .align 2 -gPkmnJumpBgGfx:: @ 82FC064 - .incbin "graphics/link_games/pkmnjump_bg.4bpp.lz" - - .align 2 -gPkmnJumpBgTilemap:: @ 82FC290 - .incbin "graphics/link_games/pkmnjump_bg.bin.lz" - - .align 2 -gPkmnJumpVenusaurPal:: @ 82FC440 - .incbin "graphics/link_games/pkmnjump_venusaur.gbapal" - - .align 2 -gPkmnJumpVenusaurGfx:: @ 82FC460 - .incbin "graphics/link_games/pkmnjump_venusaur.4bpp.lz" - - .align 2 -gPkmnJumpVenusaurTilemap:: @ 82FCDB0 - .incbin "graphics/link_games/pkmnjump_venusaur.bin.lz" - - .align 2 -gPkmnJumpResultsPal:: @ 82FD168 - .incbin "graphics/link_games/pkmnjump_results.gbapal" - - .align 2 -gPkmnJumpResultsGfx:: @ 82FD188 - .incbin "graphics/link_games/pkmnjump_results.4bpp.lz" - - .align 2 -gPkmnJumpResultsTilemap:: @ 82FDC38 - .incbin "graphics/link_games/pkmnjump_results.bin.lz" - - .align 2 -gUnknown_082FE164:: @ 82FE164 struct BgTemplate - .4byte 0x000001b0, 0x000025e6, 0x000016c9, 0x000031df - - .align 2 -gUnknown_082FE174:: @ 82FE174 - window_template 0x00, 0x13, 0x00, 0x06, 0x02, 0x02, 0x0013 - window_template 0x00, 0x08, 0x00, 0x06, 0x02, 0x02, 0x001f - null_window_template - - .align 2 -gUnknown_082FE18C:: @ 82FE18C - .4byte 0x00000000, sub_802D150 - .4byte 0x00000001, sub_802D2E4 - .4byte 0x00000002, sub_802D350 - .4byte 0x00000003, sub_802D3BC - .4byte 0x00000004, sub_802D448 - .4byte 0x00000005, sub_802D4F4 - .4byte 0x00000006, sub_802D598 - .4byte 0x00000007, sub_802D5E4 - .4byte 0x00000009, sub_802D72C - .4byte 0x00000008, sub_802D688 - - .align 2 -gUnknown_082FE1DC:: @ 82FE1DC - .byte 0x00, 0x02, 0x03 - -gUnknown_082FE1DF:: @ 82FE1DF - .byte 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00 - .byte 0x00, 0x02, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FE1EC:: @ 82FE1EC - obj_tiles gUnknown_082FF1F8, 0x0000, 0x0320 - - .align 2 -gUnknown_082FE1F4:: @ 82FE1F4 - obj_pal gUnknown_082FF1D8, 0x0320 - - .align 2 -gUnknown_082FE1FC:: @ 82FE1FC - .2byte 0x0006, 0x0008, 0x0010, 0x0008 - - .align 2 -gUnknown_082FE204:: @ 82FE204 - .2byte 0x0006, 0x0008, 0x000b, 0x0006, 0x0010, 0x0008 - - .align 2 -gUnknown_082FE210:: @ 82FE210 - .2byte 0x0002, 0x0006, 0x0006, 0x0008, 0x0010, 0x0008, 0x0014, 0x0006 - - .align 2 -gUnknown_082FE220:: @ 82FE220 - .2byte 0x0002, 0x0006, 0x0006, 0x0008, 0x000b, 0x0006 - .2byte 0x0010, 0x0008, 0x0014, 0x0006 - - .align 2 -gUnknown_082FE234:: @ 82FE234 - .4byte gUnknown_082FE1FC - .4byte gUnknown_082FE204 - .4byte gUnknown_082FE210 - .4byte gUnknown_082FE220 - - .align 2 -gUnknown_082FE244:: @ 82FE244 - .2byte 0x0058, 0x0098 - -gUnknown_082FE248:: @ 82FE248 - .2byte 0x0058, 0x0078, 0x0098 - -gUnknown_082FE24E:: @ 82FE24E - .2byte 0x0038, 0x0058, 0x0098, 0x00b8 - -gUnknown_082FE256:: @ 82FE256 - .2byte 0x0038, 0x0058, 0x0078, 0x0098, 0x00b8 - - .align 2 -gUnknown_082FE260:: @ 82FE260 - .4byte gUnknown_082FE244 - .4byte gUnknown_082FE248 - .4byte gUnknown_082FE24E - .4byte gUnknown_082FE256 - - .align 2 -gUnknown_082FE270:: @ 82FE270 - .4byte 0x1c010100, 0x00010f09 - - .align 2 -gUnknown_082FE278:: @ 82FE278 - .4byte gText_JumpsInARow - .4byte gText_BestScore2 - .4byte gText_ExcellentsInARow - - .align 2 -gPkmnJump321StartPal1:: @ 82FE284 - .incbin "graphics/link_games/pkmnjump_321start1.gbapal" - - .align 2 -gPkmnJump321StartGfx1:: @ 82FE2A4 - .incbin "graphics/link_games/pkmnjump_321start1.4bpp.lz" - - .align 2 -gUnknown_082FE6C8:: @ 82FE6C8 - obj_tiles gPkmnJump321StartGfx1, 0x0c00, 0x2000 - null_obj_tiles - - .align 2 -gUnknown_082FE6D8:: @ 82FE6D8 - obj_pal gPkmnJump321StartPal1, 0x2000 - null_obj_pal - - .align 2 -gUnknown_082FE6E8:: @ 82FE6E8 - .2byte 0x0000, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE6F0:: @ 82FE6F0 - .2byte 0x0010, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE6F8:: @ 82FE6F8 - .2byte 0x0020, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE700:: @ 82FE700 - .2byte 0x0040, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE708:: @ 82FE708 - .2byte 0x0030, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE710:: @ 82FE710 - .2byte 0x0050, 0x0000 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FE718:: @ 82FE718 - .4byte gUnknown_082FE6E8 - .4byte gUnknown_082FE6F0 - .4byte gUnknown_082FE6F8 - .4byte gUnknown_082FE700 - .4byte gUnknown_082FE708 - .4byte gUnknown_082FE710 - - .align 2 -gUnknown_082FE730:: @ 82FE730 - spr_template 0x2000, 0x2000, gUnknown_08524914, gUnknown_082FE718, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FE748:: @ 82FE748 - .4byte sub_802E83C - .4byte sub_802E8C8 - .4byte sub_802EA50 - .4byte sub_802EAB0 - - .align 2 -gPkmnJump321StartPal2:: @ 82FE758 - .incbin "graphics/link_games/pkmnjump_321start2.gbapal" - - .align 2 -gPkmnJump321StartGfx2:: @ 82FE778 - .incbin "graphics/link_games/pkmnjump_321start2.4bpp.lz" - - .align 2 -gUnknown_082FEBCC:: @ 82FEBCC - obj_tiles gPkmnJump321StartGfx2, 0x0e00, 0x0000 - - .align 2 -gUnknown_082FEBD4:: @ 82FEBD4 - obj_pal gPkmnJump321StartPal2, 0x0000 - - .align 2 -gUnknown_082FEBDC:: @ 82FEBDC - .byte 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FEBE4:: @ 82FEBE4 - .byte 0x00, 0x40, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FEBEC:: @ 82FEBEC - .2byte 0x0000, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEBF4:: @ 82FEBF4 - .2byte 0x0010, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEBFC:: @ 82FEBFC - .2byte 0x0020, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEC04:: @ 82FEC04 - .4byte gUnknown_082FEBEC - .4byte gUnknown_082FEBF4 - .4byte gUnknown_082FEBFC - - .align 2 -gUnknown_082FEC10:: @ 82FEC10 - .2byte 0x0030, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEC18:: @ 82FEC18 - .2byte 0x0050, 0x0001 - .2byte 0xffff, 0x0000 - - .align 2 -gUnknown_082FEC20:: @ 82FEC20 - .4byte gUnknown_082FEC10 - .4byte gUnknown_082FEC18 - - .align 2 -gUnknown_082FEC28:: @ 82FEC28 - .2byte 0x0100, 0x0100 - .2byte 0x0000, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC38:: @ 82FEC38 - .2byte 0x0100, 0x0100 - .2byte 0x0000, 0x0000 - .2byte 0x0010, 0xfff0 - .2byte 0x0800, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC50:: @ 82FEC50 - .2byte 0xffee, 0x0012 - .2byte 0x0800, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC60:: @ 82FEC60 - .2byte 0x0006, 0xfffa - .2byte 0x0800, 0x0000 - .2byte 0xfffc, 0x0004 - .2byte 0x0800, 0x0000 - .2byte 0x0100, 0x0100 - .2byte 0x0000, 0x0000 - .2byte 0x7fff, 0x0000 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_082FEC80:: @ 82FEC80 - .4byte gUnknown_082FEC28 - .4byte gUnknown_082FEC38 - .4byte gUnknown_082FEC50 - .4byte gUnknown_082FEC60 - -gUnknown_082FEC90:: @ 82FEC90 - spr_template 0x0000, 0x0000, gUnknown_082FEBDC, gUnknown_082FEC04, NULL, gUnknown_082FEC80, SpriteCallbackDummy - -gUnknown_082FECA8:: @ 82FECA8 - spr_template 0x0000, 0x0000, gUnknown_082FEBE4, gUnknown_082FEC20, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy diff --git a/include/global.h b/include/global.h index a76d6e4e3..eb18682e9 100644 --- a/include/global.h +++ b/include/global.h @@ -163,18 +163,17 @@ struct Pokedex /*0x44*/ u8 seen[DEX_FLAGS_NO]; }; -struct PokemonJumpResults // possibly used in the game itself? +struct PokemonJumpResults { u16 jumpsInRow; u16 field2; u16 excellentsInRow; u16 field6; - u16 field8; - u16 fieldA; + u32 field8; u32 bestJumpScore; }; -struct BerryPickingResults // possibly used in the game itself? Size may be wrong as well +struct BerryPickingResults { u32 bestScore; u16 berriesPicked; diff --git a/include/link_rfu.h b/include/link_rfu.h index 4bf106ec1..d6e1009e1 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -275,7 +275,7 @@ void sub_8010FCC(u32 a0, u32 a1, u32 a2); void sub_8011C84(void); void sub_8012188(const u8 *name, struct UnkLinkRfuStruct_02022B14 *structPtr, u8 a2); bool32 sub_8011B90(void); -void sub_800FE50(u16 *a0); +void sub_800FE50(void *a0); bool32 sub_800E540(u16 id, u8 *name); void sub_8011DE0(u32 arg0); u8 sub_801100C(s32 a0); diff --git a/include/pokemon_jump.h b/include/pokemon_jump.h index d137c37b2..2e8d9c378 100644 --- a/include/pokemon_jump.h +++ b/include/pokemon_jump.h @@ -3,7 +3,7 @@ #include "main.h" -void sub_802EB24(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4); +void sub_802EB24(s16 tileTag, s16 palTag, s16 x, s16 y, u8 subpriority); bool32 sub_802EB84(void); void sub_802A9A8(u16 monId, MainCallback callback); bool32 sub_802C908(u16 species); diff --git a/include/sprite.h b/include/sprite.h index 32bdd9c55..9753837fd 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -275,6 +275,7 @@ void FreeSpriteOamMatrix(struct Sprite *sprite); void DestroySpriteAndFreeResources(struct Sprite *sprite); void sub_800142C(u32 a1, u32 a2, u16 *a3, u16 a4, u32 a5); void AnimateSprite(struct Sprite *sprite); +void sub_8007E18(struct Sprite* sprite, s16 a2, s16 a3); void StartSpriteAnim(struct Sprite *sprite, u8 animNum); void StartSpriteAnimIfDifferent(struct Sprite *sprite, u8 animNum); void SeekSpriteAnim(struct Sprite *sprite, u8 animCmdIndex); diff --git a/include/strings.h b/include/strings.h index a959821d4..bead5849d 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2715,6 +2715,12 @@ extern const u8 gText_CommunicationStandby4[]; extern const u8 gText_AwesomeWonF701F700[]; extern const u8 gText_FilledStorageSpace2[]; extern const u8 gText_CantHoldMore[]; +extern const u8 gText_SpacePoints2[]; +extern const u8 gText_SpaceTimes3[]; +extern const u8 gText_PkmnJumpRecords[]; +extern const u8 gText_JumpsInARow[]; +extern const u8 gText_BestScore2[]; +extern const u8 gText_ExcellentsInARow[]; // Pokenav Match Call extern const u8 gText_CallCantBeMadeHere[]; diff --git a/ld_script.txt b/ld_script.txt index 9bb3dbb41..256d2bc6d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -77,7 +77,6 @@ SECTIONS { src/dodrio_berry_picking.o(.text*); asm/dodrio_berry_picking.o(.text*); src/pokemon_jump.o(.text*); - asm/pokemon_jump.o(.text*); src/rtc.o(.text*); src/main_menu.o(.text*); src/battle_controllers.o(.text*); @@ -449,7 +448,6 @@ SECTIONS { src/dodrio_berry_picking.o(.rodata); data/dodrio_berry_picking.o(.rodata); src/pokemon_jump.o(.rodata); - data/pokemon_jump.o(.rodata); src/rtc.o(.rodata); src/main_menu.o(.rodata); src/battle_controllers.o(.rodata); diff --git a/src/link_rfu.c b/src/link_rfu.c index f7ffa4aca..1f3ae4f3c 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2415,7 +2415,7 @@ void RecordMixTrainerNames(void) } } } - + // Save the connected trainers first, at the top of the list. nextSpace = 0; for (i = 0; i < GetLinkPlayerCount(); i++) @@ -2446,7 +2446,7 @@ void RecordMixTrainerNames(void) } } } - + // Finalize the new list, and clean up. memcpy(gSaveBlock1Ptr->trainerNameRecords, newRecords, 20 * sizeof(struct TrainerNameRecord)); free(newRecords); @@ -3495,7 +3495,7 @@ void sub_800FD14(u16 command) } } -void sub_800FE50(u16 *a0) +void sub_800FE50(void *a0) { if (gSendCmd[0] == 0 && !sub_8011A80()) { diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index 5272b3292..62ff10511 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -1,10 +1,12 @@ #include "global.h" #include "alloc.h" +#include "battle_anim.h" #include "bg.h" #include "data.h" #include "decompress.h" #include "dynamic_placeholder_text_util.h" #include "event_data.h" +#include "international_string_util.h" #include "item.h" #include "link.h" #include "link_rfu.h" @@ -14,6 +16,7 @@ #include "random.h" #include "rom_8034C54.h" #include "save.h" +#include "script.h" #include "sound.h" #include "sprite.h" #include "string_util.h" @@ -63,7 +66,7 @@ struct PokemonJump2 u16 filler10; u16 unk12; u16 unk14; - u8 filler16[0x1c - 0x16]; + u32 unk18; u16 unk1C[5]; u8 txtBuff[2][0x40]; u8 strBuff[0x100]; @@ -75,6 +78,15 @@ struct PokemonJump2 u8 unk81FC[MAX_RFU_PLAYERS]; }; +struct PokemonJump1Sub +{ + u8 unk0; + u8 unk1; + u16 unk2; + u16 unk4; + u32 unk8; +}; + struct PokemonJump1 { MainCallback returnCallback; @@ -123,11 +135,7 @@ struct PokemonJump1 int unk64; int unk68; int unk6C; - u8 unk70; - u8 unk71; - u16 unk72; - u16 unk74; - u32 unk78; + struct PokemonJump1Sub unk70; u8 unk7C[MAX_RFU_PLAYERS]; u8 unk81[MAX_RFU_PLAYERS]; u8 unk86[MAX_RFU_PLAYERS]; @@ -146,16 +154,6 @@ struct PokemonJumpMons u16 unk2; }; -struct Unk802B078 -{ - u8 unk0; - u8 unk1; - u16 unk2; - u16 unk4; - u16 unk6; - int unk8; -}; - static void sub_802AA60(struct PokemonJump1 *); void sub_802AA94(struct PokemonJump1 *); void sub_802AB20(void); @@ -232,7 +230,7 @@ static void sub_802CB7C(struct Sprite *sprite); static void sub_802CC40(struct Sprite *sprite); static void sub_802CD08(struct Sprite *sprite); static void sub_802CDD4(struct Sprite *sprite); -void sub_802DC9C(u32); +void sub_802DC9C(int id); void sub_802D074(struct PokemonJump2 *); void sub_802D0BC(struct PokemonJump2 *); void sub_802D0AC(void); @@ -245,34 +243,72 @@ void sub_802D884(u16 itemId); void sub_802D8FC(u16 itemId); bool32 sub_802D974(void); void sub_802DA14(void); -void sub_802DC80(int, s8); -void sub_802DD88(u8); +void sub_802DC80(u32 id, s16 y); +void sub_802DD88(u8 multiplayerId); bool32 sub_802DA44(void); void sub_802DD64(int); s8 sub_802DA8C(void); -int sub_802DCCC(u8); +int sub_802DCCC(u8 flags); void sub_802DD74(u16); -void sub_802DDA0(u8); -int sub_802DDB8(int); +void sub_802DDA0(u8 multiplayerId); +int sub_802DDB8(int multiplayerId); void sub_802DDCC(void); void sub_802DDE0(void); void sub_802DDF4(int); int sub_802DE08(void); -void sub_802E0AC(struct PokemonJump1_MonInfo *); -bool32 sub_802E0D0(int, struct PokemonJump1_MonInfo *); -void sub_802E138(struct PokemonJump1_82E4 *, u8 *); -bool32 sub_802E1BC(struct PokemonJump1_82E4 *, struct Unk802B078 *); -void sub_802E234(struct PokemonJump1_82E4 *, u8 , u16); -bool32 sub_802E264(struct PokemonJump1_82E4 *, int, u8 *, u16 *); -bool32 sub_802E2D0(struct PokemonJump1_82E4 *, int); -int sub_802E354(int, u16, u16); +void sub_802E0AC(struct PokemonJump1_MonInfo *arg0); +bool32 sub_802E0D0(int multiplayerId, struct PokemonJump1_MonInfo *arg0); +void sub_802E138(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1); +bool32 sub_802E1BC(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1); +void sub_802E234(struct PokemonJump1_82E4 *arg0, u8 arg1, u16 arg2); +bool32 sub_802E264(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3); +bool32 sub_802E2D0(struct PokemonJump1_82E4 *arg0, int multiplayerId); +bool32 sub_802E354(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow); void sub_802E3A8(void); void sub_802D12C(u8 taskId); +void sub_802E00C(u8 arg0); +void sub_802E090(u8 taskId); +void sub_802D150(void); +void sub_802DD08(void); +void sub_802DB8C(void); +void sub_802DBF8(void); +void sub_802DE1C(void); +void sub_802DFD4(void); +void sub_802D108(void (*func)(void)); +void sub_802DF70(bool32 arg0); +u32 sub_802DA9C(u32 left, u32 top, u32 width, u32 height); +void sub_802DB18(u16 left, u16 top, u8 cursorPos); +void sub_802D150(void); +void sub_802D2E4(void); +void sub_802D350(void); +void sub_802D3BC(void); +void sub_802D448(void); +void sub_802D4F4(void); +void sub_802D598(void); +void sub_802D5E4(void); +void sub_802D72C(void); +void sub_802D688(void); +void sub_802E3E4(u8 taskId); +void sub_802E6D0(u8 taskId); +void sub_802EB98(u8 taskId); +void sub_802E500(u16 windowId, s32 width); +void sub_802E620(u8 *str); +void sub_802EF50(u16 tileTag, u16 palTag); +u8 sub_802EFA8(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subpriority); +void sub_802EFFC(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subpriority, s16 *spriteId1, s16 *spriteId2); +bool32 sub_802EC98(u8 spriteId); +bool32 sub_802EE30(u8 spriteId); +void sub_802EDCC(u8 spriteId1, u8 spriteId2, u8 spriteId3); +void sub_802EE5C(struct Sprite *sprite); +void sub_802E83C(u8 taskId); +void sub_802E8C8(u8 taskId); +void sub_802EA50(u8 taskId); +void sub_802EAB0(u8 taskId); EWRAM_DATA struct PokemonJump1 *gUnknown_02022CFC = NULL; EWRAM_DATA struct PokemonJump2 *gUnknown_02022D00 = NULL; -const struct PokemonJumpMons gPkmnJumpSpecies[] = +static const struct PokemonJumpMons gPkmnJumpSpecies[] = { { .species = SPECIES_BULBASAUR, .unk2 = 2, }, { .species = SPECIES_CHARMANDER, .unk2 = 1, }, @@ -376,65 +412,6 @@ const struct PokemonJumpMons gPkmnJumpSpecies[] = { .species = SPECIES_BAGON, .unk2 = 1, }, }; -bool32 (* const gUnknown_082FB5F4[])(void) = -{ - sub_802B248, - sub_802B2D4, - sub_802B368, - sub_802B3D4, - sub_802B4CC, - sub_802B5C8, - sub_802B664, - sub_802B6B8, - sub_802B720, -}; - -bool32 (* const gUnknown_082FB618[])(void) = -{ - sub_802B29C, - sub_802B31C, - sub_802B3B4, - sub_802B470, - sub_802B568, - sub_802B628, - sub_802B664, - sub_802B704, - sub_802B720, -}; - -extern const u16 gUnknown_082FB63C[]; -extern const u16 gUnknown_082FB64C[4]; -extern const u16 gUnknown_082FB654[]; -extern const s8 gUnknown_082FB65C[][48]; -extern const int gUnknown_082FB6EC[]; -extern const u32 gUnknown_082FB714[][2]; -extern const u16 gUnknown_082FB704[8]; -extern const struct CompressedSpriteSheet gUnknown_082FBE08[5]; -extern const struct SpritePalette gUnknown_082FBE30[2]; -extern const struct SpriteTemplate gUnknown_082FBE40; -extern const struct SpriteTemplate gUnknown_082FC00C; -extern const s16 gUnknown_082FBE58[][10]; -extern const s16 gUnknown_082FBEA8[8]; -extern const struct SpriteTemplate *gUnknown_082FBEB8[4]; -extern const struct BgTemplate gUnknown_082FE164[4]; -extern const struct WindowTemplate gUnknown_082FE174[]; -extern const u16 gPkmnJumpBgPal[]; -extern const u16 gPkmnJumpVenusaurPal[]; -extern const u16 gPkmnJumpResultsPal[]; -extern const u16 gPkmnJumpPal3[]; -extern const u32 gPkmnJumpVenusaurGfx[]; -extern const u32 gPkmnJumpBgTilemap[]; -extern const u32 gPkmnJumpBgGfx[]; -extern const u32 gPkmnJumpVenusaurTilemap[]; -extern const u32 gPkmnJumpResultsGfx[]; -extern const u32 gPkmnJumpResultsTilemap[]; - -struct -{ - int id; - void (*func)(void); -} extern const gUnknown_082FE18C[10]; - void sub_802A9A8(u16 partyIndex, MainCallback callback) { u8 taskId; @@ -470,8 +447,8 @@ static void sub_802AA48(void) static void sub_802AA60(struct PokemonJump1 *arg0) { arg0->unk5 = GetLinkPlayerCount(); - arg0->unk70 = 5; - arg0->unk72 = 0; + arg0->unk70.unk0 = 5; + arg0->unk70.unk2 = 0; sub_802AB20(); sub_802AA94(arg0); if (arg0->unk5 == MAX_RFU_PLAYERS) @@ -499,9 +476,9 @@ void sub_802AA94(struct PokemonJump1 *arg0) arg0->unk46 = 0; arg0->unk49 = 0; arg0->unk48 = 1; - arg0->unk78 = 0; - arg0->unk71 = 0; - arg0->unk74 = 0; + arg0->unk70.unk8 = 0; + arg0->unk70.unk1 = 0; + arg0->unk70.unk4 = 0; arg0->unk60 = 1; arg0->unk4D = 0; arg0->unk68 = 0; @@ -666,7 +643,7 @@ static void sub_802AE50(u8 arg0) { int i; - gUnknown_02022CFC->unk70 = arg0; + gUnknown_02022CFC->unk70.unk0 = arg0; gUnknown_02022CFC->unk8 = 0; gUnknown_02022CFC->unkA = 0; gUnknown_02022CFC->unk48 = 1; @@ -693,7 +670,7 @@ static void sub_802AEA4(void) gUnknown_02022CFC->unk82E4[i].unk12 = var0; } - if (gUnknown_02022CFC->unk82E4[i].unk18 && gUnknown_02022CFC->unk8B[i] == gUnknown_02022CFC->unk70) + if (gUnknown_02022CFC->unk82E4[i].unk18 && gUnknown_02022CFC->unk8B[i] == gUnknown_02022CFC->unk70.unk0) count++; } @@ -701,6 +678,19 @@ static void sub_802AEA4(void) gUnknown_02022CFC->unk49 = 1; } +static bool32 (* const gUnknown_082FB5F4[])(void) = +{ + sub_802B248, + sub_802B2D4, + sub_802B368, + sub_802B3D4, + sub_802B4CC, + sub_802B5C8, + sub_802B664, + sub_802B6B8, + sub_802B720, +}; + static void sub_802AF80(u8 taskId) { sub_802AEA4(); @@ -713,7 +703,7 @@ static void sub_802AF80(u8 taskId) if (gUnknown_02022CFC->unk48 == 1) { - if (!gUnknown_082FB5F4[gUnknown_02022CFC->unk70]()) + if (!gUnknown_082FB5F4[gUnknown_02022CFC->unk70.unk0]()) { gUnknown_02022CFC->unk48 = 0; gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk18 = 1; @@ -738,7 +728,7 @@ static void sub_802B008(void) static void sub_802B044(u8 arg0) { - gUnknown_02022CFC->unk70 = arg0; + gUnknown_02022CFC->unk70.unk0 = arg0; gUnknown_02022CFC->unk8 = 0; gUnknown_02022CFC->unkA = 0; gUnknown_02022CFC->unk48 = 1; @@ -749,30 +739,30 @@ static void sub_802B078(void) { int i; u16 var0; - struct Unk802B078 sp0; + struct PokemonJump1Sub sp0; var0 = gUnknown_02022CFC->unk82E4[0].unk10; if (sub_802E1BC(gUnknown_02022CFC->unk82E4, &sp0)) { if (gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk18 == 1 - && sp0.unk0 != gUnknown_02022CFC->unk70) + && sp0.unk0 != gUnknown_02022CFC->unk70.unk0) { sub_802B044(sp0.unk0); } - if (gUnknown_02022CFC->unk78 != sp0.unk8) + if (gUnknown_02022CFC->unk70.unk8 != sp0.unk8) { - gUnknown_02022CFC->unk78 = sp0.unk8; + gUnknown_02022CFC->unk70.unk8 = sp0.unk8; gUnknown_02022CFC->unk5C = 1; - gUnknown_02022CFC->unk71 = sp0.unk1; - if (gUnknown_02022CFC->unk71) + gUnknown_02022CFC->unk70.unk1 = sp0.unk1; + if (gUnknown_02022CFC->unk70.unk1) gUnknown_02022CFC->unk4D = 1; else gUnknown_02022CFC->unk4D = 0; } - gUnknown_02022CFC->unk72 = sp0.unk2; - gUnknown_02022CFC->unk74 = sp0.unk4; + gUnknown_02022CFC->unk70.unk2 = sp0.unk2; + gUnknown_02022CFC->unk70.unk4 = sp0.unk4; gUnknown_02022CFC->unk82E4[0].unk12 = var0; } @@ -787,12 +777,25 @@ static void sub_802B078(void) } } +static bool32 (* const gUnknown_082FB618[])(void) = +{ + sub_802B29C, + sub_802B31C, + sub_802B3B4, + sub_802B470, + sub_802B568, + sub_802B628, + sub_802B664, + sub_802B704, + sub_802B720, +}; + static void sub_802B194(u8 taskId) { sub_802B078(); if (gUnknown_02022CFC->unk48) { - if (!gUnknown_082FB618[gUnknown_02022CFC->unk70]()) + if (!gUnknown_082FB618[gUnknown_02022CFC->unk70.unk0]()) { gUnknown_02022CFC->unk48 = 0; gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6].unk18 = 1; @@ -807,7 +810,7 @@ static void sub_802B194(u8 taskId) static void sub_802B1FC(void) { if (!gUnknown_02022CFC->unk2C) - sub_802E234(&gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6], gUnknown_02022CFC->unk70, gUnknown_02022CFC->unk42); + sub_802E234(&gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6], gUnknown_02022CFC->unk70.unk0, gUnknown_02022CFC->unk42); if (gUnknown_02022CFC->unk30 != 0x1111) { @@ -827,7 +830,7 @@ static bool32 sub_802B248(void) case 1: if (!sub_802B7E0()) { - gUnknown_02022CFC->unk72 = gUnknown_02022CFC->unk4A; + gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unk4A; gUnknown_02022CFC->unk4C = 1; return FALSE; } @@ -843,7 +846,7 @@ static bool32 sub_802B29C(void) { case 0: sub_802AE14(0); - gUnknown_02022CFC->unk24 = gUnknown_02022CFC->unk72; + gUnknown_02022CFC->unk24 = gUnknown_02022CFC->unk70.unk2; gUnknown_02022CFC->unk8++; // fall through case 1: @@ -881,7 +884,7 @@ static bool32 sub_802B31C(void) case 0: sub_802C0E8(); sub_802AE14(0); - gUnknown_02022CFC->unk4A = gUnknown_02022CFC->unk72; + gUnknown_02022CFC->unk4A = gUnknown_02022CFC->unk70.unk2; gUnknown_02022CFC->unk8++; // fall through case 1: @@ -897,7 +900,7 @@ static bool32 sub_802B368(void) { if (!sub_802B8CC()) { - gUnknown_02022CFC->unk72 = gUnknown_02022CFC->unk4A; + gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unk4A; gUnknown_02022CFC->unk4C = 1; } else if (sub_802C538()) @@ -939,17 +942,17 @@ static bool32 sub_802B3D4(void) { if (sub_802C7BC()) { - gUnknown_02022CFC->unk72 = sub_802C7E0(); + gUnknown_02022CFC->unk70.unk2 = sub_802C7E0(); gUnknown_02022CFC->unk4C = 7; } - else if (gUnknown_02022CFC->unk74 >= 200) + else if (gUnknown_02022CFC->unk70.unk4 >= 200) { - gUnknown_02022CFC->unk72 = gUnknown_02022CFC->unkE; + gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unkE; gUnknown_02022CFC->unk4C = 8; } else { - gUnknown_02022CFC->unk72 = gUnknown_02022CFC->unkE; + gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unkE; gUnknown_02022CFC->unk4C = 4; } @@ -999,7 +1002,7 @@ static bool32 sub_802B4CC(void) case 1: if (!sub_802BB84()) { - sub_802E354(gUnknown_02022CFC->unk78, gUnknown_02022CFC->unk74, gUnknown_02022CFC->unk72); + sub_802E354(gUnknown_02022CFC->unk70.unk8, gUnknown_02022CFC->unk70.unk4, gUnknown_02022CFC->unk70.unk2); gUnknown_02022CFC->unk8++; } break; @@ -1033,7 +1036,7 @@ static bool32 sub_802B568(void) case 1: if (!sub_802BB84()) { - sub_802E354(gUnknown_02022CFC->unk78, gUnknown_02022CFC->unk74, gUnknown_02022CFC->unk72); + sub_802E354(gUnknown_02022CFC->unk70.unk8, gUnknown_02022CFC->unk70.unk4, gUnknown_02022CFC->unk70.unk2); gUnknown_02022CFC->unk42 = gUnknown_02022CFC->unk45; return FALSE; } @@ -1056,7 +1059,7 @@ static bool32 sub_802B5C8(void) { sub_802AA94(gUnknown_02022CFC); gUnknown_02022CFC->unk24 = Random(); - gUnknown_02022CFC->unk72 = gUnknown_02022CFC->unk24; + gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unk24; gUnknown_02022CFC->unk4C = 0; return FALSE; } @@ -1119,7 +1122,7 @@ static bool32 sub_802B6B8(void) case 1: if (!sub_802BA58()) { - gUnknown_02022CFC->unk72 = gUnknown_02022CFC->unkE; + gUnknown_02022CFC->unk70.unk2 = gUnknown_02022CFC->unkE; gUnknown_02022CFC->unk4C = 8; return FALSE; } @@ -1143,7 +1146,7 @@ static bool32 sub_802B720(void) switch (gUnknown_02022CFC->unk8) { case 0: - sub_802E354(gUnknown_02022CFC->unk78, gUnknown_02022CFC->unk74, gUnknown_02022CFC->unk72); + sub_802E354(gUnknown_02022CFC->unk70.unk8, gUnknown_02022CFC->unk70.unk4, gUnknown_02022CFC->unk70.unk2); sub_802D0C8(5); gUnknown_02022CFC->unk8++; break; @@ -1312,7 +1315,7 @@ static bool32 sub_802B964(void) if (!sub_802D0F0()) { sub_802DDCC(); - gUnknown_02022CFC->unk71 = 0; + gUnknown_02022CFC->unk70.unk1 = 0; sub_802C114(); gUnknown_02022CFC->unkA++; return FALSE; @@ -1330,7 +1333,7 @@ static bool32 sub_802BA58(void) switch (gUnknown_02022CFC->unkA) { case 0: - sub_802C808(gUnknown_02022CFC->unk72, &gUnknown_02022CFC->unk3E, &gUnknown_02022CFC->unk40); + sub_802C808(gUnknown_02022CFC->unk70.unk2, &gUnknown_02022CFC->unk3E, &gUnknown_02022CFC->unk40); sub_802D7E8(gUnknown_02022CFC->unk3E, gUnknown_02022CFC->unk40); gUnknown_02022CFC->unkA++; break; @@ -1610,6 +1613,9 @@ static int sub_802BF48(void) return result; } +static const u16 gUnknown_082FB63C[] = {0x1a, 0x1f, 0x24, 0x29, 0x2e, 0x33, 0x38, 0x3d}; +static const u16 gUnknown_082FB64C[] = {0, 1, 1, 2}; + static void sub_802BF7C(void) { int var0; @@ -1728,21 +1734,23 @@ static void sub_802C1BC(void) gUnknown_02022CFC->unk83AC->unk10 = 0; } +static const u16 gUnknown_082FB654[] = {SE_REGI, SE_REAPOKE, SE_W234, SE_RG_EXCELLENT}; + static void sub_802C1DC(void) { if (gUnknown_02022CFC->unk5C) { - sub_802DD64(gUnknown_02022CFC->unk78); + sub_802DD64(gUnknown_02022CFC->unk70.unk8); gUnknown_02022CFC->unk5C = 0; if (gUnknown_02022CFC->unk4D) { - int index = sub_802DCCC(gUnknown_02022CFC->unk71); + int index = sub_802DCCC(gUnknown_02022CFC->unk70.unk1); PlaySE(gUnknown_082FB654[index - 2]); gUnknown_02022CFC->unk4D = 0; } } - sub_802DD74(gUnknown_02022CFC->unk74); + sub_802DD74(gUnknown_02022CFC->unk70.unk4); sub_802C280(); sub_802C240(); } @@ -1808,6 +1816,21 @@ static void sub_802C280(void) PlaySE(SE_DANSA); } +static const s8 gUnknown_082FB65C[][48] = +{ + {-3, -6, -8, -10, -13, -15, -17, -19, -21, -23, -25, -27, -28, -29, -30, -30, -30, -28, -27, + -26, -25, -23, -22, -20, -18, -17, -15, -13, -11, -8, -6, -4, + -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + {-3, -6, -9, -11, -14, -16, -18, -20, -22, -24, -26, -28, -29, -30, -30, -28, -26, -24, -22, + -20, -18, -16, -14, -11, -9, -6, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + + {-3, -6, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -28, -29, -30, -30, -30, -30, -29, + -29, -28, -28, -27, -27, -26, -25, -24, -22, -20, -18, -16, -14, + -12, -11, -9, -6, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, +}; + static void sub_802C398(int multiplayerId) { int var0; @@ -1860,7 +1883,7 @@ static void sub_802C43C(void) sub_802C780(); gUnknown_02022CFC->unk54 = 0; gUnknown_02022CFC->unk58 = 1; - gUnknown_02022CFC->unk71 = 0; + gUnknown_02022CFC->unk70.unk1 = 0; } else { @@ -1883,9 +1906,9 @@ static void sub_802C43C(void) sub_802C780(); gUnknown_02022CFC->unk54 = 0; gUnknown_02022CFC->unk58 = 1; - gUnknown_02022CFC->unk71 = 0; - if (gUnknown_02022CFC->unk74 < 9999) - gUnknown_02022CFC->unk74++; + gUnknown_02022CFC->unk70.unk1 = 0; + if (gUnknown_02022CFC->unk70.unk4 < 9999) + gUnknown_02022CFC->unk70.unk4++; sub_802C688(10); sub_802AE14(3); @@ -1989,10 +2012,10 @@ static bool32 sub_802C650(void) static void sub_802C688(int arg0) { - gUnknown_02022CFC->unk78 += arg0; + gUnknown_02022CFC->unk70.unk8 += arg0; gUnknown_02022CFC->unk5C = 1; - if (gUnknown_02022CFC->unk78 >= 99990) - gUnknown_02022CFC->unk78 = 99990; + if (gUnknown_02022CFC->unk70.unk8 >= 99990) + gUnknown_02022CFC->unk70.unk8 = 99990; } static int sub_802C6B0(void) @@ -2037,7 +2060,7 @@ static int sub_802C73C(u8 *arg0) } } - gUnknown_02022CFC->unk71 = flags; + gUnknown_02022CFC->unk70.unk1 = flags; if (flags) gUnknown_02022CFC->unk4D = 1; @@ -2049,6 +2072,8 @@ static void sub_802C780(void) gUnknown_02022CFC->unk44 = 0; } +static const int gUnknown_082FB6EC[] = {0, 0, 0x32, 0x64, 0xc8, 0x1f4}; + static int sub_802C790(int arg0) { return gUnknown_082FB6EC[arg0]; @@ -2060,9 +2085,19 @@ static void sub_802C7A0(u16 arg0) gUnknown_02022CFC->unkE = arg0; } +static const u16 gUnknown_082FB704[] = {0x8a, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93}; +static const u32 gUnknown_082FB714[][2] = +{ + {0x1388, 1}, + {0x1f40, 2}, + {0x2ee0, 3}, + {0x3e80, 4}, + {0x4e20, 5}, +}; + static bool32 sub_802C7BC(void) { - if (gUnknown_02022CFC->unk78 >= gUnknown_082FB714[0][0]) + if (gUnknown_02022CFC->unk70.unk8 >= gUnknown_082FB714[0][0]) return TRUE; else return FALSE; @@ -2096,7 +2131,7 @@ static u16 sub_802C838(void) val = 0; for (i = 0; i < 5; val = gUnknown_082FB714[i][1], i++) { - if (gUnknown_02022CFC->unk78 < gUnknown_082FB714[i][0]) + if (gUnknown_02022CFC->unk70.unk8 < gUnknown_082FB714[i][0]) break; } @@ -2196,6 +2231,324 @@ void sub_802C920(void) gSpecialVar_Result = 0; } +// Large group of data. +static const u16 gPkmnJumpPal1[] = INCBIN_U16("graphics/link_games/pkmnjump_pal1.gbapal"); +static const u16 gPkmnJumpPal2[] = INCBIN_U16("graphics/link_games/pkmnjump_pal2.gbapal"); + +static const u32 gPkmnJumpRopeGfx1[] = INCBIN_U32("graphics/link_games/pkmnjump_rope1.4bpp.lz"); +static const u32 gPkmnJumpRopeGfx2[] = INCBIN_U32("graphics/link_games/pkmnjump_rope2.4bpp.lz"); +static const u32 gPkmnJumpRopeGfx3[] = INCBIN_U32("graphics/link_games/pkmnjump_rope3.4bpp.lz"); +static const u32 gPkmnJumpRopeGfx4[] = INCBIN_U32("graphics/link_games/pkmnjump_rope4.4bpp.lz"); + +static const u32 gPkmnJumpStarGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_star.4bpp.lz"); + +static const struct CompressedSpriteSheet gUnknown_082FBE08[] = +{ + {gPkmnJumpRopeGfx1, 0x600, 5}, + {gPkmnJumpRopeGfx2, 0x0c00, 6}, + {gPkmnJumpRopeGfx3, 0x0600, 7}, + {gPkmnJumpRopeGfx4, 0x0600, 8}, + {gPkmnJumpStarGfx, 0x0200, 10}, +}; + +static const struct SpritePalette gUnknown_082FBE30[] = +{ + {gPkmnJumpPal1, 5}, + {gPkmnJumpPal2, 6}, +}; + +// Forward declarations. +static const struct OamData sOamData_82FBEC8; +static const struct SpriteTemplate gUnknown_082FBF78; +static const struct SpriteTemplate gUnknown_082FBF90; +static const struct SpriteTemplate gUnknown_082FBFA8; +static const struct SpriteTemplate gUnknown_082FBFC0; + +static const struct SpriteTemplate gUnknown_082FBE40 = +{ + .tileTag = 0, + .paletteTag = 0, + .oam = &sOamData_82FBEC8, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const s16 gUnknown_082FBE58[][10] = +{ + {0x60, 0x60, 0x60, 0x72, 0x78, 0x78, 0x78, 0x72, 0x60, 0x60}, + {0x46, 0x50, 0x60, 0x72, 0x78, 0x80, 0x78, 0x72, 0x60, 0x50}, + {0x32, 0x48, 0x60, 0x72, 0x80, 0x88, 0x80, 0x72, 0x60, 0x48}, + {0x2a, 0x48, 0x60, 0x72, 0x80, 0x88, 0x80, 0x72, 0x60, 0x48}, +}; + +static const s16 gUnknown_082FBEA8[] = {0x10, 0x28, 0x48, 0x68, 0x88, 0xa8, 0xc8, 0xe0}; + +static const struct SpriteTemplate *const gUnknown_082FBEB8[] = +{ + &gUnknown_082FBF78, + &gUnknown_082FBF90, + &gUnknown_082FBFA8, + &gUnknown_082FBFC0, +}; + +static const struct OamData sOamData_82FBEC8 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_82FBED0 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 2, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_82FBED8 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_82FBEE0 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_82FBEE8[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBEF0[] = +{ + ANIMCMD_FRAME(8, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBEF8[] = +{ + ANIMCMD_FRAME(16, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF00[] = +{ + ANIMCMD_FRAME(24, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF08[] = +{ + ANIMCMD_FRAME(32, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF10[] = +{ + ANIMCMD_FRAME(40, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF18[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF20[] = +{ + ANIMCMD_FRAME(16, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF28[] = +{ + ANIMCMD_FRAME(32, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF30[] = +{ + ANIMCMD_FRAME(48, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF38[] = +{ + ANIMCMD_FRAME(64, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBF40[] = +{ + ANIMCMD_FRAME(80, 1), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_82FBF48[] = +{ + sSpriteAnim_82FBEE8, + sSpriteAnim_82FBEF0, + sSpriteAnim_82FBEF8, + sSpriteAnim_82FBF00, + sSpriteAnim_82FBF08, + sSpriteAnim_82FBF10 +}; + +static const union AnimCmd *const sSpriteAnimTable_82FBF60[] = +{ + sSpriteAnim_82FBF18, + sSpriteAnim_82FBF20, + sSpriteAnim_82FBF28, + sSpriteAnim_82FBF30, + sSpriteAnim_82FBF38, + sSpriteAnim_82FBF40 +}; + +static const struct SpriteTemplate gUnknown_082FBF78 = +{ + .tileTag = 5, + .paletteTag = 5, + .oam = &sOamData_82FBED0, + .anims = sSpriteAnimTable_82FBF48, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct SpriteTemplate gUnknown_082FBF90 = +{ + .tileTag = 6, + .paletteTag = 5, + .oam = &sOamData_82FBED8, + .anims = sSpriteAnimTable_82FBF60, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct SpriteTemplate gUnknown_082FBFA8 = +{ + .tileTag = 7, + .paletteTag = 5, + .oam = &sOamData_82FBEE0, + .anims = sSpriteAnimTable_82FBF48, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct SpriteTemplate gUnknown_082FBFC0 = +{ + .tileTag = 8, + .paletteTag = 5, + .oam = &sOamData_82FBEE0, + .anims = sSpriteAnimTable_82FBF48, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct OamData sOamData_82FBFD8 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_82FBFE0[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FBFE8[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(4, 4), + ANIMCMD_FRAME(8, 4), + ANIMCMD_FRAME(12, 4), + ANIMCMD_LOOP(1), + ANIMCMD_FRAME(0, 4), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_82FC004[] = +{ + sSpriteAnim_82FBFE0, + sSpriteAnim_82FBFE8 +}; + +static const struct SpriteTemplate gUnknown_082FC00C = +{ + .tileTag = 10, + .paletteTag = 5, + .oam = &sOamData_82FBFD8, + .anims = sSpriteAnimTable_82FC004, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +// Back to code void sub_802C974(struct PokemonJump2 *arg0) { int i; @@ -2217,7 +2570,7 @@ static void sub_802C9BC(struct Sprite *sprite) sprite->data[i] = 0; } -void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon, u16 x, u16 y, u8 multiplayerId) +void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon, s16 x, s16 y, u8 multiplayerId) { struct SpriteTemplate spriteTemplate; struct SpriteSheet spriteSheet; @@ -2504,17 +2857,6 @@ bool32 sub_802D068(void) return sub_802EB84(); } -void sub_802D150(void); -void sub_802DD08(void); -void sub_802DB8C(void); -void sub_802DBF8(void); -void sub_802DE1C(void); -void sub_802DFD4(void); -void sub_802D108(void (*func)(void)); -void sub_802DF70(int arg0); -u32 sub_802DA9C(u8 arg0, u8 arg1, u8 arg2, u8 arg3); -void sub_802DB18(u8 arg0, u8 arg1, u8 arg2); - void sub_802D074(struct PokemonJump2 *arg0) { u8 taskId; @@ -2540,6 +2882,102 @@ void sub_802D0BC(struct PokemonJump2 *arg0) arg0->unk12 = 0xFF; } +// Gfx +static const u16 gPkmnJumpPal3[] = INCBIN_U16("graphics/link_games/pkmnjump_pal3.gbapal"); + +static const u16 gPkmnJumpBgPal[] = INCBIN_U16("graphics/link_games/pkmnjump_bg.gbapal"); +static const u32 gPkmnJumpBgGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_bg.4bpp.lz"); +static const u32 gPkmnJumpBgTilemap[] = INCBIN_U32("graphics/link_games/pkmnjump_bg.bin.lz"); + +static const u16 gPkmnJumpVenusaurPal[] = INCBIN_U16("graphics/link_games/pkmnjump_venusaur.gbapal"); +static const u32 gPkmnJumpVenusaurGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_venusaur.4bpp.lz"); +static const u32 gPkmnJumpVenusaurTilemap[] = INCBIN_U32("graphics/link_games/pkmnjump_venusaur.bin.lz"); + +static const u16 gPkmnJumpResultsPal[] = INCBIN_U16("graphics/link_games/pkmnjump_results.gbapal"); +static const u32 gPkmnJumpResultsGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_results.4bpp.lz"); +static const u32 gPkmnJumpResultsTilemap[] = INCBIN_U32("graphics/link_games/pkmnjump_results.bin.lz"); + +static const struct BgTemplate gUnknown_082FE164[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 27, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 1, + .mapBaseIndex = 30, + .screenSize = 2, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 3, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 3, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, +}; + +static const struct WindowTemplate gUnknown_082FE174[] = +{ + { + .bg = 0, + .tilemapLeft = 19, + .tilemapTop = 0, + .width = 6, + .height = 2, + .paletteNum = 2, + .baseBlock = 0x13, + }, + { + .bg = 0, + .tilemapLeft = 8, + .tilemapTop = 0, + .width = 6, + .height = 2, + .paletteNum = 2, + .baseBlock = 0x1F, + }, + DUMMY_WIN_TEMPLATE, +}; + +struct +{ + int id; + void (*func)(void); +} static const gUnknown_082FE18C[] = +{ + {0x00, sub_802D150}, + {0x01, sub_802D2E4}, + {0x02, sub_802D350}, + {0x03, sub_802D3BC}, + {0x04, sub_802D448}, + {0x05, sub_802D4F4}, + {0x06, sub_802D598}, + {0x07, sub_802D5E4}, + {0x09, sub_802D72C}, + {0x08, sub_802D688}, +}; + void sub_802D0C8(int arg0) { int i; @@ -2635,7 +3073,7 @@ void sub_802D2E4(void) case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_802DF70(0); + sub_802DF70(FALSE); gUnknown_02022D00->unk4++; } break; @@ -2664,7 +3102,7 @@ void sub_802D350(void) case 1: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_802DF70(1); + sub_802DF70(TRUE); gUnknown_02022D00->unk4++; } break; @@ -2964,12 +3402,14 @@ void sub_802DA14(void) } } -// Can't match this -/* +// Can't match this without the ugly GOTO, oh well. bool32 sub_802DA44(void) { if (gUnknown_02022D00->unk12 == 0xFF) + { + RET_FALSE: return FALSE; + } if (gUnknown_02022D00->unkD == 0) { @@ -2978,12 +3418,1221 @@ bool32 sub_802DA44(void) RemoveWindow(gUnknown_02022D00->unk12); gUnknown_02022D00->unk12 = 0xFF; gUnknown_02022D00->unkD++; - return FALSE; + goto RET_FALSE; } } else if (gUnknown_02022D00->unkD == 1) - return FALSE; + goto RET_FALSE; return TRUE; } -*/ + +s8 sub_802DA8C(void) +{ + return Menu_ProcessInputNoWrapClearOnChoose(); +} + +u32 sub_802DA9C(u32 left, u32 top, u32 width, u32 height) +{ + u32 windowId; + struct WindowTemplate window; + + window.bg = 0; + window.tilemapLeft = left; + window.tilemapTop = top; + window.width = width; + window.height = height; + window.paletteNum = 0xF; + window.baseBlock = 0x43; + + windowId = AddWindow(&window); + FillWindowPixelBuffer(windowId, 0x11); + return windowId; +} + +void sub_802DB18(u16 left, u16 top, u8 cursorPos) +{ + struct WindowTemplate window; + u8 a = cursorPos; + + window.bg = 0; + window.tilemapLeft = left; + window.tilemapTop = top; + window.width = 6; + window.height = 4; + window.paletteNum = 2; + window.baseBlock = 0x2B; + + CreateYesNoMenu(&window, 1, 0xD, a); +} + +void sub_802DB8C(void) +{ + u8 color[] = {0, 2, 3}; + + PutWindowTilemap(0); + PutWindowTilemap(1); + FillWindowPixelBuffer(0, 0); + FillWindowPixelBuffer(1, 0); + AddTextPrinterParameterized3(0, 0, 0, 1, color, 0, gText_SpacePoints2); + AddTextPrinterParameterized3(1, 0, 0, 1, color, 0, gText_SpaceTimes3); +} + +static const u8 gUnknown_082FE1DF[] = {2, 2, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0}; + +static const struct CompressedSpriteSheet gUnknown_082FE1EC = {gUnknown_082FF1F8, 0, 0x320}; +static const struct SpritePalette gUnknown_082FE1F4 = {gUnknown_082FF1D8, 0x320}; + +static const u16 gUnknown_082FE1FC[] = {0x06, 0x08, 0x10, 0x08}; +static const u16 gUnknown_082FE204[] = {0x06, 0x08, 0x0b, 0x06, 0x10, 0x08}; +static const u16 gUnknown_082FE210[] = {0x02, 0x06, 0x06, 0x08, 0x10, 0x08, 0x14, 0x06}; +static const u16 gUnknown_082FE220[] = {0x02, 0x06, 0x06, 0x08, 0x0b, 0x06, 0x10, 0x08, 0x14, 0x06}; + +static const u16 *const gUnknown_082FE234[] = +{ + gUnknown_082FE1FC, + gUnknown_082FE204, + gUnknown_082FE210, + gUnknown_082FE220, +}; + +static const s16 gUnknown_082FE244[] = {0x0058, 0x0098}; +static const s16 gUnknown_082FE248[] = {0x0058, 0x0078, 0x0098}; +static const s16 gUnknown_082FE24E[] = {0x0038, 0x0058, 0x0098, 0x00b8}; +static const s16 gUnknown_082FE256[] = {0x0038, 0x0058, 0x0078, 0x0098, 0x00b8}; + +static const s16 *const gUnknown_082FE260[] = +{ + gUnknown_082FE244, + gUnknown_082FE248, + gUnknown_082FE24E, + gUnknown_082FE256, +}; + +void sub_802DBF8(void) +{ + s32 i, y, playersCount = sub_802C8AC(); + const s16 *xCoords = gUnknown_082FE260[playersCount - 2]; + + for (i = 0; i < playersCount; i++) + { + struct PokemonJump1_MonInfo *info = sub_802C8C8(i); + + y = gMonFrontPicCoords[info->species].y_offset; + sub_802C9D4(gUnknown_02022D00, info, *xCoords, y + 112, i); + sub_802CE48(gUnknown_02022D00, *xCoords, 112, i); + xCoords++; + } +} + +void sub_802DC80(u32 id, s16 y) +{ + gUnknown_02022D00->unk81A8[id]->pos2.y = y; +} + +void sub_802DC9C(int id) +{ + sub_802CF50(gUnknown_02022D00, id); + ChangeBgY(2, (gUnknown_082FE1DF[id] * 5) << 0xD, 0); +} + +int sub_802DCCC(u8 flags) +{ + s32 i, count; + + for (i = 0, count = 0; i < 5; i++) + { + if (flags & 1) + { + sub_802CB14(gUnknown_02022D00, i); + count++; + } + flags >>= 1; + } + + sub_802E00C(count - 2); + return count; +} + +void sub_802DD08(void) +{ + struct UnkStruct3 unkStruct; + struct UnkStruct3 *ptr = &unkStruct; // This temp variable is needed to match, don't ask me why. + + ptr->shape = 0; + ptr->size = 0; + ptr->field_0_0 = 0; + ptr->priority = 1; + ptr->field_1 = 5; + ptr->xDelta = 8; + ptr->x = 108; + ptr->y = 6; + ptr->spriteSheet = (void*) &gUnknown_082FE1EC; + ptr->spritePal = &gUnknown_082FE1F4; + + sub_8034C54(2); + sub_8034D14(0, 0, ptr); + + unkStruct.field_1 = 4; + unkStruct.x = 30; + unkStruct.y = 6; + sub_8034D14(1, 0, &unkStruct); +} + +void sub_802DD64(int arg0) +{ + sub_8035044(0, arg0); +} + +void sub_802DD74(u16 arg0) +{ + sub_8035044(1, arg0); +} + +void sub_802DD88(u8 multiplayerId) +{ + sub_802CBF0(gUnknown_02022D00, multiplayerId); +} + +void sub_802DDA0(u8 multiplayerId) +{ + sub_802CC88(gUnknown_02022D00, multiplayerId); +} + +int sub_802DDB8(int multiplayerId) +{ + return sub_802CC18(gUnknown_02022D00, multiplayerId); +} + +void sub_802DDCC(void) +{ + sub_802CCB0(gUnknown_02022D00); +} + +void sub_802DDE0(void) +{ + sub_802CD3C(gUnknown_02022D00); +} + +void sub_802DDF4(int multiplayerId) +{ + sub_802CD70(gUnknown_02022D00, multiplayerId); +} + +int sub_802DE08(void) +{ + return sub_802CD98(gUnknown_02022D00); +} + +void sub_802DE1C(void) +{ + struct WindowTemplate window; + int i, playersCount = sub_802C8AC(); + const u16 *winCoords = gUnknown_082FE234[playersCount - 2]; + + window.bg = 0; + window.width = 8; + window.height = 2; + window.paletteNum = 2; + window.baseBlock = 0x2B; + + for (i = 0; i < playersCount; i++) + { + window.tilemapLeft = winCoords[0]; + window.tilemapTop = winCoords[1]; + gUnknown_02022D00->unk1C[i] = AddWindow(&window); + ClearWindowTilemap(gUnknown_02022D00->unk1C[i]); + window.baseBlock += 0x10; + winCoords += 2; + } + + CopyBgTilemapBufferToVram(0); +} + +void sub_802DED8(int multiplayerId, u8 clr1, u8 clr2, u8 clr3) +{ + u32 x; + u8 colors[3] = {clr1, clr2, clr3}; + + FillWindowPixelBuffer(gUnknown_02022D00->unk1C[multiplayerId], 0); + x = 64 - GetStringWidth(1, sub_802C8E8(multiplayerId), -1); + x /= 2; + AddTextPrinterParameterized3(gUnknown_02022D00->unk1C[multiplayerId], 1, x, 1, colors, -1, sub_802C8E8(multiplayerId)); + CopyWindowToVram(gUnknown_02022D00->unk1C[multiplayerId], 2); +} + +void sub_802DF70(bool32 arg0) +{ + int i, var, playersCount = sub_802C8AC(); + + if (!arg0) + { + for (i = 0; i < playersCount; i++) + sub_802DED8(i, 0, 2, 3); + } + else + { + var = sub_802C8BC(); + for (i = 0; i < playersCount; i++) + { + if (var != i) + sub_802DED8(i, 0, 2, 3); + else + sub_802DED8(i, 0, 4, 5); + } + } +} + +void sub_802DFD4(void) +{ + int i, playersCount = sub_802C8AC(); + + for (i = 0; i < playersCount; i++) + PutWindowTilemap(gUnknown_02022D00->unk1C[i]); + CopyBgTilemapBufferToVram(0); +} + +void sub_802E00C(u8 arg0) +{ + gUnknown_02022D00->unk18 = 0; + ChangeBgX(1, (arg0 / 2) << 16, 0); + ChangeBgY(1, (((arg0 % 2) << 8) - 40) << 8, 0); + ShowBg(1); + CreateTask(sub_802E090, 4); +} + +bool32 sub_802E058(void) +{ + if (gUnknown_02022D00->unk18 >= 32) + { + return FALSE; + } + else + { + ChangeBgY(1, 128, 1); + if (++gUnknown_02022D00->unk18 >= 32) + HideBg(1); + return TRUE; + } +} + +void sub_802E090(u8 taskId) +{ + if (!sub_802E058()) + DestroyTask(taskId); +} + +struct MonInfoPacket +{ + u8 id; // packet id + u16 species; + u32 personality; + u32 otId; +}; + +void sub_802E0AC(struct PokemonJump1_MonInfo *arg0) +{ + struct MonInfoPacket packet; + packet.id = 1, + packet.species = arg0->species, + packet.otId = arg0->otId, + packet.personality = arg0->personality, + sub_800FE50(&packet); +} + +bool32 sub_802E0D0(int multiplayerId, struct PokemonJump1_MonInfo *arg0) +{ + struct MonInfoPacket packet; + + if ((gRecvCmds[multiplayerId][0] & 0xFF00) != 0x2F00) + return FALSE; + + memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet)); + if (packet.id == 1) + { + arg0->species = packet.species; + arg0->otId = packet.otId; + arg0->personality = packet.personality; + return TRUE; + } + + return FALSE; +} + +struct UnkPacket2 +{ + u8 id; // packet id + u32 unk4; + u32 unk8; +}; + +void sub_802E120(u32 arg0) +{ + struct UnkPacket2 packet; + packet.id = 2; + packet.unk4 = arg0; + sub_800FE50(&packet); +} + +struct UnkPacket3 +{ + u8 id; // packet id + u8 unk1; + u8 unk2; + u8 unk3_0:5; + u8 unk3_1:3; + u16 unk4; + u16 unk6; + u32 unk8_0:15; + u32 unk8_1:17; +}; + +void sub_802E138(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1) +{ + struct UnkPacket3 packet; + packet.id = 3; + packet.unk8_1 = arg1->unk8; + packet.unk3_0 = arg1->unk1; + packet.unk1 = arg1->unk0; + packet.unk6 = arg1->unk2; + packet.unk8_0 = arg1->unk4; + packet.unk2 = arg0->unk10; + packet.unk3_1 = arg0->unk14; + packet.unk4 = arg0->unkE; + sub_800FE50(&packet); +} + +bool32 sub_802E1BC(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1) +{ + struct UnkPacket3 packet; + + if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) + return FALSE; + + memcpy(&packet, &gRecvCmds[0][1], sizeof(packet)); + if (packet.id != 3) + return FALSE; + + arg1->unk8 = packet.unk8_1; + arg1->unk1 = packet.unk3_0; + arg1->unk0 = packet.unk1; + arg1->unk2 = packet.unk6; + arg1->unk4 = packet.unk8_0; + arg0->unk10 = packet.unk2; + arg0->unk14 = packet.unk3_1; + arg0->unkE = packet.unk4; + return TRUE; +} + +struct UnkPacket4 +{ + u8 id; // packet id + u8 unk1; + u8 unk2; + u8 unk3; + u16 unk4; + u8 unk6; + u16 unk8; +}; + +void sub_802E234(struct PokemonJump1_82E4 *arg0, u8 arg1, u16 arg2) +{ + struct UnkPacket4 packet; + packet.id = 4; + packet.unk1 = arg0->unk10; + packet.unk2 = arg0->unk14; + packet.unk3 = arg0->unk18; + packet.unk4 = arg0->unkE; + packet.unk6 = arg1; + packet.unk8 = arg2; + sub_800FE50(&packet); +} + +bool32 sub_802E264(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3) +{ + struct UnkPacket4 packet; + + if ((gRecvCmds[multiplayerId][0] & 0xFF00) != 0x2F00) + return FALSE; + + memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet)); + if (packet.id != 4) + return FALSE; + + arg0->unk10 = packet.unk1; + arg0->unk14 = packet.unk2; + arg0->unk18 = packet.unk3; + arg0->unkE = packet.unk4; + *arg2 = packet.unk6; + *arg3 = packet.unk8; + return TRUE; +} + +bool32 sub_802E2D0(struct PokemonJump1_82E4 *arg0, int multiplayerId) +{ + struct UnkPacket4 packet; + + if ((gRecvCmds[multiplayerId][0] & 0xFF00) != 0x2F00) + return FALSE; + + memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet)); + if (packet.id != 4) + return FALSE; + + arg0->unk10 = packet.unk1; + arg0->unk14 = packet.unk2; + arg0->unk18 = packet.unk3; + arg0->unkE = packet.unk4; + return TRUE; +} + +struct PokemonJumpResults *sub_802E32C(void) +{ + return &gSaveBlock2Ptr->pokeJump; +} + +void ResetPokeJumpResults(void) +{ + struct PokemonJumpResults *pokeJump = sub_802E32C(); + pokeJump->jumpsInRow = 0; + pokeJump->bestJumpScore = 0; + pokeJump->excellentsInRow = 0; + pokeJump->field6 = 0; + pokeJump->field8 = 0; + pokeJump->field2 = 0; +} + +bool32 sub_802E354(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow) +{ + struct PokemonJumpResults *pokeJump = sub_802E32C(); + bool32 ret = FALSE; + + if (pokeJump->bestJumpScore < jumpScore && jumpScore <= 99990) + pokeJump->bestJumpScore = jumpScore, ret = TRUE; + if (pokeJump->jumpsInRow < jumpsInRow && jumpsInRow <= 9999) + pokeJump->jumpsInRow = jumpsInRow, ret = TRUE; + if (pokeJump->excellentsInRow < excellentsInRow && excellentsInRow <= 9999) + pokeJump->excellentsInRow = excellentsInRow, ret = TRUE; + + return ret; +} + +void sub_802E3A8(void) +{ + struct PokemonJumpResults *pokeJump = sub_802E32C(); + if (pokeJump->field6 < 9999) + pokeJump->field6++; +} + +void sub_802E3C4(void) +{ + u8 taskId = CreateTask(sub_802E3E4, 0); + sub_802E3E4(taskId); +} + +static const struct WindowTemplate gUnknown_082FE270 = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 9, + .paletteNum = 15, + .baseBlock = 0x1, +}; + +const u8 *const gUnknown_082FE278[] = {gText_JumpsInARow, gText_BestScore2, gText_ExcellentsInARow}; + +void sub_802E3E4(u8 taskId) +{ + struct WindowTemplate window; + s32 i, width, widthCurr; + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + window = gUnknown_082FE270; + width = GetStringWidth(1, gText_PkmnJumpRecords, 0); + for (i = 0; i < ARRAY_COUNT(gUnknown_082FE278); i++) + { + widthCurr = GetStringWidth(1, gUnknown_082FE278[i], 0) + 38; + if (widthCurr > width) + width = widthCurr; + } + width = (width + 7) / 8; + if (width & 1) + width++; + window.tilemapLeft = (30 - width) / 2; + window.width = width; + data[1] = AddWindow(&window); + sub_802E500(data[1], width); + CopyWindowToVram(data[1], 3); + data[0]++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + data[0]++; + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + rbox_fill_rectangle(data[1]); + CopyWindowToVram(data[1], 1); + data[0]++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + RemoveWindow(data[1]); + DestroyTask(taskId); + EnableBothScriptContexts(); + } + break; + } +} + +void sub_802E500(u16 windowId, s32 width) +{ + s32 i, x; + s32 results[3]; + struct PokemonJumpResults *pokeJump = sub_802E32C(); + results[0] = pokeJump->jumpsInRow; + results[1] = pokeJump->bestJumpScore; + results[2] = pokeJump->excellentsInRow; + + LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0); + DrawTextBorderOuter(windowId, 0x21D, 0xD); + FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); + AddTextPrinterParameterized(windowId, 1, gText_PkmnJumpRecords, GetStringCenterAlignXOffset(1, gText_PkmnJumpRecords, width * 8), 1, TEXT_SPEED_FF, NULL); + for (i = 0; i < ARRAY_COUNT(gUnknown_082FE278); i++) + { + AddTextPrinterParameterized(windowId, 1, gUnknown_082FE278[i], 0, 25 + (i * 16), TEXT_SPEED_FF, NULL); + ConvertIntToDecimalStringN(gStringVar1, results[i], STR_CONV_MODE_LEFT_ALIGN, 5); + sub_802E620(gStringVar1); + x = (width * 8) - GetStringWidth(1, gStringVar1, 0); + AddTextPrinterParameterized(windowId, 1, gStringVar1, x, 25 + (i * 16), TEXT_SPEED_FF, NULL); + } + PutWindowTilemap(windowId); +} + +void sub_802E620(u8 *str) +{ + for (;*str != EOS; str++) + { + if (*str == CHAR_SPACE) + { + *str = EOS; + break; + } + } +} + +static const u16 gPkmnJump321StartPal1[] = INCBIN_U16("graphics/link_games/pkmnjump_321start1.gbapal"); +static const u32 gPkmnJump321StartGfx1[] = INCBIN_U32("graphics/link_games/pkmnjump_321start1.4bpp.lz"); + +static const struct CompressedSpriteSheet gUnknown_082FE6C8[] = +{ + {gPkmnJump321StartGfx1, 0xC00, 0x2000}, + {}, +}; + +static const struct SpritePalette gUnknown_082FE6D8[] = +{ + {gPkmnJump321StartPal1, 0x2000}, + {}, +}; + +static const union AnimCmd sSpriteAnim_82FE6E8[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FE6F0[] = +{ + ANIMCMD_FRAME(16, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FE6F8[] = +{ + ANIMCMD_FRAME(32, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FE700[] = +{ + ANIMCMD_FRAME(64, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FE708[] = +{ + ANIMCMD_FRAME(48, 0), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FE710[] = +{ + ANIMCMD_FRAME(80, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_82FE718[] = +{ + sSpriteAnim_82FE6E8, + sSpriteAnim_82FE6F0, + sSpriteAnim_82FE6F8, + sSpriteAnim_82FE700, + sSpriteAnim_82FE708, + sSpriteAnim_82FE710 +}; + +static const struct SpriteTemplate gUnknown_082FE730[] = +{ + { + .tileTag = 0x2000, + .paletteTag = 0x2000, + .oam = &gUnknown_08524914, + .anims = sSpriteAnimTable_82FE718, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, +}; + +static const TaskFunc gUnknown_082FE748[][4] = +{ + { + sub_802E83C, + sub_802E8C8, + sub_802EA50, + sub_802EAB0 + }, +}; + +// There's only set of task functions. +u32 sub_802E63C(u8 funcSetId, u8 taskPriority) +{ + u8 taskId = CreateTask(sub_802E6D0, taskPriority); + struct Task *task = &gTasks[taskId]; + + task->data[0] = 1; + task->data[1] = funcSetId; + gUnknown_082FE748[funcSetId][0](taskId); + return taskId; +} + +bool32 sub_802E688(void) +{ + u8 taskId = FindTaskIdByFunc(sub_802E6D0); + if (taskId == 0xFF) + return FALSE; + + gTasks[taskId].data[0] = 2; + return TRUE; +} + +bool32 sub_802E6BC(void) +{ + return FuncIsActiveTask(sub_802E6D0); +} + +void sub_802E6D0(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 2: + gUnknown_082FE748[data[1]][2](taskId); + data[0] = 3; + break; + case 3: + gUnknown_082FE748[data[1]][3](taskId); + break; + case 4: + gUnknown_082FE748[data[1]][1](taskId); + DestroyTask(taskId); + break; + } +} + +void sub_802E75C(u8 taskId, s16 *data) +{ + u8 i; + struct Sprite *sprite; + + LoadCompressedSpriteSheet(&gUnknown_082FE6C8[data[3]]); + LoadSpritePalette(&gUnknown_082FE6D8[data[4]]); + for (i = 0; i < data[8]; i++) + data[13 + i] = CreateSprite(&gUnknown_082FE730[data[2]], data[9], data[10], data[7]); + for (i = 0; i < data[8]; i++) + { + sprite = &gSprites[data[13 + i]]; + sprite->oam.priority = data[6]; + sprite->invisible = TRUE; + sprite->data[1] = data[5]; + sprite->data[3] = taskId; + sprite->data[4] = i; + sprite->data[5] = data[13]; + } +} + +void sub_802E83C(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[2] = 0; + data[3] = 0; + data[4] = 0; + data[5] = 60; + data[6] = 0; + data[7] = 0; + data[8] = 3; + data[9] = 120; + data[10] = 88; + sub_802E75C(taskId, data); + + StartSpriteAnim(&gSprites[data[14]], 4); + gSprites[data[14]].pos2.x = -32; + + StartSpriteAnim(&gSprites[data[15]], 5); + gSprites[data[15]].pos2.x = 32; +} + +void sub_802E8C8(u8 taskId) +{ + u8 i = 0; + s16 *data = gTasks[taskId].data; + + for (i = 0; i < data[8]; i++) + DestroySprite(&gSprites[data[13 + i]]); + FreeSpriteTilesByTag(gUnknown_082FE6C8[data[3]].tag); + FreeSpritePaletteByTag(gUnknown_082FE6D8[data[4]].tag); +} + +void sub_802E938(struct Sprite *sprite) +{ + s16 *data = gTasks[sprite->data[3]].data; + + if (data[11] % data[5] != 0) + return; + if (data[11] == data[10]) + return; + + data[10] = data[11]; + switch (sprite->data[2]) + { + case 0: + sprite->invisible = FALSE; + case 1: + case 2: + PlaySE(SE_KON); + StartSpriteAnim(sprite, sprite->data[2]); + break; + case 3: + PlaySE(SE_PIN); + StartSpriteAnim(sprite, sprite->data[2]); + gSprites[data[14]].invisible = FALSE; + gSprites[data[15]].invisible = FALSE; + break; + case 4: + sprite->invisible = TRUE; + gSprites[data[14]].invisible = TRUE; + gSprites[data[15]].invisible = TRUE; + data[0] = 4; + return; + } + sprite->data[2]++; +} + +void sub_802EA50(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + PlaySE(SE_KON); + gSprites[data[13]].callback = sub_802E938; + gSprites[data[13]].invisible = FALSE; + gTasks[taskId].data[0] = 3; +} + +void sub_802EAB0(u8 taskId) +{ + u16 packet[6]; + s16 *data = gTasks[taskId].data; + + if (gReceivedRemoteLinkPlayers != 0) + { + if (gRecvCmds[0][1] == 0x7FFF) + data[11] = gRecvCmds[0][2]; + if (GetMultiplayerId() == 0) + { + data[12]++; + memset(packet, 0, sizeof(packet)); + packet[0] = 0x7FFF; + packet[1] = data[12]; + sub_800FE50(packet); + } + } + else + { + data[11]++; + } +} + +void sub_802EB24(s16 tileTag, s16 palTag, s16 x, s16 y, u8 subpriority) +{ + u8 taskId = CreateTask(sub_802EB98, 0x50); + gTasks[taskId].data[2] = tileTag; + gTasks[taskId].data[3] = palTag; + gTasks[taskId].data[4] = x; + gTasks[taskId].data[5] = y; + gTasks[taskId].data[6] = subpriority; +} + +bool32 sub_802EB84(void) +{ + return FuncIsActiveTask(sub_802EB98); +} + +void sub_802EB98(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + sub_802EF50(data[2], data[3]); + data[7] = sub_802EFA8(data[2], data[3], data[4], data[5], data[6]); + sub_802EFFC(data[2], data[3], data[4], data[5], data[6], &data[8], &data[9]); + data[0]++; + break; + case 1: + if (!sub_802EC98(data[7])) + { + sub_802EDCC(data[7], data[8], data[9]); + FreeSpriteOamMatrix(&gSprites[data[7]]); + DestroySprite(&gSprites[data[7]]); + data[0]++; + } + break; + case 2: + if (!sub_802EE30(data[8])) + { + DestroySprite(&gSprites[data[8]]); + DestroySprite(&gSprites[data[9]]); + FreeSpriteTilesByTag(data[2]); + FreeSpritePaletteByTag(data[3]); + DestroyTask(taskId); + } + break; + } +} + +bool32 sub_802EC98(u8 spriteId) +{ + struct Sprite *sprite = &gSprites[spriteId]; + + switch (sprite->data[0]) + { + case 0: + sub_8007E18(sprite, 0x800, 0x1A); + sprite->data[0]++; + case 1: + if (sprite->data[2] == 0) + PlaySE(SE_KON2); + if (++sprite->data[2] >= 20) + { + sprite->data[2] = 0; + StartSpriteAffineAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 2: + if (sprite->affineAnimEnded) + sprite->data[0]++; + break; + case 3: + if (++sprite->data[2] >= 4) + { + sprite->data[2] = 0; + sprite->data[0]++; + StartSpriteAffineAnim(sprite, 2); + } + break; + case 4: + sprite->pos1.y -= 4; + if (++sprite->data[2] >= 8) + { + if (sprite->data[4] <= 1) + { + StartSpriteAnim(sprite, sprite->data[4] + 1); + sprite->data[2] = 0; + sprite->data[0]++; + } + else + { + sprite->data[0] = 7; + return FALSE; + } + } + break; + case 5: + sprite->pos1.y += 4; + if (++sprite->data[2] >= 8) + { + sprite->data[2] = 0; + StartSpriteAffineAnim(sprite, 3); + sprite->data[0]++; + } + break; + case 6: + if (sprite->affineAnimEnded) + { + sprite->data[4]++; + sprite->data[0] = 1; + } + break; + case 7: + return FALSE; + } + + return TRUE; +} + +// First argument is unused. +void sub_802EDCC(u8 spriteId1, u8 spriteId2, u8 spriteId3) +{ + gSprites[spriteId2].pos2.y = -40; + gSprites[spriteId3].pos2.y = -40; + gSprites[spriteId2].invisible = FALSE; + gSprites[spriteId3].invisible = FALSE; + gSprites[spriteId2].callback = sub_802EE5C; + gSprites[spriteId3].callback = sub_802EE5C; +} + +bool32 sub_802EE30(u8 spriteId) +{ + return (gSprites[spriteId].callback == sub_802EE5C); +} + +void sub_802EE5C(struct Sprite *sprite) +{ + s32 y; + s16 *data = sprite->data; + + switch (data[0]) + { + case 0: + data[4] = 64; + data[5] = sprite->pos2.y << 4; + data[0]++; + case 1: + data[5] += data[4]; + data[4]++; + sprite->pos2.y = data[5] >> 4; + if (sprite->pos2.y >= 0) + { + PlaySE(SE_KON2); + sprite->pos2.y = 0; + data[0]++; + } + break; + case 2: + data[1] += 12; + if (data[1] >= 128) + { + PlaySE(SE_KON2); + data[1] = 0; + data[0]++; + } + y = gSineTable[data[1]]; + sprite->pos2.y = -(y >> 4); + break; + case 3: + data[1] += 16; + if (data[1] >= 128) + { + PlaySE(SE_KON2); + data[1] = 0; + data[0]++; + } + sprite->pos2.y = -(gSineTable[data[1]] >> 5); + break; + case 4: + if (++data[1] > 40) + sprite->callback = SpriteCallbackDummy; + break; + } +} + +static const u16 gPkmnJump321StartPal2[] = INCBIN_U16("graphics/link_games/pkmnjump_321start2.gbapal"); +static const u32 gPkmnJump321StartGfx2[] = INCBIN_U32("graphics/link_games/pkmnjump_321start2.4bpp.lz"); + +void sub_802EF50(u16 tileTag, u16 palTag) +{ + struct CompressedSpriteSheet sprSheet = {gPkmnJump321StartGfx2, 0xE00, 0}; + struct SpritePalette sprPal = {gPkmnJump321StartPal2, 0}; + + sprSheet.tag = tileTag; + sprPal.tag = palTag; + + LoadCompressedSpriteSheet(&sprSheet); + LoadSpritePalette(&sprPal); +} + +static const struct OamData sOamData_82FEBDC = +{ + .y = 0, + .affineMode = 3, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_82FEBE4 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_82FEBEC[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FEBF4[] = +{ + ANIMCMD_FRAME(16, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FEBFC[] = +{ + ANIMCMD_FRAME(32, 1), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_82FEC04[] = +{ + sSpriteAnim_82FEBEC, + sSpriteAnim_82FEBF4, + sSpriteAnim_82FEBFC +}; + +static const union AnimCmd sSpriteAnim_82FEC10[] = +{ + ANIMCMD_FRAME(48, 1), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_82FEC18[] = +{ + ANIMCMD_FRAME(80, 1), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_82FEC20[] = +{ + sSpriteAnim_82FEC10, + sSpriteAnim_82FEC18 +}; + +static const union AffineAnimCmd sSpriteAffineAnim_82FEC28[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_82FEC38[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(16, -16, 0, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_82FEC50[] = +{ + AFFINEANIMCMD_FRAME(-18, 18, 0, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_82FEC60[] = +{ + AFFINEANIMCMD_FRAME(6, -6, 0, 8), + AFFINEANIMCMD_FRAME(-4, 4, 0, 8), + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_82FEC80[] = +{ + sSpriteAffineAnim_82FEC28, + sSpriteAffineAnim_82FEC38, + sSpriteAffineAnim_82FEC50, + sSpriteAffineAnim_82FEC60 +}; + +u8 sub_802EFA8(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subpriority) +{ + u8 spriteId; + struct SpriteTemplate sprTemplate = + { + .tileTag = 0, + .paletteTag = 0, + .oam = &sOamData_82FEBDC, + .anims = sSpriteAnimTable_82FEC04, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_82FEC80, + .callback = SpriteCallbackDummy, + }; + + sprTemplate.tileTag = tileTag; + sprTemplate.paletteTag = palTag; + spriteId = CreateSprite(&sprTemplate, x, y, subpriority); + return spriteId; +} + +void sub_802EFFC(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subpriority, s16 *spriteId1, s16 *spriteId2) +{ + struct SpriteTemplate sprTemplate = + { + .tileTag = 0, + .paletteTag = 0, + .oam = &sOamData_82FEBE4, + .anims = sSpriteAnimTable_82FEC20, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + + sprTemplate.tileTag = tileTag; + sprTemplate.paletteTag = palTag; + *spriteId1 = CreateSprite(&sprTemplate, x - 32, y, subpriority); + *spriteId2 = CreateSprite(&sprTemplate, x + 32, y, subpriority); + + gSprites[*spriteId1].invisible = TRUE; + gSprites[*spriteId2].invisible = TRUE; + StartSpriteAnim(&gSprites[*spriteId2], 1); +}