diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s deleted file mode 100644 index 09d1f4fa1..000000000 --- a/asm/contest_link_80FC4F4.s +++ /dev/null @@ -1,1362 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_80FC4F4 -sub_80FC4F4: @ 80FC4F4 - push {r4,r5,lr} - adds r2, r0, 0 - lsls r4, r1, 16 - lsrs r4, 16 - ldr r5, =gDecompressionBuffer - adds r0, r5, 0 - adds r1, r2, 0 - adds r2, r4, 0 - bl memcpy - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - adds r1, r5, 0 - adds r2, r4, 0 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - bne _080FC528 - movs r0, 0 - b _080FC52A - .pool -_080FC528: - movs r0, 0x1 -_080FC52A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80FC4F4 - - thumb_func_start sub_80FC530 -sub_80FC530: @ 80FC530 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0x80 - lsls r4, 17 - lsls r4, r5 - lsrs r4, 24 - bl GetBlockReceivedStatus - ands r4, r0 - cmp r4, 0 - beq _080FC552 - adds r0, r5, 0 - bl ResetBlockReceivedFlag - movs r0, 0x1 - b _080FC554 -_080FC552: - movs r0, 0 -_080FC554: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80FC530 - - thumb_func_start sub_80FC55C -sub_80FC55C: @ 80FC55C - push {r4,lr} - bl GetBlockReceivedStatus - adds r4, r0, 0 - bl sub_800A9D8 - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - beq _080FC574 - movs r0, 0 - b _080FC57A -_080FC574: - bl ResetBlockReceivedFlags - movs r0, 0x1 -_080FC57A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80FC55C - - thumb_func_start sub_80FC580 -sub_80FC580: @ 80FC580 - push {r4-r6,lr} - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - ldr r5, =gTasks - ldr r6, =sub_80FC5C0 - ldr r4, =gBlockRecvBuffer - movs r3, 0xFF -_080FC590: - lsls r0, r1, 8 - adds r0, r4 - strh r3, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _080FC590 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r5 - movs r1, 0 - strh r1, [r0, 0x8] - str r6, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FC580 - - thumb_func_start sub_80FC5C0 -sub_80FC5C0: @ 80FC5C0 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =sub_80FC5DC - str r0, [r1] - bx lr - .pool - thumb_func_end sub_80FC5C0 - - thumb_func_start sub_80FC5DC -sub_80FC5DC: @ 80FC5DC - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080FC650 - bl GetMultiplayerId - ldr r1, =gContestPlayerMonIndex - strb r0, [r1] - bl GetLinkPlayerCount - ldr r4, =gNumLinkContestPlayers - strb r0, [r4] - ldr r1, =gIsLinkContest - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0x1 - bne _080FC60C - movs r0, 0x3 - strb r0, [r1] -_080FC60C: - movs r3, 0 - ldrb r2, [r4] - cmp r3, r2 - bge _080FC64A - ldr r1, =gLinkPlayers - ldrb r0, [r1] - subs r0, 0x1 - adds r6, r4, 0 - cmp r0, 0x1 - bls _080FC63A - adds r4, r2, 0 - adds r2, r1, 0 - movs r5, 0xFF -_080FC626: - adds r2, 0x1C - adds r3, 0x1 - cmp r3, r4 - bge _080FC64A - ldrh r1, [r2] - adds r0, r5, 0 - ands r0, r1 - subs r0, 0x1 - cmp r0, 0x1 - bhi _080FC626 -_080FC63A: - ldrb r6, [r6] - cmp r3, r6 - bge _080FC64A - ldr r0, =gIsLinkContest - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_080FC64A: - adds r0, r7, 0 - bl SwitchTaskToFollowupFunc -_080FC650: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FC5DC - - thumb_func_start sub_80FC670 -sub_80FC670: @ 80FC670 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gIsLinkContest - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _080FC698 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080FC6A0 - cmp r0, 0x1 - beq _080FC6AE - bl IsLinkTaskFinished - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080FC6B4 -_080FC698: - movs r0, 0x1 - b _080FC6B6 - .pool -_080FC6A0: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FC6B4 - bl sub_800ADF8 -_080FC6AE: - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] -_080FC6B4: - movs r0, 0 -_080FC6B6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80FC670 - - thumb_func_start sub_80FC6BC -sub_80FC6BC: @ 80FC6BC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r6, r7, 2 - adds r0, r6, r7 - lsls r4, r0, 3 - ldr r5, =gTasks + 0x8 - adds r0, r4, r5 - adds r0, 0x18 - bl sub_80FC670 - cmp r0, 0 - bne _080FC6DC - b _080FC7F4 -_080FC6DC: - adds r0, r5, 0 - subs r0, 0x8 - adds r4, r0 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080FC758 - cmp r0, 0x1 - bgt _080FC6F8 - cmp r0, 0 - beq _080FC6FE - b _080FC7DC - .pool -_080FC6F8: - cmp r0, 0xA - beq _080FC7C0 - b _080FC7DC -_080FC6FE: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _080FC738 - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FC7F4 - ldr r0, =gBlockSendBuffer - ldr r1, =gContestPlayerMonIndex - ldrb r1, [r1] - lsls r1, 6 - ldr r2, =gContestMons - adds r1, r2 - movs r2, 0x40 - bl memcpy - movs r0, 0xA - strh r0, [r4, 0x8] - b _080FC7F4 - .pool -_080FC738: - ldr r0, =gBlockSendBuffer - ldr r1, =gContestPlayerMonIndex - ldrb r1, [r1] - lsls r1, 6 - ldr r2, =gContestMons - adds r1, r2 - movs r2, 0x40 - bl memcpy - b _080FC7D6 - .pool -_080FC758: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FC7F4 - movs r5, 0 - ldr r0, =gNumLinkContestPlayers - mov r8, r6 - ldrb r0, [r0] - cmp r5, r0 - bge _080FC798 - ldr r6, =gLinkPlayers -_080FC770: - lsls r4, r5, 6 - ldr r0, =gContestMons - adds r4, r0 - lsls r1, r5, 8 - ldr r0, =gBlockRecvBuffer - adds r1, r0 - adds r0, r4, 0 - movs r2, 0x40 - bl memcpy - ldrh r1, [r6, 0x1A] - adds r0, r4, 0 - bl sub_80DFA08 - adds r6, 0x1C - adds r5, 0x1 - ldr r0, =gNumLinkContestPlayers - ldrb r0, [r0] - cmp r5, r0 - blt _080FC770 -_080FC798: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080FC7F4 - .pool -_080FC7C0: - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] - lsls r0, 16 - movs r1, 0x96 - lsls r1, 17 - cmp r0, r1 - ble _080FC7F4 - movs r0, 0x2 - bl sub_800A4D8 -_080FC7D6: - movs r0, 0x1 - strh r0, [r4, 0x8] - b _080FC7F4 -_080FC7DC: - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0 - strh r0, [r1, 0x8] - strh r0, [r1, 0x1E] - strh r0, [r1, 0x20] - adds r0, r7, 0 - bl SwitchTaskToFollowupFunc -_080FC7F4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FC6BC - - thumb_func_start sub_80FC804 -sub_80FC804: @ 80FC804 - push {r4,r5,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r5, r0, r1 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _080FC830 - cmp r0, 0x1 - beq _080FC858 - movs r0, 0 - strh r0, [r5, 0x8] - adds r0, r2, 0 - bl SwitchTaskToFollowupFunc - b _080FC880 - .pool -_080FC830: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _080FC87A - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FC880 - ldr r0, =gRngValue - movs r1, 0x4 - bl sub_80FC4F4 - cmp r0, 0x1 - bne _080FC880 - b _080FC87A - .pool -_080FC858: - movs r0, 0 - bl sub_80FC530 - lsls r0, 24 - cmp r0, 0 - beq _080FC880 - ldr r0, =gRngValue - ldr r4, =gBlockRecvBuffer - adds r1, r4, 0 - movs r2, 0x4 - bl memcpy - ldr r0, =gContestRngValue - adds r1, r4, 0 - movs r2, 0x4 - bl memcpy -_080FC87A: - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] -_080FC880: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FC804 - - thumb_func_start sub_80FC894 -sub_80FC894: @ 80FC894 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - mov r8, r0 - adds r0, r6 - lsls r5, r0, 3 - ldr r7, =gTasks + 0x8 - adds r0, r5, r7 - adds r0, 0x18 - bl sub_80FC670 - cmp r0, 0 - beq _080FC986 - movs r1, 0x8 - negs r1, r1 - adds r1, r7 - mov r9, r1 - adds r4, r5, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080FC90C - cmp r0, 0x1 - bgt _080FC8D8 - cmp r0, 0 - beq _080FC8DE - b _080FC96E - .pool -_080FC8D8: - cmp r0, 0xA - beq _080FC954 - b _080FC96E -_080FC8DE: - ldr r1, =gBlockSendBuffer - ldrh r0, [r4, 0x1A] - strb r0, [r1] - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _080FC904 - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FC986 - movs r0, 0xA - strh r0, [r4, 0x8] - b _080FC986 - .pool -_080FC904: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080FC986 -_080FC90C: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FC986 - movs r3, 0 - ldr r1, =gNumLinkContestPlayers - ldrb r0, [r1] - cmp r3, r0 - bge _080FC93A - ldr r4, =gBlockRecvBuffer - adds r0, r7, 0x2 - adds r2, r5, r0 - movs r5, 0x80 - lsls r5, 1 -_080FC92A: - ldrh r0, [r4] - strh r0, [r2] - adds r4, r5 - adds r2, 0x2 - adds r3, 0x1 - ldrb r0, [r1] - cmp r3, r0 - blt _080FC92A -_080FC93A: - mov r0, r8 - adds r1, r0, r6 - lsls r1, 3 - add r1, r9 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080FC986 - .pool -_080FC954: - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - ble _080FC986 - movs r0, 0x2 - bl sub_800A4D8 - movs r0, 0x1 - strh r0, [r4, 0x8] - b _080FC986 -_080FC96E: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r0, 0 - strh r0, [r1, 0x8] - strh r0, [r1, 0x1E] - strh r0, [r1, 0x20] - adds r0, r6, 0 - bl SwitchTaskToFollowupFunc -_080FC986: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FC894 - - thumb_func_start sub_80FC998 -sub_80FC998: @ 80FC998 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080FC9C4 - cmp r0, 0x1 - beq _080FC9E0 - movs r0, 0 - strh r0, [r4, 0x8] - adds r0, r2, 0 - bl SwitchTaskToFollowupFunc - b _080FC9F0 - .pool -_080FC9C4: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FC9F0 - ldr r0, =gContestPlayerMonIndex - movs r1, 0x1 - bl sub_80FC4F4 - cmp r0, 0x1 - bne _080FC9F0 - b _080FC9EA - .pool -_080FC9E0: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FC9F0 -_080FC9EA: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080FC9F0: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FC998 - - thumb_func_start sub_80FC9F8 -sub_80FC9F8: @ 80FC9F8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gTasks - mov r8, r0 - lsls r7, r5, 2 - adds r0, r7, r5 - lsls r0, 3 - mov r1, r8 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080FCA30 - cmp r0, 0x1 - beq _080FCA68 - movs r0, 0 - strh r0, [r4, 0x8] - adds r0, r5, 0 - bl SwitchTaskToFollowupFunc - b _080FCAB2 - .pool -_080FCA30: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCAB2 - ldr r0, =gContestResources - ldr r2, [r0] - ldr r0, =gContestPlayerMonIndex - ldrb r0, [r0] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r0, [r2, 0x4] - adds r0, r1 - adds r0, 0x6 - movs r1, 0x2 - bl sub_80FC4F4 - cmp r0, 0x1 - bne _080FCAB2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080FCAB2 - .pool -_080FCA68: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCAB2 - movs r2, 0 - ldr r6, =gNumLinkContestPlayers - mov r9, r8 - mov r12, r7 - ldrb r0, [r6] - cmp r2, r0 - bge _080FCAA4 - ldr r1, =gContestResources - mov r8, r1 - ldr r4, =gBlockRecvBuffer - movs r3, 0 - movs r7, 0x80 - lsls r7, 1 -_080FCA8C: - mov r1, r8 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r0, r3, r0 - ldrh r1, [r4] - strh r1, [r0, 0x6] - adds r4, r7 - adds r3, 0x1C - adds r2, 0x1 - ldrb r0, [r6] - cmp r2, r0 - blt _080FCA8C -_080FCAA4: - mov r0, r12 - adds r1, r0, r5 - lsls r1, 3 - add r1, r9 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_080FCAB2: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FC9F8 - - thumb_func_start sub_80FCACC -sub_80FCACC: @ 80FCACC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r1 - movs r3, 0x8 - ldrsh r0, [r2, r3] - adds r3, r1, 0 - cmp r0, 0xB - bls _080FCAE8 - b _080FCC78 -_080FCAE8: - lsls r0, 2 - ldr r1, =_080FCAFC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FCAFC: - .4byte _080FCB2C - .4byte _080FCB44 - .4byte _080FCB6C - .4byte _080FCB90 - .4byte _080FCBA4 - .4byte _080FCB6C - .4byte _080FCBCC - .4byte _080FCBE0 - .4byte _080FCB6C - .4byte _080FCC08 - .4byte _080FCC38 - .4byte _080FCB6C -_080FCB2C: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - bne _080FCB38 - b _080FCC82 -_080FCB38: - ldr r0, =gUnknown_02039F08 - movs r1, 0x8 - b _080FCC16 - .pool -_080FCB44: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - bne _080FCB50 - b _080FCC82 -_080FCB50: - ldr r0, =gUnknown_02039F08 - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x8 - b _080FCC50 - .pool -_080FCB6C: - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r3 - ldrh r0, [r2, 0xA] - adds r1, r0, 0x1 - strh r1, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bgt _080FCB84 - b _080FCC82 -_080FCB84: - movs r0, 0 - strh r0, [r2, 0xA] - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - b _080FCC82 -_080FCB90: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCC82 - ldr r0, =gUnknown_02039F10 - movs r1, 0x8 - b _080FCC16 - .pool -_080FCBA4: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCC82 - ldr r0, =gUnknown_02039F10 - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x8 - b _080FCC50 - .pool -_080FCBCC: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCC82 - ldr r0, =gUnknown_02039F18 - movs r1, 0x8 - b _080FCC16 - .pool -_080FCBE0: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCC82 - ldr r0, =gUnknown_02039F18 - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x8 - b _080FCC50 - .pool -_080FCC08: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCC82 - ldr r0, =gContestFinalStandings - movs r1, 0x4 -_080FCC16: - bl sub_80FC4F4 - cmp r0, 0x1 - bne _080FCC82 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080FCC82 - .pool -_080FCC38: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCC82 - ldr r0, =gContestFinalStandings - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x4 -_080FCC50: - bl memcpy - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _080FCC82 - .pool -_080FCC78: - movs r0, 0 - strh r0, [r2, 0x8] - adds r0, r4, 0 - bl SwitchTaskToFollowupFunc -_080FCC82: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FCACC - - thumb_func_start sub_80FCC88 -sub_80FCC88: @ 80FCC88 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r1 - movs r3, 0x8 - ldrsh r0, [r2, r3] - adds r3, r1, 0 - cmp r0, 0xB - bls _080FCCA4 - b _080FCE38 -_080FCCA4: - lsls r0, 2 - ldr r1, =_080FCCB8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080FCCB8: - .4byte _080FCCE8 - .4byte _080FCD04 - .4byte _080FCD30 - .4byte _080FCD54 - .4byte _080FCD6C - .4byte _080FCD30 - .4byte _080FCD98 - .4byte _080FCDB0 - .4byte _080FCD30 - .4byte _080FCDC8 - .4byte _080FCDF8 - .4byte _080FCD30 -_080FCCE8: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - bne _080FCCF4 - b _080FCE42 -_080FCCF4: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x4] - movs r1, 0x70 - b _080FCDD6 - .pool -_080FCD04: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - bne _080FCD10 - b _080FCE42 -_080FCD10: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x4] - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x70 - b _080FCE10 - .pool -_080FCD30: - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r2, r0, r3 - ldrh r0, [r2, 0xA] - adds r1, r0, 0x1 - strh r1, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bgt _080FCD48 - b _080FCE42 -_080FCD48: - movs r0, 0 - strh r0, [r2, 0xA] - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - b _080FCE42 -_080FCD54: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCE42 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x8] - movs r1, 0x14 - b _080FCDD6 - .pool -_080FCD6C: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCE42 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x8] - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x14 - b _080FCE10 - .pool -_080FCD98: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCE42 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x10] - b _080FCDD4 - .pool -_080FCDB0: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCE42 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x10] - b _080FCE04 - .pool -_080FCDC8: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCE42 - ldr r0, =gUnknown_02039F26 -_080FCDD4: - movs r1, 0x4 -_080FCDD6: - bl sub_80FC4F4 - cmp r0, 0x1 - bne _080FCE42 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080FCE42 - .pool -_080FCDF8: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCE42 - ldr r0, =gUnknown_02039F26 -_080FCE04: - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x4 -_080FCE10: - bl memcpy - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _080FCE42 - .pool -_080FCE38: - movs r0, 0 - strh r0, [r2, 0x8] - adds r0, r4, 0 - bl SwitchTaskToFollowupFunc -_080FCE42: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80FCC88 - - thumb_func_start sub_80FCE48 -sub_80FCE48: @ 80FCE48 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - mov r8, r0 - adds r0, r6 - lsls r5, r0, 3 - ldr r7, =gTasks + 0x8 - adds r0, r5, r7 - adds r0, 0x18 - bl sub_80FC670 - cmp r0, 0 - beq _080FCF2E - movs r1, 0x8 - negs r1, r1 - adds r1, r7 - mov r9, r1 - adds r4, r5, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080FCEC0 - cmp r0, 0x1 - bgt _080FCE8C - cmp r0, 0 - beq _080FCE92 - b _080FCF16 - .pool -_080FCE8C: - cmp r0, 0xA - beq _080FCEFC - b _080FCF16 -_080FCE92: - ldr r1, =gBlockSendBuffer - movs r0, 0x6E - strb r0, [r1] - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _080FCEB8 - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCF2E - movs r0, 0xA - strh r0, [r4, 0x8] - b _080FCF2E - .pool -_080FCEB8: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080FCF2E -_080FCEC0: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCF2E - mov r1, r8 - mov r8, r9 - ldr r4, =gBlockRecvBuffer - adds r0, r7, 0 - adds r0, 0xA - adds r2, r5, r0 - movs r5, 0x80 - lsls r5, 1 - movs r3, 0x3 -_080FCEDC: - ldrh r0, [r4] - strh r0, [r2] - adds r4, r5 - adds r2, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _080FCEDC - adds r1, r6 - lsls r1, 3 - add r1, r8 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080FCF2E - .pool -_080FCEFC: - ldrh r0, [r4, 0x1E] - adds r0, 0x1 - strh r0, [r4, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - ble _080FCF2E - movs r0, 0x2 - bl sub_800A4D8 - movs r0, 0x1 - strh r0, [r4, 0x8] - b _080FCF2E -_080FCF16: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r0, 0 - strh r0, [r1, 0x8] - strh r0, [r1, 0x1E] - strh r0, [r1, 0x20] - adds r0, r6, 0 - bl SwitchTaskToFollowupFunc -_080FCF2E: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FCE48 - - thumb_func_start sub_80FCF40 -sub_80FCF40: @ 80FCF40 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r4, r0, 3 - ldr r6, =gTasks + 0x8 - adds r0, r4, r6 - adds r0, 0x18 - bl sub_80FC670 - cmp r0, 0 - beq _080FCFBE - adds r0, r6, 0 - subs r0, 0x8 - adds r4, r0 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080FCF80 - cmp r0, 0x1 - beq _080FCF9C - movs r0, 0 - strh r0, [r4, 0x8] - strh r0, [r4, 0x20] - adds r0, r5, 0 - bl SwitchTaskToFollowupFunc - b _080FCFBE - .pool -_080FCF80: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FCFBE - ldr r0, =gContestMonConditions - movs r1, 0x8 - bl sub_80FC4F4 - cmp r0, 0x1 - bne _080FCFBE - b _080FCFB8 - .pool -_080FCF9C: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FCFBE - ldr r0, =gContestMonConditions - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x8 - bl memcpy -_080FCFB8: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080FCFBE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FCF40 - - thumb_func_start sub_80FCFD0 -sub_80FCFD0: @ 80FCFD0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r4, r0, 3 - ldr r6, =gTasks + 0x8 - adds r0, r4, r6 - adds r0, 0x18 - bl sub_80FC670 - cmp r0, 0 - beq _080FD04E - adds r0, r6, 0 - subs r0, 0x8 - adds r4, r0 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080FD010 - cmp r0, 0x1 - beq _080FD02C - movs r0, 0 - strh r0, [r4, 0x8] - strh r0, [r4, 0x20] - adds r0, r5, 0 - bl SwitchTaskToFollowupFunc - b _080FD04E - .pool -_080FD010: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _080FD04E - ldr r0, =gUnknown_02039F26 - movs r1, 0x4 - bl sub_80FC4F4 - cmp r0, 0x1 - bne _080FD04E - b _080FD048 - .pool -_080FD02C: - bl sub_80FC55C - lsls r0, 24 - cmp r0, 0 - beq _080FD04E - ldr r0, =gUnknown_02039F26 - ldr r1, =gUnknown_02039F2B - ldrb r1, [r1] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0x4 - bl memcpy -_080FD048: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_080FD04E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80FCFD0 - - .align 2, 0 @ Don't pad with nop. diff --git a/include/contest.h b/include/contest.h index fa0f49638..9d287b9a5 100644 --- a/include/contest.h +++ b/include/contest.h @@ -231,6 +231,8 @@ extern u8 gHighestRibbonRank; extern u8 gContestFinalStandings[4]; extern u8 gContestPlayerMonIndex; extern s16 gUnknown_02039F08[4]; +extern s16 gUnknown_02039F10[4]; +extern s16 gUnknown_02039F18[4]; extern s16 gContestMonConditions[4]; extern u8 gIsLinkContest; extern struct ContestWinner gUnknown_02039F3C; @@ -446,10 +448,10 @@ void sub_81D9DE4(u8 taskId); void sub_80FCF40(u8); void sub_80FCFD0(u8); void sub_80F8714(u8); -int sub_80FC670(s16 *); -int sub_80FC4F4(void *, u16); -u8 sub_80FC55C(void); -u8 sub_80FC530(u8); +bool32 sub_80FC670(s16 *); +bool32 sub_80FC4F4(void *, u16); +bool8 sub_80FC55C(void); +bool8 sub_80FC530(u8); u8 sub_80F86E0(u8 *); #endif //GUARD_CONTEST_H diff --git a/ld_script.txt b/ld_script.txt index cf40ed84b..b5457a811 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -154,7 +154,7 @@ SECTIONS { src/field_special_scene.o(.text); src/rotating_gate.o(.text); src/safari_zone.o(.text); - asm/contest_link_80FC4F4.o(.text); + src/contest_link_80FC4F4.o(.text); src/item_use.o(.text); src/battle_anim_effects_1.o(.text); src/battle_anim_effects_2.o(.text); diff --git a/src/contest_link_80FC4F4.c b/src/contest_link_80FC4F4.c new file mode 100755 index 000000000..f582626f8 --- /dev/null +++ b/src/contest_link_80FC4F4.c @@ -0,0 +1,548 @@ +#include "global.h" +#include "contest.h" +#include "decompress.h" +#include "event_data.h" +#include "link.h" +#include "pokemon.h" +#include "random.h" +#include "task.h" +#include "constants/flags.h" + +static void sub_80FC5C0(u8); +static void sub_80FC5DC(u8); + +bool32 sub_80FC4F4(void *src, u16 size) +{ + memcpy(gDecompressionBuffer, src, size); + if (SendBlock(bitmask_all_link_players_but_self(), gDecompressionBuffer, size)) + return TRUE; + else + return FALSE; +} + +bool8 sub_80FC530(u8 arg0) +{ + u8 mask = (1 << arg0); + if (!(GetBlockReceivedStatus() & mask)) + { + return FALSE; + } + else + { + ResetBlockReceivedFlag(arg0); + return TRUE; + } +} + +bool8 sub_80FC55C(void) +{ + if (GetBlockReceivedStatus() == sub_800A9D8()) + { + ResetBlockReceivedFlags(); + return TRUE; + } + else + { + return FALSE; + } +} + +void sub_80FC580(u8 taskId) +{ + u8 i; + + for (i = 0; i < 4; i++) + gBlockRecvBuffer[i][0] = 0xFF; + + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = sub_80FC5C0; +} + +static void sub_80FC5C0(u8 taskId) +{ + gTasks[taskId].func = sub_80FC5DC; +} + +static void sub_80FC5DC(u8 taskId) +{ + int i; + + if (!gReceivedRemoteLinkPlayers) + return; + + gContestPlayerMonIndex = GetMultiplayerId(); + gNumLinkContestPlayers = GetLinkPlayerCount(); + gIsLinkContest = 1; + if (gWirelessCommType == 1) + gIsLinkContest = 3; + + for (i = 0; i < gNumLinkContestPlayers && (u32)(gLinkPlayers[i].version & 0xFF) - 1 > VERSION_RUBY - 1; i++) + ; + + if (i < gNumLinkContestPlayers) + gIsLinkContest |= 0x4; + + SwitchTaskToFollowupFunc(taskId); +} + +bool32 sub_80FC670(s16 *arg0) +{ + if (gIsLinkContest & 0x4) + return TRUE; + + switch (*arg0) + { + case 0: + if (IsLinkTaskFinished()) + { + sub_800ADF8(); + (*arg0)++; + } + return FALSE; + case 1: + (*arg0)++; + return FALSE; + default: + if (IsLinkTaskFinished() != TRUE) + return FALSE; + else + return TRUE; + } +} + +void sub_80FC6BC(u8 taskId) +{ + int i; + + if (!sub_80FC670(&gTasks[taskId].data[12])) + return; + + switch (gTasks[taskId].data[0]) + { + case 0: + if (GetMultiplayerId() == 0) + { + if (IsLinkTaskFinished()) + { + memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon)); + gTasks[taskId].data[0] = 10; + } + } + else + { + memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon)); + gTasks[taskId].data[0] = 1; + } + break; + case 1: + if (sub_80FC55C()) + { + for (i = 0; i < gNumLinkContestPlayers; i++) + { + memcpy(&gContestMons[i], gBlockRecvBuffer[i], sizeof(struct ContestPokemon)); + sub_80DFA08(&gContestMons[i], gLinkPlayers[i].language); + } + + gTasks[taskId].data[0]++; + } + break; + case 10: + if (++gTasks[taskId].data[11] > 300) + { + sub_800A4D8(2); + gTasks[taskId].data[0] = 1; + } + break; + default: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[12] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FC804(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (GetMultiplayerId() == 0) + { + if (IsLinkTaskFinished() && sub_80FC4F4(&gRngValue, sizeof(gRngValue)) == TRUE) + gTasks[taskId].data[0]++; + } + else + { + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC530(0)) + { + memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue)); + memcpy(&gContestRngValue, gBlockRecvBuffer[0], sizeof(gContestRngValue)); + gTasks[taskId].data[0]++; + } + break; + default: + gTasks[taskId].data[0] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FC894(u8 taskId) +{ + int i; + + if (!sub_80FC670(&gTasks[taskId].data[12])) + return; + + switch (gTasks[taskId].data[0]) + { + case 0: + gBlockSendBuffer[0] = gTasks[taskId].data[9]; + if (GetMultiplayerId() == 0) + { + if (IsLinkTaskFinished()) + gTasks[taskId].data[0] = 10; + } + else + { + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + { + for (i = 0; i < gNumLinkContestPlayers; i++) + gTasks[taskId].data[i + 1] = gBlockRecvBuffer[i][0]; + + gTasks[taskId].data[0]++; + } + break; + case 10: + if (++gTasks[taskId].data[11] > 10) + { + sub_800A4D8(2); + gTasks[taskId].data[0] = 1; + } + break; + default: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[12] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FC998(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(&gContestPlayerMonIndex, sizeof(gContestPlayerMonIndex)) == TRUE) + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + gTasks[taskId].data[0]++; + break; + default: + gTasks[taskId].data[0] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FC9F8(u8 taskId) +{ + int i; + + switch (gTasks[taskId].data[0]) + { + case 0: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(&gContestResources->field_4[gContestPlayerMonIndex].currMove, sizeof(gContestResources->field_4[gContestPlayerMonIndex].currMove)) == TRUE) + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + { + for (i = 0; i < gNumLinkContestPlayers; i++) + gContestResources->field_4[i].currMove = gBlockRecvBuffer[i][0]; + + gTasks[taskId].data[0]++; + } + break; + default: + gTasks[taskId].data[0] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FCACC(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gUnknown_02039F08, sizeof(gUnknown_02039F08)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + { + memcpy(gUnknown_02039F08, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F08)); + gTasks[taskId].data[0]++; + } + break; + case 2: + case 5: + case 8: + case 11: + if (gTasks[taskId].data[1]++ > 10) + { + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[0]++; + } + break; + case 3: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gUnknown_02039F10, sizeof(gUnknown_02039F10)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 4: + if (sub_80FC55C()) + { + memcpy(gUnknown_02039F10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F10)); + gTasks[taskId].data[0]++; + } + break; + case 6: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gUnknown_02039F18, sizeof(gUnknown_02039F18)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 7: + if (sub_80FC55C()) + { + memcpy(gUnknown_02039F18, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F18)); + gTasks[taskId].data[0]++; + } + break; + case 9: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gContestFinalStandings, sizeof(gContestFinalStandings)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 10: + if (sub_80FC55C()) + { + memcpy(gContestFinalStandings, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestFinalStandings)); + gTasks[taskId].data[0]++; + } + break; + default: + gTasks[taskId].data[0] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FCC88(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gContestResources->field_4, 4 * sizeof(struct ContestantStatus)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + { + memcpy(gContestResources->field_4, gBlockRecvBuffer[gUnknown_02039F2B], 4 * sizeof(struct ContestantStatus)); + gTasks[taskId].data[0]++; + } + break; + case 2: + case 5: + case 8: + case 11: + if (gTasks[taskId].data[1]++ > 10) + { + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[0]++; + } + break; + case 3: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gContestResources->field_8, sizeof(struct UnknownContestStruct7)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 4: + if (sub_80FC55C()) + { + memcpy(gContestResources->field_8, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct7)); + gTasks[taskId].data[0]++; + } + break; + case 6: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gContestResources->field_10, sizeof(struct UnknownContestStruct5)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 7: + if (sub_80FC55C()) + { + memcpy(gContestResources->field_10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct5)); + gTasks[taskId].data[0]++; + } + break; + case 9: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gUnknown_02039F26, sizeof(gUnknown_02039F26)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 10: + if (sub_80FC55C()) + { + memcpy(gUnknown_02039F26, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F26)); + gTasks[taskId].data[0]++; + } + break; + default: + gTasks[taskId].data[0] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FCE48(u8 taskId) +{ + int i; + + if (!sub_80FC670(&gTasks[taskId].data[12])) + return; + + switch (gTasks[taskId].data[0]) + { + case 0: + gBlockSendBuffer[0] = 0x6E; + if (GetMultiplayerId() == 0) + { + if (IsLinkTaskFinished()) + gTasks[taskId].data[0] = 10; + } + else + { + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + { + for (i = 0; i < 4; i++) + gTasks[taskId].data[i + 5] = gBlockRecvBuffer[i][0]; + + gTasks[taskId].data[0]++; + } + break; + case 10: + if (++gTasks[taskId].data[11] > 10) + { + sub_800A4D8(2); + gTasks[taskId].data[0] = 1; + } + break; + default: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[12] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FCF40(u8 taskId) +{ + if (!sub_80FC670(&gTasks[taskId].data[12])) + return; + + switch (gTasks[taskId].data[0]) + { + case 0: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gContestMonConditions, sizeof(gContestMonConditions)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + { + memcpy(gContestMonConditions, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonConditions)); + gTasks[taskId].data[0]++; + } + break; + default: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[12] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} + +void sub_80FCFD0(u8 taskId) +{ + if (!sub_80FC670(&gTasks[taskId].data[12])) + return; + + switch (gTasks[taskId].data[0]) + { + case 0: + if (IsLinkTaskFinished()) + { + if (sub_80FC4F4(gUnknown_02039F26, sizeof(gUnknown_02039F26)) == 1) + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_80FC55C()) + { + memcpy(gUnknown_02039F26, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F26)); + gTasks[taskId].data[0]++; + } + break; + default: + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[12] = 0; + SwitchTaskToFollowupFunc(taskId); + break; + } +} diff --git a/src/contest_link_81D9DE4.c b/src/contest_link_81D9DE4.c index 2c05d6330..4b56c9c38 100755 --- a/src/contest_link_81D9DE4.c +++ b/src/contest_link_81D9DE4.c @@ -2,10 +2,8 @@ #include "contest.h" #include "event_data.h" #include "link.h" -#include "pokemon.h" #include "random.h" #include "task.h" -#include "constants/flags.h" static void sub_81D9F14(u8); static void sub_81D9F30(u8);