diff --git a/asm/field_specials.s b/asm/field_specials.s deleted file mode 100644 index aa4699b742..0000000000 --- a/asm/field_specials.s +++ /dev/null @@ -1,1320 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_813B484 -sub_813B484: @ 813B484 - push {lr} - movs r0, 0x2 - bl sub_80AB104 - pop {r0} - bx r0 - thumb_func_end sub_813B484 - - thumb_func_start sub_813B490 -sub_813B490: @ 813B490 - push {r4-r7,lr} - movs r3, 0 - ldr r0, =gSaveBlock1Ptr - ldr r4, [r0] - movs r6, 0x4 - ldrsb r6, [r4, r6] - ldr r5, =gUnknown_085B3420 - adds r0, r5, 0x2 - mov r12, r0 - adds r7, r5, 0x1 -_0813B4A4: - lsls r0, r3, 1 - adds r2, r0, r3 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r6, r0 - bne _0813B4CC - movs r1, 0x5 - ldrsb r1, [r4, r1] - adds r0, r2, r7 - ldrb r0, [r0] - cmp r1, r0 - bne _0813B4CC - mov r1, r12 - adds r0, r2, r1 - ldrb r0, [r0] - b _0813B4D8 - .pool -_0813B4CC: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xB - bls _0813B4A4 - movs r0, 0x1 -_0813B4D8: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_813B490 - - thumb_func_start sub_813B4E0 -sub_813B4E0: @ 813B4E0 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - bl GetRematchIdxByTrainerIdx - cmp r0, 0 - blt _0813B50C - movs r1, 0xAE - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B50C - movs r0, 0x1 - b _0813B50E - .pool -_0813B50C: - movs r0, 0 -_0813B50E: - pop {r1} - bx r1 - thumb_func_end sub_813B4E0 - - thumb_func_start sub_813B514 -sub_813B514: @ 813B514 - push {lr} - ldr r0, =0x0000403f - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _0813B52C - movs r0, 0x1 - b _0813B52E - .pool -_0813B52C: - movs r0, 0 -_0813B52E: - pop {r1} - bx r1 - thumb_func_end sub_813B514 - - thumb_func_start sub_813B534 -sub_813B534: @ 813B534 - push {lr} - ldr r2, =gUnknown_0203AB70 - ldr r1, =gBattleTypeFlags - ldr r0, [r1] - str r0, [r2] - movs r0, 0 - str r0, [r1] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0813B552 - ldr r0, =sub_80B3AF8 - movs r1, 0x5 - bl CreateTask -_0813B552: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B534 - - thumb_func_start sub_813B568 -sub_813B568: @ 813B568 - push {lr} - ldr r0, =sub_813B57C - movs r1, 0x5 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B568 - - thumb_func_start sub_813B57C -sub_813B57C: @ 813B57C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - ldrsh r0, [r0, r1] - cmp r0, 0x9 - bls _0813B596 - b _0813B7C6 -_0813B596: - lsls r0, 2 - ldr r1, =_0813B5A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813B5A8: - .4byte _0813B5D0 - .4byte _0813B5E4 - .4byte _0813B614 - .4byte _0813B6B4 - .4byte _0813B6E4 - .4byte _0813B728 - .4byte _0813B764 - .4byte _0813B772 - .4byte _0813B784 - .4byte _0813B7A8 -_0813B5D0: - ldr r0, =sub_80B3AF8 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _0813B5DE - b _0813B7C6 -_0813B5DE: - b _0813B790 - .pool -_0813B5E4: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813B5F2 - b _0813B7C6 -_0813B5F2: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0813B5FE - b _0813B790 -_0813B5FE: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSpecialVar_0x8004 - movs r2, 0x2 - bl SendBlock - b _0813B708 - .pool -_0813B614: - bl GetBlockReceivedStatus - movs r1, 0x2 - ands r1, r0 - cmp r1, 0 - bne _0813B622 - b _0813B7C6 -_0813B622: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _0813B62E - b _0813B790 -_0813B62E: - ldr r5, =gSpecialVar_0x8005 - ldr r0, =gBlockRecvBuffer - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r5] - movs r0, 0x1 - bl ResetBlockReceivedFlag - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0x1 - bne _0813B668 - ldrh r1, [r5] - cmp r1, 0x1 - bne _0813B668 - ldr r0, =gSpecialVar_Result - strh r1, [r0] - b _0813B790 - .pool -_0813B668: - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - adds r2, r0, 0 - cmp r1, 0 - bne _0813B68C - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0x1 - bne _0813B68C - ldr r1, =gSpecialVar_Result - movs r0, 0x2 - b _0813B6AC - .pool -_0813B68C: - ldrh r0, [r2] - cmp r0, 0x1 - bne _0813B6A8 - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0 - bne _0813B6A8 - ldr r1, =gSpecialVar_Result - movs r0, 0x3 - b _0813B6AC - .pool -_0813B6A8: - ldr r1, =gSpecialVar_Result - movs r0, 0 -_0813B6AC: - strh r0, [r1] - b _0813B790 - .pool -_0813B6B4: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813B6C2 - b _0813B7C6 -_0813B6C2: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0813B790 - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSpecialVar_Result - movs r2, 0x2 - bl SendBlock - b _0813B708 - .pool -_0813B6E4: - bl GetBlockReceivedStatus - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _0813B7C6 - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _0813B790 - ldr r1, =gSpecialVar_Result - ldr r0, =gBlockRecvBuffer - ldrh r0, [r0] - strh r0, [r1] - movs r0, 0 - bl ResetBlockReceivedFlag -_0813B708: - 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 _0813B7C6 - .pool -_0813B728: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0813B74C - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x2 - bne _0813B790 - ldr r0, =gText_YourPartnerHasRetired - bl ShowFieldAutoScrollMessage - b _0813B790 - .pool -_0813B74C: - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x3 - bne _0813B790 - ldr r0, =gText_YourPartnerHasRetired - bl ShowFieldAutoScrollMessage - b _0813B790 - .pool -_0813B764: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813B7C6 - b _0813B790 -_0813B772: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B7C6 - bl sub_800ADF8 - b _0813B790 -_0813B784: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B7C6 -_0813B790: - 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 _0813B7C6 - .pool -_0813B7A8: - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - bne _0813B7B4 - bl sub_800AC34 -_0813B7B4: - ldr r0, =gBattleTypeFlags - ldr r1, =gUnknown_0203AB70 - ldr r1, [r1] - str r1, [r0] - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_0813B7C6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B57C - - thumb_func_start sub_813B7D8 -sub_813B7D8: @ 813B7D8 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _0813B7F8 - ldr r2, =CB2_ReturnToFieldContinueScriptPlayMapMusic - movs r0, 0 - movs r1, 0x1 - bl DoRayquazaScene - b _0813B802 - .pool -_0813B7F8: - ldr r2, =CB2_ReturnToFieldContinueScriptPlayMapMusic - movs r0, 0x1 - movs r1, 0 - bl DoRayquazaScene -_0813B802: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B7D8 - - thumb_func_start sub_813B80C -sub_813B80C: @ 813B80C - push {lr} - ldr r0, =sub_813B824 - movs r1, 0x8 - bl CreateTask - movs r0, 0x9D - bl PlaySE - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B80C - - thumb_func_start sub_813B824 -sub_813B824: @ 813B824 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x2 - ldrsh r1, [r4, r0] - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r1, r0 - bne _0813B858 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - movs r0, 0 - strh r0, [r4, 0x2] - movs r0, 0x9D - bl PlaySE -_0813B858: - movs r0, 0 - ldrsh r1, [r4, r0] - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - subs r0, 0x1 - cmp r1, r0 - bne _0813B86C - adds r0, r5, 0 - bl DestroyTask -_0813B86C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B824 - - thumb_func_start sub_813B880 -sub_813B880: @ 813B880 - push {lr} - ldr r0, =_fwalk - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0 - movs r0, 0x4 - strh r0, [r1, 0x8] - strh r0, [r1, 0xA] - strh r0, [r1, 0xC] - strh r2, [r1, 0xE] - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B880 - - thumb_func_start _fwalk -_fwalk: @ 813B8B0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r0, 2 - add r0, r9 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r0, 0x6 - ldrsh r1, [r5, r0] - lsls r1, 1 - adds r1, r5 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - movs r1, 0x6 - ldrsh r0, [r5, r1] - lsls r0, 1 - adds r0, r5 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _0813B94E - movs r6, 0 -_0813B8EA: - movs r4, 0 - lsls r3, r6, 3 - mov r10, r3 - adds r7, r6, 0x1 - mov r8, r7 -_0813B8F4: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r2, 0 - ldrsh r0, [r1, r2] - adds r0, r4 - adds r0, 0x6 - movs r3, 0x2 - ldrsh r1, [r1, r3] - adds r1, r6 - adds r1, 0x4 - ldr r7, =0x00000201 - adds r2, r4, r7 - add r2, r10 - movs r7, 0x6 - ldrsh r3, [r5, r7] - lsls r3, 5 - adds r2, r3 - lsls r2, 16 - lsrs r2, 16 - bl MapGridSetMetatileIdAt - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _0813B8F4 - mov r1, r8 - lsls r0, r1, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0813B8EA - bl DrawWholeMapView - ldrh r0, [r5, 0x6] - adds r0, 0x1 - strh r0, [r5, 0x6] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _0813B94E - mov r0, r9 - bl DestroyTask - bl EnableBothScriptContexts -_0813B94E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end _fwalk - - thumb_func_start sub_813B968 -sub_813B968: @ 813B968 - push {r4,r5,lr} - ldr r5, =gSpecialVar_Result - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - movs r1, 0x7 - bl __udivsi3 - strh r0, [r5] - ldrh r4, [r5] - adds r0, r4, 0 - movs r1, 0x14 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - subs r4, r1 - strh r4, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B968 - - thumb_func_start sub_813B9A0 -sub_813B9A0: @ 813B9A0 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x1C] - movs r0, 0xB0 - lsls r0, 4 - cmp r1, r0 - bne _0813B9B6 - movs r0, 0x3 - bl Overworld_SetHealLocationWarp -_0813B9B6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B9A0 - - thumb_func_start sub_813B9C0 -sub_813B9C0: @ 813B9C0 - push {r4,lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0x4 - ldrsb r1, [r0, r1] - lsls r1, 8 - ldrb r0, [r0, 0x5] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - lsrs r3, r0, 16 - ldr r2, =gUnknown_085B3444 - ldrh r0, [r2] - ldr r1, =0x0000ffff - cmp r0, r1 - beq _0813BA06 - adds r4, r1, 0 - adds r1, r2, 0 -_0813B9E6: - ldrh r0, [r2] - cmp r0, r3 - bne _0813B9FC - movs r0, 0x1 - b _0813BA08 - .pool -_0813B9FC: - adds r1, 0x2 - adds r2, 0x2 - ldrh r0, [r1] - cmp r0, r4 - bne _0813B9E6 -_0813BA06: - movs r0, 0 -_0813BA08: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_813B9C0 - - thumb_func_start ResetFanClub -ResetFanClub: @ 813BA10 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x0000141e - adds r1, r0, r2 - movs r2, 0 - strh r2, [r1] - movs r1, 0xA1 - lsls r1, 5 - adds r0, r1 - strh r2, [r0] - bx lr - .pool - thumb_func_end ResetFanClub - - thumb_func_start sub_813BA30 -sub_813BA30: @ 813BA30 - push {lr} - bl sub_813BF44 - lsls r0, 24 - cmp r0, 0 - beq _0813BA52 - bl sub_813BCE8 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrh r0, [r0, 0xE] - movs r2, 0xA1 - lsls r2, 5 - adds r1, r2 - strh r0, [r1] -_0813BA52: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BA30 - - thumb_func_start sub_813BA60 -sub_813BA60: @ 813BA60 - push {r4,lr} - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r0, [r0] - lsrs r0, 7 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0813BAB6 - bl sub_813BF60 - bl sub_813BD84 - ldr r1, [r4] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrh r0, [r0, 0xE] - movs r2, 0xA1 - lsls r2, 5 - adds r1, r2 - strh r0, [r1] - ldr r0, =0x00000315 - bl FlagClear - ldr r0, =0x00000316 - bl FlagClear - ldr r0, =0x00000317 - bl FlagClear - movs r0, 0xC6 - lsls r0, 2 - bl FlagClear - ldr r0, =0x000002da - bl FlagClear - ldr r0, =0x00004095 - movs r1, 0x1 - bl VarSet -_0813BAB6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BA60 - - thumb_func_start sub_813BADC -sub_813BADC: @ 813BADC - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =0x00004095 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bne _0813BB58 - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r5, =0x0000141e - adds r3, r0, r5 - ldrh r2, [r3] - movs r1, 0x7F - ands r1, r2 - ldr r0, =gUnknown_085B3470 - adds r0, r6, r0 - ldrb r0, [r0] - adds r1, r0 - cmp r1, 0x13 - ble _0813BB54 - bl sub_813BCA8 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _0813BB3C - bl sub_813BB74 - ldr r0, [r4] - adds r0, r5 - ldrh r2, [r0] - ldr r1, =0x0000ff80 - ands r1, r2 - strh r1, [r0] - b _0813BB58 - .pool -_0813BB3C: - ldr r2, [r4] - adds r2, r5 - ldrh r1, [r2] - ldr r0, =0x0000ff80 - ands r0, r1 - movs r1, 0x14 - orrs r0, r1 - strh r0, [r2] - b _0813BB58 - .pool -_0813BB54: - adds r0, r2, r0 - strh r0, [r3] -_0813BB58: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x7F - ands r0, r1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BADC - - thumb_func_start sub_813BB74 -sub_813BB74: @ 813BB74 - push {r4-r7,lr} - sub sp, 0x8 - movs r3, 0 - movs r5, 0 - ldr r7, =gSaveBlock1Ptr - ldr r2, =0x0000141e - movs r6, 0x1 -_0813BB82: - ldr r0, [r7] - adds r0, r2 - ldrh r1, [r0] - ldr r0, =gUnknown_085B3474 - adds r0, r5, r0 - ldrb r4, [r0] - asrs r1, r4 - ands r1, r6 - cmp r1, 0 - bne _0813BBC8 - adds r3, r5, 0 - str r2, [sp] - str r3, [sp, 0x4] - bl Random - adds r1, r6, 0 - ands r1, r0 - ldr r2, [sp] - ldr r3, [sp, 0x4] - cmp r1, 0 - beq _0813BBC8 - ldr r0, [r7] - adds r0, r2 - adds r1, r6, 0 - lsls r1, r4 - ldrh r2, [r0] - orrs r1, r2 - strh r1, [r0] - b _0813BBEA - .pool -_0813BBC8: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x7 - bls _0813BB82 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =0x0000141e - adds r2, r0 - ldr r1, =gUnknown_085B3474 - adds r1, r3, r1 - movs r0, 0x1 - ldrb r1, [r1] - lsls r0, r1 - ldrh r1, [r2] - orrs r0, r1 - strh r0, [r2] -_0813BBEA: - adds r0, r3, 0 - add sp, 0x8 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BB74 - - thumb_func_start sub_813BC00 -sub_813BC00: @ 813BC00 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - bl sub_813BCA8 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bne _0813BC2E - movs r0, 0 - b _0813BC8E -_0813BC1E: - mov r1, r8 - ldr r0, [r1] - add r0, r9 - lsls r4, r6 - ldrh r1, [r0] - eors r4, r1 - strh r4, [r0] - b _0813BC8C -_0813BC2E: - movs r5, 0 - ldr r2, =gSaveBlock1Ptr - mov r8, r2 - ldr r0, =0x0000141e - mov r9, r0 - movs r4, 0x1 -_0813BC3A: - mov r1, r8 - ldr r0, [r1] - add r0, r9 - ldrh r1, [r0] - ldr r7, =gUnknown_085B347C - adds r0, r5, r7 - ldrb r6, [r0] - asrs r1, r6 - ands r1, r4 - cmp r1, 0 - beq _0813BC5E - mov r10, r5 - bl Random - adds r1, r4, 0 - ands r1, r0 - cmp r1, 0 - bne _0813BC1E -_0813BC5E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x7 - bls _0813BC3A - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x0000141e - adds r4, r0, r2 - ldrh r1, [r4] - mov r2, r10 - adds r0, r2, r7 - ldrb r2, [r0] - adds r0, r1, 0 - asrs r0, r2 - movs r3, 0x1 - ands r0, r3 - cmp r0, 0 - beq _0813BC8C - adds r0, r3, 0 - lsls r0, r2 - eors r1, r0 - strh r1, [r4] -_0813BC8C: - mov r0, r10 -_0813BC8E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BC00 - - thumb_func_start sub_813BCA8 -sub_813BCA8: @ 813BCA8 - push {r4,r5,lr} - movs r3, 0 - movs r2, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r4, [r0] - movs r5, 0x1 -_0813BCBA: - adds r1, r2, 0 - adds r1, 0x8 - adds r0, r4, 0 - asrs r0, r1 - ands r0, r5 - cmp r0, 0 - beq _0813BCCE - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 -_0813BCCE: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _0813BCBA - adds r0, r3, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BCA8 - - thumb_func_start sub_813BCE8 -sub_813BCE8: @ 813BCE8 - push {r4-r6,lr} - movs r5, 0 - ldr r2, =gSaveBlock2Ptr - ldr r0, [r2] - ldrh r1, [r0, 0xE] - ldr r0, =0x000003e6 - cmp r1, r0 - bhi _0813BD58 - adds r6, r2, 0 - b _0813BD32 - .pool -_0813BD04: - ldr r0, [r6] - ldrh r1, [r0, 0xE] - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - movs r2, 0xA1 - lsls r2, 5 - adds r0, r2 - ldrh r0, [r0] - subs r1, r0 - cmp r1, 0xB - ble _0813BD58 - bl sub_813BC00 - ldr r0, [r4] - movs r1, 0xA1 - lsls r1, 5 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0xC - strh r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0813BD32: - bl sub_813BCA8 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x4 - bhi _0813BD54 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, [r6] - ldrh r0, [r0, 0xE] - movs r2, 0xA1 - lsls r2, 5 - adds r1, r2 - strh r0, [r1] - b _0813BD58 - .pool -_0813BD54: - cmp r5, 0x8 - bne _0813BD04 -_0813BD58: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_813BCE8 - - thumb_func_start sub_813BD60 -sub_813BD60: @ 813BD60 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r0, [r0] - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - asrs r0, r1 - movs r1, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end sub_813BD60 - - thumb_func_start sub_813BD84 -sub_813BD84: @ 813BD84 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =0x0000141e - adds r2, r0 - ldrh r1, [r2] - movs r3, 0x80 - lsls r3, 6 - adds r0, r3, 0 - orrs r0, r1 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - orrs r0, r1 - movs r3, 0x80 - lsls r3, 3 - adds r1, r3, 0 - orrs r0, r1 - strh r0, [r2] - bx lr - .pool - thumb_func_end sub_813BD84 - - thumb_func_start sub_813BDB4 -sub_813BDB4: @ 813BDB4 - push {lr} - movs r3, 0 - movs r2, 0 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - subs r0, 0x8 - cmp r0, 0x7 - bhi _0813BE14 - lsls r0, 2 - ldr r1, =_0813BDD8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813BDD8: - .4byte _0813BE14 - .4byte _0813BE14 - .4byte _0813BDF8 - .4byte _0813BDFE - .4byte _0813BE04 - .4byte _0813BE0A - .4byte _0813BE10 - .4byte _0813BE14 -_0813BDF8: - movs r3, 0 - movs r2, 0x3 - b _0813BE14 -_0813BDFE: - movs r3, 0 - movs r2, 0x1 - b _0813BE14 -_0813BE04: - movs r3, 0x1 - movs r2, 0 - b _0813BE14 -_0813BE0A: - movs r3, 0 - movs r2, 0x4 - b _0813BE14 -_0813BE10: - movs r3, 0x1 - movs r2, 0x5 -_0813BE14: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003150 - adds r0, r1 - adds r1, r3, 0 - bl sub_813BE30 - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BDB4 - - thumb_func_start sub_813BE30 -sub_813BE30: @ 813BE30 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r0, r5, 4 - adds r1, r6, r0 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0813BEE8 - cmp r2, 0x5 - bhi _0813BED4 - lsls r0, r2, 2 - ldr r1, =_0813BE58 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813BE58: - .4byte _0813BED4 - .4byte _0813BE70 - .4byte _0813BE84 - .4byte _0813BE98 - .4byte _0813BEAC - .4byte _0813BEC0 -_0813BE70: - ldr r0, =gStringVar1 - ldr r1, =gText_Steven - bl StringCopy - b _0813BF04 - .pool -_0813BE84: - ldr r0, =gStringVar1 - ldr r1, =gText_Brawly - bl StringCopy - b _0813BF04 - .pool -_0813BE98: - ldr r0, =gStringVar1 - ldr r1, =gText_Winona - bl StringCopy - b _0813BF04 - .pool -_0813BEAC: - ldr r0, =gStringVar1 - ldr r1, =gText_Phoebe - bl StringCopy - b _0813BF04 - .pool -_0813BEC0: - ldr r0, =gStringVar1 - ldr r1, =gText_Glacia - bl StringCopy - b _0813BF04 - .pool -_0813BED4: - ldr r0, =gStringVar1 - ldr r1, =gText_Wallace - bl StringCopy - b _0813BF04 - .pool -_0813BEE8: - ldr r4, =gStringVar1 - adds r0, r4, 0 - movs r2, 0x7 - bl StringCopyN - movs r0, 0xFF - strb r0, [r4, 0x7] - adds r0, r6, 0 - adds r0, 0x50 - adds r0, r5 - ldrb r1, [r0] - adds r0, r4, 0 - bl ConvertInternationalString -_0813BF04: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BE30 - - thumb_func_start sub_813BF10 -sub_813BF10: @ 813BF10 - push {lr} - ldr r0, =0x00004095 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bne _0813BF40 - bl sub_813BA30 - ldr r0, =gBattleOutcome - ldrb r0, [r0] - cmp r0, 0x1 - bne _0813BF3C - bl sub_813BB74 - b _0813BF40 - .pool -_0813BF3C: - bl sub_813BC00 -_0813BF40: - pop {r0} - bx r0 - thumb_func_end sub_813BF10 - - thumb_func_start sub_813BF44 -sub_813BF44: @ 813BF44 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r0, [r0] - lsrs r0, 7 - movs r1, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end sub_813BF44 - - thumb_func_start sub_813BF60 -sub_813BF60: @ 813BF60 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x0000141e - adds r1, r0 - ldrh r2, [r1] - movs r0, 0x80 - orrs r0, r2 - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_813BF60 - - thumb_func_start sub_813BF7C -sub_813BF7C: @ 813BF7C - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrb r0, [r0] - bl sub_813BADC - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BF7C - - .align 2, 0 @ Don't pad with nop. diff --git a/data/event_scripts.s b/data/event_scripts.s index 90229a4a1b..7dbe3fd015 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1110,10 +1110,10 @@ EventScript_2715DE:: @ 82715DE setflag FLAG_0x2DE setflag FLAG_0x351 setflag FLAG_0x32F - setflag FLAG_0x315 - setflag FLAG_0x316 - setflag FLAG_0x317 - setflag FLAG_0x318 + setflag FLAG_HIDE_FANCLUB_OLD_LADY + setflag FLAG_HIDE_FANCLUB_BOY + setflag FLAG_HIDE_FANCLUB_LITTLE_BOY + setflag FLAG_HIDE_FANCLUB_LADY setflag FLAG_0x2DA setflag FLAG_0x31D setflag FLAG_0x31E diff --git a/data/field_specials.s b/data/field_specials.s deleted file mode 100644 index 86a8606e16..0000000000 --- a/data/field_specials.s +++ /dev/null @@ -1,23 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_085B3420:: @ 85B3420 - .byte 0x02, 0x04, 0x01, 0x04, 0x04, 0x01, 0x05, 0x00, 0x01, 0x06, 0x03, 0x01, 0x08, 0x06, 0x01, 0x09, 0x0d, 0x01, 0x0a, 0x07, 0x01, 0x0b, 0x07, 0x01, 0x0c, 0x04, 0x01, 0x0e, 0x05, 0x01, 0x0f, 0x04 - .byte 0x01, 0x1a, 0x37, 0x01 - - .align 1 -gUnknown_085B3444:: @ 85B3444 - .2byte 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a - .2byte 0x1a35, 0x1918, 0x1919, 0x191a, 0x191b, 0xffff - -gUnknown_085B3470:: @ 85B3470 - .byte 0x02, 0x01, 0x02, 0x01 - -gUnknown_085B3474:: @ 85B3474 - .byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f - -gUnknown_085B347C:: @ 85B347C - .byte 0x08, 0x0d, 0x0e, 0x0b, 0x0a, 0x0c, 0x0f, 0x09 - diff --git a/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc b/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc index 74146fc7e2..9587bcae37 100644 --- a/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc +++ b/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc @@ -4,7 +4,7 @@ LilycoveCity_PokemonTrainerFanClub_MapScripts:: @ 821C785 .byte 0 LilycoveCity_PokemonTrainerFanClub_MapScript2_21C790: @ 821C790 - map_script_2 VAR_0x4095, 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C79A + map_script_2 VAR_LILYCOVE_FAN_CLUB_STATE, 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C79A .2byte 0 LilycoveCity_PokemonTrainerFanClub_EventScript_21C79A:: @ 821C79A @@ -24,7 +24,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21C79A:: @ 821C79A waitmovement 0 applymovement 4, LilycoveCity_PokemonTrainerFanClub_Movement_21C807 waitmovement 0 - setvar VAR_0x4095, 2 + setvar VAR_LILYCOVE_FAN_CLUB_STATE, 2 releaseall end @@ -62,45 +62,45 @@ LilycoveCity_PokemonTrainerFanClub_Movement_21C807: @ 821C807 LilycoveCity_PokemonTrainerFanClub_MapScript1_21C80D: @ 821C80D call LilycoveCity_PokemonTrainerFanClub_EventScript_21C8DA - compare VAR_0x4095, 1 + compare VAR_LILYCOVE_FAN_CLUB_STATE, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21C9F8 - compare VAR_0x4095, 2 + compare VAR_LILYCOVE_FAN_CLUB_STATE, 2 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21C829 end LilycoveCity_PokemonTrainerFanClub_EventScript_21C829:: @ 821C829 - special sub_813BCE8 + special UpdateMovedLilycoveFanClubMembers call LilycoveCity_PokemonTrainerFanClub_EventScript_21C8F5 setvar VAR_0x8004, 8 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9B8 setvar VAR_0x8004, 9 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9C0 setvar VAR_0x8004, 10 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9C8 setvar VAR_0x8004, 11 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9D0 setvar VAR_0x8004, 12 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9D8 setvar VAR_0x8004, 13 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9E0 setvar VAR_0x8004, 14 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9E8 setvar VAR_0x8004, 15 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9F0 end @@ -120,35 +120,35 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21C8F1:: @ 821C8F1 LilycoveCity_PokemonTrainerFanClub_EventScript_21C8F5:: @ 821C8F5 setvar VAR_0x8005, 8 setvar VAR_0x8004, 8 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE setvar VAR_0x8004, 9 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE setvar VAR_0x8004, 10 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE setvar VAR_0x8004, 11 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE setvar VAR_0x8004, 12 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE setvar VAR_0x8004, 13 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE setvar VAR_0x8004, 14 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE setvar VAR_0x8004, 15 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 0 call_if 1, LilycoveCity_PokemonTrainerFanClub_EventScript_21C9AE compare VAR_0x8005, 5 @@ -208,13 +208,13 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CA17:: @ 821CA17 lock faceplayer setvar VAR_0x8004, 13 - special sub_813BDB4 - compare VAR_0x4095, 0 + special BufferStreakTrainerText + compare VAR_LILYCOVE_FAN_CLUB_STATE, 0 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CA84 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CA56 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CA7A msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D12A, 4 @@ -222,7 +222,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CA17:: @ 821CA17 end LilycoveCity_PokemonTrainerFanClub_EventScript_21CA56:: @ 821CA56 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CA70 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D094, 4 @@ -248,13 +248,13 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CA8E:: @ 821CA8E lock faceplayer setvar VAR_0x8004, 8 - special sub_813BDB4 - compare VAR_0x4095, 0 + special BufferStreakTrainerText + compare VAR_LILYCOVE_FAN_CLUB_STATE, 0 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CAFB - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CACD - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CAF1 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D347, 4 @@ -262,7 +262,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CA8E:: @ 821CA8E end LilycoveCity_PokemonTrainerFanClub_EventScript_21CACD:: @ 821CACD - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CAE7 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D2A6, 4 @@ -288,13 +288,13 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CB05:: @ 821CB05 lock faceplayer setvar VAR_0x8004, 9 - special sub_813BDB4 - compare VAR_0x4095, 0 + special BufferStreakTrainerText + compare VAR_LILYCOVE_FAN_CLUB_STATE, 0 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CB72 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CB44 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CB68 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D52E, 4 @@ -302,7 +302,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CB05:: @ 821CB05 end LilycoveCity_PokemonTrainerFanClub_EventScript_21CB44:: @ 821CB44 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CB5E msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D438, 4 @@ -328,13 +328,13 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CB7C:: @ 821CB7C lock faceplayer setvar VAR_0x8004, 10 - special sub_813BDB4 - compare VAR_0x4095, 0 + special BufferStreakTrainerText + compare VAR_LILYCOVE_FAN_CLUB_STATE, 0 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CBE9 - specialvar VAR_RESULT, sub_813BD60 + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CBBB - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CBDF msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D822, 4 @@ -342,7 +342,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CB7C:: @ 821CB7C end LilycoveCity_PokemonTrainerFanClub_EventScript_21CBBB:: @ 821CBBB - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CBD5 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D751, 4 @@ -368,11 +368,11 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CBF3:: @ 821CBF3 lock faceplayer setvar VAR_0x8004, 11 - special sub_813BDB4 - specialvar VAR_RESULT, sub_813BD60 + special BufferStreakTrainerText + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CC27 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CC4B msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D9D1, 4 @@ -380,7 +380,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CBF3:: @ 821CBF3 end LilycoveCity_PokemonTrainerFanClub_EventScript_21CC27:: @ 821CC27 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CC41 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21D921, 4 @@ -401,11 +401,11 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CC55:: @ 821CC55 lock faceplayer setvar VAR_0x8004, 12 - special sub_813BDB4 - specialvar VAR_RESULT, sub_813BD60 + special BufferStreakTrainerText + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CC89 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CCAD msgbox LilycoveCity_PokemonTrainerFanClub_Text_21DB69, 4 @@ -413,7 +413,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CC55:: @ 821CC55 end LilycoveCity_PokemonTrainerFanClub_EventScript_21CC89:: @ 821CC89 - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CCA3 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21DA73, 4 @@ -434,11 +434,11 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CCB7:: @ 821CCB7 lock faceplayer setvar VAR_0x8004, 14 - special sub_813BDB4 - specialvar VAR_RESULT, sub_813BD60 + special BufferStreakTrainerText + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CCEB - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CD0F msgbox LilycoveCity_PokemonTrainerFanClub_Text_21DD36, 4 @@ -446,7 +446,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CCB7:: @ 821CCB7 end LilycoveCity_PokemonTrainerFanClub_EventScript_21CCEB:: @ 821CCEB - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CD05 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21DC68, 4 @@ -467,11 +467,11 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CD19:: @ 821CD19 lock faceplayer setvar VAR_0x8004, 15 - special sub_813BDB4 - specialvar VAR_RESULT, sub_813BD60 + special BufferStreakTrainerText + specialvar VAR_RESULT, ShouldMoveLilycoveFanClubMember compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CD4D - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 7 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CD71 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21DEFF, 4 @@ -479,7 +479,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CD19:: @ 821CD19 end LilycoveCity_PokemonTrainerFanClub_EventScript_21CD4D:: @ 821CD4D - specialvar VAR_RESULT, sub_813BCA8 + specialvar VAR_RESULT, GetNumMovedLilycoveFanClubMembers compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CD67 msgbox LilycoveCity_PokemonTrainerFanClub_Text_21DE72, 4 @@ -512,7 +512,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CD90:: @ 821CD90 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CEFF copyvar VAR_0x800A, VAR_0x8006 setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText msgbox LilycoveCity_PokemonTrainerFanClub_Text_281BCB, 4 setvar VAR_0x8004, 14 copyvar VAR_0x8005, VAR_0x800A @@ -532,7 +532,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CDE0:: @ 821CDE0 LilycoveCity_PokemonTrainerFanClub_EventScript_21CDEE:: @ 821CDEE setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText msgbox LilycoveCity_PokemonTrainerFanClub_Text_281C3D, 5 compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CEC6 @@ -542,7 +542,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CDEE:: @ 821CDEE LilycoveCity_PokemonTrainerFanClub_EventScript_21CE15:: @ 821CE15 setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText msgbox LilycoveCity_PokemonTrainerFanClub_Text_281C65, 4 setvar VAR_0x8004, 14 copyvar VAR_0x8005, VAR_0x800A @@ -557,7 +557,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CE15:: @ 821CE15 LilycoveCity_PokemonTrainerFanClub_EventScript_21CE4D:: @ 821CE4D setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText message LilycoveCity_PokemonTrainerFanClub_Text_281C95 waitmessage setvar VAR_0x8004, 2 @@ -568,7 +568,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CE4D:: @ 821CE4D case 11, LilycoveCity_PokemonTrainerFanClub_EventScript_21CE9F case 127, LilycoveCity_PokemonTrainerFanClub_EventScript_21CE9F setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText copyvar VAR_0x8006, VAR_0x800A copyvar VAR_0x8005, VAR_RESULT special PutFanClubSpecialOnTheAir @@ -577,7 +577,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CE4D:: @ 821CE4D LilycoveCity_PokemonTrainerFanClub_EventScript_21CE9F:: @ 821CE9F setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText msgbox LilycoveCity_PokemonTrainerFanClub_Text_281CCD, 5 compare VAR_RESULT, 1 goto_eq LilycoveCity_PokemonTrainerFanClub_EventScript_21CEC6 @@ -587,14 +587,14 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CE9F:: @ 821CE9F LilycoveCity_PokemonTrainerFanClub_EventScript_21CEC6:: @ 821CEC6 setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText msgbox LilycoveCity_PokemonTrainerFanClub_Text_281CF5, 4 release end LilycoveCity_PokemonTrainerFanClub_EventScript_21CED8:: @ 821CED8 setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText msgbox LilycoveCity_PokemonTrainerFanClub_Text_281D40, 4 setflag FLAG_0x0D2 release @@ -602,7 +602,7 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_21CED8:: @ 821CED8 LilycoveCity_PokemonTrainerFanClub_EventScript_21CEED:: @ 821CEED setvar VAR_0x8004, 8 - special sub_813BDB4 + special BufferStreakTrainerText msgbox LilycoveCity_PokemonTrainerFanClub_Text_281DB4, 4 release end diff --git a/data/specials.inc b/data/specials.inc index 0b58f39ba3..86355f4840 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -174,11 +174,11 @@ gSpecials:: @ 81DBA64 def_special GetFirstFreePokeblockSlot def_special DoBerryBlending def_special sub_8142BC8 - def_special sub_813BD60 - def_special sub_813BCA8 - def_special sub_813BDB4 + def_special ShouldMoveLilycoveFanClubMember + def_special GetNumMovedLilycoveFanClubMembers + def_special BufferStreakTrainerText def_special sub_813BA30 - def_special sub_813BCE8 + def_special UpdateMovedLilycoveFanClubMembers def_special sub_813BF60 def_special sub_813BA60 def_special sub_813BF7C diff --git a/include/cable_club.h b/include/cable_club.h index 734a4f070f..8be376721e 100644 --- a/include/cable_club.h +++ b/include/cable_club.h @@ -1,6 +1,8 @@ #ifndef GUARD_CABLE_CLUB_H #define GUARD_CABLE_CLUB_H +#include "task.h" + // Exported type declarations // Exported RAM declarations @@ -11,5 +13,6 @@ void sub_80B37D4(TaskFunc taskFunc); u8 sub_80B3050(void); void sub_80B360C(void); bool32 sub_80B2AF4(u16 *arg0, u16 *arg1); +void sub_80B3AF8(u8 taskId); #endif //GUARD_CABLE_CLUB_H diff --git a/include/constants/flags.h b/include/constants/flags.h index f6143982d9..6c1400410b 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -790,10 +790,10 @@ #define FLAG_0x312 0x312 #define FLAG_0x313 0x313 #define FLAG_0x314 0x314 -#define FLAG_0x315 0x315 -#define FLAG_0x316 0x316 -#define FLAG_0x317 0x317 -#define FLAG_0x318 0x318 +#define FLAG_HIDE_FANCLUB_OLD_LADY 0x315 +#define FLAG_HIDE_FANCLUB_BOY 0x316 +#define FLAG_HIDE_FANCLUB_LITTLE_BOY 0x317 +#define FLAG_HIDE_FANCLUB_LADY 0x318 #define FLAG_0x319 0x319 #define FLAG_0x31A 0x31A #define FLAG_0x31B 0x31B diff --git a/include/constants/vars.h b/include/constants/vars.h index 92cbaba5f1..7cf232efe4 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -81,8 +81,8 @@ #define VAR_ALTERING_CAVE_WILD_SET 0x403E #define VAR_0x403F 0x403F #define VAR_DAYS 0x4040 -#define VAR_0x4041 0x4041 -#define VAR_0x4042 0x4042 +#define VAR_FANCLUB_UNKNOWN_1 0x4041 +#define VAR_FANCLUB_UNKNOWN_2 0x4042 #define VAR_DEPT_STORE_FLOOR 0x4043 #define VAR_0x4044 0x4044 #define VAR_POKELOT_PRIZE 0x4045 @@ -165,7 +165,7 @@ #define VAR_0x4092 0x4092 #define VAR_0x4093 0x4093 #define VAR_0x4094 0x4094 -#define VAR_0x4095 0x4095 +#define VAR_LILYCOVE_FAN_CLUB_STATE 0x4095 #define VAR_0x4096 0x4096 #define VAR_0x4097 0x4097 #define VAR_0x4098 0x4098 diff --git a/include/field_screen.h b/include/field_screen.h index 268b9312e1..bf15024053 100644 --- a/include/field_screen.h +++ b/include/field_screen.h @@ -15,5 +15,6 @@ void sub_80AC3D0(void); void sub_80AC3E4(void); void PreservePaletteInWeather(u8); void sub_80AF128(void); +void sub_80AB104(u8); #endif //GUARD_FIELD_SCREEN_H diff --git a/include/global.h b/include/global.h index 687ee26d27..2015d47cc7 100644 --- a/include/global.h +++ b/include/global.h @@ -163,6 +163,16 @@ enum OPTIONS_BATTLE_STYLE_SET }; +struct Coords8 { + s8 x; + s8 y; +}; + +struct UCoords8 { + u8 x; + u8 y; +}; + struct Coords16 { s16 x; diff --git a/include/match_call.h b/include/match_call.h index 9698e7cd3f..1f431bfaf1 100644 --- a/include/match_call.h +++ b/include/match_call.h @@ -10,4 +10,6 @@ enum { MATCH_CALL_TYPE_GYMLEADER_ELITEFOUR }; +s32 GetRematchIdxByTrainerIdx(s32 trainerIdx); + #endif //GUARD_MATCH_CALL_H diff --git a/include/strings.h b/include/strings.h index afb26b7cbe..528f70f69e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -753,4 +753,13 @@ extern const u8 BattleFrontier_Lounge7_Text_26615F[]; extern const u8 BattleFrontier_Lounge7_Text_266185[]; extern const u8 BattleFrontier_Lounge7_Text_2661B5[]; +extern const u8 gText_YourPartnerHasRetired[]; + +extern const u8 gText_Wallace[]; +extern const u8 gText_Steven[]; +extern const u8 gText_Brawly[]; +extern const u8 gText_Winona[]; +extern const u8 gText_Phoebe[]; +extern const u8 gText_Glacia[]; + #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index 2a0900e516..0447ce40d5 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -181,7 +181,6 @@ SECTIONS { src/birch_pc.o(.text); src/hof_pc.o(.text); src/field_specials.o(.text); - asm/field_specials.o(.text); src/battle_records.o(.text); asm/pokedex_area_screen.o(.text); src/evolution_scene.o(.text); @@ -471,7 +470,6 @@ SECTIONS { src/fldeff_flash.o(.rodata); src/time_events.o(.rodata); src/field_specials.o(.rodata); - data/field_specials.o(.rodata); src/battle_records.o(.rodata); data/pokedex_area_screen.o(.rodata); src/evolution_scene.o(.rodata); diff --git a/src/field_specials.c b/src/field_specials.c index 7d57bddde2..897bcc8d73 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -2,6 +2,7 @@ #include "main.h" #include "battle.h" #include "battle_tower.h" +#include "cable_club.h" #include "data2.h" #include "decoration.h" #include "diploma.h" @@ -13,6 +14,7 @@ #include "field_message_box.h" #include "field_player_avatar.h" #include "field_region_map.h" +#include "field_screen.h" #include "field_specials.h" #include "field_weather.h" #include "international_string_util.h" @@ -20,6 +22,7 @@ #include "link.h" #include "list_menu.h" #include "malloc.h" +#include "match_call.h" #include "menu.h" #include "overworld.h" #include "party_menu.h" @@ -27,6 +30,7 @@ #include "pokemon.h" #include "pokemon_storage_system.h" #include "random.h" +#include "rayquaza_scene.h" #include "region_map.h" #include "rom_8011DC0.h" #include "rtc.h" @@ -64,6 +68,7 @@ EWRAM_DATA u8 gUnknown_0203AB6C = 0; EWRAM_DATA u8 gUnknown_0203AB6D = 0; EWRAM_DATA u8 gUnknown_0203AB6E = 0; EWRAM_DATA u8 gUnknown_0203AB6F = 0; +EWRAM_DATA u32 gUnknown_0203AB70 = 0; struct ListMenuTemplate gUnknown_030061D0; @@ -73,9 +78,51 @@ extern const u16 gEventObjectPalette33[]; extern const u16 gEventObjectPalette34[]; extern void LoadPalette(const void *src, u32 offset, u16 size); // incorrect signature, needed to match +extern void BlendPalettes(u32, u8, u16); + +void UpdateMovedLilycoveFanClubMembers(void); +void sub_813BF60(void); +u16 GetNumMovedLilycoveFanClubMembers(void); static void RecordCyclingRoadResults(u32, u8); static void LoadLinkPartnerEventObjectSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum); +static void Task_PetalburgGym(u8); +static void PetalburgGymFunc(u8, u16); +static void Task_PCTurnOnEffect(u8); +static void PCTurnOnEffect_0(struct Task *); +static void PCTurnOnEffect_1(s16, s8, s8); +static void PCTurnOffEffect(void); +static void Task_LotteryCornerComputerEffect(u8); +static void LotteryCornerComputerEffect(struct Task *); +static void sub_81395BC(u8 taskId); +static void sub_8139620(u8 taskId); +static void sub_8139AF4(u8 taskId); +static void sub_8139C2C(u16 a1, u8 a2); +static void sub_8139C80(u8 taskId); +static void sub_813A2DC(u8 taskId); +static void sub_813AA60(u16 a0, u16 a1); +static void sub_813ACE8(u8 a0, u16 a1); +static void sub_813A42C(void); +static void sub_813A4EC(u8 taskId); +static void sub_813A694(u8 taskId); +static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list); +static void sub_813AC44(u16 a0, u16 a1); +static void sub_813AD34(u8 a0, u16 a1); +static void sub_813A570(u8 taskId); +static void sub_813A738(u8 taskId); +static void sub_813A600(u8 taskId); +static void sub_813A664(u8 taskId); +static void sub_813ABD4(u16 a0); +static void task_deoxys_sound(u8 taskId); +static void sub_813B0B4(u8 a0); +static void sub_813B160(u8 taskId); +static void sub_813B57C(u8 taskId); +static void sub_813B824(u8 taskId); +static void _fwalk(u8 taskId); +static u8 sub_813BF44(void); +static void sub_813BD84(void); +static u16 sub_813BB74(void); +static void sub_813BE30(struct LinkBattleRecords *linkRecords, u8 a, u8 b); void Special_ShowDiploma(void) { @@ -572,12 +619,7 @@ static void LoadLinkPartnerEventObjectSpritePalette(u8 graphicsId, u8 localEvent } } -struct Coords8 { - u8 x; - u8 y; -}; - -const struct Coords8 gUnknown_085B2B68[] = { +static const struct UCoords8 gUnknown_085B2B68[] = { { 7, 22}, {11, 19}, {10, 16}, @@ -699,7 +741,7 @@ void MauvilleGymSpecial2(void) void MauvilleGymSpecial3(void) { int i, x, y; - const struct Coords8 *switchCoords = gUnknown_085B2B68; + const struct UCoords8 *switchCoords = gUnknown_085B2B68; for (i = ARRAY_COUNT(gUnknown_085B2B68) - 1; i >= 0; i--) { MapGridSetMetatileIdAt(switchCoords->x, switchCoords->y, 0x206); @@ -753,10 +795,8 @@ void MauvilleGymSpecial3(void) } } -static void Task_PetalburgGym(u8); -static void PetalburgGymFunc(u8, u16); -const u8 gUnknown_085B2B78[] = {0, 1, 1, 1, 1}; -const u16 gUnknown_085B2B7E[] = {0x218, 0x219, 0x21a, 0x21b, 0x21c}; +static const u8 gUnknown_085B2B78[] = {0, 1, 1, 1, 1}; +static const u16 gUnknown_085B2B7E[] = {0x218, 0x219, 0x21a, 0x21b, 0x21c}; void PetalburgGymSpecial1(void) { @@ -956,7 +996,7 @@ u8 GetLeadMonFriendshipScore(void) return 0; } -void CB2_FieldShowRegionMap(void) +static void CB2_FieldShowRegionMap(void) { FieldInitRegionMap(CB2_ReturnToFieldContinueScriptPlayMapMusic); } @@ -966,10 +1006,6 @@ void FieldShowRegionMap(void) SetMainCallback2(CB2_FieldShowRegionMap); } -static void Task_PCTurnOnEffect(u8); -static void PCTurnOnEffect_0(struct Task *); -static void PCTurnOnEffect_1(s16, s8, s8); - void DoPCTurnOnEffect(void) { if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE) @@ -1063,8 +1099,6 @@ static void PCTurnOnEffect_1(s16 flag, s8 dx, s8 dy) MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00); } -static void PCTurnOffEffect(void); - void DoPCTurnOffEffect(void) { PCTurnOffEffect(); @@ -1107,9 +1141,6 @@ static void PCTurnOffEffect(void) DrawWholeMapView(); } -static void Task_LotteryCornerComputerEffect(u8); -static void LotteryCornerComputerEffect(struct Task *); - void DoLotteryCornerComputerEffect(void) { if (FuncIsActiveTask(Task_LotteryCornerComputerEffect) != TRUE) @@ -1279,12 +1310,12 @@ void BufferEReaderTrainerName(void) GetEreaderTrainerName(gStringVar1); } -const u8 gUnknown_085B2B88[] = {12, 2, 4, 5, 1, 8, 7, 11, 3, 10, 9, 6}; -const u8 gUnknown_085B2B94[] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5}; -const u8 gUnknown_085B2BA0[] = {3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5}; - u16 GetSlotMachineId(void) { + static const u8 gUnknown_085B2B88[] = {12, 2, 4, 5, 1, 8, 7, 11, 3, 10, 9, 6}; + static const u8 gUnknown_085B2B94[] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5}; + static const u8 gUnknown_085B2BA0[] = {3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5}; + u32 v0 = gSaveBlock1Ptr->easyChatPairs[0].unk0_0 + gSaveBlock1Ptr->easyChatPairs[0].unk2 + gUnknown_085B2B88[gSpecialVar_0x8004]; if (GetPriceReduction(2)) { @@ -1436,9 +1467,6 @@ bool8 IsPokerusInParty(void) return TRUE; } -static void sub_81395BC(u8 taskId); -static void sub_8139620(u8 taskId); - void sub_8139560(void) { u8 taskId = CreateTask(sub_81395BC, 9); @@ -1486,7 +1514,7 @@ void SetRoute119Weather(void) { if (is_map_type_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE) { - SetSav1Weather(0x14); + SetSav1Weather(20); } } @@ -1494,7 +1522,7 @@ void SetRoute123Weather(void) { if (is_map_type_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE) { - SetSav1Weather(0x15); + SetSav1Weather(21); } } @@ -1545,7 +1573,9 @@ u16 SetPacifidlogTMReceivedDay(void) bool8 MonOTNameMatchesPlayer(void) { if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_LANGUAGE) != GAME_LANGUAGE) + { return TRUE; // huh? + } GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_OT_NAME, gStringVar1); if (!StringCompare(gSaveBlock2Ptr->playerName, gStringVar1)) @@ -1648,9 +1678,6 @@ void sub_8139980(void) SetCameraPanning(8, 0); } -void sub_8139AF4(u8 taskId); -void sub_8139C2C(u16 a1, u8 a2); - const struct WindowTemplate gUnknown_085B2BAC = { .priority = 0, .tilemapLeft = 21, @@ -1682,9 +1709,6 @@ const u8 *const gElevatorFloorsTable[] = { const u16 gUnknown_085B2BF4[] = { 0x0329, 0x032a, 0x032b, 0x0331, 0x0332, 0x0333, 0x0339, 0x033a, 0x033b }; const u16 gUnknown_085B2C06[] = { 0x0329, 0x032b, 0x032a, 0x0331, 0x0333, 0x0332, 0x0339, 0x033b, 0x033a }; -const u8 gUnknown_085B2C18[] = { 0x08, 0x10, 0x18, 0x20, 0x26, 0x2e, 0x34, 0x38, 0x39 }; -const u8 gUnknown_085B2C21[] = { 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15, 0x18, 0x1b }; -const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xffff }; void SetDepartmentStoreFloorVar(void) { @@ -1753,6 +1777,8 @@ u16 sub_81399F4(void) void ShakeScreenInElevator(void) { + static const u8 gUnknown_085B2C18[] = { 0x08, 0x10, 0x18, 0x20, 0x26, 0x2e, 0x34, 0x38, 0x39 }; + s16 *data = gTasks[CreateTask(sub_8139AF4, 9)].data; u16 floorDelta; @@ -1781,7 +1807,7 @@ void ShakeScreenInElevator(void) PlaySE(SE_ELEBETA); } -void sub_8139AF4(u8 taskId) +static void sub_8139AF4(u8 taskId) { s16 *data = gTasks[taskId].data; data[1]++; @@ -1824,10 +1850,10 @@ void sub_8139C10(void) RemoveWindow(gUnknown_0203AB5E); } -void sub_8139C80(u8 taskId); - -void sub_8139C2C(u16 a1, u8 a2) +static void sub_8139C2C(u16 a1, u8 a2) { + static const u8 gUnknown_085B2C21[] = { 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15, 0x18, 0x1b }; + if (FuncIsActiveTask(sub_8139C80) != TRUE) { u8 taskId = CreateTask(sub_8139C80, 8); @@ -1841,7 +1867,7 @@ void sub_8139C2C(u16 a1, u8 a2) // Annoyingly close but compiler wants to add all the parts of the index into the arrays // first and then shift by one, whereas we need each individual part to shift and then be added. #ifdef NONMATCHING -void sub_8139C80(u8 taskId) +static void sub_8139C80(u8 taskId) { u8 x, y; s16 *data = gTasks[taskId].data; @@ -1880,7 +1906,7 @@ void sub_8139C80(u8 taskId) } #else NAKED -void sub_8139C80(u8 taskId) +static void sub_8139C80(u8 taskId) { asm_unified("push {r4-r7,lr}\n\ mov r7, r10\n\ @@ -2064,6 +2090,8 @@ void sub_8139D98(void) bool32 warp0_in_pokecenter(void) { + static const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xffff }; + int i; u16 map = (gUnknown_020322DC.mapGroup << 8) + gUnknown_020322DC.mapNum; @@ -2092,34 +2120,34 @@ void UpdateFrontierManiac(u16 a0) *var %= 10; } -const u8 *const gUnknown_085B2C50[][3] = { - { BattleFrontier_Lounge2_Text_260971, BattleFrontier_Lounge2_Text_260A1E, BattleFrontier_Lounge2_Text_260AE7 }, - { BattleFrontier_Lounge2_Text_2619AC, BattleFrontier_Lounge2_Text_261A91, BattleFrontier_Lounge2_Text_261B0C }, - { BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95 }, - { BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A }, - { BattleFrontier_Lounge2_Text_260BC4, BattleFrontier_Lounge2_Text_260C6D, BattleFrontier_Lounge2_Text_260D3A }, - { BattleFrontier_Lounge2_Text_260E1E, BattleFrontier_Lounge2_Text_260EC7, BattleFrontier_Lounge2_Text_260F74 }, - { BattleFrontier_Lounge2_Text_2614E6, BattleFrontier_Lounge2_Text_261591, BattleFrontier_Lounge2_Text_26166F }, - { BattleFrontier_Lounge2_Text_261282, BattleFrontier_Lounge2_Text_261329, BattleFrontier_Lounge2_Text_261403 }, - { BattleFrontier_Lounge2_Text_261026, BattleFrontier_Lounge2_Text_2610CC, BattleFrontier_Lounge2_Text_261194 }, - { BattleFrontier_Lounge2_Text_26174D, BattleFrontier_Lounge2_Text_2617F9, BattleFrontier_Lounge2_Text_2618C4 }, -}; - -const u8 gUnknown_085B2CC8[][2] = { - { 0x15, 0x38 }, - { 0x15, 0x23 }, - { 0xff, 0xff }, - { 0xff, 0xff }, - { 0x02, 0x04 }, - { 0x07, 0x15 }, - { 0x07, 0x15 }, - { 0x0e, 0x1c }, - { 0x0d, 0x70 }, - { 0x07, 0x38 } -}; - void sub_8139F20(void) { + static const u8 *const gUnknown_085B2C50[][3] = { + { BattleFrontier_Lounge2_Text_260971, BattleFrontier_Lounge2_Text_260A1E, BattleFrontier_Lounge2_Text_260AE7 }, + { BattleFrontier_Lounge2_Text_2619AC, BattleFrontier_Lounge2_Text_261A91, BattleFrontier_Lounge2_Text_261B0C }, + { BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95 }, + { BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A }, + { BattleFrontier_Lounge2_Text_260BC4, BattleFrontier_Lounge2_Text_260C6D, BattleFrontier_Lounge2_Text_260D3A }, + { BattleFrontier_Lounge2_Text_260E1E, BattleFrontier_Lounge2_Text_260EC7, BattleFrontier_Lounge2_Text_260F74 }, + { BattleFrontier_Lounge2_Text_2614E6, BattleFrontier_Lounge2_Text_261591, BattleFrontier_Lounge2_Text_26166F }, + { BattleFrontier_Lounge2_Text_261282, BattleFrontier_Lounge2_Text_261329, BattleFrontier_Lounge2_Text_261403 }, + { BattleFrontier_Lounge2_Text_261026, BattleFrontier_Lounge2_Text_2610CC, BattleFrontier_Lounge2_Text_261194 }, + { BattleFrontier_Lounge2_Text_26174D, BattleFrontier_Lounge2_Text_2617F9, BattleFrontier_Lounge2_Text_2618C4 }, + }; + + static const u8 gUnknown_085B2CC8[][2] = { + { 0x15, 0x38 }, + { 0x15, 0x23 }, + { 0xff, 0xff }, + { 0xff, 0xff }, + { 0x02, 0x04 }, + { 0x07, 0x15 }, + { 0x07, 0x15 }, + { 0x0e, 0x1c }, + { 0x0d, 0x70 }, + { 0x07, 0x38 } + }; + u8 i; u16 unk = 0; u16 var = VarGet(VAR_FRONTIER_MANIAC_FACILITY); @@ -2205,12 +2233,12 @@ void sub_8139F20(void) ShowFieldMessage(gUnknown_085B2C50[var][i]); } -const u16 gUnknown_085B2CDC[] = { - 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x0031, 0x003f, 0x004d, 0x005b, 0x0000 -}; - void sub_813A080(void) { + static const u16 gUnknown_085B2CDC[] = { + 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x0031, 0x003f, 0x004d, 0x005b, 0x0000 + }; + u8 i; u16 var = VarGet(VAR_0x40CE); u8 chosenLevel = gSaveBlock2Ptr->frontier.chosenLvl; @@ -2236,8 +2264,6 @@ void sub_813A080(void) gSpecialVar_0x8006 = 12; } -void sub_813A2DC(u8 taskId); - void sub_813A128(void) { u8 taskId = CreateTask(sub_813A2DC, 8); @@ -2374,11 +2400,7 @@ void sub_813A128(void) } } -void sub_813AA60(u16 a0, u16 a1); -void sub_813ACE8(u8 a0, u16 a1); -void sub_813A42C(void); - -const u8 *const gUnknown_085B2CF0[][16] = { +static const u8 *const gUnknown_085B2CF0[][16] = { { gText_Exit, NULL, @@ -2615,10 +2637,7 @@ const u8 *const gUnknown_085B2CF0[][16] = { } }; -void sub_813A4EC(u8 taskId); -void sub_813A694(u8 taskId); - -void sub_813A2DC(u8 taskId) +static void sub_813A2DC(u8 taskId) { u32 unk1; u8 i, windowId; @@ -2672,9 +2691,7 @@ void sub_813A2DC(u8 taskId) gTasks[taskId].func = sub_813A4EC; } -void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list); - -void sub_813A42C(void) +static void sub_813A42C(void) { gUnknown_030061D0.items = gUnknown_0203AB64; gUnknown_030061D0.moveCursorFunc = sub_813A46C; @@ -2696,12 +2713,7 @@ void sub_813A42C(void) gUnknown_030061D0.cursorKind = 0; } -void sub_813A4EC(u8 taskId); -void sub_813AA60(u16 a0, u16 a1); -void sub_813AC44(u16 a0, u16 a1); -void sub_813AD34(u8 a0, u16 a1); - -void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) +static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) { u8 taskId; PlaySE(SE_SELECT); @@ -2720,13 +2732,9 @@ void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) } } -void sub_813A570(u8 taskId); -void sub_813A738(u8 taskId); -void sub_813A600(u8 taskId); - // stupid r5<->r6 swap #ifdef NONMATCHING -void sub_813A4EC(u8 taskId) +static void sub_813A4EC(u8 taskId) { struct Task *task = &gTasks[taskId]; s32 itemId = ListMenuHandleInputGetItemId(task->data[14]); @@ -2743,25 +2751,22 @@ void sub_813A4EC(u8 taskId) default: gSpecialVar_Result = itemId; PlaySE(SE_SELECT); - if (task->data[6]) + if (!task->data[6] || itemId == task->data[1] - 1) { - if (itemId == task->data[1] - 1) - { - sub_813A570(taskId); - } - else - { - sub_813A738(taskId); - task->func = sub_813A600; - EnableBothScriptContexts(); - } + sub_813A570(taskId); + } + else + { + sub_813A738(taskId); + task->func = sub_813A600; + EnableBothScriptContexts(); } break; } } #else NAKED -void sub_813A4EC(u8 taskId) +static void sub_813A4EC(u8 taskId) { asm_unified("push {r4-r6,lr}\n\ lsls r0, 24\n\ @@ -2826,7 +2831,7 @@ _0813A566:\n\ } #endif // NONMATCHING -void sub_813A570(u8 taskId) +static void sub_813A570(u8 taskId) { u16 array; struct Task *task = &gTasks[taskId]; @@ -2843,9 +2848,7 @@ void sub_813A570(u8 taskId) EnableBothScriptContexts(); } -void sub_813A664(u8 taskId); - -void sub_813A600(u8 taskId) +static void sub_813A600(u8 taskId) { switch (gTasks[taskId].data[6]) { @@ -2872,29 +2875,29 @@ void sub_813A630(void) } } -void sub_813A664(u8 taskId) +static void sub_813A664(u8 taskId) { ScriptContext2_Enable(); sub_813A694(taskId); gTasks[taskId].func = sub_813A4EC; } -const struct ScrollArrowsTemplate gUnknown_085B3030 = { - .firstArrowType = 2, - .firstX = 0, - .firstY = 0, - .secondArrowType = 3, - .secondX = 0, - .secondY = 0, - .fullyUpThreshold = 0, - .fullyDownThreshold = 0, - .tileTag = 2000, - .palTag = 100, - .palNum = 0 -}; - -void sub_813A694(u8 taskId) +static void sub_813A694(u8 taskId) { + static const struct ScrollArrowsTemplate gUnknown_085B3030 = { + .firstArrowType = 2, + .firstX = 0, + .firstY = 0, + .secondArrowType = 3, + .secondX = 0, + .secondY = 0, + .fullyUpThreshold = 0, + .fullyDownThreshold = 0, + .tileTag = 2000, + .palTag = 100, + .palNum = 0 + }; + struct Task *task = &gTasks[taskId]; struct ScrollArrowsTemplate template = gUnknown_085B3030; if (task->data[0] != task->data[1]) @@ -2909,7 +2912,7 @@ void sub_813A694(u8 taskId) } } -void sub_813A738(u8 taskId) +static void sub_813A738(u8 taskId) { struct Task *task = &gTasks[taskId]; if (task->data[0] != task->data[1]) @@ -2939,36 +2942,36 @@ void sub_813A76C(void) } } -const u8 *const gUnknown_085B3040[] = { - BattleFrontier_Lounge5_Text_26468D, - BattleFrontier_Lounge5_Text_2646E5, - BattleFrontier_Lounge5_Text_264741, - BattleFrontier_Lounge5_Text_2647A4, - BattleFrontier_Lounge5_Text_2647FC, - BattleFrontier_Lounge5_Text_264858, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264916, - BattleFrontier_Lounge5_Text_264972, - BattleFrontier_Lounge5_Text_2649D5, - BattleFrontier_Lounge5_Text_264A3F, - BattleFrontier_Lounge5_Text_264A9B, - BattleFrontier_Lounge5_Text_264AF3, - BattleFrontier_Lounge5_Text_264B5D, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264BC3, - BattleFrontier_Lounge5_Text_264C36, - BattleFrontier_Lounge5_Text_2648BE, - BattleFrontier_Lounge5_Text_264C95, - BattleFrontier_Lounge5_Text_264D01, - BattleFrontier_Lounge5_Text_264D6B, - BattleFrontier_Lounge5_Text_264DD7, - BattleFrontier_Lounge5_Text_264E33, - BattleFrontier_Lounge5_Text_264E8F, - BattleFrontier_Lounge5_Text_2648BE, -}; - void sub_813A7B8(void) { + static const u8 *const gUnknown_085B3040[] = { + BattleFrontier_Lounge5_Text_26468D, + BattleFrontier_Lounge5_Text_2646E5, + BattleFrontier_Lounge5_Text_264741, + BattleFrontier_Lounge5_Text_2647A4, + BattleFrontier_Lounge5_Text_2647FC, + BattleFrontier_Lounge5_Text_264858, + BattleFrontier_Lounge5_Text_2648BE, + BattleFrontier_Lounge5_Text_264916, + BattleFrontier_Lounge5_Text_264972, + BattleFrontier_Lounge5_Text_2649D5, + BattleFrontier_Lounge5_Text_264A3F, + BattleFrontier_Lounge5_Text_264A9B, + BattleFrontier_Lounge5_Text_264AF3, + BattleFrontier_Lounge5_Text_264B5D, + BattleFrontier_Lounge5_Text_2648BE, + BattleFrontier_Lounge5_Text_264BC3, + BattleFrontier_Lounge5_Text_264C36, + BattleFrontier_Lounge5_Text_2648BE, + BattleFrontier_Lounge5_Text_264C95, + BattleFrontier_Lounge5_Text_264D01, + BattleFrontier_Lounge5_Text_264D6B, + BattleFrontier_Lounge5_Text_264DD7, + BattleFrontier_Lounge5_Text_264E33, + BattleFrontier_Lounge5_Text_264E8F, + BattleFrontier_Lounge5_Text_2648BE, + }; + u8 nature; if (gSpecialVar_0x8004 >= PARTY_SIZE) @@ -2987,52 +2990,52 @@ void UpdateFrontierGambler(u16 a0) *var %= 12; } -const u8 *const gUnknown_085B30A4[] = { - BattleFrontier_Lounge3_Text_262261, - BattleFrontier_Lounge3_Text_26230D, - BattleFrontier_Lounge3_Text_2623B9, - BattleFrontier_Lounge3_Text_262464, - BattleFrontier_Lounge3_Text_26250E, - BattleFrontier_Lounge3_Text_2625B8, - BattleFrontier_Lounge3_Text_26266A, - BattleFrontier_Lounge3_Text_26271C, - BattleFrontier_Lounge3_Text_2627C9, - BattleFrontier_Lounge3_Text_262876, - BattleFrontier_Lounge3_Text_26291A, - BattleFrontier_Lounge3_Text_2629BC, -}; - void sub_813A820(void) { + static const u8 *const gUnknown_085B30A4[] = { + BattleFrontier_Lounge3_Text_262261, + BattleFrontier_Lounge3_Text_26230D, + BattleFrontier_Lounge3_Text_2623B9, + BattleFrontier_Lounge3_Text_262464, + BattleFrontier_Lounge3_Text_26250E, + BattleFrontier_Lounge3_Text_2625B8, + BattleFrontier_Lounge3_Text_26266A, + BattleFrontier_Lounge3_Text_26271C, + BattleFrontier_Lounge3_Text_2627C9, + BattleFrontier_Lounge3_Text_262876, + BattleFrontier_Lounge3_Text_26291A, + BattleFrontier_Lounge3_Text_2629BC, + }; + u16 var = VarGet(VAR_FRONTIER_GAMBLER_FACILITY); ShowFieldMessage(gUnknown_085B30A4[var]); VarSet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F, var); } -const u8 *const gUnknown_085B30D4[] = { - BattleFrontier_Lounge3_Text_262C04, - BattleFrontier_Lounge3_Text_262C90, - BattleFrontier_Lounge3_Text_262D1C, - BattleFrontier_Lounge3_Text_262DA7, - BattleFrontier_Lounge3_Text_262E34, - BattleFrontier_Lounge3_Text_262EC1, - BattleFrontier_Lounge3_Text_262F56, - BattleFrontier_Lounge3_Text_262FEB, - BattleFrontier_Lounge3_Text_263078, - BattleFrontier_Lounge3_Text_263105, - BattleFrontier_Lounge3_Text_26318C, - BattleFrontier_Lounge3_Text_263211, -}; - void sub_813A854(void) { + static const u8 *const gUnknown_085B30D4[] = { + BattleFrontier_Lounge3_Text_262C04, + BattleFrontier_Lounge3_Text_262C90, + BattleFrontier_Lounge3_Text_262D1C, + BattleFrontier_Lounge3_Text_262DA7, + BattleFrontier_Lounge3_Text_262E34, + BattleFrontier_Lounge3_Text_262EC1, + BattleFrontier_Lounge3_Text_262F56, + BattleFrontier_Lounge3_Text_262FEB, + BattleFrontier_Lounge3_Text_263078, + BattleFrontier_Lounge3_Text_263105, + BattleFrontier_Lounge3_Text_26318C, + BattleFrontier_Lounge3_Text_263211, + }; + ShowFieldMessage(gUnknown_085B30D4[VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F)]); } -const u16 gUnknown_085B3104[] = {0x0000, 0x0001, 0x0002, 0x0100, 0x0101, 0x0400, 0x0401, 0x0200, 0x0201, 0x0300, 0x0500, 0x0600}; - void sub_813A878(u8 a0) { + static const u16 gUnknown_085B3104[] = {0x0000, 0x0001, 0x0002, 0x0100, 0x0101, 0x0400, 0x0401, 0x0200, 0x0201, 0x0300, 0x0500, 0x0600}; + u16 var1 = VarGet(VAR_0x40CE); u16 var2 = VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F); u16 var3 = VarGet(VAR_FRONTIER_FACILITY); @@ -3062,18 +3065,18 @@ void sub_813A8FC(void) PrintTextOnWindow(gUnknown_0203AB6D, 1, string, x, 1, 0, NULL); } -const struct WindowTemplate gUnknown_085B311C = { - .priority = 0, - .tilemapLeft = 1, - .tilemapTop = 1, - .width = 6, - .height = 2, - .paletteNum = 15, - .baseBlock = 8, -}; - void sub_813A958(void) { + static const struct WindowTemplate gUnknown_085B311C = { + .priority = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 6, + .height = 2, + .paletteNum = 15, + .baseBlock = 8, + }; + gUnknown_0203AB6D = AddWindow(&gUnknown_085B311C); SetStandardWindowBorderStyle(gUnknown_0203AB6D, 0); sub_813A8FC(); @@ -3115,18 +3118,18 @@ u16 sub_813AA04(void) return gSaveBlock2Ptr->frontier.frontierBattlePoints; } -const struct WindowTemplate gUnknown_085B3124 = { - .priority = 0, - .tilemapLeft = 2, - .tilemapTop = 9, - .width = 4, - .height = 4, - .paletteNum = 15, - .baseBlock = 20, -}; - void sub_813AA18(void) { + static const struct WindowTemplate gUnknown_085B3124 = { + .priority = 0, + .tilemapLeft = 2, + .tilemapTop = 9, + .width = 4, + .height = 4, + .paletteNum = 15, + .baseBlock = 20, + }; + gUnknown_0203AB6E = AddWindow(&gUnknown_085B3124); SetStandardWindowBorderStyle(gUnknown_0203AB6E, 0); CopyWindowToVram(gUnknown_0203AB6E, 2); @@ -3138,61 +3141,59 @@ void sub_813AA44(void) RemoveWindow(gUnknown_0203AB6E); } -const u16 gUnknown_085B312C[] = { 0x004b, 0x0067, 0x0057, 0x004f, 0x0054, 0x0055, 0x0056, 0x0050, 0x0051, 0x0052, 0xffff }; -const u16 gUnknown_085B3142[] = { 0x0071, 0x006f, 0x0072, 0x0073, 0x0074, 0xffff }; -const u16 gUnknown_085B314E[] = { 0x0040, 0x0043, 0x0041, 0x0046, 0x0042, 0x003f, 0xffff }; -const u16 gUnknown_085B315C[] = { 0x00c8, 0x00b4, 0x00b7, 0x00b9, 0x00b3, 0x00ba, 0x00bb, 0x00c4, 0x00c6, 0xffff }; - -const u8 *const gUnknown_085B3170[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_2601AA, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2601D0, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260201, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26022F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26025B, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260287, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2602B5, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2602E0, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26030F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26033E, - gText_Exit, -}; - -const u8 *const gUnknown_085B319C[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, - gText_Exit -}; - -const u8 *const gUnknown_085B31B4[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_260397, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2603BE, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2603E6, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26040E, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260436, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26045C, - gText_Exit -}; - -const u8 *const gUnknown_085B31D0[] = { - BattleFrontier_BattlePointExchangeServiceCorner_Text_26047A, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2604AC, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2604D8, - BattleFrontier_BattlePointExchangeServiceCorner_Text_26050F, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260542, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260575, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2605A8, - BattleFrontier_BattlePointExchangeServiceCorner_Text_2605E2, - BattleFrontier_BattlePointExchangeServiceCorner_Text_260613, - gText_Exit -}; - -void sub_813ABD4(u16 a0); - -void sub_813AA60(u16 a0, u16 a1) +static void sub_813AA60(u16 a0, u16 a1) { + static const u16 gUnknown_085B312C[] = { 0x004b, 0x0067, 0x0057, 0x004f, 0x0054, 0x0055, 0x0056, 0x0050, 0x0051, 0x0052, 0xffff }; + static const u16 gUnknown_085B3142[] = { 0x0071, 0x006f, 0x0072, 0x0073, 0x0074, 0xffff }; + static const u16 gUnknown_085B314E[] = { 0x0040, 0x0043, 0x0041, 0x0046, 0x0042, 0x003f, 0xffff }; + static const u16 gUnknown_085B315C[] = { 0x00c8, 0x00b4, 0x00b7, 0x00b9, 0x00b3, 0x00ba, 0x00bb, 0x00c4, 0x00c6, 0xffff }; + + static const u8 *const gUnknown_085B3170[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_2601AA, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2601D0, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260201, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26022F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26025B, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260287, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2602B5, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2602E0, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26030F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26033E, + gText_Exit, + }; + + static const u8 *const gUnknown_085B319C[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + gText_Exit + }; + + static const u8 *const gUnknown_085B31B4[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_260397, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2603BE, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2603E6, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26040E, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260436, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26045C, + gText_Exit + }; + + static const u8 *const gUnknown_085B31D0[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_26047A, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2604AC, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2604D8, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26050F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260542, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260575, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2605A8, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2605E2, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260613, + gText_Exit + }; + if (a0 > 2 && a0 < 7) { FillWindowPixelRect(0, 0x11, 0, 0, 216, 32); @@ -3236,7 +3237,7 @@ void sub_813AA60(u16 a0, u16 a1) } } -void sub_813ABD4(u16 a0) +static void sub_813ABD4(u16 a0) { FreeSpriteTilesByTag(5500); FreeSpritePaletteByTag(5500); @@ -3250,7 +3251,7 @@ void sub_813ABD4(u16 a0) } } -void sub_813AC44(u16 a0, u16 unused) +static void sub_813AC44(u16 a0, u16 unused) { if (gUnknown_0203AB6C != MAX_SPRITES) { @@ -3264,8 +3265,8 @@ void sub_813AC44(u16 a0, u16 unused) } } -const u16 gUnknown_085B31F8[] = { 0x0087, 0x0045, 0x008a, 0x0005, 0x0019, 0x0022, 0x009d, 0x0044, 0x0056, 0x000e }; -const u16 gUnknown_085B320C[] = { 0x006f, 0x00ad, 0x00bd, 0x0081, 0x00c4, 0x00cb, 0x00f4, 0x0008, 0x0009, 0x0007 }; +static const u16 gUnknown_085B31F8[] = { 0x0087, 0x0045, 0x008a, 0x0005, 0x0019, 0x0022, 0x009d, 0x0044, 0x0056, 0x000e }; +static const u16 gUnknown_085B320C[] = { 0x006f, 0x00ad, 0x00bd, 0x0081, 0x00c4, 0x00cb, 0x00f4, 0x0008, 0x0009, 0x0007 }; void sub_813AC7C(void) { @@ -3279,18 +3280,18 @@ void sub_813AC7C(void) } } -const struct WindowTemplate gUnknown_085B3220 = { - .priority = 0, - .tilemapLeft = 1, - .tilemapTop = 7, - .width = 12, - .height = 6, - .paletteNum = 15, - .baseBlock = 28, -}; - -void sub_813ACE8(u8 a0, u16 a1) +static void sub_813ACE8(u8 a0, u16 a1) { + static const struct WindowTemplate gUnknown_085B3220 = { + .priority = 0, + .tilemapLeft = 1, + .tilemapTop = 7, + .width = 12, + .height = 6, + .paletteNum = 15, + .baseBlock = 28, + }; + if (a0 == 9 || a0 == 10) { if (gSpecialVar_0x8006 == 0) @@ -3302,36 +3303,36 @@ void sub_813ACE8(u8 a0, u16 a1) } } -const u8 *const gUnknown_085B3228[] = { - BattleFrontier_Lounge7_Text_265E30, - BattleFrontier_Lounge7_Text_265E5B, - BattleFrontier_Lounge7_Text_265E8A, - BattleFrontier_Lounge7_Text_265EC0, - BattleFrontier_Lounge7_Text_265EED, - BattleFrontier_Lounge7_Text_265F1C, - BattleFrontier_Lounge7_Text_265F47, - BattleFrontier_Lounge7_Text_265F77, - BattleFrontier_Lounge7_Text_265FAA, - BattleFrontier_Lounge7_Text_265FDD, - gText_Exit, -}; - -const u8 *const gUnknown_085B3254[] = { - BattleFrontier_Lounge7_Text_26600A, - BattleFrontier_Lounge7_Text_26603E, - BattleFrontier_Lounge7_Text_266070, - BattleFrontier_Lounge7_Text_2660A6, - BattleFrontier_Lounge7_Text_2660D0, - BattleFrontier_Lounge7_Text_2660FF, - BattleFrontier_Lounge7_Text_26612D, - BattleFrontier_Lounge7_Text_26615F, - BattleFrontier_Lounge7_Text_266185, - BattleFrontier_Lounge7_Text_2661B5, - gText_Exit, -}; - -void sub_813AD34(u8 a0, u16 a1) +static void sub_813AD34(u8 a0, u16 a1) { + static const u8 *const gUnknown_085B3228[] = { + BattleFrontier_Lounge7_Text_265E30, + BattleFrontier_Lounge7_Text_265E5B, + BattleFrontier_Lounge7_Text_265E8A, + BattleFrontier_Lounge7_Text_265EC0, + BattleFrontier_Lounge7_Text_265EED, + BattleFrontier_Lounge7_Text_265F1C, + BattleFrontier_Lounge7_Text_265F47, + BattleFrontier_Lounge7_Text_265F77, + BattleFrontier_Lounge7_Text_265FAA, + BattleFrontier_Lounge7_Text_265FDD, + gText_Exit, + }; + + static const u8 *const gUnknown_085B3254[] = { + BattleFrontier_Lounge7_Text_26600A, + BattleFrontier_Lounge7_Text_26603E, + BattleFrontier_Lounge7_Text_266070, + BattleFrontier_Lounge7_Text_2660A6, + BattleFrontier_Lounge7_Text_2660D0, + BattleFrontier_Lounge7_Text_2660FF, + BattleFrontier_Lounge7_Text_26612D, + BattleFrontier_Lounge7_Text_26615F, + BattleFrontier_Lounge7_Text_266185, + BattleFrontier_Lounge7_Text_2661B5, + gText_Exit, + }; + if (a0 == 9 || a0 == 10) { FillWindowPixelRect(gUnknown_0203AB5E, 0x11, 0, 0, 96, 48); @@ -3429,14 +3430,12 @@ void sub_813AF48(void) } } -void task_deoxys_sound(u8 taskId); - void sub_813AFC8(void) { CreateTask(task_deoxys_sound, 8); } -const u16 gUnknown_085B3280[][16] = { +static const u16 gUnknown_085B3280[][16] = { INCBIN_U16("graphics/misc/deoxys1.gbapal"), INCBIN_U16("graphics/misc/deoxys2.gbapal"), INCBIN_U16("graphics/misc/deoxys3.gbapal"), @@ -3450,7 +3449,7 @@ const u16 gUnknown_085B3280[][16] = { INCBIN_U16("graphics/misc/deoxys11.gbapal"), }; -const u8 gUnknown_085B33E0[][2] = { +static const u8 gUnknown_085B33E0[][2] = { { 0x0f, 0x0c }, { 0x0b, 0x0e }, { 0x0f, 0x08 }, @@ -3464,12 +3463,10 @@ const u8 gUnknown_085B33E0[][2] = { { 0x0f, 0x0a }, }; -const u8 gUnknown_085B33F6[] = { 0x04, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x06, 0x03, 0x03 }; - -void sub_813B0B4(u8 a0); - -void task_deoxys_sound(u8 taskId) +static void task_deoxys_sound(u8 taskId) { + static const u8 gUnknown_085B33F6[] = { 0x04, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x06, 0x03, 0x03 }; + if (FlagGet(FLAG_0x8D4) == TRUE) { gSpecialVar_Result = 3; @@ -3507,9 +3504,7 @@ void task_deoxys_sound(u8 taskId) } } -void sub_813B160(u8 taskId); - -void sub_813B0B4(u8 a0) +static void sub_813B0B4(u8 a0) { u8 eventObjectId; LoadPalette(&gUnknown_085B3280[a0], 0x1A0, 8); @@ -3545,7 +3540,7 @@ void sub_813B0B4(u8 a0) Overworld_SetEventObjTemplateCoords(1, gUnknown_085B33E0[a0][0], gUnknown_085B33E0[a0][1]); } -void sub_813B160(u8 taskId) +static void sub_813B160(u8 taskId) { if (FieldEffectActiveListContains(FLDEFF_66) == FALSE) { @@ -3571,8 +3566,6 @@ void increment_var_x4026_on_birth_island_modulo_100(void) } } -extern void BlendPalettes(u32, u8, u16); - void sub_813B1D0(void) { LoadPalette(&gUnknown_085B3280[(u8)VarGet(VAR_0x4035)], 0x1A0, 8); @@ -3656,10 +3649,10 @@ void sub_813B2E4(void) } } -const u8 gUnknown_085B3400[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; - bool32 sub_813B374(void) { + static const u8 gUnknown_085B3400[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; + u16 var = VarGet(VAR_0x4037); GetMapName(gStringVar1, gUnknown_085B3400[var - 1], 0); @@ -3674,169 +3667,663 @@ bool32 sub_813B374(void) } } -const u8 gUnknown_085B3410[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; - -// last parts of switch statements insist on merging -#ifdef NONMATCHING bool32 sub_813B3B0(void) { + static const u8 gUnknown_085B3410[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; + u16 var1 = VarGet(VAR_0x4038); u16 var2 = VarGet(VAR_0x4037); - if (var2 != 0) + if (!var2) { - if (++var1 > 999) - { - VarSet(VAR_0x4038, 0); - if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER_MARINE_CAVE)) - { - switch (gSaveBlock1Ptr->location.mapNum) - { - case MAP_NUM(UNDERWATER_MARINE_CAVE): - case MAP_NUM(MARINE_CAVE_ENTRANCE): - case MAP_NUM(MARINE_CAVE_END): - case MAP_NUM(TERRA_CAVE_ENTRANCE): - case MAP_NUM(TERRA_CAVE_END): - VarSet(VAR_0x4039, 1); - return FALSE; - default: - break; - } - } - - if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER3)) - { - switch (gSaveBlock1Ptr->location.mapNum) - { - case MAP_NUM(UNDERWATER3): - case MAP_NUM(UNDERWATER5): - case MAP_NUM(UNDERWATER6): - case MAP_NUM(UNDERWATER7): - VarSet(VAR_0x4039, 1); - return FALSE; - default: - break; - } - } + return FALSE; + } - if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3410[var2 - 1] && - gSaveBlock1Ptr->location.mapGroup == 0) + if (++var1 > 999) + { + VarSet(VAR_0x4038, 0); + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER_MARINE_CAVE)) + { + switch (gSaveBlock1Ptr->location.mapNum) { - return TRUE; + case MAP_NUM(UNDERWATER_MARINE_CAVE): + case MAP_NUM(MARINE_CAVE_ENTRANCE): + case MAP_NUM(MARINE_CAVE_END): + case MAP_NUM(TERRA_CAVE_ENTRANCE): + case MAP_NUM(TERRA_CAVE_END): + VarSet(VAR_0x4039, 1); + return FALSE; + default: + break; } - else + } + + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER3)) + { + switch (gSaveBlock1Ptr->location.mapNum) { - VarSet(VAR_0x4037, 0); - return FALSE; + case MAP_NUM(UNDERWATER3): + case MAP_NUM(UNDERWATER5): + case MAP_NUM(UNDERWATER6): + case MAP_NUM(UNDERWATER7): + VarSet(VAR_0x4039, 1); + return FALSE; + default: + break; } } + + if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3410[var2 - 1] && + gSaveBlock1Ptr->location.mapGroup == 0) + { + return TRUE; + } else { - VarSet(VAR_0x4038, var1); + VarSet(VAR_0x4037, 0); return FALSE; } } else { + VarSet(VAR_0x4038, var1); return FALSE; } } -#else -NAKED -bool32 sub_813B3B0(void) + +void sub_813B484(void) { - asm_unified("push {r4-r6,lr}\n\ - ldr r5, =0x00004038\n\ - adds r0, r5, 0\n\ - bl VarGet\n\ - lsls r0, 16\n\ - lsrs r4, r0, 16\n\ - ldr r0, =0x00004037\n\ - bl VarGet\n\ - lsls r0, 16\n\ - lsrs r6, r0, 16\n\ - cmp r6, 0\n\ - beq _0813B47C\n\ - adds r0, r4, 0x1\n\ - lsls r0, 16\n\ - lsrs r4, r0, 16\n\ - ldr r0, =0x000003e7\n\ - cmp r4, r0\n\ - bls _0813B474\n\ - adds r0, r5, 0\n\ - movs r1, 0\n\ - bl VarSet\n\ - ldr r0, =gSaveBlock1Ptr\n\ - ldr r1, [r0]\n\ - movs r0, 0x4\n\ - ldrsb r0, [r1, r0]\n\ - cmp r0, 0x18\n\ - bne _0813B414\n\ - movs r0, 0x5\n\ - ldrsb r0, [r1, r0]\n\ - cmp r0, 0x69\n\ - bgt _0813B414\n\ - cmp r0, 0x65\n\ - blt _0813B414\n\ - ldr r0, =0x00004039\n\ - movs r1, 0x1\n\ - b _0813B478\n\ - .pool\n\ -_0813B414:\n\ - ldr r0, =gSaveBlock1Ptr\n\ - ldr r2, [r0]\n\ - movs r1, 0x4\n\ - ldrsb r1, [r2, r1]\n\ - adds r3, r0, 0\n\ - cmp r1, 0\n\ - bne _0813B444\n\ - movs r0, 0x5\n\ - ldrsb r0, [r2, r0]\n\ - cmp r0, 0x34\n\ - beq _0813B436\n\ - cmp r0, 0x34\n\ - blt _0813B444\n\ - cmp r0, 0x38\n\ - bgt _0813B444\n\ - cmp r0, 0x36\n\ - blt _0813B444\n\ -_0813B436:\n\ - ldr r0, =0x00004039\n\ - movs r1, 0x1\n\ - b _0813B478\n\ - .pool\n\ -_0813B444:\n\ - ldr r3, [r3]\n\ - movs r2, 0x5\n\ - ldrsb r2, [r3, r2]\n\ - ldr r1, =gUnknown_085B3410\n\ - subs r0, r6, 0x1\n\ - adds r0, r1\n\ - ldrb r0, [r0]\n\ - cmp r2, r0\n\ - bne _0813B468\n\ - movs r0, 0x4\n\ - ldrsb r0, [r3, r0]\n\ - cmp r0, 0\n\ - bne _0813B468\n\ - movs r0, 0x1\n\ - b _0813B47E\n\ - .pool\n\ -_0813B468:\n\ - ldr r0, =0x00004037\n\ - movs r1, 0\n\ - b _0813B478\n\ - .pool\n\ -_0813B474:\n\ - adds r0, r5, 0\n\ - adds r1, r4, 0\n\ -_0813B478:\n\ - bl VarSet\n\ -_0813B47C:\n\ - movs r0, 0\n\ -_0813B47E:\n\ - pop {r4-r6}\n\ - pop {r1}\n\ - bx r1"); + sub_80AB104(2); +} + +bool32 sub_813B490(void) +{ + static const u8 gUnknown_085B3420[][3] = { + { 0x02, 0x04, 0x01 }, + { 0x04, 0x04, 0x01 }, + { 0x05, 0x00, 0x01 }, + { 0x06, 0x03, 0x01 }, + { 0x08, 0x06, 0x01 }, + { 0x09, 0x0d, 0x01 }, + { 0x0a, 0x07, 0x01 }, + { 0x0b, 0x07, 0x01 }, + { 0x0c, 0x04, 0x01 }, + { 0x0e, 0x05, 0x01 }, + { 0x0f, 0x04, 0x01 }, + { 0x1a, 0x37, 0x01 } + }; + + u8 i; + for (i = 0; i < 12; i++) + { + if (gSaveBlock1Ptr->location.mapGroup == gUnknown_085B3420[i][0]) + { + if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3420[i][1]) + { + return gUnknown_085B3420[i][2]; + } + } + } + return TRUE; +} + +bool32 sub_813B4E0(void) +{ + int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); + if (index >= 0) + { + if (FlagGet(FLAG_MATCH_CALL_REGISTERED + index) == TRUE) + return TRUE; + } + return FALSE; +} + +bool32 sub_813B514(void) +{ + if (!VarGet(VAR_0x403F)) + { + return FALSE; + } + return TRUE; +} + +void sub_813B534(void) +{ + gUnknown_0203AB70 = gBattleTypeFlags; + gBattleTypeFlags = 0; + if (!gReceivedRemoteLinkPlayers) + { + CreateTask(sub_80B3AF8, 5); + } +} + +void sub_813B568(void) +{ + CreateTask(sub_813B57C, 5); +} + +static void sub_813B57C(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (!FuncIsActiveTask(sub_80B3AF8)) + { + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_800A520() == TRUE) + { + if (GetMultiplayerId() == 0) + { + gTasks[taskId].data[0]++; + } + else + { + SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_0x8004, 2); + gTasks[taskId].data[0]++; + } + } + break; + case 2: + if ((GetBlockReceivedStatus() & 2) != 0) + { + if (GetMultiplayerId() == 0) + { + gSpecialVar_0x8005 = gBlockRecvBuffer[1][0]; + ResetBlockReceivedFlag(1); + if (gSpecialVar_0x8004 == 1 && gSpecialVar_0x8005 == 1) + { + gSpecialVar_Result = 1; + } + else if (gSpecialVar_0x8004 == 0 && gSpecialVar_0x8005 == 1) + { + gSpecialVar_Result = 2; + } + else if (gSpecialVar_0x8004 == 1 && gSpecialVar_0x8005 == 0) + { + gSpecialVar_Result = 3; + } + else + { + gSpecialVar_Result = 0; + } + } + gTasks[taskId].data[0]++; + } + break; + case 3: + if (sub_800A520() == TRUE) + { + if (GetMultiplayerId() != 0) + { + gTasks[taskId].data[0]++; + } + else + { + SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_Result, 2); + gTasks[taskId].data[0]++; + } + } + break; + case 4: + if ((GetBlockReceivedStatus() & 1) != 0) + { + if (GetMultiplayerId() != 0) + { + gSpecialVar_Result = gBlockRecvBuffer[0][0]; + ResetBlockReceivedFlag(0); + gTasks[taskId].data[0]++; + } + else + { + gTasks[taskId].data[0]++; + } + } + break; + case 5: + if (GetMultiplayerId() == 0) + { + if (gSpecialVar_Result == 2) + { + ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); + } + } + else + { + if (gSpecialVar_Result == 3) + { + ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); + } + } + gTasks[taskId].data[0]++; + break; + case 6: + if (!IsTextPrinterActive(0)) + { + gTasks[taskId].data[0]++; + } + break; + case 7: + if (sub_800A520() == 1) + { + sub_800ADF8(); + gTasks[taskId].data[0]++; + } + break; + case 8: + if (sub_800A520() == 1) + { + gTasks[taskId].data[0]++; + } + break; + case 9: + if (gWirelessCommType == 0) + { + sub_800AC34(); + } + gBattleTypeFlags = gUnknown_0203AB70; + EnableBothScriptContexts(); + DestroyTask(taskId); + break; + } +} + +void sub_813B7D8(void) +{ + if (gSpecialVar_0x8004 == 0) + { + DoRayquazaScene(0, TRUE, CB2_ReturnToFieldContinueScriptPlayMapMusic); + } + else + { + DoRayquazaScene(1, FALSE, CB2_ReturnToFieldContinueScriptPlayMapMusic); + } +} + +void sub_813B80C(void) +{ + CreateTask(sub_813B824, 8); + PlaySE(SE_W017); +} + +static void sub_813B824(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + data[1]++; + if (data[1] == gSpecialVar_0x8005) + { + data[0]++; + data[1] = 0; + PlaySE(SE_W017); + } + + if (data[0] == gSpecialVar_0x8004 - 1) + { + DestroyTask(taskId); + } +} + +void sub_813B880(void) +{ + u8 taskId = CreateTask(_fwalk, 8); + gTasks[taskId].data[0] = 4; + gTasks[taskId].data[1] = 4; + gTasks[taskId].data[2] = 4; + gTasks[taskId].data[3] = 0; +} + +static void _fwalk(u8 taskId) +{ + u8 x, y; + s16 *data = gTasks[taskId].data; + + data[data[3]]--; + if (data[data[3]] == 0) + { + for (y = 0; y < 4; y++) + { + for (x = 0; x < 3; x++) + { + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + x + 6, gSaveBlock1Ptr->pos.y + y + 4, x + 0x201 + y * 8 + data[3] * 32); + } + } + DrawWholeMapView(); + data[3]++; + if (data[3] == 3) + { + DestroyTask(taskId); + EnableBothScriptContexts(); + } + } +} + +void sub_813B968(void) +{ + gSpecialVar_Result = gSpecialVar_0x8004 / 7; + gSpecialVar_Result -= (gSpecialVar_Result / 20) * 20; +} + +void sub_813B9A0(void) +{ + if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN)) + { + Overworld_SetHealLocationWarp(3); + } +} + +bool32 sub_813B9C0(void) +{ + static const u16 gUnknown_085B3444[] = { + MAP_OLDALE_TOWN_POKEMON_CENTER_1F, + MAP_DEWFORD_TOWN_POKEMON_CENTER_1F, + MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F, + MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F, + MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F, + MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F, + MAP_PETALBURG_CITY_POKEMON_CENTER_1F, + MAP_SLATEPORT_CITY_POKEMON_CENTER_1F, + MAP_MAUVILLE_CITY_POKEMON_CENTER_1F, + MAP_RUSTBORO_CITY_POKEMON_CENTER_1F, + MAP_FORTREE_CITY_POKEMON_CENTER_1F, + MAP_LILYCOVE_CITY_POKEMON_CENTER_1F, + MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F, + MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F, + MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F, + MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F, + MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F, + MAP_SINGLE_BATTLE_COLOSSEUM, + MAP_TRADE_CENTER, + MAP_RECORD_CORNER, + MAP_DOUBLE_BATTLE_COLOSSEUM, + 0xffff + }; + + int i; + u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum; + + for (i = 0; gUnknown_085B3444[i] != 0xFFFF; i++) + { + if (gUnknown_085B3444[i] == map) + { + return TRUE; + } + } + return FALSE; +} + +void ResetFanClub(void) +{ + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] = 0; + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = 0; +} + +void sub_813BA30(void) +{ + if (sub_813BF44() != 0) + { + UpdateMovedLilycoveFanClubMembers(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = gSaveBlock2Ptr->playTimeHours; + } +} + +void sub_813BA60(void) +{ + if (!((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> 7) & 1)) + { + sub_813BF60(); + sub_813BD84(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = gSaveBlock2Ptr->playTimeHours; + FlagClear(FLAG_HIDE_FANCLUB_OLD_LADY); + FlagClear(FLAG_HIDE_FANCLUB_BOY); + FlagClear(FLAG_HIDE_FANCLUB_LITTLE_BOY); + FlagClear(FLAG_HIDE_FANCLUB_LADY); + FlagClear(FLAG_0x2DA); + VarSet(VAR_LILYCOVE_FAN_CLUB_STATE, 1); + } +} + +u8 sub_813BADC(u8 a0) +{ + static const u8 gUnknown_085B3470[] = { 0x02, 0x01, 0x02, 0x01 }; + + if (VarGet(VAR_LILYCOVE_FAN_CLUB_STATE) == 2) + { + if ((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] & 0x7F) + gUnknown_085B3470[a0] > 19) + { + if (GetNumMovedLilycoveFanClubMembers() < 3) + { + sub_813BB74(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] &= 0xFF80; + } + else + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] = (gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] & 0xFF80) | 0x14; + } + } + else + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] += gUnknown_085B3470[a0]; + } + } + + return gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] & 0x7F; +} + +static u16 sub_813BB74(void) +{ + static const u8 gUnknown_085B3474[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; + + u8 i; + u8 retVal = 0; + + for (i = 0; i < 8; i++) + { + if (!((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gUnknown_085B3474[i]) & 1)) + { + retVal = i; + if ((Random() & 1) != 0) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 1 << gUnknown_085B3474[retVal]; + return retVal; + } + } + } + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 1 << gUnknown_085B3474[retVal]; + return retVal; +} + +static u16 sub_813BC00(void) +{ + static const u8 gUnknown_085B347C[] = { 0x08, 0x0d, 0x0e, 0x0b, 0x0a, 0x0c, 0x0f, 0x09 }; + + u8 i; + u8 retVal = 0; + + if (GetNumMovedLilycoveFanClubMembers() == 1) + { + return 0; + } + + for (i = 0; i < 8; i++) + { + if (((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gUnknown_085B347C[i]) & 1) != 0) + { + retVal = i; + if ((Random() & 1) != 0) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] ^= 1 << gUnknown_085B347C[retVal]; + return retVal; + } + } + } + + if (((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gUnknown_085B347C[retVal]) & 1)) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] ^= 1 << gUnknown_085B347C[retVal]; + } + + return retVal; +} + +u16 GetNumMovedLilycoveFanClubMembers(void) +{ + u8 i; + u8 retVal = 0; + + for (i = 0; i < 8; i++) + { + if (((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> (i + 8)) & 1) != 0) + { + retVal++; + } + } + + return retVal; +} + +void UpdateMovedLilycoveFanClubMembers(void) +{ + u8 i = 0; + if (gSaveBlock2Ptr->playTimeHours < 999) + { + while (TRUE) + { + if (GetNumMovedLilycoveFanClubMembers() < 5) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = gSaveBlock2Ptr->playTimeHours; + break; + } + else if (i == 8) + { + break; + } + else if (gSaveBlock2Ptr->playTimeHours - gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] < 12) + { + return; + } + sub_813BC00(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] += 12; + i++; + } + } +} + +bool8 ShouldMoveLilycoveFanClubMember(void) +{ + return (gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gSpecialVar_0x8004) & 1; +} + +static void sub_813BD84(void) +{ + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x2000; + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x100; + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x400; +} + +void BufferStreakTrainerText(void) +{ + u8 a = 0; + u8 b = 0; + switch (gSpecialVar_0x8004) + { + case 8: + break; + case 9: + break; + case 10: + a = 0; + b = 3; + break; + case 11: + a = 0; + b = 1; + break; + case 12: + a = 1; + b = 0; + break; + case 13: + a = 0; + b = 4; + break; + case 14: + a = 1; + b = 5; + break; + case 15: + break; + } + sub_813BE30(&gSaveBlock1Ptr->linkBattleRecords, a, b); +} + +static void sub_813BE30(struct LinkBattleRecords *linkRecords, u8 a, u8 b) +{ + struct LinkBattleRecord *record = &linkRecords->entries[a]; + if (record->name[0] == EOS) + { + switch (b) + { + case 0: + StringCopy(gStringVar1, gText_Wallace); + break; + case 1: + StringCopy(gStringVar1, gText_Steven); + break; + case 2: + StringCopy(gStringVar1, gText_Brawly); + break; + case 3: + StringCopy(gStringVar1, gText_Winona); + break; + case 4: + StringCopy(gStringVar1, gText_Phoebe); + break; + case 5: + StringCopy(gStringVar1, gText_Glacia); + break; + default: + StringCopy(gStringVar1, gText_Wallace); + break; + } + } + else + { + StringCopyN(gStringVar1, record->name, 7); + gStringVar1[7] = EOS; + ConvertInternationalString(gStringVar1, linkRecords->languages[a]); + } +} + +void sub_813BF10(void) +{ + if (VarGet(VAR_LILYCOVE_FAN_CLUB_STATE) == 2) + { + sub_813BA30(); + if (gBattleOutcome == 1) + { + sub_813BB74(); + } + else + { + sub_813BC00(); + } + } +} + +static bool8 sub_813BF44(void) +{ + return (gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> 7) & 1; +} + +void sub_813BF60(void) +{ + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x80; +} + +u8 sub_813BF7C(void) +{ + return sub_813BADC(gSpecialVar_0x8004); } -#endif // NONMATCHING diff --git a/sym_ewram.txt b/sym_ewram.txt index 34c9658e8e..37a34b19a6 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -604,10 +604,6 @@ gPlayerFacingPosition: @ 203AB40 .include "src/pokeblock.o" .include "src/field_specials.o" - -gUnknown_0203AB70: @ 203AB70 - .space 0x4 - .include "src/battle_records.o" gUnknown_0203AB7C: @ 203AB7C