diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index b450d811d..4bfd02b18 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -5,1858 +5,7 @@ .text - - thumb_func_start sub_80156E0 -sub_80156E0: @ 80156E0 - push {r4-r7,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - ldr r0, =gUnknown_02022C30 - ldr r6, [r0] - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - ldrb r0, [r6, 0x14] - cmp r0, 0x38 - bls _08015702 - bl _08016878 -_08015702: - lsls r0, 2 - ldr r1, =_08015718 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08015718: - .4byte _080157FC - .4byte _08015854 - .4byte _08015878 - .4byte _080158C8 - .4byte _080159A6 - .4byte _08015E5C - .4byte _08015C54 - .4byte _08015E5C - .4byte _08016864 - .4byte _080161C8 - .4byte _080162D4 - .4byte _080160AC - .4byte _080160C6 - .4byte _08016324 - .4byte _08016348 - .4byte _08016350 - .4byte _08016360 - .4byte _0801638E - .4byte _080163A2 - .4byte _08015F32 - .4byte _08015FB8 - .4byte _08015FD6 - .4byte _0801604A - .4byte _08015ADA - .4byte _08015B00 - .4byte _08015B78 - .4byte _08016838 - .4byte _08015D4C - .4byte _08015D34 - .4byte _08015DD0 - .4byte _08015C2A - .4byte _08015DA6 - .4byte _08015D9C - .4byte _08016158 - .4byte _08016178 - .4byte _080161B8 - .4byte _080162DC - .4byte _08016318 - .4byte _08015BF4 - .4byte _08016104 - .4byte _08015E94 - .4byte _08015EC4 - .4byte _080163CC - .4byte _0801645C - .4byte _080165A8 - .4byte _08016610 - .4byte _0801662C - .4byte _08016478 - .4byte _08016634 - .4byte _08016738 - .4byte _0801676C - .4byte _080167F4 - .4byte _0801652C - .4byte _080164E0 - .4byte _080164F4 - .4byte _0801658C - .4byte _080165DC -_080157FC: - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0x4] - movs r0, 0x70 - bl AllocZeroed - str r0, [r6, 0xC] - movs r0, 0x80 - lsls r0, 1 - bl AllocZeroed - str r0, [r6] - movs r0, 0x20 - bl AllocZeroed - str r0, [r6, 0x8] - ldr r0, [r6] - movs r1, 0x8 - bl sub_8017580 - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] - ldr r0, [r6, 0xC] - ldr r1, [r6, 0x4] - movs r2, 0x9 - bl sub_8016DF0 - adds r1, r6, 0 - adds r1, 0x20 - strb r0, [r1] - adds r0, r6, 0 - adds r0, 0xA0 - bl sub_8019BA8 - bl sub_8019F2C - movs r0, 0x1 - bl _08016876 - .pool -_08015854: - adds r0, r6, 0 - adds r0, 0x21 - movs r2, 0 - ldrsh r1, [r7, r2] - bl sub_8019E70 - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - beq _08015872 - bl _08016878 -_08015872: - movs r0, 0x2 - bl _08016876 -_08015878: - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8010F84 - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - bl sub_800B488 - bl OpenLink - bl sub_8011C84 - ldr r0, [r6, 0x8] - movs r1, 0x1 - bl sub_8017580 - ldr r0, [r6, 0x4] - movs r1, 0x4 - bl sub_80175EC - ldr r0, [r6, 0xC] - movs r1, 0x4 - bl sub_80175EC - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - movs r0, 0x3 - bl _08016876 - .pool -_080158C8: - bl sub_81B1360 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x8 - beq _080158E0 - bl sub_81B1360 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x9 - bne _080159A0 -_080158E0: - ldr r4, =gUnknown_02022C40 - ldrh r0, [r4] - cmp r0, 0 - beq _080159A0 - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r5, r0, 24 - ldrh r0, [r4] - cmp r0, 0x1 - beq _08015900 - cmp r0, 0x2 - beq _08015950 - b _0801598E - .pool -_08015900: - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - cmp r5, 0x5 - bls _0801592C - adds r0, r4, 0 - bl sub_801807C - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_082EF4FC - bl sub_801568C - b _0801598E - .pool -_0801592C: - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80180A0 - cmp r0, 0 - bne _0801594C - ldr r1, =gUnknown_082EF47C - movs r0, 0x34 - bl sub_8015664 - b _0801598E - .pool -_0801594C: - movs r0, 0x37 - b _0801598C -_08015950: - adds r0, r6, 0 - bl sub_80156C8 - ldrb r0, [r4, 0x8] - strh r0, [r7, 0x2] - cmp r5, 0x5 - bls _0801596C - ldr r0, =gUnknown_082EF544 - bl sub_801568C - b _0801598E - .pool -_0801596C: - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - ldr r1, =gUnknown_02022C2C - movs r0, 0x44 - strb r0, [r1] - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80180E8 - movs r0, 0x33 -_0801598C: - strb r0, [r6, 0x14] -_0801598E: - ldr r1, =gUnknown_02022C40 - movs r0, 0 - strh r0, [r1] - bl _08016878 - .pool -_080159A0: - movs r0, 0x4 - bl _08016876 -_080159A6: - ldr r4, =gSpecialVar_Result - ldrh r0, [r4] - cmp r0, 0 - beq _08015A0A - cmp r0, 0x9 - bne _080159E0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r0, 0x2 - bl PlaySE - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - movs r1, 0 - movs r0, 0x2A - b _08015A02 - .pool -_080159E0: - cmp r0, 0xB - bne _080159F4 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r1, 0 - movs r0, 0x17 - b _08015A02 -_080159F4: - movs r0, 0 - strh r0, [r7] - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r7, 0x2] - movs r1, 0 - movs r0, 0x18 -_08015A02: - strb r0, [r6, 0x14] - strh r1, [r4] - bl _08016878 -_08015A0A: - bl ScriptContext2_IsEnabled - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08015A1A - bl _08016878 -_08015A1A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08015A80 - ldr r0, [r6] - adds r2, r7, 0x2 - adds r3, r6, 0 - adds r3, 0x21 - adds r1, r7, 0 - bl sub_801A2A8 - cmp r0, 0 - beq _08015A4C - movs r0, 0x5 - bl PlaySE - bl sub_80181CC - movs r0, 0x18 - bl _08016876 - .pool -_08015A4C: - bl sub_8017940 - cmp r0, 0 - beq _08015A80 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r0, 0x2 - bl PlaySE - bl sub_80181CC - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - movs r0, 0x2D - bl _08016876 - .pool -_08015A80: - bl sub_8016B00 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _08015AA2 - cmp r0, 0x2 - bgt _08015A96 - cmp r0, 0x1 - beq _08015A9C - b _08015AD0 -_08015A96: - cmp r0, 0x4 - beq _08015AAA - b _08015AD0 -_08015A9C: - movs r0, 0x2 - bl PlaySE -_08015AA2: - adds r0, r6, 0 - bl sub_801A274 - b _08015AD0 -_08015AAA: - movs r0, 0xB - strb r0, [r6, 0x14] - bl sub_80181CC - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - adds r0, r6, 0 - bl sub_80181DC - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x53 - movs r2, 0 - bl sub_8011090 -_08015AD0: - adds r0, r6, 0 - bl sub_801A284 - bl _08016878 -_08015ADA: - ldr r0, =sub_809FA34 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08015AEA - bl _08016878 -_08015AEA: - movs r0, 0x40 - movs r1, 0 - movs r2, 0 - bl sub_8011090 - movs r0, 0x4 - bl _08016876 - .pool -_08015B00: - bl sub_801704C - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - ldr r0, [r6] - ldrb r1, [r7] - ldrb r2, [r7, 0x2] - adds r3, r4, 0 - bl sub_80179D4 - cmp r0, 0x1 - beq _08015B44 - cmp r0, 0x1 - bgt _08015B36 - cmp r0, 0 - beq _08015B3E - bl _08016878 -_08015B36: - cmp r0, 0x2 - beq _08015B68 - bl _08016878 -_08015B3E: - movs r0, 0x1A - bl _08016876 -_08015B44: - movs r1, 0x2 - ldrsh r0, [r7, r1] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - ldr r2, =gUnknown_02022C2C - ldrb r2, [r2] - bl sub_8012188 - strh r5, [r6, 0x12] - movs r0, 0x19 - bl _08016876 - .pool -_08015B68: - ldr r1, =gStringVar4 - movs r0, 0x13 - bl sub_8015664 - bl _08016878 - .pool -_08015B78: - bl sub_801704C - bl sub_8011A74 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - blt _08015BBE - cmp r4, 0x2 - ble _08015B9A - cmp r4, 0x4 - bne _08015BBE - movs r0, 0x1 - bl sub_801818C - strb r4, [r6, 0x14] - b _08015BBE -_08015B9A: - bl sub_8011B90 - cmp r0, 0x1 - bne _08015BB0 - ldr r0, =gUnknown_082EE6C8 - bl sub_801568C - b _08015BB8 - .pool -_08015BB0: - ldr r1, =gUnknown_082EE6C8 - movs r0, 0x1E - bl sub_8015664 -_08015BB8: - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] -_08015BBE: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015BCA - bl _08016878 -_08015BCA: - ldr r0, =gBlockSendBuffer - movs r1, 0x1 - bl sub_80143E4 - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - movs r0, 0x26 - bl _08016876 - .pool -_08015BF4: - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08015C04 - bl _08016878 -_08015C04: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x44 - bne _08015C24 - ldr r1, =gUnknown_082EE004 - movs r0, 0x1F - bl sub_8015664 - bl _08016878 - .pool -_08015C24: - movs r0, 0x5 - bl _08016876 -_08015C2A: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08015C36 - bl _08016878 -_08015C36: - movs r0, 0 - bl sub_801818C - movs r2, 0 - ldrsh r0, [r7, r2] - movs r3, 0x2 - ldrsh r1, [r7, r3] - ldr r2, [r6] - bl sub_801A3D0 - movs r0, 0x2 - bl _08016876 - .pool -_08015C54: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1B - adds r2, r6, 0 - adds r2, 0x1C - ldr r3, =gUnknown_082F021C - ldr r4, =gUnknown_082F0244 - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _08015C78 - bl _08016878 -_08015C78: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015C94 - movs r0, 0x1C - bl _08016876 - .pool -_08015C94: - adds r1, r6, 0 - adds r1, 0x98 - movs r0, 0 - strh r0, [r1] - movs r2, 0x2 - ldrsh r0, [r7, r2] - ldr r1, [r6] - bl sub_8017CF8 - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _08015CB2 - cmp r5, 0x40 - bne _08015CE4 -_08015CB2: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x40 - strh r1, [r0] - bl sub_800FE50 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EEB80 - ldr r1, =gLinkPlayers - ldrb r1, [r1, 0x13] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - movs r0, 0x20 - bl _08016876 - .pool -_08015CE4: - ldr r0, =gUnknown_02022C2C - strb r5, [r0] - ldr r1, =gUnknown_02022C2D - lsrs r0, r5, 8 - strb r0, [r1] - lsls r0, r5, 24 - lsrs r0, 24 - cmp r0, 0x41 - bne _08015D18 - bl sub_8018024 - cmp r0, 0 - bne _08015D18 - ldr r1, =gUnknown_082EEBD0 - movs r0, 0x5 - bl sub_8015664 - bl _08016878 - .pool -_08015D18: - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - movs r1, 0x40 - orrs r1, r0 - adds r0, r6, 0 - adds r0, 0x4C - strh r1, [r0] - bl sub_800FE50 - movs r0, 0x1B - bl _08016876 - .pool -_08015D34: - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEB88 - bl StringCopy - movs r0, 0x24 - bl _08016876 - .pool -_08015D4C: - adds r0, r6, 0 - bl sub_8017FD8 - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - adds r0, r6, 0 - adds r0, 0x4C - ldrh r1, [r0] - movs r0, 0x3F - ands r0, r1 - bl sub_8017984 - adds r5, r0, 0 - adds r0, r6, 0 - adds r0, 0x16 - ldr r3, =gUnknown_082EE82C - lsls r1, r5, 2 - lsls r2, r4, 4 - adds r1, r2 - adds r1, r3 - ldr r1, [r1] - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08015D8C - bl _08016878 -_08015D8C: - movs r0, 0 - strh r0, [r7, 0x6] - movs r0, 0x1D - bl _08016876 - .pool -_08015D9C: - bl sub_800AC34 - movs r0, 0x24 - bl _08016876 -_08015DA6: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x44 - strh r1, [r0] - ldr r2, =gUnknown_02022C40 - ldrh r1, [r2, 0xE] - adds r3, r6, 0 - adds r3, 0x4E - strh r1, [r3] - ldrh r2, [r2, 0x10] - adds r1, r6, 0 - adds r1, 0x50 - strh r2, [r1] - bl sub_800FE50 - movs r0, 0x1D - bl _08016876 - .pool -_08015DD0: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08015DF4 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEB88 - bl StringCopy - movs r0, 0x1C - bl _08016876 - .pool -_08015DF4: - adds r0, r6, 0 - bl sub_8017FD8 - adds r0, r6, 0 - adds r0, 0x98 - ldrh r0, [r0] - cmp r0, 0x51 - bne _08015E2A - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x8 - bne _08015E24 - ldr r0, =gStringVar4 - adds r1, r6, 0 - movs r2, 0 - bl sub_8018220 - movs r0, 0x28 - bl _08016876 - .pool -_08015E24: - movs r0, 0xD - bl _08016876 -_08015E2A: - cmp r0, 0x52 - beq _08015E32 - bl _08016878 -_08015E32: - movs r5, 0 - movs r0, 0x20 - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r4, =gUnknown_02022C2C - ldrb r2, [r4] - movs r1, 0x40 - orrs r1, r2 - ldr r2, =gLinkPlayers - ldrb r2, [r2, 0x13] - bl sub_8017D9C - strb r5, [r4] - bl _08016878 - .pool -_08015E5C: - movs r0, 0x2 - ldrsh r1, [r7, r0] - lsls r1, 5 - ldr r0, [r6] - adds r0, r1 - bl sub_80179AC - adds r5, r0, 0 - movs r1, 0x2 - ldrsh r0, [r7, r1] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - ldr r2, =gUnknown_082EE24C - lsls r0, r4, 2 - lsls r1, r5, 3 - adds r0, r1 - adds r0, r2 - ldr r1, [r0] - movs r0, 0x6 - bl sub_8015664 - bl _08016878 - .pool -_08015E94: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08015EA8 - bl _08016878 -_08015EA8: - movs r4, 0 - movs r0, 0x29 - strb r0, [r6, 0x14] - bl sub_800ADF8 - adds r0, r6, 0 - adds r0, 0x98 - strh r4, [r0] - adds r0, 0x2 - strh r4, [r0] - bl _08016878 - .pool -_08015EC4: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _08015ED2 - bl _08016878 -_08015ED2: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _08015F2C - ldr r5, =gStringVar1 - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r4, =gLinkPlayers + 8 - adds r1, r4 - adds r0, r5, 0 - bl StringCopy - ldrh r0, [r4, 0x18] - adds r4, 0x1C - adds r1, r4, 0 - bl sub_800E540 - adds r5, r0, 0 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EE378 - lsls r1, r5, 2 - adds r1, r2 - ldr r1, [r1] - bl StringExpandPlaceholders - movs r0, 0x21 - bl _08016876 - .pool -_08015F2C: - movs r0, 0x7 - bl _08016876 -_08015F32: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r5, r0, 24 - cmp r5, 0 - beq _08015F5C - cmp r5, 0 - bgt _08015F54 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _08015F98 - bl _08016878 -_08015F54: - cmp r5, 0x1 - beq _08015F98 - bl _08016878 -_08015F5C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r4, =gUnknown_02022C2C - movs r0, 0x45 - strb r0, [r4] - movs r0, 0x45 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - movs r2, 0x2 - ldrsh r0, [r7, r2] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - ldrb r2, [r4] - bl sub_8012188 - ldrh r0, [r7, 0x2] - strh r0, [r6, 0x12] - movs r0, 0x14 - strb r0, [r6, 0x14] - strh r5, [r7, 0x6] - bl _08016878 - .pool -_08015F98: - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - ldr r1, =gUnknown_082EEC9C - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - bl sub_801568C - bl _08016878 - .pool -_08015FB8: - ldrh r0, [r7, 0x4] - adds r0, 0x1 - strh r0, [r7, 0x4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - bgt _08015FCA - bl _08016878 -_08015FCA: - movs r1, 0 - movs r0, 0x15 - strb r0, [r6, 0x14] - strh r1, [r7, 0x4] - bl _08016878 -_08015FD6: - bl sub_8011A74 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - beq _0801603C - cmp r4, 0x3 - ble _08015FF4 - cmp r4, 0x4 - bne _08016040 - movs r0, 0x1 - bl sub_801818C - strb r4, [r6, 0x14] - b _08016040 -_08015FF4: - cmp r4, 0x1 - blt _08016040 - movs r1, 0x2 - ldrsh r0, [r7, r1] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - bl sub_8011B90 - cmp r0, 0x1 - bne _08016028 - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_801568C - b _08016040 - .pool -_08016028: - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1E - bl sub_8015664 - b _08016040 - .pool -_0801603C: - movs r0, 0x16 - strb r0, [r6, 0x14] -_08016040: - ldrh r0, [r7, 0x6] - adds r0, 0x1 - strh r0, [r7, 0x6] - bl _08016878 -_0801604A: - bl sub_8011A80 - cmp r0, 0 - beq _08016092 - movs r2, 0x2 - ldrsh r0, [r7, r2] - ldr r1, [r6] - bl sub_8017CF8 - adds r4, r0, 0 - movs r0, 0x54 - movs r1, 0 - movs r2, 0x1 - bl sub_8011090 - bl sub_8011B90 - cmp r0, 0x1 - bne _08016084 - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_801568C - b _08016092 - .pool -_08016084: - ldr r0, =gUnknown_082EED3C - lsls r1, r4, 2 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1E - bl sub_8015664 -_08016092: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801609E - bl _08016878 -_0801609E: - movs r0, 0x10 - bl _08016876 - .pool -_080160AC: - movs r0, 0x49 - bl PlaySE - bl sub_800EF7C - movs r0, 0 - movs r1, 0xC - strb r1, [r6, 0x14] - adds r1, r6, 0 - adds r1, 0x9A - strh r0, [r1] - bl _08016878 -_080160C6: - bl sub_8011A80 - cmp r0, 0 - beq _080160DA - movs r0, 0 - bl sub_801818C - movs r0, 0x2 - bl _08016876 -_080160DA: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _080160E4 - b _08016878 -_080160E4: - ldr r0, =gBlockSendBuffer - movs r1, 0x1 - bl sub_80143E4 - ldr r0, =sub_80140E0 - movs r1, 0x5 - bl CreateTask - movs r0, 0x27 - b _08016876 - .pool -_08016104: - adds r0, r6, 0 - bl sub_801689C - ldr r0, =sub_80140E0 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _08016118 - b _08016878 -_08016118: - movs r0, 0x21 - strb r0, [r6, 0x14] - ldr r0, =gStringVar1 - ldr r4, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name - adds r1, r4, 0 - bl StringCopy - adds r0, r4, 0 - subs r0, 0x24 - ldrh r0, [r0, 0x20] - adds r1, r4, 0 - bl sub_800E540 - adds r5, r0, 0 - ldr r0, =gStringVar4 - ldr r2, =gUnknown_082EE324 - lsls r1, r5, 2 - adds r1, r2 - ldr r1, [r1] - bl StringExpandPlaceholders - b _08016878 - .pool -_08016158: - adds r0, r6, 0 - bl sub_801689C - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08016170 - b _08016878 -_08016170: - movs r0, 0x22 - b _08016876 - .pool -_08016178: - adds r0, r6, 0 - bl sub_801689C - adds r0, r6, 0 - bl sub_80168DC - cmp r0, 0 - bne _0801618A - b _08016878 -_0801618A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _08016198 - b _08016878 -_08016198: - movs r0, 0x1 - bl sub_8011DE0 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EE598 - bl StringCopy - movs r0, 0x24 - b _08016876 - .pool -_080161B8: - ldr r1, =gStringVar4 - movs r0, 0x9 - bl sub_8015664 - b _08016878 - .pool -_080161C8: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080161EE - cmp r1, 0 - bgt _080161E8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080162AE - b _08016878 -_080161E8: - cmp r1, 0x1 - beq _080162AE - b _08016878 -_080161EE: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x51 - strh r1, [r0] - ldr r1, =gUnknown_02022C2C - ldrb r1, [r1] - adds r5, r0, 0 - cmp r1, 0x45 - bne _08016220 - movs r4, 0x40 - orrs r4, r1 - movs r0, 0x1 - bl sub_801100C - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0 - bl sub_8011090 - b _0801623E - .pool -_08016220: - movs r0, 0x40 - adds r4, r1, 0 - orrs r4, r0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_801100C - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0x1 - bl sub_8011090 -_0801623E: - ldr r1, [r6, 0x8] - movs r0, 0 - strb r0, [r1, 0x1B] - strh r0, [r7, 0x6] - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x41 - bne _08016286 - bl sub_8018024 - cmp r0, 0 - bne _0801627C - movs r0, 0x52 - strh r0, [r5] - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xA - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EEC14 - bl StringCopy - b _08016878 - .pool -_0801627C: - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xD - b _08016876 -_08016286: - cmp r0, 0x48 - bne _080162A4 - adds r0, r5, 0 - bl sub_800FE50 - ldr r0, =gStringVar4 - adds r1, r6, 0 - movs r2, 0x1 - bl sub_8018220 - movs r0, 0x28 - b _08016876 - .pool -_080162A4: - adds r0, r5, 0 - bl sub_800FE50 - movs r0, 0xD - b _08016876 -_080162AE: - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0x52 - strh r1, [r0] - bl sub_800FE50 - movs r0, 0xA - strb r0, [r6, 0x14] - ldr r0, =gStringVar4 - ldr r1, =gUnknown_02022C2C - ldrb r1, [r1] - bl sub_8013078 - b _08016878 - .pool -_080162D4: - bl sub_800AC34 - movs r0, 0x24 - b _08016876 -_080162DC: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r4, [r0] - cmp r4, 0 - beq _080162E6 - b _08016878 -_080162E6: - ldr r1, =gUnknown_02022C2C - movs r0, 0x40 - strb r0, [r1] - ldr r1, =gStringVar4 - movs r0, 0x25 - bl sub_8015664 - adds r0, r6, 0 - adds r0, 0x4C - movs r1, 0 - movs r2, 0xC - bl memset - adds r0, r6, 0 - adds r0, 0x9A - strh r4, [r0] - subs r0, 0x2 - strh r4, [r0] - b _08016878 - .pool -_08016318: - movs r0, 0x2 - strb r0, [r6, 0x14] - movs r0, 0 - bl sub_801818C - b _08016878 -_08016324: - ldr r4, =gStringVar4 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - movs r1, 0x40 - orrs r1, r0 - adds r0, r4, 0 - bl sub_8017E00 - movs r0, 0xE - adds r1, r4, 0 - bl sub_8015664 - b _08016878 - .pool -_08016348: - bl sub_800ADF8 - movs r0, 0xF - b _08016876 -_08016350: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _0801635C - b _08016878 -_0801635C: - movs r0, 0x10 - b _08016876 -_08016360: - ldr r0, [r6, 0x8] - bl Free - ldr r0, [r6] - bl Free - ldr r0, [r6, 0xC] - bl Free - ldr r0, [r6, 0x4] - bl Free - adds r0, r6, 0 - adds r0, 0x20 - ldrb r0, [r0] - bl DestroyTask - adds r0, r6, 0 - adds r0, 0x21 - bl sub_8019F04 - movs r0, 0x11 - b _08016876 -_0801638E: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x12 - b _08016876 -_080163A2: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _080163AE - b _08016878 -_080163AE: - bl sub_8019E3C - adds r0, r4, 0 - bl DestroyTask - ldr r0, =gUnknown_02022C30 - ldr r0, [r0] - bl Free - bl sub_80149D8 - b _08016878 - .pool -_080163CC: - bl sub_800F7DC - ldrh r1, [r0, 0x8] - ldr r4, =0x000003ff - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - bne _080163E4 - movs r0, 0x2B - b _08016876 - .pool -_080163E4: - bl sub_800F7DC - ldrh r1, [r0, 0x8] - adds r0, r4, 0 - ands r0, r1 - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - bne _08016408 - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EF590 - bl StringCopy - b _0801643E - .pool -_08016408: - ldr r4, =gStringVar1 - bl sub_800F7DC - ldrh r0, [r0, 0x8] - lsls r0, 22 - lsrs r0, 22 - movs r1, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r4, =gStringVar2 - bl sub_800F7DC - ldrb r1, [r0, 0xB] - lsrs r1, 1 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar4 - ldr r1, =gUnknown_082EF564 - bl StringExpandPlaceholders -_0801643E: - ldr r1, =gStringVar4 - movs r0, 0x2C - bl sub_8015664 - b _08016878 - .pool -_0801645C: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF20C - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _0801646E - b _08016878 -_0801646E: - movs r0, 0x2F - b _08016876 - .pool -_08016478: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x1E - ldr r3, =gUnknown_082F025C - ldr r4, =gUnknown_082F027C - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0801649A - b _08016878 -_0801649A: - subs r0, 0x1 - cmp r5, r0 - beq _080164A4 - cmp r5, 0x3 - bne _080164B8 -_080164A4: - movs r0, 0x4 - strb r0, [r6, 0x14] - movs r0, 0x1 - bl sub_801818C - b _08016878 - .pool -_080164B8: - cmp r5, 0x1 - beq _080164C2 - cmp r5, 0x2 - beq _080164D0 - b _08016878 -_080164C2: - ldr r1, =gUnknown_082EF4C4 - movs r0, 0x35 - bl sub_8015664 - b _08016878 - .pool -_080164D0: - ldr r1, =gUnknown_082EF298 - movs r0, 0x2F - bl sub_8015664 - b _08016878 - .pool -_080164E0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x36 - b _08016876 -_080164F4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08016502 - b _08016878 -_08016502: - ldr r1, =gUnknown_02022C40 - movs r0, 0x1 - strh r0, [r1] - ldr r1, =gFieldCallback - ldr r0, =sub_80AF128 - str r0, [r1] - ldr r1, =CB2_ReturnToField - movs r0, 0x8 - bl sub_81B8904 - b _08016878 - .pool -_0801652C: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x1E - ldr r3, =gUnknown_082F0294 - ldr r4, =gUnknown_082F032C - str r4, [sp] - bl sub_8017178 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0801654E - b _08016878 -_0801654E: - subs r0, 0x1 - cmp r5, r0 - beq _08016558 - cmp r5, 0x12 - bne _08016580 -_08016558: - ldr r0, =gUnknown_02022C40 - bl sub_801807C - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_082EF4FC - bl sub_801568C - b _08016878 - .pool -_08016580: - ldr r0, =gUnknown_02022C40 - strh r5, [r0, 0x2] - movs r0, 0x37 - b _08016876 - .pool -_0801658C: - ldr r2, =gUnknown_02022C40 - ldrh r0, [r2, 0x2] - ldrh r1, [r2, 0xA] - ldrh r2, [r2, 0xC] - bl sub_8010FCC - ldr r0, =gUnknown_082EF520 - bl sub_801568C - b _08016878 - .pool -_080165A8: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080165CE - cmp r1, 0 - bgt _080165C8 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080165D2 - b _08016878 -_080165C8: - cmp r1, 0x1 - beq _080165D2 - b _08016878 -_080165CE: - movs r0, 0x38 - b _08016876 -_080165D2: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 -_080165DC: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF5B8 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _080165EE - b _08016878 -_080165EE: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl sub_8010FCC - ldr r0, =gUnknown_02022C40 - bl sub_801807C - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 - .pool -_08016610: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF1EC - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _08016622 - b _08016878 -_08016622: - movs r0, 0x2E - b _08016876 - .pool -_0801662C: - bl sub_80173B0 - movs r0, 0x30 - b _08016876 -_08016634: - adds r0, r6, 0 - adds r0, 0x16 - adds r1, r6, 0 - adds r1, 0x1D - adds r2, r6, 0 - adds r2, 0x4A - adds r3, r6, 0 - adds r3, 0x1E - ldr r4, =gUnknown_082F034C - str r4, [sp] - ldr r4, =gUnknown_082F03A4 - str r4, [sp, 0x4] - ldr r4, [r6] - str r4, [sp, 0x8] - bl sub_80172A0 - adds r5, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _08016660 - b _08016878 -_08016660: - subs r0, 0x1 - cmp r5, r0 - beq _0801666A - cmp r5, 0x8 - bne _0801667C -_0801666A: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 - .pool -_0801667C: - bl sub_80173B0 - ldr r1, [r6] - lsls r4, r5, 5 - adds r1, r4 - ldrb r0, [r1, 0x9] - lsrs r0, 2 - ldrh r1, [r1, 0x8] - lsls r1, 22 - lsrs r1, 22 - bl sub_8017D04 - cmp r0, 0x1 - beq _080166C8 - cmp r0, 0x1 - bgt _080166A2 - cmp r0, 0 - beq _080166A8 - b _08016878 -_080166A2: - cmp r0, 0x2 - beq _080166FC - b _08016878 -_080166A8: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r1, =gUnknown_082EF65C - movs r0, 0x31 - bl sub_8015664 - strh r5, [r7, 0x2] - b _08016878 - .pool -_080166C8: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r0, =gStringVar2 - ldr r1, [r6] - adds r1, r4 - ldrb r2, [r1, 0x9] - lsrs r2, 2 - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - ldr r1, =gUnknown_082EF6E4 - b _0801671E - .pool -_080166FC: - ldr r0, =gStringVar1 - ldr r1, [r6] - adds r1, r4 - bl sub_8018404 - ldr r0, =gStringVar2 - ldr r1, [r6] - adds r1, r4 - ldrb r2, [r1, 0x9] - lsrs r2, 2 - lsls r1, r2, 3 - subs r1, r2 - ldr r2, =gTypeNames - adds r1, r2 - bl StringCopy - ldr r1, =gUnknown_082EF718 -_0801671E: - movs r0, 0x2E - bl sub_8015664 - b _08016878 - .pool -_08016738: - adds r0, r6, 0 - adds r0, 0x16 - movs r1, 0 - bl sub_80170B8 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801675E - cmp r1, 0 - bgt _08016758 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08016762 - b _08016878 -_08016758: - cmp r1, 0x1 - beq _08016762 - b _08016878 -_0801675E: - movs r0, 0x32 - b _08016876 -_08016762: - movs r0, 0x1 - bl sub_801818C - movs r0, 0x4 - b _08016876 -_0801676C: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gUnknown_082EF4C4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - bne _0801677E - b _08016878 -_0801677E: - ldr r4, =gUnknown_02022C40 - movs r0, 0x2 - strh r0, [r4] - ldr r2, =gUnknown_02022C38 - movs r3, 0x2 - ldrsh r0, [r7, r3] - ldr r1, [r6] - lsls r0, 5 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - ldr r2, =gUnknown_02022C3E - ldr r1, [r6] - movs r3, 0x2 - ldrsh r0, [r7, r3] - lsls r0, 5 - adds r1, r0 - ldrb r0, [r1, 0x9] - lsrs r0, 2 - strb r0, [r2] - ldr r2, =gUnknown_02022C3C - ldr r1, [r6] - movs r3, 0x2 - ldrsh r0, [r7, r3] - lsls r0, 5 - adds r1, r0 - ldrh r0, [r1, 0x8] - lsls r0, 22 - lsrs r0, 22 - strh r0, [r2] - ldr r1, =gFieldCallback - ldr r0, =sub_80AF128 - str r0, [r1] - ldr r1, =CB2_ReturnToField - movs r0, 0x9 - bl sub_81B8904 - adds r0, r6, 0 - bl sub_80156B0 - ldrh r0, [r7, 0x2] - strb r0, [r4, 0x8] - b _08016878 - .pool -_080167F4: - ldr r1, =gUnknown_02022C2C - movs r0, 0x44 - strb r0, [r1] - movs r1, 0x2 - ldrsh r0, [r7, r1] - lsls r0, 5 - ldr r1, [r6] - adds r1, r0 - adds r0, r1, 0 - adds r0, 0x10 - movs r2, 0x44 - bl sub_8012188 - ldr r0, =gStringVar1 - movs r3, 0x2 - ldrsh r2, [r7, r3] - lsls r2, 5 - ldr r1, [r6] - adds r1, r2 - bl sub_8018404 - ldr r0, =gUnknown_082EE17C - ldr r0, [r0, 0x8] - bl sub_8017020 - movs r0, 0x19 - b _08016876 - .pool -_08016838: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - beq _08016878 - movs r0, 0x1 - bl sub_801818C - movs r1, 0 - ldrsh r0, [r7, r1] - movs r2, 0x2 - ldrsh r1, [r7, r2] - ldr r2, [r6] - bl sub_801A3D0 - movs r0, 0x4 - b _08016876 - .pool -_08016864: - adds r0, r6, 0 - adds r0, 0x16 - ldr r1, =gStringVar4 - bl PrintOnTextbox - lsls r0, 24 - cmp r0, 0 - beq _08016878 - ldrb r0, [r6, 0x15] -_08016876: - strb r0, [r6, 0x14] -_08016878: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80156E0 - - thumb_func_start var_800D_set_xB -var_800D_set_xB: @ 8016884 - push {lr} - bl InUnionRoom - cmp r0, 0x1 - bne _08016894 - ldr r1, =gSpecialVar_Result - movs r0, 0xB - strh r0, [r1] -_08016894: - pop {r0} - bx r0 - .pool - thumb_func_end var_800D_set_xB thumb_func_start sub_801689C sub_801689C: @ 801689C diff --git a/include/librfu.h b/include/librfu.h index 03c142587..dc3d336da 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -47,7 +47,7 @@ enum RFU_UNK3A, RFU_UNK3B, RFU_UNK3C, - RFU_STOP_MODE, //3D + RFU_STOP_MODE, // 3D }; struct RfuPacket8 @@ -67,7 +67,7 @@ union RfuPacket struct RfuPacket8 rfuPacket8; }; -struct __attribute__((packed)) UnkLinkRfuStruct_02022B14 +struct UnkLinkRfuStruct_02022B14Substruct { u16 unk_00_0:4; u16 unk_00_4:1; @@ -79,6 +79,11 @@ struct __attribute__((packed)) UnkLinkRfuStruct_02022B14 u16 unk_01_2:4; u16 unk_01_6:2; u8 playerTrainerId[2]; +}; + +struct UnkLinkRfuStruct_02022B14 +{ + struct UnkLinkRfuStruct_02022B14Substruct unk_00; u8 unk_04[4]; u16 species:10; u16 type:6; diff --git a/include/link_rfu.h b/include/link_rfu.h index 52006be44..c3ca75604 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -263,6 +263,6 @@ void sub_800FE50(u16 *a0); bool32 sub_800E540(u16 id, u8 *name); void sub_8011DE0(u32 arg0); u8 sub_801100C(int a0); -void sub_800FE50(u16 *a0); +void sub_800EF7C(void); #endif //GUARD_LINK_RFU_H diff --git a/src/link_rfu.c b/src/link_rfu.c index b539c31d6..29256899d 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2126,7 +2126,7 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, int r for (i = 0; i < 2; i++) { - data->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; + data->unk_00.playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; } for (i = 0; i < 4; i++) { @@ -2136,14 +2136,14 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, int r data->playerGender = gSaveBlock2Ptr->playerGender; data->unk_0a_0 = r9; data->unk_0a_7 = r2; - data->unk_00_0 = 2; - data->unk_01_2 = 3; - data->unk_00_4 = 0; - data->unk_00_5 = 0; - data->unk_00_6 = 0; - data->unk_00_7 = FlagGet(FLAG_0x87F); - data->unk_01_0 = IsNationalPokedexEnabled(); - data->unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR); + data->unk_00.unk_00_0 = 2; + data->unk_00.unk_01_2 = 3; + data->unk_00.unk_00_4 = 0; + data->unk_00.unk_00_5 = 0; + data->unk_00.unk_00_6 = 0; + data->unk_00.unk_00_7 = FlagGet(FLAG_0x87F); + data->unk_00.unk_01_0 = IsNationalPokedexEnabled(); + data->unk_00.unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR); } bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx) @@ -2155,12 +2155,12 @@ bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx) retVal = TRUE; if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04) && ((gUnknown_03007890->unk_07 >> idx) & 1)) { - memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, 0xD); memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } else { - memset(buff1, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memset(buff1, 0, 0xD); memset(buff2, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } } @@ -2169,12 +2169,12 @@ bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx) retVal = FALSE; if (sub_8010454(gUnknown_03007890->unk_14[idx].unk_04)) { - memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memcpy(buff1, &gUnknown_03007890->unk_14[idx].unk_06, 0xD); memcpy(buff2, gUnknown_03007890->unk_14[idx].unk_15, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } else { - memset(buff1, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_06)); + memset(buff1, 0, 0xD); memset(buff2, 0, sizeof(gUnknown_03007890->unk_14[idx].unk_15)); } } @@ -4512,14 +4512,14 @@ void sub_8010F84(u8 a0, u32 a1, u32 a2) void sub_8010FA0(bool32 a0, bool32 a1) { - gUnknown_02022B14.unk_00_4 = a0; - gUnknown_02022B14.unk_00_5 = a1; + gUnknown_02022B14.unk_00.unk_00_4 = a0; + gUnknown_02022B14.unk_00.unk_00_5 = a1; } void sub_8010FCC(u32 a0, u32 a1, u32 a2) { - gUnknown_02022B14.unk_09_2 = a0; - gUnknown_02022B14.unk_08_0 = a1; + gUnknown_02022B14.type = a0; + gUnknown_02022B14.species = a1; gUnknown_02022B14.unk_0b_1 = a2; } diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index 2f1c413b9..81aef45c6 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -38,9 +38,6 @@ extern void HealPlayerParty(void); struct UnkStruct_Shared { struct UnkLinkRfuStruct_02022B14 field_0; - u8 field_xD; - u8 field_E; - u8 field_xF; u8 playerName[PLAYER_NAME_LENGTH]; }; @@ -119,6 +116,14 @@ struct UnkStruct_Group u8 field_15; }; +struct UnkStruct_8019BA8 +{ + u8 field_0; + u8 field_1; + u8 field_2; + u8 field_3; +}; + struct UnkStruct_URoom { struct UnkStruct_Main0 *field_0; @@ -128,7 +133,7 @@ struct UnkStruct_URoom u16 field_10; u16 field_12; u8 state; - u8 field_15; + u8 stateAfterPrint; u8 textState; u8 field_17; u8 field_18; @@ -141,11 +146,15 @@ struct UnkStruct_URoom u8 field_1F; u8 field_20; u8 spriteIds[40]; + u8 field_49; u8 field_4A; u16 field_4C[6]; u8 field_58[0x98 - 0x58]; u16 field_98; u16 field_9A; + u16 field_9C; + u16 field_9E; + struct UnkStruct_8019BA8 field_A0[8]; }; union UnkUnion_Main @@ -176,6 +185,9 @@ extern union UnkUnion_Main gUnknown_02022C30; extern u8 gUnknown_02022C2C; extern u8 gUnknown_02022C2D; +extern u8 gUnknown_02022C3E; +extern u16 gUnknown_02022C3C; +extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; extern u8 gFieldLinkPlayerCount; extern u8 gUnknown_03005DB4; @@ -237,7 +249,7 @@ s8 sub_8018B08(u8 *textState, u8 *arg1, u8 arg2, const u8 *str); bool32 sub_8016F1C(struct UnkStruct_x20 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); void sub_8019F2C(void); -s16 sub_8019E70(u8 *arg0, s32 arg1); +void sub_8019E70(u8 *arg0, s32 arg1); bool32 sub_80180A0(u8 monId, struct TradeUnkStruct *arg1); void sub_80180E8(u8 monId, struct TradeUnkStruct *arg1); bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3); @@ -246,13 +258,13 @@ bool32 sub_8017940(void); u8 sub_8016B00(void); void sub_801A274(struct UnkStruct_URoom *arg0); void sub_801A284(struct UnkStruct_URoom *arg0); -void sub_8017FD8(struct UnkStruct_URoom *arg0); +bool32 sub_8017FD8(struct UnkStruct_URoom *arg0); void sub_801689C(struct UnkStruct_URoom *arg0); u8 sub_80181DC(struct UnkStruct_URoom *arg0); bool32 sub_80168DC(struct UnkStruct_URoom *arg0); bool32 sub_801704C(void); u32 sub_8017CF8(u32 arg1, struct UnkStruct_Main0 *arg0); -u32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 arg3); +s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender); void sub_801818C(bool32 arg0); void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2); s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate); @@ -261,12 +273,14 @@ bool32 sub_8018024(void); u32 sub_8017984(u32 arg0); void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2); void sub_8017D9C(u8 *dst, u32 arg1, u32 playerGender); -s32 sub_80179AC(struct UnkStruct_x20 *arg0); +u32 sub_80179AC(struct UnkStruct_x20 *arg0); void sub_8017E00(u8 *dst, u8 arg1); void sub_8019F04(u8 *spriteIds); void sub_8019E3C(void); void sub_80173B0(void); s32 sub_8017D04(u32 type, u32 species); +void sub_8017020(const u8 *src); +void sub_8019BA8(); // const rom data extern const u8 *const gUnknown_082EDB60[][5]; @@ -317,6 +331,8 @@ extern const u8 gUnknown_082EF564[]; extern const u8 gUnknown_082EF4C4[]; extern const u8 gUnknown_082EF298[]; extern const u8 gUnknown_082EF65C[]; +extern const u8 gUnknown_082EF6E4[]; +extern const u8 gUnknown_082EF718[]; extern const u32 gUnknown_082F00C4[]; @@ -352,8 +368,10 @@ extern const u8 *const gUnknown_082EE378[]; extern const u8 *const gUnknown_082EEC9C[]; extern const u8 *const gUnknown_082EED3C[]; extern const u8 *const gUnknown_082EE324[]; +extern const u8 *const gUnknown_082EE17C[]; + +extern const u8 *const gUnknown_082EE82C[][4]; -extern const u8 *const gUnknown_082EE82C[][2]; extern const u8 *const gUnknown_082EE24C[][2]; extern const struct UnkStruct_Shared gUnknown_082F045C[]; @@ -579,19 +597,19 @@ void sub_8012780(u8 taskId) } break; case 11: - switch (sub_80170B8(&data->textState, sub_801064C(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName))) + switch (sub_80170B8(&data->textState, sub_801064C(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName))) { case 0: sub_800E0E8(); CreateWirelessStatusIndicatorSprite(0, 0); data->field_19 = 5; - sub_8010688(5, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); + sub_8010688(5, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); data->state = 12; break; case 1: case -1: data->field_19 = 6; - sub_8010688(6, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); + sub_8010688(6, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); data->state = 12; break; case -3: @@ -600,7 +618,7 @@ void sub_8012780(u8 taskId) } break; case 12: - val = sub_8010714(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); + val = sub_8010714(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); if (val == 1) { if (data->field_19 == 5) @@ -631,7 +649,7 @@ void sub_8012780(u8 taskId) } else { - sub_8011DC0(data->field_0->arr[data->field_13].unk.playerName, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId)); + sub_8011DC0(data->field_0->arr[data->field_13].unk.playerName, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId)); data->field_0->arr[data->field_13].field_1A_0 = 0; sub_8013398(data->field_0); sub_81AE70C(data->listTaskId); @@ -1290,11 +1308,11 @@ u32 sub_8013B8C(struct UnkStruct_Group *arg0, s32 id) { struct UnkStruct_x20 *structPtr = &arg0->field_0->arr[id]; - if (gUnknown_02022C2C == 4 && structPtr->unk.field_0.unk_01_2 != 3) + if (gUnknown_02022C2C == 4 && structPtr->unk.field_0.unk_00.unk_01_2 != 3) { if (!(gSaveBlock2Ptr->specialSaveWarp & 0x80)) return 1; - else if (structPtr->unk.field_0.unk_00_7) + else if (structPtr->unk.field_0.unk_00.unk_00_7) return 0; } else @@ -1313,7 +1331,7 @@ void sub_8013BD8(struct UnkStruct_Group *data, s32 id) sub_81AE70C(data->listTaskId); sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]); sub_8011090(gUnknown_082F0530[gSpecialVar_0x8004], 0, 1); - sub_8011FC8(data->field_0->arr[data->field_F].unk.playerName, ReadAsU16(data->field_0->arr[data->field_F].unk.field_0.playerTrainerId)); + sub_8011FC8(data->field_0->arr[data->field_F].unk.playerName, ReadAsU16(data->field_0->arr[data->field_F].unk.field_0.unk_00.playerTrainerId)); } u8 sub_8013C40(void) @@ -1972,19 +1990,19 @@ void sub_8014A40(u8 taskId) data->field_0->arr[data->field_13].field_1B = 0; sub_81AE70C(data->listTaskId); data->field_19 = 5; - sub_8010688(5, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); + sub_8010688(5, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); data->state = 8; break; case 1: case -1: data->field_19 = 6; - sub_8010688(6, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); + sub_8010688(6, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); data->state = 8; break; } break; case 8: - val = sub_8010714(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); + val = sub_8010714(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName); if (val == 1) { if (data->field_19 == 5) @@ -1999,7 +2017,7 @@ void sub_8014A40(u8 taskId) } else { - sub_8011DC0(data->field_0->arr[data->field_13].unk.playerName, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.playerTrainerId)); + sub_8011DC0(data->field_0->arr[data->field_13].unk.playerName, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId)); data->field_0->arr[data->field_13].field_1A_0 = 0; sub_8013398(data->field_0); sub_81AE70C(data->listTaskId); @@ -2174,7 +2192,7 @@ void sub_8014F48(u8 taskId) CreateWirelessStatusIndicatorSprite(0, 0); sub_81AE70C(data->listTaskId); sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]); - sub_8011FC8(data->field_0->arr[data->field_F].unk.playerName, ReadAsU16(data->field_0->arr[data->field_F].unk.field_0.playerTrainerId)); + sub_8011FC8(data->field_0->arr[data->field_F].unk.playerName, ReadAsU16(data->field_0->arr[data->field_F].unk.field_0.unk_00.playerTrainerId)); PlaySE(SE_PN_ON); data->state = 4; } @@ -2335,7 +2353,7 @@ void sub_80152F4(u8 taskId) data->field_14 = 0; sub_800E0E8(); CreateWirelessStatusIndicatorSprite(0, 0); - sub_8011FC8(data->field_0->arr[0].unk.playerName, ReadAsU16(data->field_0->arr[0].unk.field_0.playerTrainerId)); + sub_8011FC8(data->field_0->arr[0].unk.playerName, ReadAsU16(data->field_0->arr[0].unk.field_0.unk_00.playerTrainerId)); PlaySE(SE_PN_ON); data->state = 4; } @@ -2466,7 +2484,7 @@ void sub_8015664(u32 arg0, const u8 *src) struct UnkStruct_URoom *data = gUnknown_02022C30.uRoom; data->state = 8; - data->field_15 = arg0; + data->stateAfterPrint = arg0; if (src != gStringVar4) StringExpandPlaceholders(gStringVar4, src); } @@ -2492,9 +2510,9 @@ void sub_80156C8(struct UnkStruct_URoom *data) void sub_80156E0(u8 taskId) { - u32 var; - s32 var5; - u8 monId = 0; + u32 id = 0; + s32 var5 = 0; + u32 playerGender = 0; struct UnkStruct_URoom *data = gUnknown_02022C30.uRoom; s16 *taskData = gTasks[taskId].data; @@ -2508,11 +2526,13 @@ void sub_80156E0(u8 taskId) sub_8017580(data->field_0, 8); gUnknown_02022C2C = 0x40; data->field_20 = sub_8016DF0(data->field_C, data->field_4, 9); + sub_8019BA8(data->field_A0); sub_8019F2C(); data->state = 1; break; case 1: - if (sub_8019E70(data->spriteIds, taskData[0]++) == 8) + sub_8019E70(data->spriteIds, taskData[0]); + if (++taskData[0] == 8) data->state = 2; break; case 2: @@ -2530,18 +2550,18 @@ void sub_80156E0(u8 taskId) case 3: if ((sub_81B1360() == 8 || sub_81B1360() == 9) && gUnknown_02022C40.field_0 != 0) { - monId = GetCursorSelectionMonId(); + id = GetCursorSelectionMonId(); switch (gUnknown_02022C40.field_0) { case 1: sub_8011090(0x54, 0, 1); - if (monId >= PARTY_SIZE) + if (id >= PARTY_SIZE) { sub_801807C(&gUnknown_02022C40); sub_8010FCC(0, 0, 0); sub_801568C(gUnknown_082EF4FC); } - else if (sub_80180A0(GetCursorSelectionMonId(), &gUnknown_02022C40)) + else if (!sub_80180A0(GetCursorSelectionMonId(), &gUnknown_02022C40)) { sub_8015664(0x34, gUnknown_082EF47C); } @@ -2553,7 +2573,7 @@ void sub_80156E0(u8 taskId) case 2: sub_80156C8(data); taskData[1] = gUnknown_02022C40.field_8; - if (monId >= PARTY_SIZE) + if (id >= PARTY_SIZE) { sub_801568C(gUnknown_082EF544); } @@ -2598,9 +2618,9 @@ void sub_80156E0(u8 taskId) gSpecialVar_Result = 0; } } - else if (ScriptContext2_IsEnabled() == TRUE) + else if (ScriptContext2_IsEnabled() != TRUE) { - if (gMain.heldKeys & A_BUTTON) + if (gMain.newKeys & A_BUTTON) { if (sub_801A2A8(data->field_0, &taskData[0], &taskData[1], data->spriteIds)) { @@ -2646,16 +2666,16 @@ void sub_80156E0(u8 taskId) break; case 24: sub_801704C(); - var = sub_8017CF8(taskData[1], data->field_0); + playerGender = sub_8017CF8(taskData[1], data->field_0); sub_8011090(0x54, 0, 1); - switch (sub_80179D4(data->field_0, taskData[0], taskData[1], var)) + switch (sub_80179D4(data->field_0, taskData[0], taskData[1], playerGender)) { case 0: data->state = 26; break; case 1: - sub_8012188(data->field_0->arr[taskData[0]].unk.playerName, &data->field_0->arr[taskData[0]].unk.field_0, gUnknown_02022C2C); - data->field_12 = 0; + sub_8012188(data->field_0->arr[taskData[1]].unk.playerName, &data->field_0->arr[taskData[1]].unk.field_0, gUnknown_02022C2C); + data->field_12 = id; data->state = 25; break; case 2: @@ -2665,8 +2685,7 @@ void sub_80156E0(u8 taskId) break; case 25: sub_801704C(); - var = sub_8011A74(); - switch (var) + switch (sub_8011A74()) { case 4: sub_801818C(TRUE); @@ -2683,7 +2702,7 @@ void sub_80156E0(u8 taskId) break; } - if (gReceivedRemoteLinkPlayers == 0) + if (gReceivedRemoteLinkPlayers != 0) { sub_80143E4(gBlockSendBuffer, TRUE); CreateTask(sub_80140E0, 5); @@ -2691,7 +2710,7 @@ void sub_80156E0(u8 taskId) } break; case 38: - if (FuncIsActiveTask(sub_80140E0)) + if (!FuncIsActiveTask(sub_80140E0)) { if (gUnknown_02022C2C == 0x44) sub_8015664(31, gUnknown_082EE004); @@ -2718,28 +2737,30 @@ void sub_80156E0(u8 taskId) else { data->field_98 = 0; - sub_8017CF8(taskData[1], data->field_0); - if (var5 == -2 || var5 == 0x40) + playerGender = sub_8017CF8(taskData[1], data->field_0); + switch (var5) { + case -2: + case 0x40: data->field_4C[0] = 0x40; sub_800FE50(data->field_4C); StringCopy(gStringVar4, gUnknown_082EEB80[gLinkPlayers[0].gender]); data->state = 32; - } - else - { + break; + default: gUnknown_02022C2C = var5; - gUnknown_02022C2D = var5 >> 8; + gUnknown_02022C2D = (u32)(var5) >> 8; if (gUnknown_02022C2C == 0x41 && !sub_8018024()) { sub_8015664(5, gUnknown_082EEBD0); } else { - gUnknown_02022C2C |= 0x40; - data->field_4C[0] = gUnknown_02022C2C; + data->field_4C[0] = gUnknown_02022C2C | 0x40; + sub_800FE50(data->field_4C); data->state = 27; } + break; } } } @@ -2750,9 +2771,9 @@ void sub_80156E0(u8 taskId) break; case 27: sub_8017FD8(data); - var = sub_8017CF8(taskData[1], data->field_0); - var5 = sub_8017984(data->field_4C[0] & 0x3F); - if (PrintOnTextbox(&data->textState, gUnknown_082EE82C[var5][var])) + playerGender = sub_8017CF8(taskData[1], data->field_0); + id = sub_8017984(data->field_4C[0] & 0x3F); + if (PrintOnTextbox(&data->textState, gUnknown_082EE82C[playerGender][id])) { taskData[3] = 0; data->state = 29; @@ -2764,7 +2785,8 @@ void sub_80156E0(u8 taskId) break; case 31: data->field_4C[0] = 0x44; - data->field_4C[1] = gUnknown_02022C40.level; + data->field_4C[1] = gUnknown_02022C40.species; + data->field_4C[2] = gUnknown_02022C40.level; sub_800FE50(data->field_4C); data->state = 29; break; @@ -2799,9 +2821,9 @@ void sub_80156E0(u8 taskId) break; case 5: case 7: - var5 = sub_80179AC(&data->field_0->arr[taskData[1]]); - var = sub_8017CF8(taskData[1], data->field_0); - sub_8015664(6, gUnknown_082EE24C[var][var5]); + id = sub_80179AC(&data->field_0->arr[taskData[1]]); + playerGender = sub_8017CF8(taskData[1], data->field_0); + sub_8015664(6, gUnknown_082EE24C[id][playerGender]); break; case 40: if (PrintOnTextbox(&data->textState, gStringVar4)) @@ -2818,8 +2840,8 @@ void sub_80156E0(u8 taskId) if (GetMultiplayerId() == 0) { StringCopy(gStringVar1, gLinkPlayers[GetMultiplayerId() ^ 1].name); - var5 = sub_800E540(gLinkPlayers[2].id, gLinkPlayers[2].name); - StringExpandPlaceholders(gStringVar4, gUnknown_082EE378[var5]); + id = sub_800E540(gLinkPlayers[1].trainerId, gLinkPlayers[1].name); + StringExpandPlaceholders(gStringVar4, gUnknown_082EE378[id]); data->state = 33; } else @@ -2829,8 +2851,7 @@ void sub_80156E0(u8 taskId) } break; case 19: - var5 = sub_80170B8(&data->textState, FALSE); - switch (var5) + switch (sub_80170B8(&data->textState, FALSE)) { case 0: CopyBgTilemapBufferToVram(0); @@ -2843,21 +2864,20 @@ void sub_80156E0(u8 taskId) break; case 1: case -1: - var = sub_8017CF8(taskData[1], data->field_0); - sub_801568C(gUnknown_082EEC9C[var]); + playerGender = sub_8017CF8(taskData[1], data->field_0); + sub_801568C(gUnknown_082EEC9C[playerGender]); break; } break; case 20: - if (++taskData[2] >= 60) + if (++taskData[2] > 60) { data->state = 21; taskData[2] = 0; } break; case 21: - var = sub_8011A74(); - switch (var) + switch (sub_8011A74()) { case 4: sub_801818C(TRUE); @@ -2865,12 +2885,12 @@ void sub_80156E0(u8 taskId) break; case 1: case 2: - var = sub_8017CF8(taskData[1], data->field_0); + playerGender = sub_8017CF8(taskData[1], data->field_0); sub_8011090(0x54, 0, 1); if (sub_8011B90() == TRUE) - sub_801568C(gUnknown_082EED3C[var]); + sub_801568C(gUnknown_082EED3C[playerGender]); else - sub_8015664(30, gUnknown_082EED3C[var]); + sub_8015664(30, gUnknown_082EED3C[playerGender]); break; case 3: data->state = 22; @@ -2881,18 +2901,19 @@ void sub_80156E0(u8 taskId) case 22: if (sub_8011A80()) { - var = sub_8017CF8(taskData[1], data->field_0); + playerGender = sub_8017CF8(taskData[1], data->field_0); sub_8011090(0x54, 0, 1); if (sub_8011B90() == TRUE) - sub_801568C(gUnknown_082EED3C[var]); + sub_801568C(gUnknown_082EED3C[playerGender]); else - sub_8015664(30, gUnknown_082EED3C[var]); + sub_8015664(30, gUnknown_082EED3C[playerGender]); } - if (gReceivedRemoteLinkPlayers == 0) + if (gReceivedRemoteLinkPlayers != 0) data->state = 16; break; case 11: PlaySE(SE_PINPON); + sub_800EF7C(); data->state = 12; data->field_9A = 0; break; @@ -2902,7 +2923,7 @@ void sub_80156E0(u8 taskId) sub_801818C(FALSE); data->state = 2; } - else if (gReceivedRemoteLinkPlayers == 0) + else if (gReceivedRemoteLinkPlayers != 0) { sub_80143E4(gBlockSendBuffer, TRUE); CreateTask(sub_80140E0, 5); @@ -2915,8 +2936,8 @@ void sub_80156E0(u8 taskId) { data->state = 33; StringCopy(gStringVar1, gLinkPlayers[1].name); - var5 = sub_800E540(gLinkPlayers[1].id, gLinkPlayers[1].name); - StringExpandPlaceholders(gStringVar4, gUnknown_082EE324[var5]); + id = sub_800E540(gLinkPlayers[1].trainerId, gLinkPlayers[1].name); + StringExpandPlaceholders(gStringVar4, gUnknown_082EE324[id]); } break; case 33: @@ -2926,7 +2947,7 @@ void sub_80156E0(u8 taskId) break; case 34: sub_801689C(data); - if (sub_80168DC(data) && gMain.heldKeys & B_BUTTON) + if (sub_80168DC(data) && gMain.newKeys & B_BUTTON) { sub_8011DE0(1); StringCopy(gStringVar4, gUnknown_082EE598); @@ -2950,7 +2971,7 @@ void sub_80156E0(u8 taskId) taskData[3] = 0; if (gUnknown_02022C2C == 0x41) { - if (sub_8018024()) + if (!sub_8018024()) { data->field_4C[0] = 0x52; sub_800FE50(data->field_4C); @@ -2965,6 +2986,7 @@ void sub_80156E0(u8 taskId) } else if (gUnknown_02022C2C == 0x48) { + sub_800FE50(data->field_4C); sub_8018220(gStringVar4, data, 1); data->state = 40; } @@ -3063,19 +3085,22 @@ void sub_80156E0(u8 taskId) var5 = sub_8017178(&data->textState, &data->field_1D, &data->field_1E, &gUnknown_082F025C, &gUnknown_082F027C); if (var5 != -1) { - switch (var5) + if (var5 == -2 || var5 == 3) { - case -2: - case 3: data->state = 4; sub_801818C(TRUE); - break; - case 1: - sub_8015664(53, gUnknown_082EF4C4); - break; - case 2: - sub_8015664(47, gUnknown_082EF298); - break; + } + else + { + switch (var5) + { + case 1: + sub_8015664(53, gUnknown_082EF4C4); + break; + case 2: + sub_8015664(47, gUnknown_082EF298); + break; + } } } break; @@ -3145,7 +3170,7 @@ void sub_80156E0(u8 taskId) data->state = 48; break; case 48: - var5 = sub_80172A0(&data->textState, &data->field_1D, &data->field_4A, &data->field_1E, &gUnknown_082F0294, &gUnknown_082F032C, data->field_0); + var5 = sub_80172A0(&data->textState, &data->field_1D, &data->field_4A, &data->field_1E, &gUnknown_082F034C, &gUnknown_082F03A4, data->field_0); if (var5 != -1) { switch (var5) @@ -3165,11 +3190,70 @@ void sub_80156E0(u8 taskId) taskData[1] = var5; break; case 1: + sub_8018404(gStringVar1, &data->field_0->arr[var5]); + StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].unk.field_0.type]); + sub_8015664(46, gUnknown_082EF6E4); + break; + case 2: + sub_8018404(gStringVar1, &data->field_0->arr[var5]); + StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].unk.field_0.type]); + sub_8015664(46, gUnknown_082EF718); break; } break; } } break; + case 49: + switch (sub_80170B8(&data->textState, FALSE)) + { + case 0: + data->state = 50; + break; + case -1: + case 1: + sub_801818C(TRUE); + data->state = 4; + break; + } + break; + case 50: + if (PrintOnTextbox(&data->textState, gUnknown_082EF4C4)) + { + gUnknown_02022C40.field_0 = 2; + memcpy(&gUnknown_02022C38, &data->field_0->arr[taskData[1]].unk.field_0.unk_00, sizeof(gUnknown_02022C38)); + gUnknown_02022C3E = data->field_0->arr[taskData[1]].unk.field_0.type; + gUnknown_02022C3C = data->field_0->arr[taskData[1]].unk.field_0.species; + gFieldCallback = sub_80AF128; + sub_81B8904(9, CB2_ReturnToField); + sub_80156B0(data); + gUnknown_02022C40.field_8 = taskData[1]; + } + break; + case 51: + gUnknown_02022C2C = 0x44; + sub_8012188(data->field_0->arr[taskData[1]].unk.playerName, &data->field_0->arr[taskData[1]].unk.field_0, 0x44); + sub_8018404(gStringVar1, &data->field_0->arr[taskData[1]]); + sub_8017020(gUnknown_082EE17C[2]); + data->state = 25; + break; + case 26: + if (PrintOnTextbox(&data->textState, gStringVar4)) + { + sub_801818C(TRUE); + sub_801A3D0(taskData[0], taskData[1], data->field_0); + data->state = 4; + } + break; + case 8: + if (PrintOnTextbox(&data->textState, gStringVar4)) + data->state = data->stateAfterPrint; + break; } } + +void var_800D_set_xB(void) +{ + if (InUnionRoom() == TRUE) + gSpecialVar_Result = 11; +}