diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index ec962c71d..edaafc838 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -606,7 +606,7 @@ _080F5DE0: movs r0, 0x64 b _080F5E2C _080F5DF4: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080F5EBA @@ -616,7 +616,7 @@ _080F5DF4: strh r0, [r4, 0x8] b _080F5EBA _080F5E0A: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -741,7 +741,7 @@ sub_80F5F30: @ 80F5F30 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080F5F60 @@ -5564,7 +5564,7 @@ sub_80F8714: @ 80F8714 ldrh r0, [r0] cmp r0, 0x1 bne _080F8748 - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080F877E diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index 5934c3623..33207e246 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -213,7 +213,7 @@ sub_80FC670: @ 80FC670 beq _080FC6A0 cmp r0, 0x1 beq _080FC6AE - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -223,7 +223,7 @@ _080FC698: b _080FC6B6 .pool _080FC6A0: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FC6B4 @@ -280,7 +280,7 @@ _080FC6FE: lsls r0, 24 cmp r0, 0 bne _080FC738 - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FC7F4 @@ -412,7 +412,7 @@ _080FC830: lsls r0, 24 cmp r0, 0 bne _080FC87A - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FC880 @@ -494,7 +494,7 @@ _080FC8DE: lsls r0, 24 cmp r0, 0 bne _080FC904 - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FC986 @@ -599,7 +599,7 @@ sub_80FC998: @ 80FC998 b _080FC9F0 .pool _080FC9C4: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FC9F0 @@ -653,7 +653,7 @@ sub_80FC9F8: @ 80FC9F8 b _080FCAB2 .pool _080FCA30: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCAB2 @@ -763,7 +763,7 @@ _080FCAFC: .4byte _080FCC38 .4byte _080FCB6C _080FCB2C: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 bne _080FCB38 @@ -810,7 +810,7 @@ _080FCB84: strh r0, [r2, 0x8] b _080FCC82 _080FCB90: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCC82 @@ -833,7 +833,7 @@ _080FCBA4: b _080FCC50 .pool _080FCBCC: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCC82 @@ -856,7 +856,7 @@ _080FCBE0: b _080FCC50 .pool _080FCC08: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCC82 @@ -949,7 +949,7 @@ _080FCCB8: .4byte _080FCDF8 .4byte _080FCD30 _080FCCE8: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 bne _080FCCF4 @@ -1000,7 +1000,7 @@ _080FCD48: strh r0, [r2, 0x8] b _080FCE42 _080FCD54: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCE42 @@ -1027,7 +1027,7 @@ _080FCD6C: b _080FCE10 .pool _080FCD98: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCE42 @@ -1047,7 +1047,7 @@ _080FCDB0: b _080FCE04 .pool _080FCDC8: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCE42 @@ -1149,7 +1149,7 @@ _080FCE92: lsls r0, 24 cmp r0, 0 bne _080FCEB8 - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCF2E @@ -1258,7 +1258,7 @@ sub_80FCF40: @ 80FCF40 b _080FCFBE .pool _080FCF80: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FCFBE @@ -1324,7 +1324,7 @@ sub_80FCFD0: @ 80FCFD0 b _080FD04E .pool _080FD010: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080FD04E diff --git a/asm/contest_link_81D9DE4.s b/asm/contest_link_81D9DE4.s index 3969be9a2..5a3393374 100644 --- a/asm/contest_link_81D9DE4.s +++ b/asm/contest_link_81D9DE4.s @@ -434,7 +434,7 @@ sub_81DA160: @ 81DA160 b _081DA224 .pool _081DA1A4: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _081DA224 @@ -536,7 +536,7 @@ _081DA284: lsls r0, 24 cmp r0, 0 bne _081DA2CE - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _081DA2D4 @@ -613,7 +613,7 @@ sub_81DA2E8: @ 81DA2E8 b _081DA39E .pool _081DA338: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _081DA39E @@ -716,7 +716,7 @@ sub_81DA3B8: @ 81DA3B8 b _081DA46E .pool _081DA408: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _081DA46E @@ -816,7 +816,7 @@ _081DA4CC: lsls r0, 24 cmp r0, 0 bne _081DA4FA - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _081DA55C diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index e6751247b..64c021001 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -8257,7 +8257,7 @@ _0801AF24: b _0801AF8A .pool _0801AF40: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801AFAE @@ -13680,7 +13680,7 @@ _0801DA72: beq _0801DB46 b _0801DB5E _0801DA7C: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801DB5E @@ -13713,7 +13713,7 @@ _0801DA7C: b _0801DB3E .pool _0801DAC8: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801DB5E @@ -13752,7 +13752,7 @@ _0801DB08: strh r0, [r4, 0x10] b _0801DB5E _0801DB1C: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801DB5E @@ -14364,7 +14364,7 @@ _0801DFCE: adds r0, 0x1 strh r0, [r1, 0x6] _0801DFE0: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E028 @@ -14389,7 +14389,7 @@ _0801DFE0: b _0801E028 .pool _0801E018: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E028 @@ -14838,7 +14838,7 @@ _0801E3AC: b _0801E458 .pool _0801E3D4: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E414 @@ -14978,7 +14978,7 @@ _0801E4E8: b _0801E59A .pool _0801E50C: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E5BC @@ -15013,7 +15013,7 @@ _0801E540: b _0801E59A .pool _0801E560: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E5BC @@ -15100,7 +15100,7 @@ _0801E604: lsls r0, 24 cmp r0, 0 bne _0801E662 - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E662 @@ -15212,7 +15212,7 @@ _0801E6F0: lsrs r0, 24 cmp r0, 0x1 beq _0801E75C - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E75C @@ -15304,7 +15304,7 @@ _0801E7AC: adds r0, 0x1 strh r0, [r1, 0x6] _0801E7C0: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -15348,7 +15348,7 @@ _0801E812: b _0801E830 .pool _0801E820: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0801E830 @@ -20715,7 +20715,7 @@ _08021358: bl sub_8010434 b _0802143E _0802135E: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08021444 @@ -23804,7 +23804,7 @@ _08022CE4: bl sub_8010434 b _08022D06 _08022CEA: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 bne _08022D06 @@ -24016,7 +24016,7 @@ _08022E6C: bl sub_8010434 b _08022E9C _08022E72: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08022EA2 @@ -24148,7 +24148,7 @@ _08022F74: bl sub_8010434 b _08023060 _08022F7A: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08023066 @@ -24170,7 +24170,7 @@ _08022F7A: bl SendBlock b _08023060 _08022FAA: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08023066 @@ -24300,7 +24300,7 @@ _080230A8: bl sub_8010434 b _080231A8 _080230BA: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080231AE @@ -24369,7 +24369,7 @@ _08023120: b _080231A8 .pool _08023150: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080231AE @@ -24395,7 +24395,7 @@ _08023172: bl sub_8010434 b _080231A8 _08023184: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080231AE @@ -24547,7 +24547,7 @@ _0802329C: bl sub_8010434 b _080232DC _080232BE: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080232E2 @@ -24591,7 +24591,7 @@ _08023302: beq _08023338 b _0802338C _0802330C: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08023392 @@ -24612,7 +24612,7 @@ _08023332: bl sub_8010434 b _0802338C _08023338: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08023392 @@ -25683,7 +25683,7 @@ _08023B7A: strh r0, [r4, 0x10] b _08023BB2 _08023B94: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08023BB8 @@ -25785,7 +25785,7 @@ _08023C2A: bl SetGpuReg b _08023C9C _08023C5C: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08023CA2 @@ -25884,7 +25884,7 @@ _08023D12: bl SendBlock b _0802402E _08023D2A: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 bne _08023D36 @@ -26227,7 +26227,7 @@ _08023FC4: bl SendBlock b _0802402E _08023FD0: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08024034 @@ -26451,7 +26451,7 @@ _080241A0: bl sub_8010434 b _08024218 _080241A6: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0802421E @@ -26630,7 +26630,7 @@ _08024300: bl sub_8010434 b _080243AC _08024306: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080243B2 @@ -26646,7 +26646,7 @@ _08024306: bl SendBlock b _080243AC _08024328: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080243B2 @@ -26914,7 +26914,7 @@ _08024522: bl sub_8010434 b _08024558 _08024528: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0802455E @@ -27814,7 +27814,7 @@ _08024C4C: bl sub_8010434 b _08024D20 _08024C5A: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08024D40 @@ -28075,7 +28075,7 @@ _08024E90: b _08024EF0 .pool _08024EA0: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08024F08 @@ -28116,7 +28116,7 @@ _08024EF0: strb r0, [r1, 0x10] b _08024F08 _08024EF8: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08024F08 @@ -28475,7 +28475,7 @@ _080251BA: strb r4, [r0, 0x8] b _08025202 _080251D0: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08025226 @@ -28560,7 +28560,7 @@ _08025252: ldr r1, [r5] b _080252CC _08025274: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08025316 @@ -28710,7 +28710,7 @@ _0802539C: b _08025448 .pool _080253BC: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _08025466 @@ -28900,7 +28900,7 @@ _0802553C: b _080255E8 .pool _08025564: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0802563C @@ -29391,7 +29391,7 @@ _0802593E: b _08025976 .pool _0802596C: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _080259E8 @@ -39683,7 +39683,7 @@ _0802AD3C: b _0802ADC0 .pool _0802AD68: - bl sub_800A520 + bl IsLinkTaskFinished lsls r0, 24 cmp r0, 0 beq _0802AE08 diff --git a/asm/trade.s b/asm/trade.s deleted file mode 100644 index b833240dd..000000000 --- a/asm/trade.s +++ /dev/null @@ -1,14903 +0,0 @@ - .include "asm/macros.inc" - .include "constants/gba_constants.inc" - .include "constants/global.inc" - - .syntax unified - - .text - - thumb_func_start sub_8077170 -sub_8077170: @ 8077170 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x1D - beq _08077194 - lsls r2, r3, 16 - lsrs r2, 16 - movs r0, 0 - adds r1, r4, 0 - bl SendBlock - lsls r0, 24 - lsrs r0, 24 - b _080771A2 - .pool -_08077194: - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - movs r1, 0x54 - adds r2, r4, 0 - bl rfu_NI_setSendData - movs r0, 0x1 -_080771A2: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8077170 - - thumb_func_start sub_80771AC -sub_80771AC: @ 80771AC - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_800A4D8 - pop {r0} - bx r0 - thumb_func_end sub_80771AC - - thumb_func_start sub_80771BC -sub_80771BC: @ 80771BC - push {r4,lr} - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x1D - bne _080771F0 - ldr r4, =gUnknown_03007880 - ldr r0, =gUnknown_03004140 - ldrb r0, [r0] - bl sub_800E87C - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - ldrh r0, [r0] - cmp r0, 0 - bne _080771EC - movs r0, 0x1 - b _080771F8 - .pool -_080771EC: - movs r0, 0 - b _080771F8 -_080771F0: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 -_080771F8: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80771BC - - thumb_func_start sub_8077200 -sub_8077200: @ 8077200 - push {lr} - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_8077200 - - thumb_func_start sub_8077210 -sub_8077210: @ 8077210 - push {lr} - bl sub_8077260 - cmp r0, 0 - beq _0807722C - ldr r0, =gUnknown_03004140 - ldrb r1, [r0] - movs r0, 0xC - bl rfu_clearSlot - b _08077230 - .pool -_0807722C: - bl ResetBlockReceivedFlags -_08077230: - pop {r0} - bx r0 - thumb_func_end sub_8077210 - - thumb_func_start sub_8077234 -sub_8077234: @ 8077234 - push {r4,lr} - adds r4, r0, 0 - bl sub_8077260 - cmp r0, 0 - beq _08077250 - ldr r0, =gUnknown_03004140 - ldrb r1, [r0] - movs r0, 0xC - bl rfu_clearSlot - b _08077258 - .pool -_08077250: - lsls r0, r4, 24 - lsrs r0, 24 - bl ResetBlockReceivedFlag -_08077258: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8077234 - - thumb_func_start sub_8077260 -sub_8077260: @ 8077260 - push {lr} - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _08077280 - ldr r0, =gUnknown_02022C2C - ldrb r0, [r0] - cmp r0, 0x1D - bne _08077280 - movs r0, 0x1 - b _08077282 - .pool -_08077280: - movs r0, 0 -_08077282: - pop {r1} - bx r1 - thumb_func_end sub_8077260 - - thumb_func_start sub_8077288 -sub_8077288: @ 8077288 - push {lr} - bl sub_800ADF8 - pop {r0} - bx r0 - thumb_func_end sub_8077288 - - thumb_func_start sub_8077294 -sub_8077294: @ 8077294 - push {lr} - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_8077294 - - thumb_func_start sub_80772A4 -sub_80772A4: @ 80772A4 - push {r4,r5,lr} - sub sp, 0xC - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r0, =sub_807811C - bl SetVBlankCallback - ldr r4, =gUnknown_0860F074 - adds r0, r4, 0 - movs r1, 0xF0 - movs r2, 0x14 - bl LoadPalette - adds r0, r4, 0 - movs r1, 0xD0 - movs r2, 0x14 - bl LoadPalette - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0832DEE4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - movs r0, 0x8F - lsls r0, 4 - adds r1, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r0, =gUnknown_0832DEF4 - bl InitWindows - lsls r0, 16 - cmp r0, 0 - beq _0807738C - bl DeactivateAllTextPrinters - movs r5, 0 -_08077310: - lsls r4, r5, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl ClearWindowTilemap - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r5, 0x1 - cmp r5, 0x11 - bls _08077310 - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - movs r1, 0x14 - movs r2, 0xC0 - bl LoadUserWindowBorderGfx_ - movs r0, 0x2 - movs r1, 0x1 - movs r2, 0xE0 - bl LoadUserWindowBorderGfx - bl LoadMonIconPalettes - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - adds r0, 0x69 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x6F - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x70 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x74 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x75 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x7A - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x7B - strb r1, [r0] - ldr r0, [r2] - adds r0, 0xA8 - strb r1, [r0] -_0807738C: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80772A4 - - thumb_func_start sub_80773AC -sub_80773AC: @ 80773AC - push {lr} - ldr r0, =sub_80773D0 - bl SetMainCallback2 - ldr r0, =gMain - movs r1, 0 - str r1, [r0] - ldr r0, =gEnemyPartyCount - strb r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80773AC - - thumb_func_start sub_80773D0 -sub_80773D0: @ 80773D0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x28 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r3, r1, 0 - cmp r0, 0x16 - bls _080773EA - b _08077B46 -_080773EA: - lsls r0, 2 - ldr r1, =_080773FC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080773FC: - .4byte _08077458 - .4byte _080774A4 - .4byte _08077560 - .4byte _0807758C - .4byte _080775E8 - .4byte _08077648 - .4byte _08077688 - .4byte _080776A8 - .4byte _080777E8 - .4byte _08077810 - .4byte _08077834 - .4byte _080778BC - .4byte _080778CA - .4byte _08077970 - .4byte _08077A40 - .4byte _08077A80 - .4byte _08077A9A - .4byte _08077AA8 - .4byte _08077ABC - .4byte _08077ADC - .4byte _08077AFC - .4byte _08077B10 - .4byte _08077B30 -_08077458: - ldr r4, =gUnknown_0203229C - ldr r0, =0x000010f0 - bl AllocZeroed - str r0, [r4] - bl sub_80772A4 - ldr r4, =gUnknown_02032184 - movs r0, 0xE0 - lsls r0, 4 - bl AllocZeroed - str r0, [r4] - movs r6, 0 - ldr r2, =gUnknown_02032188 -_08077476: - lsls r1, r6, 8 - ldr r0, [r4] - adds r0, r1 - stm r2!, {r0} - adds r6, 0x1 - cmp r6, 0xD - ble _08077476 - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _08077B22 - .pool -_080774A4: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - movs r6, 0 - movs r4, 0 -_080774B2: - movs r0, 0x64 - muls r0, r6 - ldr r1, =gEnemyParty - adds r0, r1 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] - movs r1, 0 - movs r2, 0 - movs r3, 0x20 - bl CreateMon - adds r6, 0x1 - cmp r6, 0x5 - ble _080774B2 - movs r0, 0 - bl sub_807A19C - movs r0, 0 - bl ShowBg - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r2, [r0] - cmp r2, 0 - bne _0807754C - ldr r1, =gLinkType - ldr r5, =0x00001122 - adds r0, r5, 0 - strh r0, [r1] - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0xA8 - strb r2, [r0] - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _08077528 - bl sub_800B488 - bl OpenLink - bl sub_8011BA4 - b _08077B46 - .pool -_08077528: - bl OpenLink - ldr r0, =gMain - movs r7, 0x87 - lsls r7, 3 - adds r0, r7 - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - ldr r0, =task00_08081A90 - movs r1, 0x1 - bl CreateTask - b _08077B46 - .pool -_0807754C: - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x4 - strb r1, [r0] - b _08077B46 - .pool -_08077560: - ldr r2, =gUnknown_0203229C - ldr r1, [r2] - adds r1, 0xA8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r2] - adds r1, r0, 0 - adds r1, 0xA8 - ldrb r0, [r1] - cmp r0, 0xB - bhi _0807757A - b _08077B46 -_0807757A: - movs r0, 0 - strb r0, [r1] - movs r2, 0x87 - lsls r2, 3 - adds r1, r3, r2 - b _08077B22 - .pool -_0807758C: - bl GetLinkPlayerCount_2 - adds r4, r0, 0 - bl sub_800AA48 - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bcs _080775A0 - b _08077B46 -_080775A0: - bl IsLinkMaster - lsls r0, 24 - cmp r0, 0 - beq _080775D8 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r1, 0xA8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1E - bhi _080775C0 - b _08077B46 -_080775C0: - bl sub_800A620 - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _08077B22 - .pool -_080775D8: - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - b _08077B22 - .pool -_080775E8: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - beq _080775F2 - b _08077B46 -_080775F2: - bl IsLinkPlayerDataExchangeComplete - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08077600 - b _08077B46 -_08077600: - bl sub_8011BD0 - bl CalculatePlayerPartyCount - ldr r1, =gMain - movs r7, 0x87 - lsls r7, 3 - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0xA8 - strb r2, [r0] - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - bne _0807762A - b _08077B46 -_0807762A: - movs r0, 0x1 - bl sub_801048C - bl sub_800ADF8 - b _08077B46 - .pool -_08077648: - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _08077680 - bl sub_8010500 - lsls r0, 24 - cmp r0, 0 - bne _0807765C - b _08077B46 -_0807765C: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl CreateWirelessStatusIndicatorSprite - b _08077B46 - .pool -_08077680: - movs r2, 0x87 - lsls r2, 3 - adds r1, r3, r2 - b _08077B22 -_08077688: - bl shedinja_maker_maybe - lsls r0, 24 - cmp r0, 0 - bne _08077694 - b _08077B46 -_08077694: - bl sub_807A5B0 - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _08077B22 - .pool -_080776A8: - bl CalculateEnemyPartyCount - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - ldr r1, =gPlayerPartyCount - ldrb r1, [r1] - adds r0, 0x36 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =gEnemyPartyCount - ldrb r1, [r1] - adds r0, 0x37 - strb r1, [r0] - movs r6, 0 - ldr r0, [r2] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - bge _08077740 - mov r8, r2 - ldr r7, =gUnknown_0832DE24 -_080776E2: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - ldrb r2, [r7] - lsls r2, 19 - movs r1, 0xE0 - lsls r1, 12 - adds r2, r1 - asrs r2, 16 - ldrb r3, [r7, 0x1] - lsls r3, 19 - ldr r1, =0xfff40000 - adds r3, r1 - asrs r3, 16 - movs r1, 0x1 - str r1, [sp] - str r0, [sp, 0x4] - str r1, [sp, 0x8] - adds r0, r5, 0 - ldr r1, =sub_80D3014 - bl CreateMonIcon - mov r2, r8 - ldr r1, [r2] - adds r1, 0x28 - adds r1, r6 - strb r0, [r1] - adds r7, 0x2 - adds r6, 0x1 - ldr r0, [r2] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - blt _080776E2 -_08077740: - movs r6, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - bge _080777B8 - ldr r0, =gUnknown_0832DE24 - mov r8, r1 - adds r7, r0, 0 - adds r7, 0xC -_08077756: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - ldrb r2, [r7] - lsls r2, 19 - movs r3, 0xE0 - lsls r3, 12 - adds r2, r3 - asrs r2, 16 - ldrb r3, [r7, 0x1] - lsls r3, 19 - ldr r1, =0xfff40000 - adds r3, r1 - asrs r3, 16 - movs r1, 0x1 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r5, 0 - ldr r1, =sub_80D3014 - bl CreateMonIcon - mov r2, r8 - ldr r1, [r2] - adds r1, 0x2E - adds r1, r6 - strb r0, [r1] - adds r7, 0x2 - adds r6, 0x1 - ldr r0, [r2] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - blt _08077756 -_080777B8: - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _08077B22 - .pool -_080777E8: - bl LoadHeldItemIcons - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x36 - adds r1, 0x28 - movs r2, 0 - bl sub_81B5D4C - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - b _08077B22 - .pool -_08077810: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x36 - adds r1, 0x28 - movs r2, 0x1 - bl sub_81B5D4C - ldr r1, =gMain - movs r7, 0x87 - lsls r7, 3 - adds r1, r7 - b _08077B22 - .pool -_08077834: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r5, =gUnknown_02032188 - ldr r1, [r5] - movs r4, 0x3 - str r4, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - bl GetMultiplayerId - lsls r0, 24 - movs r1, 0x80 - lsls r1, 17 - eors r1, r0 - lsrs r1, 24 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - ldr r1, =gLinkPlayers + 8 - adds r0, r1 - ldr r1, [r5, 0xC] - str r4, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - ldr r4, =gUnknown_0832DE94 - ldr r0, [r4] - ldr r1, [r5, 0x18] - movs r2, 0x2 - str r2, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - ldr r0, [r4, 0x4] - ldr r1, [r5, 0x20] - movs r2, 0x18 - bl sub_807A308 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0xA8 - strb r2, [r0] - b _08077B46 - .pool -_080778BC: - bl sub_807A1F0 - lsls r0, 24 - cmp r0, 0 - bne _080778C8 - b _08077B46 -_080778C8: - b _08077B1A -_080778CA: - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - movs r0, 0x1 - movs r2, 0x78 - bl GetStringCenterAlignXOffset - movs r6, 0 - add r5, sp, 0x10 - adds r4, r0, 0 - adds r4, 0x10 -_080778DE: - add r1, sp, 0x10 - ldr r0, =gSpriteTemplate_832DCAC - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldrh r0, [r5] - adds r0, r6 - strh r0, [r5] - lsls r1, r4, 16 - asrs r1, 16 - add r0, sp, 0x10 - movs r2, 0xA - movs r3, 0x1 - bl CreateSprite - adds r4, 0x20 - adds r6, 0x1 - cmp r6, 0x2 - ble _080778DE - 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 r0, =gLinkPlayers + 8 - adds r1, r0 - movs r0, 0x1 - movs r2, 0x78 - bl GetStringCenterAlignXOffset - movs r6, 0 - add r5, sp, 0x10 - adds r4, r0, 0 - adds r4, 0x88 -_0807792C: - add r1, sp, 0x10 - ldr r0, =gSpriteTemplate_832DCAC - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - adds r0, r6, 0x3 - ldrh r3, [r5] - adds r0, r3 - strh r0, [r5] - lsls r1, r4, 16 - asrs r1, 16 - add r0, sp, 0x10 - movs r2, 0xA - movs r3, 0x1 - bl CreateSprite - adds r4, 0x20 - adds r6, 0x1 - cmp r6, 0x2 - ble _0807792C - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - b _08077B22 - .pool -_08077970: - ldr r4, =gSpriteTemplate_832DCAC - add r1, sp, 0x10 - adds r0, r4, 0 - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} - add r1, sp, 0x10 - adds r0, r1, 0 - ldrh r0, [r0] - adds r0, 0x6 - strh r0, [r1] - adds r0, r1, 0 - movs r1, 0xD7 - movs r2, 0x98 - movs r3, 0x1 - bl CreateSprite - add r0, sp, 0x10 - ldm r4!, {r3,r5,r7} - stm r0!, {r3,r5,r7} - ldm r4!, {r1-r3} - stm r0!, {r1-r3} - add r1, sp, 0x10 - adds r0, r1, 0 - ldrh r0, [r0] - adds r0, 0x7 - strh r0, [r1] - adds r0, r1, 0 - movs r1, 0xF7 - movs r2, 0x98 - movs r3, 0x1 - bl CreateSprite - movs r6, 0 - add r4, sp, 0x10 - movs r5, 0xC0 - lsls r5, 13 -_080779BC: - add r1, sp, 0x10 - ldr r0, =gSpriteTemplate_832DCAC - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - adds r0, r6, 0 - adds r0, 0x8 - ldrh r7, [r4] - adds r0, r7 - strh r0, [r4] - asrs r1, r5, 16 - add r0, sp, 0x10 - movs r2, 0x96 - movs r3, 0x1 - bl CreateSprite - movs r0, 0x80 - lsls r0, 14 - adds r5, r0 - adds r6, 0x1 - cmp r6, 0x5 - ble _080779BC - ldr r0, =gSpriteTemplate_832DC94 - ldr r2, =gUnknown_0832DE24 - ldrb r1, [r2] - lsls r1, 19 - movs r3, 0x80 - lsls r3, 14 - adds r1, r3 - asrs r1, 16 - ldrb r2, [r2, 0x1] - lsls r2, 3 - movs r3, 0x2 - bl CreateSprite - ldr r2, =gUnknown_0203229C - ldr r1, [r2] - adds r1, 0x34 - movs r3, 0 - strb r0, [r1] - ldr r0, [r2] - adds r0, 0x35 - strb r3, [r0] - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 - bl rbox_fill_rectangle - b _08077B46 - .pool -_08077A40: - movs r0, 0 - bl sub_807A320 - movs r0, 0 - bl sub_8079BE0 - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - strb r1, [r0, 0x1] - bl sub_8078388 - ldr r1, =gMain - movs r7, 0x87 - lsls r7, 3 - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, =0x000001b3 - bl PlayBGM - b _08077B46 - .pool -_08077A80: - movs r0, 0x1 - bl sub_807A320 - movs r0, 0x1 - bl sub_8079BE0 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08077A9A: - movs r0, 0 - bl sub_80782B8 - b _08077B1A - .pool -_08077AA8: - movs r0, 0x1 - bl sub_80782B8 - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _08077B22 - .pool -_08077ABC: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - b _08077B22 - .pool -_08077ADC: - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0x2 - bl sub_80782B8 - ldr r1, =gMain - movs r7, 0x87 - lsls r7, 3 - adds r1, r7 - b _08077B22 - .pool -_08077AFC: - movs r0, 0 - bl sub_807A468 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08077B22 - .pool -_08077B10: - movs r0, 0x1 - bl sub_807A468 - bl sub_807A53C -_08077B1A: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_08077B22: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08077B46 - .pool -_08077B30: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08077B46 - ldr r0, =sub_8078C34 - str r0, [r3] - ldr r0, =sub_807825C - bl SetMainCallback2 -_08077B46: - bl RunTextPrinters - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0x28 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80773D0 - - thumb_func_start sub_8077B74 -sub_8077B74: @ 8077B74 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x24 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x16 - bls _08077B8E - b _080780F6 -_08077B8E: - lsls r0, 2 - ldr r1, =_08077BA0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08077BA0: - .4byte _08077BFC - .4byte _08077C10 - .4byte _08077C18 - .4byte _08077C20 - .4byte _08077C28 - .4byte _08077C3C - .4byte _08077C64 - .4byte _08077C6C - .4byte _08077DB0 - .4byte _08077DD8 - .4byte _08077DFC - .4byte _08077E84 - .4byte _08077EA0 - .4byte _08077F48 - .4byte _080780F6 - .4byte _080780F6 - .4byte _08078038 - .4byte _08078040 - .4byte _08078068 - .4byte _080780A4 - .4byte _080780C4 - .4byte _080780CC - .4byte _080780E4 -_08077BFC: - bl sub_80772A4 - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _080780D8 - .pool -_08077C10: - movs r5, 0x87 - lsls r5, 3 - adds r1, r2, r5 - b _08077E58 -_08077C18: - movs r7, 0x87 - lsls r7, 3 - adds r1, r2, r7 - b _080780D8 -_08077C20: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - b _080780D8 -_08077C28: - bl CalculatePlayerPartyCount - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _080780D8 - .pool -_08077C3C: - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _08077C50 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl CreateWirelessStatusIndicatorSprite -_08077C50: - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _080780D8 - .pool -_08077C64: - movs r5, 0x87 - lsls r5, 3 - adds r1, r2, r5 - b _080780D8 -_08077C6C: - bl CalculateEnemyPartyCount - ldr r4, =gUnknown_0203229C - ldr r0, [r4] - ldr r1, =gPlayerPartyCount - ldrb r1, [r1] - adds r0, 0x36 - strb r1, [r0] - ldr r0, [r4] - ldr r1, =gEnemyPartyCount - ldrb r1, [r1] - adds r0, 0x37 - strb r1, [r0] - movs r0, 0 - bl ClearWindowTilemap - movs r0, 0 - bl sub_8079BE0 - movs r0, 0x1 - bl sub_8079BE0 - movs r6, 0 - ldr r0, [r4] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - bge _08077D08 - mov r8, r4 - ldr r7, =gUnknown_0832DE24 -_08077CA8: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - ldrb r2, [r7] - lsls r2, 19 - movs r1, 0xE0 - lsls r1, 12 - adds r2, r1 - asrs r2, 16 - ldrb r3, [r7, 0x1] - lsls r3, 19 - ldr r1, =0xfff40000 - adds r3, r1 - asrs r3, 16 - movs r1, 0x1 - str r1, [sp] - str r0, [sp, 0x4] - str r1, [sp, 0x8] - adds r0, r5, 0 - ldr r1, =sub_80D3014 - bl CreateMonIcon - mov r2, r8 - ldr r1, [r2] - adds r1, 0x28 - adds r1, r6 - strb r0, [r1] - adds r7, 0x2 - adds r6, 0x1 - ldr r0, [r2] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - blt _08077CA8 -_08077D08: - movs r6, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - bge _08077D80 - ldr r0, =gUnknown_0832DE24 - mov r8, r1 - adds r7, r0, 0 - adds r7, 0xC -_08077D1E: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - ldrb r2, [r7] - lsls r2, 19 - movs r3, 0xE0 - lsls r3, 12 - adds r2, r3 - asrs r2, 16 - ldrb r3, [r7, 0x1] - lsls r3, 19 - ldr r1, =0xfff40000 - adds r3, r1 - asrs r3, 16 - movs r1, 0x1 - str r1, [sp] - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r5, 0 - ldr r1, =sub_80D3014 - bl CreateMonIcon - mov r2, r8 - ldr r1, [r2] - adds r1, 0x2E - adds r1, r6 - strb r0, [r1] - adds r7, 0x2 - adds r6, 0x1 - ldr r0, [r2] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - blt _08077D1E -_08077D80: - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _080780D8 - .pool -_08077DB0: - bl LoadHeldItemIcons - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x36 - adds r1, 0x28 - movs r2, 0 - bl sub_81B5D4C - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - b _080780D8 - .pool -_08077DD8: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x36 - adds r1, 0x28 - movs r2, 0x1 - bl sub_81B5D4C - ldr r1, =gMain - movs r7, 0x87 - lsls r7, 3 - adds r1, r7 - b _080780D8 - .pool -_08077DFC: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r5, =gUnknown_02032188 - ldr r1, [r5] - movs r4, 0x3 - str r4, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - bl GetMultiplayerId - lsls r0, 24 - movs r1, 0x80 - lsls r1, 17 - eors r1, r0 - lsrs r1, 24 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - ldr r1, =gLinkPlayers + 8 - adds r0, r1 - ldr r1, [r5, 0xC] - str r4, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - ldr r4, =gUnknown_0832DE94 - ldr r0, [r4] - ldr r1, [r5, 0x18] - movs r2, 0x2 - str r2, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - ldr r0, [r4, 0x4] - ldr r1, [r5, 0x20] - movs r2, 0x18 - bl sub_807A308 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_08077E58: - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0xA8 - strb r2, [r0] - b _080780F6 - .pool -_08077E84: - bl sub_807A1F0 - lsls r0, 24 - cmp r0, 0 - bne _08077E90 - b _080780F6 -_08077E90: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _080780D8 - .pool -_08077EA0: - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - movs r0, 0x1 - movs r2, 0x78 - bl GetStringCenterAlignXOffset - movs r6, 0 - add r5, sp, 0xC - adds r4, r0, 0 - adds r4, 0x10 -_08077EB4: - add r1, sp, 0xC - ldr r0, =gSpriteTemplate_832DCAC - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldrh r0, [r5] - adds r0, r6 - strh r0, [r5] - lsls r1, r4, 16 - asrs r1, 16 - add r0, sp, 0xC - movs r2, 0xA - movs r3, 0x1 - bl CreateSprite - adds r4, 0x20 - adds r6, 0x1 - cmp r6, 0x2 - ble _08077EB4 - 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 r0, =gLinkPlayers + 8 - adds r1, r0 - movs r0, 0x1 - movs r2, 0x78 - bl GetStringCenterAlignXOffset - movs r6, 0 - add r5, sp, 0xC - adds r4, r0, 0 - adds r4, 0x88 -_08077F02: - add r1, sp, 0xC - ldr r0, =gSpriteTemplate_832DCAC - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - adds r0, r6, 0x3 - ldrh r3, [r5] - adds r0, r3 - strh r0, [r5] - lsls r1, r4, 16 - asrs r1, 16 - add r0, sp, 0xC - movs r2, 0xA - movs r3, 0x1 - bl CreateSprite - adds r4, 0x20 - adds r6, 0x1 - cmp r6, 0x2 - ble _08077F02 - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - b _080780D8 - .pool -_08077F48: - ldr r4, =gSpriteTemplate_832DCAC - add r1, sp, 0xC - adds r0, r4, 0 - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} - add r1, sp, 0xC - adds r0, r1, 0 - ldrh r0, [r0] - adds r0, 0x6 - strh r0, [r1] - adds r0, r1, 0 - movs r1, 0xD7 - movs r2, 0x98 - movs r3, 0x1 - bl CreateSprite - add r0, sp, 0xC - ldm r4!, {r3,r5,r7} - stm r0!, {r3,r5,r7} - ldm r4!, {r1-r3} - stm r0!, {r1-r3} - add r1, sp, 0xC - adds r0, r1, 0 - ldrh r0, [r0] - adds r0, 0x7 - strh r0, [r1] - adds r0, r1, 0 - movs r1, 0xF7 - movs r2, 0x98 - movs r3, 0x1 - bl CreateSprite - movs r6, 0 - add r4, sp, 0xC - movs r5, 0xC0 - lsls r5, 13 -_08077F94: - add r1, sp, 0xC - ldr r0, =gSpriteTemplate_832DCAC - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - adds r0, r6, 0 - adds r0, 0x8 - ldrh r7, [r4] - adds r0, r7 - strh r0, [r4] - asrs r1, r5, 16 - add r0, sp, 0xC - movs r2, 0x96 - movs r3, 0x1 - bl CreateSprite - movs r0, 0x80 - lsls r0, 14 - adds r5, r0 - adds r6, 0x1 - cmp r6, 0x5 - ble _08077F94 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x35 - ldrb r1, [r2] - adds r4, r0, 0 - cmp r1, 0x5 - bhi _08077FE4 - ldr r0, =gUnknown_0203CF20 - ldrb r0, [r0] - b _08077FEA - .pool -_08077FE4: - ldr r0, =gUnknown_0203CF20 - ldrb r0, [r0] - adds r0, 0x6 -_08077FEA: - strb r0, [r2] - ldr r0, =gSpriteTemplate_832DC94 - ldr r3, =gUnknown_0832DE24 - ldr r1, [r4] - adds r1, 0x35 - ldrb r2, [r1] - lsls r2, 1 - adds r1, r2, r3 - ldrb r1, [r1] - lsls r1, 19 - movs r5, 0x80 - lsls r5, 14 - adds r1, r5 - asrs r1, 16 - adds r3, 0x1 - adds r2, r3 - ldrb r2, [r2] - lsls r2, 3 - movs r3, 0x2 - bl CreateSprite - ldr r1, [r4] - adds r1, 0x34 - strb r0, [r1] - ldr r0, =gMain - movs r7, 0x87 - lsls r7, 3 - adds r0, r7 - movs r1, 0x10 - strb r1, [r0] - b _080780F6 - .pool -_08078038: - movs r0, 0 - bl sub_80782B8 - b _080780D0 -_08078040: - movs r0, 0x1 - bl sub_80782B8 - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - strb r1, [r0, 0x1] - bl sub_8078388 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _080780D8 - .pool -_08078068: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - str r0, [sp] - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _080780D8 - .pool -_080780A4: - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0x2 - bl sub_80782B8 - ldr r1, =gMain - movs r5, 0x87 - lsls r5, 3 - adds r1, r5 - b _080780D8 - .pool -_080780C4: - movs r7, 0x87 - lsls r7, 3 - adds r1, r2, r7 - b _080780D8 -_080780CC: - bl sub_807A53C -_080780D0: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_080780D8: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080780F6 - .pool -_080780E4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080780F6 - ldr r0, =sub_807825C - bl SetMainCallback2 -_080780F6: - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0x24 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8077B74 - - thumb_func_start sub_807811C -sub_807811C: @ 807811C - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_807811C - - thumb_func_start sub_8078130 -sub_8078130: @ 8078130 - push {r4,lr} - sub sp, 0x4 - ldr r4, =gUnknown_0203229C - ldr r1, [r4] - adds r1, 0xA8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xF - bls _08078160 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0xA - strb r1, [r0] -_08078160: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8078130 - - thumb_func_start sub_807816C -sub_807816C: @ 807816C - push {r4,lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080781C2 - ldr r1, =gUnknown_02032298 - ldr r4, =gUnknown_0203229C - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x35 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0 - adds r0, 0x7E - ldrb r0, [r0] - strb r0, [r1, 0x1] - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _080781B4 - adds r1, r2, 0 - adds r1, 0x6F - movs r0, 0x10 - strb r0, [r1] - b _080781C2 - .pool -_080781B4: - movs r0, 0x20 - bl sub_800ABF4 - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0xD - strb r1, [r0] -_080781C2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_807816C - - thumb_func_start sub_80781C8 -sub_80781C8: @ 80781C8 - push {r4,r5,lr} - ldr r5, =gMain - ldr r0, =sub_80773AC - str r0, [r5, 0x8] - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _08078220 - bl sub_8010500 - lsls r0, 24 - cmp r0, 0 - beq _08078244 - ldr r0, =gUnknown_02032184 - ldr r0, [r0] - bl Free - bl FreeAllWindowBuffers - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - bl Free - movs r0, 0 - str r0, [r5] - bl sub_800E084 - ldr r0, =sub_807AE50 - bl SetMainCallback2 - b _08078244 - .pool -_08078220: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r4, [r0] - cmp r4, 0 - bne _08078244 - ldr r0, =gUnknown_02032184 - ldr r0, [r0] - bl Free - bl FreeAllWindowBuffers - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - bl Free - str r4, [r5] - ldr r0, =sub_807AE50 - bl SetMainCallback2 -_08078244: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80781C8 - - thumb_func_start sub_807825C -sub_807825C: @ 807825C - push {r4,lr} - bl sub_80795AC - bl sub_807A0C4 - movs r0, 0 - bl sub_80796B4 - movs r0, 0x1 - bl sub_80796B4 - ldr r4, =gUnknown_0203229C - ldr r2, [r4] - ldrb r1, [r2] - adds r0, r1, 0x1 - strb r0, [r2] - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x18 - bl SetGpuReg - ldr r2, [r4] - ldrb r1, [r2, 0x1] - adds r0, r1, 0 - adds r0, 0xFF - strb r0, [r2, 0x1] - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1C - bl SetGpuReg - bl RunTextPrintersAndIsPrinter0Active - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807825C - - thumb_func_start sub_80782B8 -sub_80782B8: @ 80782B8 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - beq _08078324 - cmp r4, 0x1 - bgt _080782CE - cmp r4, 0 - beq _080782D4 - b _0807837E -_080782CE: - cmp r4, 0x2 - beq _0807834C - b _0807837E -_080782D4: - ldr r0, =gUnknown_08DDB3E4 - movs r1, 0 - movs r2, 0x60 - bl LoadPalette - ldr r1, =gUnknown_08DDB464 - movs r2, 0x94 - lsls r2, 5 - movs r0, 0x1 - movs r3, 0 - bl LoadBgTiles - ldr r1, =gUnknown_08DDCF04 - movs r0, 0x20 - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r1, =gTradeStripesBG2Tilemap - movs r2, 0x80 - lsls r2, 4 - movs r0, 0x2 - movs r3, 0 - bl LoadBgTilemap - b _0807837E - .pool -_08078324: - ldr r1, =gTradeStripesBG3Tilemap - movs r2, 0x80 - lsls r2, 4 - movs r0, 0x3 - movs r3, 0 - bl LoadBgTilemap - movs r0, 0 - bl sub_8079E44 - movs r0, 0x1 - bl sub_8079E44 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - b _0807837E - .pool -_0807834C: - movs r5, 0x80 - lsls r5, 21 - movs r4, 0x3 -_08078352: - lsrs r0, r5, 24 - movs r1, 0 - bl SetGpuReg - movs r0, 0x80 - lsls r0, 18 - adds r5, r0 - subs r4, 0x1 - cmp r4, 0 - bge _08078352 - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg -_0807837E: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80782B8 - - thumb_func_start sub_8078388 -sub_8078388: @ 8078388 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r3, 0 - ldr r5, =gUnknown_0203229C - mov r8, r5 - ldr r0, =gSprites - mov r12, r0 - movs r1, 0x5 - negs r1, r1 - mov r9, r1 - movs r4, 0x6 - movs r7, 0x1 - movs r6, 0 -_080783A6: - mov r1, r8 - ldr r0, [r1] - adds r1, r0, 0 - adds r1, 0x36 - ldrb r1, [r1] - cmp r3, r1 - bge _080783E0 - adds r0, 0x28 - adds r0, r3 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r12 - adds r1, 0x3E - ldrb r2, [r1] - mov r0, r9 - ands r0, r2 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x38 - adds r0, r3 - strb r7, [r0] - b _080783E6 - .pool -_080783E0: - adds r0, 0x38 - adds r0, r3 - strb r6, [r0] -_080783E6: - mov r1, r8 - ldr r0, [r1] - adds r1, r0, 0 - adds r1, 0x37 - ldrb r1, [r1] - cmp r3, r1 - bge _08078416 - adds r0, 0x2E - adds r0, r3 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r12 - adds r1, 0x3E - ldrb r2, [r1] - mov r0, r9 - ands r0, r2 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x38 - adds r0, r4 - strb r7, [r0] - b _0807841C -_08078416: - adds r0, 0x38 - adds r0, r4 - strb r6, [r0] -_0807841C: - adds r4, 0x1 - adds r3, 0x1 - cmp r3, 0x5 - ble _080783A6 - ldr r0, [r5] - adds r0, 0x44 - movs r1, 0x1 - strb r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8078388 - - thumb_func_start sub_8078438 -sub_8078438: @ 8078438 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r3, 0 - cmp r3, r2 - bcs _08078452 -_08078444: - adds r0, r5, r3 - adds r1, r4, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, r2 - bcc _08078444 -_08078452: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8078438 - - thumb_func_start shedinja_maker_maybe -shedinja_maker_maybe: @ 8078458 - push {r4-r6,lr} - sub sp, 0xC - bl GetMultiplayerId - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x69 - ldrb r0, [r0] - cmp r0, 0x15 - bls _08078472 - b _080787AA -_08078472: - lsls r0, 2 - ldr r1, =_08078484 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08078484: - .4byte _080784DC - .4byte _08078508 - .4byte _08078784 - .4byte _08078534 - .4byte _08078548 - .4byte _0807857C - .4byte _08078784 - .4byte _08078598 - .4byte _080785AC - .4byte _080785E0 - .4byte _08078784 - .4byte _080785FC - .4byte _08078610 - .4byte _08078644 - .4byte _08078784 - .4byte _0807866C - .4byte _08078680 - .4byte _080786B4 - .4byte _08078784 - .4byte _080786DC - .4byte _080786F0 - .4byte _08078720 -_080784DC: - ldr r0, =gBlockSendBuffer - ldr r1, =gPlayerParty - movs r2, 0xC8 - bl sub_8078438 - ldr r3, =gUnknown_0203229C - ldr r1, [r3] - adds r1, 0x69 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - ldr r0, [r3] - adds r0, 0xA8 - strb r2, [r0] - b _080787AA - .pool -_08078508: - bl sub_80771BC - cmp r0, 0 - bne _08078512 - b _080787AA -_08078512: - bl sub_8077200 - cmp r0, 0 - bne _08078524 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_08078524: - bl sub_8077210 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_08078534: - cmp r5, 0 - bne _0807853E - movs r0, 0x1 - bl sub_80771AC -_0807853E: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_08078548: - bl sub_8077200 - cmp r0, 0x3 - beq _08078552 - b _080787AA -_08078552: - ldr r0, =gEnemyParty - movs r2, 0x1 - adds r1, r5, 0 - eors r1, r2 - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0xC8 - bl sub_8078438 - bl sub_8077210 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_0807857C: - ldr r0, =gBlockSendBuffer - ldr r1, =gPlayerParty + 200 - movs r2, 0xC8 - bl sub_8078438 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_08078598: - cmp r5, 0 - bne _080785A2 - movs r0, 0x1 - bl sub_80771AC -_080785A2: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_080785AC: - bl sub_8077200 - cmp r0, 0x3 - beq _080785B6 - b _080787AA -_080785B6: - ldr r0, =gEnemyParty + 200 - movs r2, 0x1 - adds r1, r5, 0 - eors r1, r2 - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0xC8 - bl sub_8078438 - bl sub_8077210 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_080785E0: - ldr r0, =gBlockSendBuffer - ldr r1, =gPlayerParty + 400 - movs r2, 0xC8 - bl sub_8078438 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_080785FC: - cmp r5, 0 - bne _08078606 - movs r0, 0x1 - bl sub_80771AC -_08078606: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_08078610: - bl sub_8077200 - cmp r0, 0x3 - beq _0807861A - b _080787AA -_0807861A: - ldr r0, =gEnemyParty + 400 - movs r2, 0x1 - adds r1, r5, 0 - eors r1, r2 - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0xC8 - bl sub_8078438 - bl sub_8077210 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_08078644: - ldr r0, =gBlockSendBuffer - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - ldr r2, =0x00002be0 - adds r1, r2 - movs r2, 0xDC - bl sub_8078438 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_0807866C: - cmp r5, 0 - bne _08078676 - movs r0, 0x3 - bl sub_80771AC -_08078676: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_08078680: - bl sub_8077200 - cmp r0, 0x3 - beq _0807868A - b _080787AA -_0807868A: - ldr r0, =gUnknown_020321C0 - movs r2, 0x1 - adds r1, r5, 0 - eors r1, r2 - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0xD8 - bl sub_8078438 - bl sub_8077210 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_080786B4: - ldr r0, =gBlockSendBuffer - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - ldr r2, =0x000031a8 - adds r1, r2 - movs r2, 0xB - bl sub_8078438 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_080786DC: - cmp r5, 0 - bne _080786E6 - movs r0, 0x4 - bl sub_80771AC -_080786E6: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _080787A2 - .pool -_080786F0: - bl sub_8077200 - cmp r0, 0x3 - bne _080787AA - ldr r4, =gUnknown_0203229C - ldr r0, [r4] - adds r0, 0xA9 - movs r2, 0x1 - adds r1, r5, 0 - eors r1, r2 - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - movs r2, 0xB - bl sub_8078438 - bl sub_8077210 - ldr r1, [r4] - b _080787A2 - .pool -_08078720: - ldr r4, =gEnemyParty - ldr r6, =0x0000012f - movs r5, 0x5 -_08078726: - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - beq _08078766 - cmp r0, r6 - bne _08078766 - adds r0, r4, 0 - movs r1, 0x3 - bl GetMonData - cmp r0, 0x1 - beq _08078766 - adds r0, r4, 0 - movs r1, 0x2 - mov r2, sp - bl GetMonData - mov r0, sp - ldr r1, =gJPText_Shedinja - bl StringCompareWithoutExtCtrlCodes - cmp r0, 0 - bne _08078766 - adds r0, r4, 0 - movs r1, 0x2 - ldr r2, =gSpeciesNames + 303 * 11 @ SPECIES_SHEDINJA * POKEMON_NAME_LENGTH + 1 - bl SetMonData -_08078766: - adds r4, 0x64 - subs r5, 0x1 - cmp r5, 0 - bge _08078726 - movs r0, 0x1 - b _080787AC - .pool -_08078784: - ldr r2, =gUnknown_0203229C - ldr r1, [r2] - adds r1, 0xA8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r2] - adds r1, r0, 0 - adds r1, 0xA8 - ldrb r0, [r1] - cmp r0, 0xA - bls _080787AA - movs r0, 0 - strb r0, [r1] - ldr r1, [r2] -_080787A2: - adds r1, 0x69 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080787AA: - movs r0, 0 -_080787AC: - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end shedinja_maker_maybe - - thumb_func_start sub_80787B8 -sub_80787B8: @ 80787B8 - push {lr} - ldr r0, =gText_IsThisTradeOkay - ldr r1, =gUnknown_0203229C - ldr r1, [r1] - adds r1, 0x72 - ldrh r1, [r1] - lsls r1, 5 - ldr r2, =0x06010000 - adds r1, r2 - movs r2, 0x18 - bl sub_807A308 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80787B8 - - thumb_func_start sub_80787E0 -sub_80787E0: @ 80787E0 - push {r4,lr} - lsls r1, 24 - lsrs r4, r1, 24 - movs r2, 0x1 - adds r0, r4, 0 - ands r0, r2 - cmp r0, 0 - beq _08078864 - ldr r0, =gBlockRecvBuffer - ldrh r1, [r0] - ldr r0, =0x0000bbbb - cmp r1, r0 - beq _08078844 - cmp r1, r0 - bgt _08078814 - ldr r0, =0x0000aabb - cmp r1, r0 - beq _08078834 - b _0807885E - .pool -_08078814: - ldr r0, =0x0000bbcc - cmp r1, r0 - beq _08078854 - ldr r0, =0x0000eeaa - cmp r1, r0 - bne _0807885E - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x78 - b _0807885A - .pool -_08078834: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x78 - strb r2, [r0] - b _0807885E - .pool -_08078844: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x7A - strb r2, [r0] - b _0807885E - .pool -_08078854: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x7A -_0807885A: - movs r1, 0x2 - strb r1, [r0] -_0807885E: - movs r0, 0 - bl sub_8077234 -_08078864: - movs r2, 0x2 - adds r0, r4, 0 - ands r0, r2 - cmp r0, 0 - beq _080788F6 - ldr r3, =gBlockRecvBuffer - movs r1, 0x80 - lsls r1, 1 - adds r0, r3, r1 - ldrh r1, [r0] - ldr r0, =0x0000bbbb - cmp r1, r0 - beq _080788D8 - cmp r1, r0 - bgt _0807889C - ldr r0, =0x0000aabb - cmp r1, r0 - beq _080788BC - b _080788F0 - .pool -_0807889C: - ldr r0, =0x0000bbcc - cmp r1, r0 - beq _080788E8 - ldr r0, =0x0000eeaa - cmp r1, r0 - bne _080788F0 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x79 - b _080788EE - .pool -_080788BC: - ldr r2, =gUnknown_0203229C - ldr r1, [r2] - movs r4, 0x81 - lsls r4, 1 - adds r0, r3, r4 - ldrb r0, [r0] - adds r0, 0x6 - adds r1, 0x7E - strb r0, [r1] - ldr r0, [r2] - adds r0, 0x79 - b _080788DE - .pool -_080788D8: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x7B -_080788DE: - movs r1, 0x1 - strb r1, [r0] - b _080788F0 - .pool -_080788E8: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x7B -_080788EE: - strb r2, [r0] -_080788F0: - movs r0, 0x1 - bl sub_8077234 -_080788F6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80787E0 - - thumb_func_start sub_8078900 -sub_8078900: @ 8078900 - push {r4,r5,lr} - sub sp, 0x4 - lsls r1, 24 - lsrs r5, r1, 24 - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - beq _080789E2 - ldr r2, =gBlockRecvBuffer - ldrh r1, [r2] - ldr r0, =0x0000ddee - cmp r1, r0 - beq _080789CC - cmp r1, r0 - bgt _0807893C - ldr r0, =0x0000ccdd - cmp r1, r0 - beq _080789AC - ldr r0, =0x0000dddd - cmp r1, r0 - beq _08078978 - b _080789DC - .pool -_0807893C: - ldr r0, =0x0000eebb - cmp r1, r0 - beq _08078950 - adds r0, 0x11 - cmp r1, r0 - beq _08078974 - b _080789DC - .pool -_08078950: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - movs r0, 0x4 - bl sub_807A19C - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0xB - b _080789DA - .pool -_08078974: - movs r0, 0x5 - b _080789CE -_08078978: - ldr r4, =gUnknown_0203229C - ldr r1, [r4] - ldrb r0, [r2, 0x2] - adds r0, 0x6 - adds r1, 0x7E - strb r0, [r1] - movs r0, 0 - bl rbox_fill_rectangle - ldr r0, [r4] - adds r0, 0x35 - ldrb r0, [r0] - bl sub_807967C - ldr r0, [r4] - adds r0, 0x7E - ldrb r0, [r0] - bl sub_807967C - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0x7 - b _080789DA - .pool -_080789AC: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0xA - b _080789DA - .pool -_080789CC: - movs r0, 0x1 -_080789CE: - bl sub_807A19C - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x8 -_080789DA: - strb r1, [r0] -_080789DC: - movs r0, 0 - bl sub_8077234 -_080789E2: - movs r0, 0x2 - ands r0, r5 - cmp r0, 0 - beq _080789F0 - movs r0, 0x1 - bl sub_8077234 -_080789F0: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8078900 - - thumb_func_start sub_80789FC -sub_80789FC: @ 80789FC - push {r4-r6,lr} - sub sp, 0x4 - ldr r6, =gUnknown_0203229C - ldr r2, [r6] - adds r1, r2, 0 - adds r1, 0x78 - ldrb r0, [r1] - cmp r0, 0 - bne _08078A10 - b _08078B44 -_08078A10: - adds r0, r2, 0 - adds r0, 0x79 - ldrb r0, [r0] - cmp r0, 0 - bne _08078A1C - b _08078B44 -_08078A1C: - ldrh r1, [r1] - ldr r0, =0x00000101 - cmp r1, r0 - bne _08078A64 - adds r1, r2, 0 - adds r1, 0x6F - movs r0, 0x6 - strb r0, [r1] - ldr r2, [r6] - adds r1, r2, 0 - adds r1, 0x80 - movs r4, 0 - ldr r0, =0x0000dddd - strh r0, [r1] - adds r0, r2, 0 - adds r0, 0x35 - ldrb r1, [r0] - adds r0, 0x4D - strh r1, [r0] - movs r0, 0x5 - movs r1, 0 - bl sub_807A048 - ldr r0, [r6] - adds r2, r0, 0 - adds r2, 0x79 - strb r4, [r2] - adds r0, 0x78 - strb r4, [r0] - b _08078B44 - .pool -_08078A64: - ldr r0, =0x00000201 - cmp r1, r0 - bne _08078AB4 - movs r0, 0x1 - bl sub_807A19C - ldr r1, [r6] - adds r2, r1, 0 - adds r2, 0x80 - movs r4, 0 - movs r3, 0 - ldr r0, =0x0000eecc - strh r0, [r2] - adds r1, 0x82 - strh r3, [r1] - movs r0, 0x5 - movs r1, 0 - bl sub_807A048 - ldr r0, [r6] - adds r1, r0, 0 - adds r1, 0x7B - strb r4, [r1] - adds r0, 0x7A - strb r4, [r0] - ldr r0, [r6] - adds r1, r0, 0 - adds r1, 0x79 - strb r4, [r1] - adds r0, 0x78 - strb r4, [r0] - ldr r0, [r6] - adds r0, 0x6F - movs r1, 0x8 - b _08078B42 - .pool -_08078AB4: - movs r0, 0x81 - lsls r0, 1 - cmp r1, r0 - bne _08078B00 - movs r0, 0x5 - bl sub_807A19C - ldr r1, [r6] - adds r2, r1, 0 - adds r2, 0x80 - movs r4, 0 - movs r3, 0 - ldr r0, =0x0000ddee - strh r0, [r2] - adds r1, 0x82 - strh r3, [r1] - movs r0, 0x5 - movs r1, 0 - bl sub_807A048 - ldr r0, [r6] - adds r1, r0, 0 - adds r1, 0x7B - strb r4, [r1] - adds r0, 0x7A - strb r4, [r0] - ldr r0, [r6] - adds r1, r0, 0 - adds r1, 0x79 - strb r4, [r1] - adds r0, 0x78 - strb r4, [r0] - ldr r0, [r6] - adds r0, 0x6F - movs r1, 0x8 - b _08078B42 - .pool -_08078B00: - ldr r0, =0x00000202 - cmp r1, r0 - bne _08078B44 - adds r1, r2, 0 - adds r1, 0x80 - movs r5, 0 - movs r4, 0 - ldr r0, =0x0000eebb - strh r0, [r1] - adds r0, r2, 0 - adds r0, 0x82 - strh r4, [r0] - movs r0, 0x5 - movs r1, 0 - bl sub_807A048 - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, [r6] - adds r1, r0, 0 - adds r1, 0x79 - strb r5, [r1] - adds r0, 0x78 - strb r5, [r0] - ldr r0, [r6] - adds r0, 0x6F - movs r1, 0xB -_08078B42: - strb r1, [r0] -_08078B44: - ldr r5, =gUnknown_0203229C - ldr r3, [r5] - adds r1, r3, 0 - adds r1, 0x7A - ldrb r0, [r1] - cmp r0, 0 - beq _08078BDC - adds r0, r3, 0 - adds r0, 0x7B - ldrb r0, [r0] - cmp r0, 0 - beq _08078BDC - ldrh r1, [r1] - ldr r0, =0x00000101 - cmp r1, r0 - bne _08078B92 - adds r1, r3, 0 - adds r1, 0x80 - movs r4, 0 - movs r2, 0 - ldr r0, =0x0000ccdd - strh r0, [r1] - adds r0, r3, 0 - adds r0, 0x82 - strh r2, [r0] - movs r0, 0x5 - movs r1, 0 - bl sub_807A048 - ldr r0, [r5] - adds r0, 0x7A - strb r4, [r0] - ldr r0, [r5] - adds r0, 0x7B - strb r4, [r0] - ldr r0, [r5] - adds r0, 0x6F - movs r1, 0x9 - strb r1, [r0] -_08078B92: - ldr r1, [r5] - adds r0, r1, 0 - adds r0, 0x7A - ldrb r0, [r0] - cmp r0, 0x2 - beq _08078BA8 - adds r0, r1, 0 - adds r0, 0x7B - ldrb r0, [r0] - cmp r0, 0x2 - bne _08078BDC -_08078BA8: - movs r0, 0x1 - bl sub_807A19C - ldr r1, [r5] - adds r2, r1, 0 - adds r2, 0x80 - movs r4, 0 - movs r3, 0 - ldr r0, =0x0000ddee - strh r0, [r2] - adds r1, 0x82 - strh r3, [r1] - movs r0, 0x5 - movs r1, 0 - bl sub_807A048 - ldr r0, [r5] - adds r0, 0x7A - strb r4, [r0] - ldr r0, [r5] - adds r0, 0x7B - strb r4, [r0] - ldr r0, [r5] - adds r0, 0x6F - movs r1, 0x8 - strb r1, [r0] -_08078BDC: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80789FC - - thumb_func_start sub_8078BFC -sub_8078BFC: @ 8078BFC - push {lr} - strh r1, [r0] - strh r2, [r0, 0x2] - movs r0, 0x5 - movs r1, 0 - bl sub_807A048 - pop {r0} - bx r0 - thumb_func_end sub_8078BFC - - thumb_func_start sub_8078C10 -sub_8078C10: @ 8078C10 - push {lr} - adds r3, r0, 0 - adds r2, r1, 0 - lsls r3, 16 - lsrs r3, 16 - lsls r2, 16 - lsrs r2, 16 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x80 - adds r1, r3, 0 - bl sub_8078BFC - pop {r0} - bx r0 - .pool - thumb_func_end sub_8078C10 - - thumb_func_start sub_8078C34 -sub_8078C34: @ 8078C34 - push {r4,lr} - bl GetMultiplayerId - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_8077200 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _08078C5C - cmp r4, 0 - bne _08078C56 - movs r0, 0 - bl sub_80787E0 - b _08078C5C -_08078C56: - adds r0, r4, 0 - bl sub_8078900 -_08078C5C: - cmp r4, 0 - bne _08078C64 - bl sub_80789FC -_08078C64: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8078C34 - - thumb_func_start sub_8078C6C -sub_8078C6C: @ 8078C6C - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r6, 0 - movs r5, 0 - ldr r2, =gUnknown_0203229C - ldr r3, [r2] - ldr r4, =gUnknown_0832DCEC - lsls r2, r1, 1 - adds r2, r1 - lsls r2, 1 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - adds r3, 0x38 - adds r2, r1 - adds r2, r4 -_08078C92: - ldrb r1, [r2] - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08078CA8 - adds r6, r1, 0 - b _08078CB0 - .pool -_08078CA8: - adds r2, 0x1 - adds r5, 0x1 - cmp r5, 0x5 - ble _08078C92 -_08078CB0: - adds r0, r6, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8078C6C - - thumb_func_start sub_8078CB8 -sub_8078CB8: @ 8078CB8 - push {r4-r7,lr} - adds r7, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldrb r0, [r7] - bl sub_8078C6C - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0xC - bne _08078D10 - ldr r5, =gUnknown_0203229C - ldr r0, [r5] - adds r0, 0x34 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r2, [r5] - adds r2, 0x34 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xE0 - strh r1, [r0, 0x20] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xA0 - strh r1, [r0, 0x22] - b _08078D58 - .pool -_08078D10: - ldr r4, =gUnknown_0203229C - ldr r0, [r4] - adds r0, 0x34 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - movs r1, 0 - bl StartSpriteAnim - ldr r4, [r4] - adds r4, 0x34 - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - ldr r2, =gUnknown_0832DE24 - lsls r3, r6, 1 - adds r0, r3, r2 - ldrb r0, [r0] - lsls r0, 3 - adds r0, 0x20 - strh r0, [r1, 0x20] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - adds r2, 0x1 - adds r3, r2 - ldrb r0, [r3] - lsls r0, 3 - strh r0, [r1, 0x22] -_08078D58: - ldrb r0, [r7] - cmp r0, r6 - beq _08078D64 - movs r0, 0x5 - bl PlaySE -_08078D64: - strb r6, [r7] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8078CB8 - - thumb_func_start sub_8078D78 -sub_8078D78: @ 8078D78 - push {r4,lr} - movs r0, 0 - bl sub_807A19C - ldr r4, =gUnknown_0203229C - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0x64 - strb r1, [r0] - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08078DAC - ldr r0, =0x0000aabb - ldr r1, [r4] - adds r1, 0x35 - ldrb r1, [r1] - bl sub_8078C10 - b _08078DB4 - .pool -_08078DAC: - ldr r0, [r4] - adds r0, 0x78 - movs r1, 0x1 - strb r1, [r0] -_08078DB4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8078D78 - - thumb_func_start sub_8078DBC -sub_8078DBC: @ 8078DBC - push {r4,lr} - sub sp, 0x4 - ldr r0, =gMain - ldrh r1, [r0, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08078DE4 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x35 - movs r1, 0 - bl sub_8078CB8 - b _08078E30 - .pool -_08078DE4: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08078E00 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x35 - movs r1, 0x1 - bl sub_8078CB8 - b _08078E30 - .pool -_08078E00: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08078E1C - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x35 - movs r1, 0x2 - bl sub_8078CB8 - b _08078E30 - .pool -_08078E1C: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08078E30 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x35 - movs r1, 0x3 - bl sub_8078CB8 -_08078E30: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08078EE4 - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_0203229C - ldr r0, [r4] - adds r0, 0x35 - ldrb r0, [r0] - cmp r0, 0x5 - bhi _08078E98 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0xE - bl sub_8098858 - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gUnknown_0832DEAC - movs r0, 0x1 - movs r1, 0x2 - bl PrintMenuTable - movs r0, 0x1 - movs r1, 0x2 - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0x1 - strb r1, [r0] - b _08078EE4 - .pool -_08078E98: - cmp r0, 0xB - bhi _08078EB6 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0x2 - strb r1, [r0] - b _08078EE4 -_08078EB6: - cmp r0, 0xC - bne _08078EE4 - ldr r0, =gUnknown_0832DF8C - movs r1, 0x1 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0x4 - strb r1, [r0] - ldr r0, =gUnknown_0832DE94 - ldr r0, [r0, 0x10] - ldr r1, [r4] - adds r1, 0x72 - ldrh r1, [r1] - lsls r1, 5 - ldr r2, =0x06010000 - adds r1, r2 - movs r2, 0x18 - bl sub_807A308 -_08078EE4: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8078DBC - - thumb_func_start sub_8078EF8 -sub_8078EF8: @ 8078EF8 - push {lr} - bl sub_8079F74 - ldr r3, =gUnknown_0203229C - ldr r0, [r3] - adds r0, 0x6F - movs r1, 0 - strb r1, [r0] - ldr r2, =gSprites - ldr r0, [r3] - adds r0, 0x34 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r0, =gUnknown_0832DE94 - ldr r0, [r0, 0x4] - ldr r1, [r3] - adds r1, 0x72 - ldrh r1, [r1] - lsls r1, 5 - ldr r2, =0x06010000 - adds r1, r2 - movs r2, 0x18 - bl sub_807A308 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8078EF8 - - thumb_func_start sub_8078F50 -sub_8078F50: @ 8078F50 - push {lr} - sub sp, 0x4 - bl Menu_ProcessInputNoWrap - lsls r0, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _08078F72 - cmp r0, r1 - ble _0807902A - cmp r0, 0 - beq _08078F7E - cmp r0, 0x1 - beq _08078F9C - b _0807902A -_08078F72: - movs r0, 0x5 - bl PlaySE - bl sub_8078EF8 - b _0807902A -_08078F7E: - str r0, [sp] - adds r0, r1, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x2 - b _08079028 - .pool -_08078F9C: - ldr r0, =gPlayerParty - ldr r1, =gPlayerPartyCount - ldrb r1, [r1] - ldr r2, =gUnknown_0203229C - ldr r2, [r2] - adds r2, 0x35 - ldrb r2, [r2] - bl sub_807A5F4 - cmp r0, 0x5 - bhi _0807902A - lsls r0, 2 - ldr r1, =_08078FCC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08078FCC: - .4byte _08078FE4 - .4byte _0807900C - .4byte _08079012 - .4byte _08079018 - .4byte _08079012 - .4byte _08079018 -_08078FE4: - bl sub_8078D78 - ldr r2, =gSprites - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x34 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - b _08079028 - .pool -_0807900C: - movs r0, 0x3 - movs r1, 0x3 - b _0807901C -_08079012: - movs r0, 0x3 - movs r1, 0x6 - b _0807901C -_08079018: - movs r0, 0x3 - movs r1, 0x7 -_0807901C: - bl sub_807A048 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x8 -_08079028: - strb r1, [r0] -_0807902A: - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8078F50 - - thumb_func_start sub_8079034 -sub_8079034: @ 8079034 - push {lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0807904A - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _08079054 -_0807904A: - movs r0, 0x5 - bl PlaySE - bl sub_8078EF8 -_08079054: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079034 - - thumb_func_start sub_807905C -sub_807905C: @ 807905C - push {lr} - sub sp, 0x4 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080790C4 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r3, r0, 0 - adds r3, 0x35 - ldrb r2, [r3] - cmp r2, 0x5 - bhi _080790A4 - ldr r1, =gPlayerParty - ldrb r2, [r3] - adds r0, 0x36 - ldrb r3, [r0] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_8077B74 - str r0, [sp] - movs r0, 0x1 - bl ShowPokemonSummaryScreen - b _080790C0 - .pool -_080790A4: - ldr r1, =gEnemyParty - subs r2, 0x6 - lsls r2, 24 - lsrs r2, 24 - adds r0, 0x37 - ldrb r3, [r0] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sub_8077B74 - str r0, [sp] - movs r0, 0x1 - bl ShowPokemonSummaryScreen -_080790C0: - bl FreeAllWindowBuffers -_080790C4: - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_807905C - - thumb_func_start sub_80790D4 -sub_80790D4: @ 80790D4 - push {r4-r7,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r6, r3, 24 - movs r5, 0 - movs r3, 0 - ldr r7, =gEnemyParty - cmp r5, r1 - bge _08079102 -_080790EE: - cmp r2, r3 - beq _080790FC - adds r0, r4, r3 - ldrb r0, [r0] - adds r0, r5, r0 - lsls r0, 24 - lsrs r5, r0, 24 -_080790FC: - adds r3, 0x1 - cmp r3, r1 - blt _080790EE -_08079102: - adds r0, r6, 0 - movs r1, 0x6 - bl __umodsi3 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0x64 - muls r0, r6 - adds r7, r0, r7 - adds r0, r7, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - movs r0, 0xCD - lsls r0, 1 - cmp r4, r0 - beq _0807912C - cmp r4, 0x97 - bne _08079138 -_0807912C: - adds r0, r7, 0 - movs r1, 0x50 - bl GetMonData - cmp r0, 0 - beq _08079158 -_08079138: - bl IsNationalPokedexEnabled - cmp r0, 0 - bne _08079164 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x57 - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0 - bne _08079158 - adds r0, r4, 0 - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _08079164 -_08079158: - movs r0, 0x2 - b _0807916C - .pool -_08079164: - cmp r5, 0 - beq _0807916A - movs r5, 0x1 -_0807916A: - adds r0, r5, 0 -_0807916C: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80790D4 - - thumb_func_start sub_8079174 -sub_8079174: @ 8079174 - push {r4,r5,lr} - sub sp, 0xC - movs r2, 0 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r3, r1, 0 - adds r3, 0x36 - adds r5, r0, 0 - ldrb r0, [r3] - cmp r2, r0 - bge _080791A0 - adds r4, r1, 0 - adds r4, 0x45 -_0807918E: - mov r1, sp - adds r0, r1, r2 - adds r1, r4, r2 - ldrb r1, [r1] - strb r1, [r0] - adds r2, 0x1 - ldrb r0, [r3] - cmp r2, r0 - blt _0807918E -_080791A0: - ldr r0, [r5] - adds r1, r0, 0 - adds r1, 0x36 - ldrb r1, [r1] - adds r2, r0, 0 - adds r2, 0x35 - ldrb r2, [r2] - adds r0, 0x7E - ldrb r3, [r0] - mov r0, sp - bl sub_80790D4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080791E8 - cmp r0, 0x1 - bgt _080791D0 - cmp r0, 0 - beq _080791D6 - b _0807920C - .pool -_080791D0: - cmp r0, 0x2 - beq _08079200 - b _0807920C -_080791D6: - movs r0, 0x3 - movs r1, 0x3 - bl sub_807A048 - ldr r0, =0x0000bbcc - b _080791F2 - .pool -_080791E8: - movs r0, 0x3 - movs r1, 0x1 - bl sub_807A048 - ldr r0, =0x0000bbbb -_080791F2: - movs r1, 0 - bl sub_8078C10 - b _0807920C - .pool -_08079200: - movs r0, 0x3 - movs r1, 0x8 - bl sub_807A048 - movs r0, 0x1 - b _0807920E -_0807920C: - movs r0, 0 -_0807920E: - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8079174 - - thumb_func_start sub_8079218 -sub_8079218: @ 8079218 - push {lr} - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0807923A - cmp r1, 0 - bgt _08079234 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08079268 - b _08079290 -_08079234: - cmp r1, 0x1 - beq _08079268 - b _08079290 -_0807923A: - bl sub_8079174 - cmp r0, 0 - bne _08079250 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x64 - b _08079258 - .pool -_08079250: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x11 -_08079258: - strb r1, [r0] - movs r0, 0x11 - bl PutWindowTilemap - b _08079290 - .pool -_08079268: - movs r0, 0x3 - movs r1, 0x1 - bl sub_807A048 - bl sub_80771BC - cmp r0, 0 - beq _08079280 - ldr r0, =0x0000bbcc - movs r1, 0 - bl sub_8078C10 -_08079280: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x64 - strb r1, [r0] - movs r0, 0x11 - bl PutWindowTilemap -_08079290: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079218 - - thumb_func_start sub_807929C -sub_807929C: @ 807929C - push {r4-r6,lr} - movs r5, 0 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x37 - ldrb r0, [r0] - subs r0, 0x4 - cmp r5, r0 - bge _080792D8 - movs r6, 0xC0 - lsls r6, 20 -_080792B2: - lsrs r4, r6, 24 - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x1 - bl CopyWindowToVram - movs r0, 0x80 - lsls r0, 17 - adds r6, r0 - adds r5, 0x1 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x37 - ldrb r0, [r0] - subs r0, 0x4 - cmp r5, r0 - blt _080792B2 -_080792D8: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807929C - - thumb_func_start sub_80792E4 -sub_80792E4: @ 80792E4 - push {lr} - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _08079306 - cmp r1, 0 - bgt _08079300 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0807934C - b _08079356 -_08079300: - cmp r1, 0x1 - beq _0807934C - b _08079356 -_08079306: - movs r0, 0x4 - bl sub_807A19C - ldr r0, =0x0000eeaa - movs r1, 0 - bl sub_8078C10 - ldr r2, =gSprites - ldr r3, =gUnknown_0203229C - ldr r0, [r3] - adds r0, 0x34 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r3] - adds r0, 0x6F - movs r1, 0x64 - strb r1, [r0] - bl sub_807929C - b _08079356 - .pool -_0807934C: - movs r0, 0x5 - bl PlaySE - bl sub_8078EF8 -_08079356: - pop {r0} - bx r0 - thumb_func_end sub_80792E4 - - thumb_func_start sub_807935C -sub_807935C: @ 807935C - push {r4,lr} - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _08079384 - movs r0, 0 - bl rbox_fill_rectangle - ldr r4, =gUnknown_0203229C - ldr r0, [r4] - adds r0, 0x35 - ldrb r0, [r0] - bl sub_807967C - ldr r0, [r4] - adds r0, 0x7E - ldrb r0, [r0] - bl sub_807967C -_08079384: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x7 - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807935C - - thumb_func_start sub_8079398 -sub_8079398: @ 8079398 - push {r4,lr} - ldr r4, =gUnknown_0203229C - ldr r0, [r4] - adds r0, 0x74 - ldrh r1, [r0] - ldr r0, =0x00000505 - cmp r1, r0 - bne _080793B4 - bl sub_80787B8 - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0xE - strb r1, [r0] -_080793B4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079398 - - thumb_func_start sub_80793C4 -sub_80793C4: @ 80793C4 - push {r4,lr} - ldr r4, =gUnknown_0203229C - ldr r1, [r4] - adds r1, 0xA8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0xA8 - ldrb r0, [r0] - cmp r0, 0x78 - bls _080793F8 - ldr r0, =gUnknown_0832DF8C - movs r1, 0x1 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - ldr r0, [r4] - adds r0, 0xA8 - movs r1, 0 - strb r1, [r0] - ldr r0, [r4] - adds r0, 0x6F - movs r1, 0x3 - strb r1, [r0] -_080793F8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80793C4 - - thumb_func_start sub_8079408 -sub_8079408: @ 8079408 - push {r4-r6,lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0807947C - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl rbox_fill_rectangle - movs r0, 0x1 - bl rbox_fill_rectangle - movs r6, 0 - movs r5, 0xE0 - lsls r5, 20 -_0807942E: - lsrs r4, r5, 24 - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0 - bl rbox_fill_rectangle - movs r0, 0x80 - lsls r0, 17 - adds r5, r0 - adds r6, 0x1 - cmp r6, 0x3 - ble _0807942E - movs r0, 0 - bl sub_8079F88 - movs r0, 0x1 - bl sub_8079F88 - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - adds r0, 0x6F - movs r1, 0 - strb r1, [r0] - ldr r3, =gSprites - ldr r0, [r2] - adds r0, 0x34 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] -_0807947C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079408 - - thumb_func_start sub_8079490 -sub_8079490: @ 8079490 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080794C4 - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _080794B4 - bl sub_800ADF8 - b _080794BA - .pool -_080794B4: - movs r0, 0xC - bl sub_800ABF4 -_080794BA: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0xC - strb r1, [r0] -_080794C4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079490 - - thumb_func_start sub_80794CC -sub_80794CC: @ 80794CC - push {lr} - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _08079518 - bl sub_80771BC - cmp r0, 0 - beq _0807953A - bl sub_807A09C - cmp r0, 0 - bne _0807953A - ldr r0, =gUnknown_02032184 - ldr r0, [r0] - bl Free - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - bl Free - bl FreeAllWindowBuffers - bl sub_800E084 - ldr r0, =c2_8056854 - bl SetMainCallback2 - b _0807953A - .pool -_08079518: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0807953A - ldr r0, =gUnknown_02032184 - ldr r0, [r0] - bl Free - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - bl Free - bl FreeAllWindowBuffers - ldr r0, =c2_8056854 - bl SetMainCallback2 -_0807953A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80794CC - - thumb_func_start sub_8079550 -sub_8079550: @ 8079550 - push {lr} - movs r0, 0 - bl sub_801048C - lsls r0, 24 - cmp r0, 0 - bne _08079574 - bl sub_807A09C - cmp r0, 0 - bne _08079574 - bl sub_800ADF8 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0xD - strb r1, [r0] -_08079574: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079550 - - thumb_func_start sub_807957C -sub_807957C: @ 807957C - push {lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0807959C - ldr r0, =0x0000bbcc - movs r1, 0 - bl sub_8078C10 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - movs r1, 0x64 - strb r1, [r0] -_0807959C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_807957C - - thumb_func_start sub_80795AC -sub_80795AC: @ 80795AC - push {lr} - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x6F - ldrb r0, [r0] - cmp r0, 0x11 - bhi _08079678 - lsls r0, 2 - ldr r1, =_080795CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080795CC: - .4byte _08079614 - .4byte _0807961A - .4byte _08079620 - .4byte _08079626 - .4byte _0807962C - .4byte _08079678 - .4byte _08079632 - .4byte _08079638 - .4byte _0807963E - .4byte _08079644 - .4byte _0807964A - .4byte _08079650 - .4byte _08079656 - .4byte _0807965C - .4byte _08079662 - .4byte _08079668 - .4byte _0807966E - .4byte _08079674 -_08079614: - bl sub_8078DBC - b _08079678 -_0807961A: - bl sub_8078F50 - b _08079678 -_08079620: - bl sub_807905C - b _08079678 -_08079626: - bl sub_8079218 - b _08079678 -_0807962C: - bl sub_80792E4 - b _08079678 -_08079632: - bl sub_807935C - b _08079678 -_08079638: - bl sub_8079398 - b _08079678 -_0807963E: - bl sub_8079408 - b _08079678 -_08079644: - bl sub_8078130 - b _08079678 -_0807964A: - bl sub_807816C - b _08079678 -_08079650: - bl sub_8079490 - b _08079678 -_08079656: - bl sub_80794CC - b _08079678 -_0807965C: - bl sub_80781C8 - b _08079678 -_08079662: - bl sub_80793C4 - b _08079678 -_08079668: - bl sub_8079034 - b _08079678 -_0807966E: - bl sub_8079550 - b _08079678 -_08079674: - bl sub_807957C -_08079678: - pop {r0} - bx r0 - thumb_func_end sub_80795AC - - thumb_func_start sub_807967C -sub_807967C: @ 807967C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - movs r1, 0x6 - bl __udivsi3 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r3, =gUnknown_0203229C - ldr r0, [r3] - adds r0, 0x74 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - bne _080796A8 - movs r0, 0x1 - strb r0, [r1] - ldr r0, [r3] - adds r0, 0x76 - adds r0, r2 - strb r4, [r0] -_080796A8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807967C - - thumb_func_start sub_80796B4 -sub_80796B4: @ 80796B4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x68 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203229C - ldr r4, [r0] - adds r0, r4, 0 - adds r0, 0x76 - adds r0, r7 - ldrb r0, [r0] - movs r1, 0x1 - str r1, [sp, 0x60] - cmp r0, 0x5 - bhi _080796DC - movs r2, 0 - str r2, [sp, 0x60] -_080796DC: - movs r1, 0x6 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - movs r0, 0 - mov r8, r0 - adds r0, r4, 0 - adds r0, 0x74 - adds r3, r0, r7 - ldrb r0, [r3] - cmp r0, 0x2 - bne _080796FA - b _08079884 -_080796FA: - cmp r0, 0x2 - bgt _08079708 - cmp r0, 0x1 - beq _08079716 - b _08079A24 - .pool -_08079708: - cmp r0, 0x3 - bne _0807970E - b _080798BC -_0807970E: - cmp r0, 0x4 - bne _08079714 - b _080799EC -_08079714: - b _08079A24 -_08079716: - movs r5, 0 - adds r0, r4, 0 - adds r0, 0x36 - adds r0, r7 - ldr r1, [sp, 0x60] - lsls r1, 1 - mov r9, r1 - lsls r6, r7, 1 - lsls r2, r7, 4 - str r2, [sp, 0x64] - ldrb r0, [r0] - cmp r8, r0 - bcs _0807976A - ldr r0, =gSprites - mov r8, r0 - ldr r4, =gUnknown_0203229C - ldr r0, [sp, 0x60] - add r0, r9 - lsls r2, r0, 1 - movs r3, 0x4 -_0807973E: - ldr r0, [r4] - adds r1, r5, r2 - adds r0, 0x28 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r3 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [r4] - adds r0, 0x36 - adds r0, r7 - ldrb r0, [r0] - cmp r5, r0 - bcc _0807973E -_0807976A: - movs r5, 0 - adds r0, r6, r7 - lsls r0, 1 - adds r4, r0, 0x2 -_08079772: - lsls r0, r5, 24 - asrs r0, 24 - adds r0, r4 - lsls r0, 24 - lsrs r0, 24 - bl ClearWindowTilemap - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08079772 - ldr r1, =gSprites - mov r8, r1 - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - ldr r6, [sp, 0x60] - add r6, r9 - lsls r3, r6, 1 - add r10, r3 - adds r0, 0x28 - add r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r0, =gUnknown_0203229C - ldr r4, [r0] - adds r4, 0x28 - add r4, r10 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - movs r1, 0x14 - strh r1, [r0, 0x2E] - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - add r2, r8 - ldr r5, =gUnknown_0832DE24 - lsls r6, 2 - adds r0, r6, r5 - ldrb r0, [r0] - adds r3, 0x1 - lsls r3, 1 - adds r3, r5 - ldrb r1, [r3] - adds r0, r1 - asrs r0, 1 - lsls r0, 3 - adds r0, 0xE - strh r0, [r2, 0x32] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r8 - adds r5, 0x1 - adds r6, r5 - ldrb r0, [r6] - lsls r0, 3 - subs r0, 0xC - strh r0, [r1, 0x36] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - ldr r1, =sub_80D3014 - bl StoreSpriteCallbackInData6 - ldr r2, =gUnknown_0203229C - ldr r1, [r2] - adds r1, 0x74 - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r2] - adds r0, 0x28 - add r0, r10 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - bl sub_80A6DEC - ldr r1, =gTradePartyBoxTilemap - ldr r0, [sp, 0x64] - subs r2, r0, r7 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0xF - str r0, [sp] - movs r0, 0x11 - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [sp, 0x60] - cmp r1, 0 - beq _08079868 - b _08079A24 -_08079868: - bl sub_8079F74 - b _08079A24 - .pool -_08079884: - ldr r2, =gSprites - ldr r1, [sp, 0x60] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - add r0, r10 - adds r1, r4, 0 - adds r1, 0x28 - adds r1, r0 - ldrb r1, [r1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =sub_80D3014 - cmp r1, r0 - beq _080798AC - b _08079A24 -_080798AC: - movs r0, 0x3 - strb r0, [r3] - b _08079A24 - .pool -_080798BC: - ldr r1, =gTradeMovesBoxTilemap - ldr r0, [sp, 0x60] - lsls r2, r0, 4 - subs r2, r0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0xF - str r0, [sp] - movs r0, 0x11 - str r0, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r6, =gSprites - ldr r1, =gUnknown_0203229C - ldr r4, [r1] - ldr r2, [sp, 0x60] - lsls r3, r2, 1 - adds r3, r2 - lsls r1, r3, 1 - mov r2, r10 - adds r0, r2, r1 - adds r4, 0x28 - adds r4, r0 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - ldr r5, =gUnknown_0832DE24 - lsls r3, 2 - adds r0, r3, r5 - ldrb r0, [r0] - adds r1, 0x1 - lsls r1, 1 - adds r1, r5 - ldrb r1, [r1] - adds r0, r1 - asrs r0, 1 - lsls r0, 3 - adds r0, 0xE - strh r0, [r2, 0x20] - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r5, 0x1 - adds r3, r5 - ldrb r0, [r3] - lsls r0, 3 - subs r0, 0xC - strh r0, [r1, 0x22] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r8 - strh r1, [r0, 0x24] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r2, r8 - strh r2, [r0, 0x26] - add r0, sp, 0x14 - ldr r1, [sp, 0x60] - mov r2, r10 - bl sub_8079A3C - lsls r4, r7, 1 - adds r5, r4, 0 - adds r5, 0xE - lsls r5, 24 - lsrs r5, 24 - lsls r0, 24 - asrs r0, 24 - movs r2, 0x50 - subs r2, r0 - lsrs r0, r2, 31 - adds r2, r0 - asrs r2, 1 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0832DEE0 - mov r8, r0 - str r0, [sp] - movs r1, 0 - str r1, [sp, 0x4] - add r0, sp, 0x14 - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r3, 0x4 - bl AddTextPrinterParameterized3 - add r6, sp, 0x28 - adds r0, r6, 0 - ldr r1, [sp, 0x60] - mov r2, r10 - bl sub_8079AA4 - adds r4, 0xF - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - mov r2, r8 - str r2, [sp, 0x8] - str r1, [sp, 0xC] - str r6, [sp, 0x10] - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl AddTextPrinterParameterized4 - adds r0, r5, 0 - bl PutWindowTilemap - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - b _08079A1A - .pool -_080799EC: - ldr r0, =gUnknown_0832DF99 - lsls r1, r7, 1 - adds r4, r1, r0 - ldrb r2, [r4] - adds r2, 0x4 - lsls r2, 24 - lsrs r2, 24 - adds r0, 0x1 - adds r1, r0 - ldrb r3, [r1] - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4] - str r0, [sp] - ldrb r0, [r1] - str r0, [sp, 0x4] - adds r0, r7, 0 - mov r1, r10 - bl sub_8079C4C - ldr r2, =gUnknown_0203229C - ldr r1, [r2] -_08079A1A: - adds r1, 0x74 - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08079A24: - add sp, 0x68 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80796B4 - - thumb_func_start sub_8079A3C -sub_8079A3C: @ 8079A3C - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r1, 24 - lsls r2, 24 - lsrs r2, 24 - cmp r1, 0 - bne _08079A64 - movs r0, 0x64 - muls r0, r2 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2 - mov r2, sp - bl GetMonData - b _08079A74 - .pool -_08079A64: - movs r0, 0x64 - muls r0, r2 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2 - mov r2, sp - bl GetMonData -_08079A74: - adds r0, r4, 0 - mov r1, sp - bl StringCopy10 - movs r0, 0 - movs r1, 0x2 - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0 - adds r1, r4, 0 - bl GetStringWidth - lsls r0, 24 - lsrs r0, 24 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8079A3C - - thumb_func_start sub_8079AA4 -sub_8079AA4: @ 8079AA4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r6, r0, 0 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 1 - adds r0, r2, r0 - adds r1, 0x51 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - bne _08079B5C - movs r4, 0 - movs r0, 0x64 - adds r5, r2, 0 - muls r5, r0 - ldr r0, =gPlayerParty - mov r9, r0 - ldr r2, =gEnemyParty - mov r8, r2 -_08079ADE: - cmp r7, 0 - bne _08079AF8 - adds r1, r4, 0 - adds r1, 0xD - mov r2, r9 - b _08079AFE - .pool -_08079AF8: - adds r1, r4, 0 - adds r1, 0xD - mov r2, r8 -_08079AFE: - adds r0, r5, r2 - movs r2, 0 - bl GetMonData - lsls r1, r4, 1 - add r1, sp - strh r0, [r1] - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x3 - bls _08079ADE - ldr r1, =gText_EmptyString7 - adds r0, r6, 0 - bl StringCopy - movs r4, 0 -_08079B20: - lsls r0, r4, 1 - mov r2, sp - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _08079B3C - adds r1, r0, 0 - movs r0, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r6, 0 - bl StringAppend -_08079B3C: - adds r0, r6, 0 - ldr r1, =gText_NewLine3 - bl StringAppend - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x3 - bls _08079B20 - b _08079B6C - .pool -_08079B5C: - ldr r1, =gText_EmptyString7 - adds r0, r6, 0 - bl StringCopy - ldr r1, =gText_FourQuestionMarks - adds r0, r6, 0 - bl StringAppend -_08079B6C: - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079AA4 - - thumb_func_start sub_8079B84 -sub_8079B84: @ 8079B84 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 1 - adds r1, 0x2 - lsls r4, 24 - asrs r4, 24 - adds r4, r1 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - adds r1, r5, 0 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0832DEE0 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r5, [sp, 0x8] - adds r0, r4, 0 - movs r1, 0 - movs r3, 0x4 - bl AddTextPrinterParameterized3 - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079B84 - - thumb_func_start sub_8079BE0 -sub_8079BE0: @ 8079BE0 - push {r4-r7,lr} - sub sp, 0x34 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r7, =gEnemyParty - cmp r6, 0 - bne _08079BF0 - ldr r7, =gPlayerParty -_08079BF0: - movs r4, 0 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x36 - adds r0, r6 - ldrb r0, [r0] - cmp r4, r0 - bcs _08079C36 - add r5, sp, 0x14 -_08079C02: - movs r0, 0x64 - muls r0, r4 - adds r0, r7, r0 - movs r1, 0x2 - mov r2, sp - bl GetMonData - adds r0, r5, 0 - mov r1, sp - bl StringCopy10 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_8079B84 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x36 - adds r0, r6 - ldrb r0, [r0] - cmp r4, r0 - bcc _08079C02 -_08079C36: - add sp, 0x34 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079BE0 - - thumb_func_start sub_8079C4C -sub_8079C4C: @ 8079C4C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - ldr r4, [sp, 0x3C] - ldr r5, [sp, 0x40] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - lsls r3, 24 - lsrs r3, 24 - mov r10, r3 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gUnknown_08DDD704 - movs r0, 0x6 - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x1 - adds r2, r4, 0 - adds r3, r5, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - mov r0, r8 - cmp r0, 0 - bne _08079CB0 - movs r0, 0x64 - muls r0, r7 - ldr r1, =gPlayerParty - b _08079CB6 - .pool -_08079CB0: - movs r0, 0x64 - muls r0, r7 - ldr r1, =gEnemyParty -_08079CB6: - adds r0, r1 - movs r1, 0x38 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r6, r0, 24 - ldr r4, =gUnknown_0203229C - ldr r5, [r4] - mov r1, r8 - lsls r2, r1, 1 - adds r1, r2, r1 - lsls r1, 1 - adds r1, r7, r1 - adds r0, r5, 0 - adds r0, 0x51 - adds r0, r1 - ldrb r0, [r0] - str r2, [sp, 0x18] - cmp r0, 0 - bne _08079D34 - adds r0, r6, 0 - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r2, r0, 24 - mov r0, r10 - lsls r3, r0, 5 - cmp r2, 0 - beq _08079D08 - mov r1, r9 - adds r0, r1, r3 - lsls r0, 1 - movs r1, 0x8F - lsls r1, 4 - adds r5, r1 - adds r1, r5, r0 - adds r0, r2, 0 - adds r0, 0x60 - strh r0, [r1] -_08079D08: - ldr r4, [r4] - mov r1, r9 - adds r0, r1, r3 - adds r0, 0x1 - lsls r0, 1 - movs r3, 0x8F - lsls r3, 4 - adds r4, r3 - adds r4, r0 - adds r0, r6, 0 - movs r1, 0xA - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x70 - strh r0, [r4] - b _08079D72 - .pool -_08079D34: - mov r1, r10 - lsls r0, r1, 5 - mov r1, r9 - adds r3, r1, r0 - adds r1, r3, 0 - subs r1, 0x20 - lsls r1, 1 - movs r0, 0x8F - lsls r0, 4 - adds r2, r5, r0 - adds r1, r2, r1 - adds r0, r3, 0 - subs r0, 0x21 - lsls r0, 1 - adds r0, r2, r0 - ldrh r0, [r0] - strh r0, [r1] - adds r1, r3, 0 - subs r1, 0x1F - lsls r1, 1 - adds r1, r2, r1 - adds r0, r3, 0 - subs r0, 0x24 - lsls r0, 1 - adds r2, r0 - ldrh r2, [r2] - movs r3, 0x80 - lsls r3, 3 - adds r0, r3, 0 - orrs r0, r2 - strh r0, [r1] -_08079D72: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - ldr r0, [sp, 0x18] - add r0, r8 - lsls r0, 1 - adds r0, r7, r0 - adds r1, 0x51 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - beq _08079D94 - movs r2, 0x90 - lsls r2, 3 - b _08079E16 - .pool -_08079D94: - mov r0, r8 - cmp r0, 0 - bne _08079DC0 - movs r0, 0x64 - adds r4, r7, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - bl GetMonGender - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r4, 0 - movs r1, 0x2 - add r2, sp, 0xC - bl GetMonData - b _08079DDE - .pool -_08079DC0: - movs r0, 0x64 - adds r4, r7, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - bl GetMonGender - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r4, 0 - movs r1, 0x2 - add r2, sp, 0xC - bl GetMonData -_08079DDE: - cmp r5, 0 - beq _08079DF0 - cmp r5, 0xFE - beq _08079E04 - movs r2, 0x83 - b _08079E16 - .pool -_08079DF0: - add r0, sp, 0xC - movs r1, 0 - bl NameHasGenderSymbol - lsls r0, 24 - movs r2, 0x83 - cmp r0, 0 - bne _08079E16 - movs r2, 0x84 - b _08079E16 -_08079E04: - add r0, sp, 0xC - movs r1, 0xFE - bl NameHasGenderSymbol - lsls r0, 24 - movs r2, 0x83 - cmp r0, 0 - bne _08079E16 - movs r2, 0x85 -_08079E16: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - mov r0, r10 - subs r0, 0x1 - lsls r0, 5 - add r0, r9 - adds r0, 0x1 - lsls r0, 1 - movs r3, 0x8F - lsls r3, 4 - adds r1, r3 - adds r1, r0 - strh r2, [r1] - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079C4C - - thumb_func_start sub_8079E44 -sub_8079E44: @ 8079E44 - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r6, r0, 24 - movs r7, 0 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x36 - adds r0, r6 - ldrb r0, [r0] - cmp r7, r0 - bge _08079E94 - lsls r0, r6, 1 - adds r0, r6 - ldr r1, =gUnknown_0832DE3E - lsls r0, 2 - adds r5, r0, r1 - ldr r1, =gUnknown_0832DE56 - adds r4, r0, r1 -_08079E6A: - lsls r1, r7, 24 - lsrs r1, 24 - ldrb r2, [r5] - ldrb r3, [r5, 0x1] - ldrb r0, [r4] - str r0, [sp] - ldrb r0, [r4, 0x1] - str r0, [sp, 0x4] - adds r0, r6, 0 - bl sub_8079C4C - adds r5, 0x2 - adds r4, 0x2 - adds r7, 0x1 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x36 - adds r0, r6 - ldrb r0, [r0] - cmp r7, r0 - blt _08079E6A -_08079E94: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079E44 - - thumb_func_start sub_8079EA8 -sub_8079EA8: @ 8079EA8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r12, r0 - movs r7, 0 - ldr r3, =gUnknown_0203229C - ldr r0, [r3] - adds r0, 0x36 - add r0, r12 - ldrb r0, [r0] - cmp r7, r0 - bge _08079F5A - ldr r6, =gSprites - mov r9, r3 - mov r1, r12 - lsls r0, r1, 1 - add r0, r12 - lsls r2, r0, 1 - mov r10, r2 - ldr r1, =gUnknown_0832DE24 - movs r2, 0 - mov r8, r2 - lsls r0, 2 - adds r5, r0, r1 -_08079EE0: - mov r1, r9 - ldr r0, [r1] - mov r2, r10 - adds r4, r7, r2 - adds r0, 0x28 - adds r0, r4 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - mov r0, r9 - ldr r3, [r0] - adds r2, r3, 0 - adds r2, 0x28 - adds r2, r4 - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r5] - lsls r0, 3 - adds r0, 0xE - strh r0, [r1, 0x20] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r5, 0x1] - lsls r0, 3 - subs r0, 0xC - strh r0, [r1, 0x22] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r8 - strh r1, [r0, 0x24] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r2, r8 - strh r2, [r0, 0x26] - adds r5, 0x2 - adds r7, 0x1 - adds r3, 0x36 - add r3, r12 - ldrb r3, [r3] - cmp r7, r3 - blt _08079EE0 -_08079F5A: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079EA8 - - thumb_func_start sub_8079F74 -sub_8079F74: @ 8079F74 - push {lr} - movs r0, 0x1 - bl rbox_fill_rectangle - movs r0, 0x1 - bl sub_8079BE0 - pop {r0} - bx r0 - thumb_func_end sub_8079F74 - - thumb_func_start sub_8079F88 -sub_8079F88: @ 8079F88 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gTradePartyBoxTilemap - lsls r2, r4, 4 - subs r2, r4 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0xF - str r0, [sp] - movs r0, 0x11 - str r0, [sp, 0x4] - movs r6, 0 - str r6, [sp, 0x8] - movs r0, 0x1 - movs r3, 0 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - adds r0, r4, 0 - bl sub_8079E44 - adds r0, r4, 0 - bl sub_8079BE0 - adds r0, r4, 0 - bl sub_8079EA8 - ldr r0, =gUnknown_0832DE94 - ldr r0, [r0, 0x4] - ldr r5, =gUnknown_0203229C - ldr r1, [r5] - adds r1, 0x72 - ldrh r1, [r1] - lsls r1, 5 - ldr r2, =0x06010000 - adds r1, r2 - movs r2, 0x18 - bl sub_807A308 - ldr r0, [r5] - adds r0, 0x74 - adds r0, r4 - strb r6, [r0] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8079F88 - - thumb_func_start sub_807A000 -sub_807A000: @ 807A000 - push {lr} - sub sp, 0x8 - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_807A000 - - thumb_func_start sub_807A024 -sub_807A024: @ 807A024 - push {lr} - sub sp, 0x8 - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_807A024 - - thumb_func_start sub_807A048 -sub_807A048: @ 807A048 - push {r4-r7,lr} - lsls r0, 16 - lsrs r5, r0, 16 - lsls r1, 24 - lsrs r6, r1, 24 - movs r3, 0 - ldr r4, =gUnknown_0203229C - mov r12, r4 - movs r7, 0x8D - lsls r7, 4 -_0807A05C: - mov r1, r12 - ldr r0, [r1] - lsls r1, r3, 3 - adds r2, r0, r1 - adds r0, r2, r7 - ldrb r0, [r0] - cmp r0, 0 - bne _0807A090 - ldr r3, =0x000008d2 - adds r0, r2, r3 - strh r5, [r0] - adds r3, 0x2 - adds r0, r2, r3 - strb r6, [r0] - ldr r0, [r4] - adds r0, r1 - movs r1, 0x8D - lsls r1, 4 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - b _0807A096 - .pool -_0807A090: - adds r3, 0x1 - cmp r3, 0x3 - ble _0807A05C -_0807A096: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_807A048 - - thumb_func_start sub_807A09C -sub_807A09C: @ 807A09C - push {lr} - movs r3, 0 - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - movs r2, 0x8D - lsls r2, 4 - adds r1, r0, r2 - movs r2, 0x3 -_0807A0AC: - ldrb r0, [r1] - adds r3, r0 - adds r1, 0x8 - subs r2, 0x1 - cmp r2, 0 - bge _0807A0AC - adds r0, r3, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_807A09C - - thumb_func_start sub_807A0C4 -sub_807A0C4: @ 807A0C4 - push {r4,r5,lr} - movs r4, 0 - ldr r3, =gUnknown_0203229C -_0807A0CA: - ldr r0, [r3] - lsls r1, r4, 3 - adds r2, r0, r1 - movs r5, 0x8D - lsls r5, 4 - adds r0, r2, r5 - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0 - beq _0807A18C - ldr r0, =0x000008d2 - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _0807A0F8 - subs r0, 0x1 - strh r0, [r1] - b _0807A18C - .pool -_0807A0F8: - ldr r1, =0x000008d4 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x8 - bhi _0807A17A - lsls r0, 2 - ldr r1, =_0807A114 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807A114: - .4byte _0807A138 - .4byte _0807A14C - .4byte _0807A154 - .4byte _0807A15C - .4byte _0807A15C - .4byte _0807A15C - .4byte _0807A164 - .4byte _0807A16C - .4byte _0807A174 -_0807A138: - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0x80 - movs r1, 0x14 - bl sub_8077170 - b _0807A17A - .pool -_0807A14C: - movs r0, 0 - bl sub_807A19C - b _0807A17A -_0807A154: - movs r0, 0x2 - bl sub_807A19C - b _0807A17A -_0807A15C: - movs r0, 0x3 - bl sub_807A19C - b _0807A17A -_0807A164: - movs r0, 0x6 - bl sub_807A19C - b _0807A17A -_0807A16C: - movs r0, 0x7 - bl sub_807A19C - b _0807A17A -_0807A174: - movs r0, 0x8 - bl sub_807A19C -_0807A17A: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r1, r5 - movs r2, 0x8D - lsls r2, 4 - adds r1, r2 - movs r2, 0 - strb r2, [r1] - adds r3, r0, 0 -_0807A18C: - adds r4, 0x1 - cmp r4, 0x3 - ble _0807A0CA - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A0C4 - - thumb_func_start sub_807A19C -sub_807A19C: @ 807A19C - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0832DEBC - lsls r4, 2 - adds r4, r0 - ldr r2, [r4] - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x14 - movs r2, 0xC - bl sub_8098858 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A19C - - thumb_func_start sub_807A1F0 -sub_807A1F0: @ 807A1F0 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_0203229C - ldr r1, [r0] - adds r3, r1, 0 - adds r3, 0xA8 - ldrb r1, [r3] - adds r4, r0, 0 - cmp r1, 0xD - bhi _0807A22C - ldr r1, =gUnknown_02032188 - ldrb r0, [r3] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp] - ldr r0, =0xffff0000 - ldr r2, [sp, 0x4] - ands r2, r0 - movs r0, 0x80 - lsls r0, 1 - orrs r2, r0 - str r2, [sp, 0x4] - ldrb r1, [r3] - adds r1, 0xC8 - lsls r1, 16 - ldr r0, =0x0000ffff - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x4] -_0807A22C: - ldr r0, [r4] - adds r0, 0xA8 - ldrb r0, [r0] - cmp r0, 0x11 - bhi _0807A2FC - lsls r0, 2 - ldr r1, =_0807A254 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807A254: - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A29C - .4byte _0807A2A0 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2B8 - .4byte _0807A2BC - .4byte _0807A2C8 - .4byte _0807A2D4 - .4byte _0807A2F0 -_0807A29C: - mov r0, sp - b _0807A2D6 -_0807A2A0: - mov r0, sp - bl LoadSpriteSheet - ldr r1, =gUnknown_0203229C - ldr r1, [r1] - adds r2, r1, 0 - adds r2, 0x72 - strh r0, [r2] - b _0807A2DE - .pool -_0807A2B8: - mov r0, sp - b _0807A2D6 -_0807A2BC: - ldr r0, =gSpritePalette_TradeScreenText - bl LoadSpritePalette - b _0807A2DA - .pool -_0807A2C8: - ldr r0, =gUnknown_0832DC44 - bl LoadSpritePalette - b _0807A2DA - .pool -_0807A2D4: - ldr r0, =gUnknown_0832DC3C -_0807A2D6: - bl LoadSpriteSheet -_0807A2DA: - ldr r0, =gUnknown_0203229C - ldr r1, [r0] -_0807A2DE: - adds r1, 0xA8 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0807A2FC - .pool -_0807A2F0: - ldr r0, [r4] - adds r0, 0xA8 - movs r1, 0 - strb r1, [r0] - movs r0, 0x1 - b _0807A2FE -_0807A2FC: - movs r0, 0 -_0807A2FE: - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_807A1F0 - - thumb_func_start sub_807A308 -sub_807A308: @ 807A308 - push {lr} - sub sp, 0x4 - movs r2, 0x6 - str r2, [sp] - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_807A308 - - thumb_func_start sub_807A320 -sub_807A320: @ 807A320 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0 - beq _0807A338 - cmp r0, 0x1 - beq _0807A3CC - b _0807A458 -_0807A338: - movs r7, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x36 - ldrb r0, [r0] - cmp r7, r0 - blt _0807A348 - b _0807A458 -_0807A348: - adds r6, r1, 0 - movs r5, 0 - mov r9, r5 -_0807A34E: - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - adds r1, r0, 0 - cmp r1, 0x1 - bne _0807A380 - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - mov r2, r9 - strb r2, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A3B0 - .pool -_0807A380: - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - adds r1, r0, 0 - cmp r1, 0 - bne _0807A39E - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A3B0 -_0807A39E: - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - mov r1, r9 -_0807A3B0: - strb r1, [r0] - ldr r0, =gUnknown_0203229C - adds r5, 0x1 - adds r7, 0x1 - ldr r0, [r0] - adds r0, 0x36 - add r0, r8 - ldrb r0, [r0] - cmp r7, r0 - blt _0807A34E - b _0807A458 - .pool -_0807A3CC: - movs r7, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x37 - ldrb r0, [r0] - cmp r7, r0 - bge _0807A458 - adds r6, r1, 0 - movs r5, 0x6 - movs r2, 0 - mov r9, r2 -_0807A3E2: - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gEnemyParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - adds r1, r0, 0 - cmp r1, 0x1 - bne _0807A414 - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - mov r2, r9 - strb r2, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A444 - .pool -_0807A414: - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - adds r1, r0, 0 - cmp r1, 0 - bne _0807A432 - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - b _0807A444 -_0807A432: - ldr r0, [r6] - adds r0, 0x45 - adds r0, r5 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r6] - adds r0, 0x51 - adds r0, r5 - mov r1, r9 -_0807A444: - strb r1, [r0] - ldr r0, =gUnknown_0203229C - adds r5, 0x1 - adds r7, 0x1 - ldr r0, [r0] - adds r0, 0x36 - add r0, r8 - ldrb r0, [r0] - cmp r7, r0 - blt _0807A3E2 -_0807A458: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A320 - - thumb_func_start sub_807A468 -sub_807A468: @ 807A468 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0807A478 - cmp r0, 0x1 - beq _0807A4D8 - b _0807A52C -_0807A478: - movs r6, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - bcs _0807A52C - adds r7, r1, 0 -_0807A488: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r0, r5, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - bl GetHPBarLevel - ldr r1, [r7] - adds r1, 0x5D - adds r1, r6 - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, [r7] - adds r0, 0x36 - ldrb r0, [r0] - cmp r6, r0 - bcc _0807A488 - b _0807A52C - .pool -_0807A4D8: - movs r6, 0 - ldr r1, =gUnknown_0203229C - ldr r0, [r1] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - bcs _0807A52C - adds r7, r1, 0 -_0807A4E8: - movs r0, 0x64 - adds r4, r6, 0 - muls r4, r0 - ldr r0, =gEnemyParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r0, r5, 16 - asrs r0, 16 - lsls r1, 16 - asrs r1, 16 - bl GetHPBarLevel - ldr r1, [r7] - adds r1, 0x63 - adds r1, r6 - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, [r7] - adds r0, 0x37 - ldrb r0, [r0] - cmp r6, r0 - bcc _0807A4E8 -_0807A52C: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A468 - - thumb_func_start sub_807A53C -sub_807A53C: @ 807A53C - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r5, 0 -_0807A544: - movs r4, 0 - ldr r2, =gUnknown_0203229C - ldr r0, [r2] - adds r0, 0x36 - adds r0, r5 - adds r1, r5, 0x1 - mov r8, r1 - ldrb r0, [r0] - cmp r4, r0 - bge _0807A596 - adds r6, r2, 0 - lsls r0, r5, 1 - adds r0, r5 - lsls r7, r0, 1 -_0807A560: - ldr r2, [r6] - adds r3, r4, r7 - adds r0, r2, 0 - adds r0, 0x28 - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r2, 0x5D - adds r2, r3 - ldrb r2, [r2] - movs r1, 0x4 - subs r1, r2 - lsls r1, 24 - lsrs r1, 24 - bl sub_80D32C8 - adds r4, 0x1 - ldr r0, [r6] - adds r0, 0x36 - adds r0, r5 - ldrb r0, [r0] - cmp r4, r0 - blt _0807A560 -_0807A596: - mov r5, r8 - cmp r5, 0x1 - ble _0807A544 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A53C - - thumb_func_start sub_807A5B0 -sub_807A5B0: @ 807A5B0 - push {r4,r5,lr} - movs r3, 0 - ldr r5, =gSaveBlock1Ptr - ldr r4, =0x000031a8 -_0807A5B8: - ldr r0, [r5] - adds r0, r4 - adds r2, r0, r3 - ldrb r0, [r2] - cmp r0, 0 - bne _0807A5DA - ldr r0, =gUnknown_0203229C - ldr r0, [r0] - adds r0, 0xA9 - adds r0, r3 - ldrb r0, [r0] - adds r1, r0, 0 - cmp r1, 0 - beq _0807A5DA - cmp r1, 0x3F - bhi _0807A5DA - strb r0, [r2] -_0807A5DA: - adds r3, 0x1 - cmp r3, 0xA - ble _0807A5B8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807A5B0 - - thumb_func_start sub_807A5F4 -sub_807A5F4: @ 807A5F4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x30 - mov r8, r0 - adds r7, r1, 0 - mov r9, r2 - movs r5, 0 - cmp r5, r7 - bge _0807A62E - mov r6, sp -_0807A60C: - movs r0, 0x64 - adds r4, r5, 0 - muls r4, r0 - add r4, r8 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - str r0, [r6, 0x18] - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - stm r6!, {r0} - adds r5, 0x1 - cmp r5, r7 - blt _0807A60C -_0807A62E: - bl IsNationalPokedexEnabled - mov r1, r9 - lsls r4, r1, 2 - cmp r0, 0 - bne _0807A65C - add r0, sp, 0x18 - adds r0, r4 - ldr r1, [r0] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - bne _0807A64C - movs r0, 0x3 - b _0807A718 -_0807A64C: - lsls r0, r1, 16 - lsrs r0, 16 - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _0807A65C - movs r0, 0x2 - b _0807A718 -_0807A65C: - 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 r0, =gLinkPlayers - adds r1, r0 - ldrb r0, [r1] - subs r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bls _0807A6AC - ldrb r1, [r1, 0x12] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _0807A6AC - add r0, sp, 0x18 - adds r0, r4 - ldr r1, [r0] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - bne _0807A6A0 - movs r0, 0x5 - b _0807A718 - .pool -_0807A6A0: - lsls r0, r1, 16 - lsrs r0, 16 - bl IsSpeciesInHoennDex - cmp r0, 0 - beq _0807A6D2 -_0807A6AC: - mov r1, sp - adds r0, r1, r4 - ldr r1, [r0] - movs r0, 0xCD - lsls r0, 1 - cmp r1, r0 - beq _0807A6BE - cmp r1, 0x97 - bne _0807A6D6 -_0807A6BE: - movs r0, 0x64 - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - add r0, r8 - movs r1, 0x50 - bl GetMonData - cmp r0, 0 - bne _0807A6D6 -_0807A6D2: - movs r0, 0x4 - b _0807A718 -_0807A6D6: - cmp r7, 0 - ble _0807A6F4 - movs r3, 0xCE - lsls r3, 1 - movs r2, 0 - add r1, sp, 0x18 - adds r5, r7, 0 -_0807A6E4: - ldr r0, [r1] - cmp r0, r3 - bne _0807A6EC - str r2, [r1] -_0807A6EC: - adds r1, 0x4 - subs r5, 0x1 - cmp r5, 0 - bne _0807A6E4 -_0807A6F4: - movs r2, 0 - movs r5, 0 - cmp r2, r7 - bge _0807A70E - add r1, sp, 0x18 -_0807A6FE: - cmp r5, r9 - beq _0807A706 - ldr r0, [r1] - adds r2, r0 -_0807A706: - adds r1, 0x4 - adds r5, 0x1 - cmp r5, r7 - blt _0807A6FE -_0807A70E: - cmp r2, 0 - bne _0807A716 - movs r0, 0x1 - b _0807A718 -_0807A716: - movs r0, 0 -_0807A718: - add sp, 0x30 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_807A5F4 - - thumb_func_start sub_807A728 -sub_807A728: @ 807A728 - push {r4-r7,lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0807A7B4 - movs r4, 0 - bl GetMultiplayerId - ldr r5, =gLinkPlayers - movs r7, 0x1 - eors r0, r7 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r1, [r1] - subs r0, r1, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bls _0807A7B4 - subs r0, r1, 0x4 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bhi _0807A762 - movs r4, 0x2 -_0807A762: - cmp r4, 0 - ble _0807A7B4 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r1, [r1, 0x12] - movs r6, 0xF0 - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _0807A7B0 - cmp r4, 0x2 - bne _0807A7B4 - bl GetMultiplayerId - eors r0, r7 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r5 - ldrb r1, [r1, 0x12] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - bne _0807A7B4 - movs r0, 0x2 - b _0807A7B6 - .pool -_0807A7B0: - movs r0, 0x1 - b _0807A7B6 -_0807A7B4: - movs r0, 0 -_0807A7B6: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_807A728 - - thumb_func_start sub_807A7BC -sub_807A7BC: @ 807A7BC - push {lr} - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0xCD - lsls r0, 1 - cmp r2, r0 - beq _0807A7D2 - cmp r2, 0x97 - bne _0807A7DA -_0807A7D2: - cmp r1, 0 - bne _0807A7DA - movs r0, 0x1 - b _0807A7DC -_0807A7DA: - movs r0, 0 -_0807A7DC: - pop {r1} - bx r1 - thumb_func_end sub_807A7BC - - thumb_func_start sub_807A7E0 -sub_807A7E0: @ 807A7E0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r4, [sp, 0x20] - ldr r5, [sp, 0x24] - ldr r6, [sp, 0x28] - lsls r2, 16 - lsrs r7, r2, 16 - lsls r3, 16 - lsrs r3, 16 - mov r8, r3 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 24 - lsrs r6, 24 - lsls r2, r0, 23 - lsrs r2, 31 - mov r9, r2 - lsls r0, 24 - lsrs r2, r0, 31 - lsls r0, r1, 23 - lsrs r0, 31 - mov r10, r0 - lsls r0, r1, 24 - lsrs r0, 31 - lsls r1, 18 - lsrs r1, 28 - cmp r1, 0x3 - beq _0807A832 - cmp r2, 0 - bne _0807A82A - movs r0, 0x8 - b _0807A8C0 -_0807A82A: - cmp r0, 0 - bne _0807A832 - movs r0, 0x9 - b _0807A8C0 -_0807A832: - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_807A7BC - cmp r0, 0 - bne _0807A898 - movs r0, 0xCE - lsls r0, 1 - cmp r8, r0 - bne _0807A84E - cmp r7, r8 - beq _0807A86C - movs r0, 0x2 - b _0807A8C0 -_0807A84E: - ldr r0, =gBaseStats - lsls r1, r7, 3 - subs r1, r7 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x6] - cmp r0, r4 - beq _0807A86C - ldrb r0, [r1, 0x7] - cmp r0, r4 - beq _0807A86C - movs r0, 0x1 - b _0807A8C0 - .pool -_0807A86C: - movs r0, 0xCE - lsls r0, 1 - cmp r7, r0 - bne _0807A87C - cmp r7, r8 - beq _0807A87C - movs r0, 0x3 - b _0807A8C0 -_0807A87C: - mov r0, r9 - cmp r0, 0 - bne _0807A8AA - movs r0, 0xCE - lsls r0, 1 - cmp r7, r0 - bne _0807A88E - movs r0, 0x6 - b _0807A8C0 -_0807A88E: - adds r0, r7, 0 - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _0807A89C -_0807A898: - movs r0, 0x4 - b _0807A8C0 -_0807A89C: - mov r0, r8 - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _0807A8AA - movs r0, 0x5 - b _0807A8C0 -_0807A8AA: - mov r0, r10 - cmp r0, 0 - bne _0807A8BE - adds r0, r7, 0 - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _0807A8BE - movs r0, 0x7 - b _0807A8C0 -_0807A8BE: - movs r0, 0 -_0807A8C0: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_807A7E0 - - thumb_func_start sub_807A8D0 -sub_807A8D0: @ 807A8D0 - push {r4-r6,lr} - lsls r1, 16 - lsrs r5, r1, 16 - adds r6, r5, 0 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 24 - lsrs r3, 24 - lsls r0, 23 - lsrs r4, r0, 31 - adds r0, r2, 0 - adds r1, r3, 0 - bl sub_807A7BC - cmp r0, 0 - bne _0807A90A - cmp r4, 0 - bne _0807A90E - movs r0, 0xCE - lsls r0, 1 - cmp r5, r0 - bne _0807A900 - movs r0, 0x2 - b _0807A910 -_0807A900: - adds r0, r6, 0 - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _0807A90E -_0807A90A: - movs r0, 0x1 - b _0807A910 -_0807A90E: - movs r0, 0 -_0807A910: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_807A8D0 - - thumb_func_start sub_807A918 -sub_807A918: @ 807A918 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - adds r6, r0, 0 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - movs r5, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r5, r0 - bge _0807A95A - mov r4, sp -_0807A934: - movs r0, 0x64 - muls r0, r5 - adds r0, r6, r0 - movs r1, 0x41 - bl GetMonData - str r0, [r4] - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - bne _0807A94E - movs r0, 0 - str r0, [r4] -_0807A94E: - adds r4, 0x4 - adds r5, 0x1 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r5, r0 - blt _0807A934 -_0807A95A: - movs r7, 0 - movs r6, 0x1 - movs r5, 0 - ldr r4, =gLinkPlayers - b _0807A980 - .pool -_0807A96C: - ldrb r0, [r4] - subs r0, 0x4 - cmp r0, 0x1 - bhi _0807A978 - movs r7, 0 - b _0807A97C -_0807A978: - movs r0, 0x1 - orrs r7, r0 -_0807A97C: - adds r4, 0x1C - adds r5, 0x1 -_0807A980: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - blt _0807A96C - movs r5, 0 - movs r4, 0 - b _0807A9B4 -_0807A992: - ldr r0, =gLinkPlayers - adds r2, r4, r0 - ldrb r1, [r2, 0x10] - movs r0, 0xF - ands r0, r1 - cmp r0, 0 - bne _0807A9A2 - movs r6, 0 -_0807A9A2: - cmp r7, 0 - beq _0807A9B0 - ldrb r0, [r2, 0x10] - lsrs r0, 4 - cmp r0, 0 - beq _0807A9B0 - movs r6, 0 -_0807A9B0: - adds r4, 0x1C - adds r5, 0x1 -_0807A9B4: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - blt _0807A992 - cmp r6, 0 - bne _0807A9EA - mov r1, r8 - lsls r0, r1, 2 - mov r1, sp - adds r4, r1, r0 - ldrh r0, [r4] - bl IsSpeciesInHoennDex - cmp r0, 0 - bne _0807A9E0 - movs r0, 0x2 - b _0807AA1A - .pool -_0807A9E0: - ldr r0, [r4] - cmp r0, 0 - bne _0807A9EA - movs r0, 0x3 - b _0807AA1A -_0807A9EA: - movs r2, 0 - movs r5, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r2, r0 - bge _0807AA0A - adds r3, r0, 0 - mov r1, sp -_0807A9FA: - cmp r8, r5 - beq _0807AA02 - ldr r0, [r1] - adds r2, r0 -_0807AA02: - adds r1, 0x4 - adds r5, 0x1 - cmp r5, r3 - blt _0807A9FA -_0807AA0A: - cmp r2, 0 - beq _0807AA18 - movs r0, 0 - b _0807AA1A - .pool -_0807AA18: - movs r0, 0x1 -_0807AA1A: - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_807A918 - - thumb_func_start sub_807AA28 -sub_807AA28: @ 807AA28 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _0807AA44 - movs r0, 0x17 - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2E] -_0807AA44: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_807AA28 - - thumb_func_start sub_807AA4C -sub_807AA4C: @ 807AA4C - push {r4,r5,lr} - adds r4, r0, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r0, 0x4 - ands r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _0807AA76 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _0807AA76 - movs r0, 0xC2 - bl PlaySE - strh r5, [r4, 0x2E] -_0807AA76: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_807AA4C - - thumb_func_start sub_807AA7C -sub_807AA7C: @ 807AA7C - push {lr} - adds r2, r0, 0 - movs r0, 0x30 - ldrsh r1, [r2, r0] - cmp r1, 0 - bne _0807AAB2 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xC - bne _0807AA98 - strh r1, [r2, 0x2E] -_0807AA98: - movs r1, 0x2E - ldrsh r0, [r2, r1] - lsls r0, 1 - ldr r1, =gUnknown_08338EA4 - adds r0, r1 - ldrb r1, [r2, 0x5] - lsrs r1, 4 - adds r1, 0x10 - lsls r1, 4 - adds r1, 0x4 - movs r2, 0x2 - bl LoadPalette -_0807AAB2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_807AA7C - - thumb_func_start sub_807AABC -sub_807AABC: @ 807AABC - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x2E] - adds r1, 0x1 - strh r1, [r2, 0x2E] - ldrh r0, [r2, 0x26] - adds r0, 0x1 - strh r0, [r2, 0x26] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0xA - bne _0807AADA - adds r0, r2, 0 - bl DestroySprite -_0807AADA: - pop {r0} - bx r0 - thumb_func_end sub_807AABC - - thumb_func_start sub_807AAE0 -sub_807AAE0: @ 807AAE0 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x2E] - adds r1, 0x1 - strh r1, [r2, 0x2E] - ldrh r0, [r2, 0x26] - subs r0, 0x1 - strh r0, [r2, 0x26] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0xA - bne _0807AAFE - adds r0, r2, 0 - bl DestroySprite -_0807AAFE: - pop {r0} - bx r0 - thumb_func_end sub_807AAE0 - - thumb_func_start sub_807AB04 -sub_807AB04: @ 807AB04 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xF - bne _0807AB20 - movs r0, 0xCC - bl PlaySE - movs r0, 0 - strh r0, [r4, 0x2E] -_0807AB20: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_807AB04 - - thumb_func_start sub_807AB28 -sub_807AB28: @ 807AB28 - push {r4,r5,lr} - sub sp, 0x20 - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - mov r12, r0 - adds r0, 0xD4 - ldrh r1, [r0] - lsls r1, 8 - adds r0, 0x2 - ldrh r2, [r0] - lsls r2, 8 - adds r0, 0x6 - movs r4, 0 - ldrsh r3, [r0, r4] - adds r0, 0x2 - movs r5, 0 - ldrsh r0, [r0, r5] - str r0, [sp] - mov r4, r12 - adds r4, 0xE8 - movs r5, 0 - ldrsh r0, [r4, r5] - str r0, [sp, 0x4] - movs r5, 0 - ldrsh r0, [r4, r5] - str r0, [sp, 0x8] - mov r0, r12 - adds r0, 0xEC - ldrh r0, [r0] - str r0, [sp, 0xC] - add r0, sp, 0x10 - bl DoBgAffineSet - add r0, sp, 0x10 - ldrh r1, [r0] - movs r0, 0x20 - bl SetGpuReg - add r0, sp, 0x10 - ldrh r1, [r0, 0x2] - movs r0, 0x22 - bl SetGpuReg - add r0, sp, 0x10 - ldrh r1, [r0, 0x4] - movs r0, 0x24 - bl SetGpuReg - add r0, sp, 0x10 - ldrh r1, [r0, 0x6] - movs r0, 0x26 - bl SetGpuReg - ldr r1, [sp, 0x18] - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x28 - bl SetGpuReg - ldr r1, [sp, 0x18] - lsrs r1, 16 - movs r0, 0x2A - bl SetGpuReg - ldr r1, [sp, 0x1C] - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x2C - bl SetGpuReg - ldr r1, [sp, 0x1C] - lsrs r1, 16 - movs r0, 0x2E - bl SetGpuReg - add sp, 0x20 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807AB28 - - thumb_func_start sub_807ABCC -sub_807ABCC: @ 807ABCC - push {r4,lr} - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r0, 0xE0 - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, [r4] - adds r0, 0xE2 - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - movs r0, 0 - bl GetGpuReg - lsls r0, 16 - movs r1, 0xE0 - lsls r1, 11 - ands r1, r0 - cmp r1, 0 - bne _0807AC18 - ldr r0, [r4] - adds r0, 0xE4 - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, [r4] - adds r0, 0xE6 - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - b _0807AC1C - .pool -_0807AC18: - bl sub_807AB28 -_0807AC1C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_807ABCC - - thumb_func_start sub_807AC24 -sub_807AC24: @ 807AC24 - push {lr} - bl sub_807ABCC - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_807AC24 - - thumb_func_start sub_807AC3C -sub_807AC3C: @ 807AC3C - push {r4,lr} - ldr r3, =gUnknown_020322A0 - ldr r1, [r3] - movs r0, 0x8A - adds r0, r1 - mov r12, r0 - movs r2, 0 - movs r0, 0 - mov r4, r12 - strh r0, [r4] - adds r1, 0x88 - strb r2, [r1] - ldr r0, [r3] - adds r0, 0x89 - strb r2, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807AC3C - - thumb_func_start sub_807AC64 -sub_807AC64: @ 807AC64 - push {r4,r5,lr} - ldr r0, =gUnknown_020322A0 - ldr r2, [r0] - adds r1, r2, 0 - adds r1, 0x88 - adds r3, r2, 0 - adds r3, 0x89 - ldrb r1, [r1] - adds r5, r0, 0 - ldrb r3, [r3] - cmp r1, r3 - bne _0807AC8C - adds r1, r2, 0 - adds r1, 0x8A - ldrh r0, [r1] - adds r0, 0x1 - b _0807AC92 - .pool -_0807AC8C: - adds r1, r2, 0 - adds r1, 0x8A - movs r0, 0 -_0807AC92: - strh r0, [r1] - adds r4, r5, 0 - ldr r0, [r4] - adds r0, 0x8A - ldrh r1, [r0] - movs r0, 0x96 - lsls r0, 1 - cmp r1, r0 - bls _0807ACC4 - bl CloseLink - ldr r0, =CB2_LinkError - bl SetMainCallback2 - ldr r1, [r4] - adds r3, r1, 0 - adds r3, 0x8A - movs r2, 0 - movs r0, 0 - strh r0, [r3] - adds r1, 0x89 - strb r2, [r1] - ldr r0, [r4] - adds r0, 0x88 - strb r2, [r0] -_0807ACC4: - ldr r0, [r5] - adds r1, r0, 0 - adds r1, 0x88 - ldrb r1, [r1] - adds r0, 0x89 - strb r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807AC64 - - thumb_func_start sub_807ACDC -sub_807ACDC: @ 807ACDC - push {lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0807ACF0 - movs r0, 0 - b _0807ACF8 - .pool -_0807ACF0: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 -_0807ACF8: - pop {r1} - bx r1 - thumb_func_end sub_807ACDC - - thumb_func_start sub_807ACFC -sub_807ACFC: @ 807ACFC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - movs r4, 0 - mov r8, r4 - cmp r6, 0 - bne _0807AD22 - ldr r0, =gUnknown_02032298 - ldrb r1, [r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - mov r8, r1 - movs r4, 0x1 -_0807AD22: - cmp r6, 0x1 - bne _0807AD40 - ldr r0, =gUnknown_02032298 - ldrb r0, [r0, 0x1] - movs r1, 0x6 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r1, r0 - ldr r0, =gEnemyParty - adds r1, r0 - mov r8, r1 - movs r4, 0x3 -_0807AD40: - cmp r5, 0 - beq _0807AD58 - cmp r5, 0x1 - beq _0807ADE0 - b _0807AE36 - .pool -_0807AD58: - mov r0, r8 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - mov r0, r8 - movs r1, 0 - bl GetMonData - adds r7, r0, 0 - cmp r6, 0 - bne _0807AD94 - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x8] - adds r2, r5, 0 - adds r3, r7, 0 - bl HandleLoadSpecialPokePic_2 - movs r4, 0 - b _0807ADB2 - .pool -_0807AD94: - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r2, [r1] - lsls r4, r6, 1 - adds r1, r4, 0x1 - lsls r1, 2 - adds r2, 0x4 - adds r2, r1 - ldr r1, [r2] - adds r2, r5, 0 - adds r3, r7, 0 - bl HandleLoadSpecialPokePic_DontHandleDeoxys -_0807ADB2: - mov r0, r8 - bl GetMonSpritePalStruct - bl LoadCompressedSpritePalette - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xF0 - adds r0, r4 - strh r5, [r0] - lsls r0, r6, 2 - adds r1, 0x68 - adds r1, r0 - str r7, [r1] - b _0807AE36 - .pool -_0807ADE0: - mov r0, r8 - bl GetMonSpritePalStruct - ldrh r0, [r0, 0x4] - adds r1, r4, 0 - bl SetMultiuseSpriteTemplateToPokemon - ldr r0, =gMultiuseSpriteTemplate - movs r1, 0x78 - movs r2, 0x3C - movs r3, 0x6 - bl CreateSprite - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - adds r1, 0x8E - adds r1, r6 - strb r0, [r1] - ldr r3, =gSprites - ldr r0, [r4] - adds r0, 0x8E - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r4] - adds r0, 0x8E - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, 0x1C - adds r0, r3 - ldr r1, =SpriteCallbackDummy - str r1, [r0] -_0807AE36: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807ACFC - - thumb_func_start sub_807AE50 -sub_807AE50: @ 807AE50 - push {r4,r5,lr} - sub sp, 0x4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0xC - bls _0807AE66 - b _0807B116 -_0807AE66: - lsls r0, 2 - ldr r1, =_0807AE78 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807AE78: - .4byte _0807AEAC - .4byte _0807AF58 - .4byte _0807AF9C - .4byte _0807AFBC - .4byte _0807B006 - .4byte _0807B034 - .4byte _0807B058 - .4byte _0807B070 - .4byte _0807B07A - .4byte _0807B094 - .4byte _0807B0B0 - .4byte _0807B0D4 - .4byte _0807B0F0 -_0807AEAC: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0807AEC0 - ldr r1, =gLinkType - ldr r2, =0x00001144 - adds r0, r2, 0 - strh r0, [r1] - bl CloseLink -_0807AEC0: - ldr r4, =gUnknown_020322A0 - movs r5, 0x80 - lsls r5, 1 - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4] - bl AllocateMonSpritesGfx - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r0, =sub_807AC24 - bl SetVBlankCallback - bl sub_807B170 - bl sub_807AC3C - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x8C - strh r2, [r0] - adds r0, 0x8 - strh r2, [r0] - adds r1, 0xEE - movs r0, 0x1 - strb r0, [r1] - ldr r3, [r4] - adds r0, r3, 0 - adds r0, 0xD4 - movs r1, 0x40 - strh r1, [r0] - adds r0, 0x2 - strh r1, [r0] - adds r0, 0x2 - strh r2, [r0] - adds r0, 0x2 - strh r2, [r0] - adds r1, r3, 0 - adds r1, 0xDC - movs r0, 0x78 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x50 - strh r0, [r1] - adds r0, r3, 0 - adds r0, 0xE8 - strh r5, [r0] - adds r0, 0x4 - strh r2, [r0] - b _0807B116 - .pool -_0807AF58: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r5, [r0] - cmp r5, 0 - bne _0807AF90 - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r0, 0xFA - movs r1, 0x1 - strb r1, [r0] - bl OpenLink - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - str r5, [r0, 0x64] - b _0807B116 - .pool -_0807AF90: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - movs r0, 0x4 - strb r0, [r1] - b _0807B116 -_0807AF9C: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x3C - bhi _0807AFAC - b _0807B116 -_0807AFAC: - movs r0, 0 - str r0, [r1, 0x64] - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - b _0807B0E4 - .pool -_0807AFBC: - bl IsLinkMaster - lsls r0, 24 - cmp r0, 0 - bne _0807AFC8 - b _0807B0DC -_0807AFC8: - bl GetLinkPlayerCount_2 - adds r4, r0, 0 - bl sub_800AA48 - lsls r4, 24 - lsls r0, 24 - cmp r4, r0 - bcc _0807B000 - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x1E - bhi _0807AFEA - b _0807B116 -_0807AFEA: - bl sub_800A620 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0807B0E4 - .pool -_0807B000: - bl sub_807AC64 - b _0807B116 -_0807B006: - bl sub_807AC64 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0x1 - beq _0807B014 - b _0807B116 -_0807B014: - bl IsLinkPlayerDataExchangeComplete - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0807B022 - b _0807B116 -_0807B022: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0807B0E4 - .pool -_0807B034: - ldr r2, =gUnknown_020322A0 - ldr r0, [r2] - adds r0, 0x72 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x73 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0x93 - strb r1, [r0] - movs r0, 0 - bl sub_807ACFC - b _0807B0DC - .pool -_0807B058: - movs r0, 0 - movs r1, 0x1 - bl sub_807ACFC - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0807B0E4 - .pool -_0807B070: - movs r0, 0x1 - movs r1, 0 - bl sub_807ACFC - b _0807B0DC -_0807B07A: - movs r0, 0x1 - movs r1, 0x1 - bl sub_807ACFC - bl sub_807B154 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0807B0E4 - .pool -_0807B094: - bl sub_807BA94 - ldr r0, =gUnknown_08338D18 - bl LoadSpriteSheet - ldr r0, =gUnknown_08338D20 - bl LoadSpritePalette - b _0807B0DC - .pool -_0807B0B0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0 - bl ShowBg - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0807B0E4 - .pool -_0807B0D4: - bl sub_807B140 - bl sub_807BAD8 -_0807B0DC: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_0807B0E4: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0807B116 - .pool -_0807B0F0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807B116 - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _0807B110 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl CreateWirelessStatusIndicatorSprite -_0807B110: - ldr r0, =sub_807EA2C - bl SetMainCallback2 -_0807B116: - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807AE50 - - thumb_func_start sub_807B140 -sub_807B140: @ 807B140 - push {lr} - movs r0, 0x5 - bl sub_807B62C - movs r0, 0 - bl sub_807B62C - pop {r0} - bx r0 - thumb_func_end sub_807B140 - - thumb_func_start sub_807B154 -sub_807B154: @ 807B154 - push {lr} - movs r0, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end sub_807B154 - - thumb_func_start sub_807B170 -sub_807B170: @ 807B170 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0x4 - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_08339014 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r5, 0x80 - lsls r5, 4 - adds r0, r5, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0 - bl SetBgTilemapBuffer - adds r0, r5, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x1 - bl SetBgTilemapBuffer - adds r0, r5, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x3 - bl SetBgTilemapBuffer - bl DeactivateAllTextPrinters - ldr r0, =gBattleTextboxTiles - mov r10, r0 - movs r0, 0 - mov r9, r0 - str r0, [sp] - mov r1, r10 - movs r2, 0 - movs r3, 0 - bl DecompressAndLoadBgGfxUsingHeap - ldr r0, =gBattleTextboxTilemap - mov r8, r0 - ldr r4, =gDecompressionBuffer - adds r1, r4, 0 - bl LZDecompressWram - movs r0, 0 - adds r1, r4, 0 - adds r2, r5, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r6, =gBattleTextboxPalette - adds r0, r6, 0 - movs r1, 0 - movs r2, 0x20 - bl LoadCompressedPalette - ldr r0, =gUnknown_08338FFC - bl InitWindows - mov r0, r9 - str r0, [sp] - movs r0, 0 - mov r1, r10 - movs r2, 0 - movs r3, 0 - bl DecompressAndLoadBgGfxUsingHeap - mov r0, r8 - adds r1, r4, 0 - bl LZDecompressWram - movs r0, 0 - adds r1, r4, 0 - adds r2, r5, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - adds r0, r6, 0 - movs r1, 0 - movs r2, 0x20 - bl LoadCompressedPalette - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807B170 - - thumb_func_start sub_807B270 -sub_807B270: @ 807B270 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xC - bls _0807B288 - b _0807B43E -_0807B288: - lsls r0, 2 - ldr r1, =_0807B29C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807B29C: - .4byte _0807B2D0 - .4byte _0807B43E - .4byte _0807B43E - .4byte _0807B43E - .4byte _0807B43E - .4byte _0807B3AC - .4byte _0807B3B6 - .4byte _0807B3C0 - .4byte _0807B3D0 - .4byte _0807B3F0 - .4byte _0807B40C - .4byte _0807B414 - .4byte _0807B438 -_0807B2D0: - ldr r1, =gUnknown_02032298 - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - movs r6, 0 - strb r0, [r1] - movs r0, 0x6 - strb r0, [r1, 0x1] - ldr r4, =gLinkPlayers + 8 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r0, r4, 0 - bl StringCopy - ldr r5, =gEnemyParty - adds r0, r5, 0 - movs r1, 0x7 - mov r2, sp - bl GetMonData - adds r0, r4, 0 - adds r0, 0x1C - mov r1, sp - bl StringCopy - subs r4, 0x8 - movs r0, 0 - mov r8, r0 - movs r0, 0x2 - strh r0, [r4, 0x1A] - adds r0, r5, 0 - movs r1, 0x3 - bl GetMonData - strh r0, [r4, 0x36] - ldr r4, =gUnknown_020322A0 - movs r5, 0x80 - lsls r5, 1 - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4] - bl AllocateMonSpritesGfx - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r0, =sub_807AC24 - bl SetVBlankCallback - bl sub_807B170 - ldr r0, [r4] - adds r0, 0xEE - mov r1, r8 - strb r1, [r0] - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x8C - strh r6, [r0] - adds r0, 0x8 - strh r6, [r0] - adds r0, 0x40 - movs r1, 0x40 - strh r1, [r0] - adds r0, 0x2 - strh r1, [r0] - adds r0, 0x2 - strh r6, [r0] - adds r0, 0x2 - strh r6, [r0] - adds r1, r2, 0 - adds r1, 0xDC - movs r0, 0x78 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x50 - strh r0, [r1] - adds r0, r2, 0 - adds r0, 0xE8 - strh r5, [r0] - adds r0, 0x4 - strh r6, [r0] - str r6, [r2, 0x64] - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x5 - strb r1, [r0] - b _0807B43E - .pool -_0807B3AC: - movs r0, 0 - movs r1, 0 - bl sub_807ACFC - b _0807B424 -_0807B3B6: - movs r0, 0 - movs r1, 0x1 - bl sub_807ACFC - b _0807B424 -_0807B3C0: - movs r0, 0x1 - movs r1, 0 - bl sub_807ACFC - movs r0, 0 - bl ShowBg - b _0807B424 -_0807B3D0: - movs r0, 0x1 - movs r1, 0x1 - bl sub_807ACFC - movs r0, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - b _0807B424 -_0807B3F0: - bl sub_807BA94 - ldr r0, =gUnknown_08338D18 - bl LoadSpriteSheet - ldr r0, =gUnknown_08338D20 - bl LoadSpritePalette - b _0807B424 - .pool -_0807B40C: - movs r0, 0 - bl ShowBg - b _0807B424 -_0807B414: - movs r0, 0x5 - bl sub_807B62C - movs r0, 0 - bl sub_807B62C - bl sub_807BAD8 -_0807B424: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0807B43E - .pool -_0807B438: - ldr r0, =sub_807B60C - bl SetMainCallback2 -_0807B43E: - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807B270 - - thumb_func_start sub_807B464 -sub_807B464: @ 807B464 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _0807B4B8 - adds r0, r5, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0 - movs r2, 0 - bl GetMonData - adds r5, r0, 0 - adds r0, r4, 0 - bl SpeciesToNationalPokedexNum - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r4, 0 - movs r1, 0x2 - bl GetSetPokedexFlag - adds r0, r4, 0 - movs r1, 0x3 - adds r2, r5, 0 - bl HandleSetPokedexFlag -_0807B4B8: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807B464 - - thumb_func_start sub_807B4C4 -sub_807B4C4: @ 807B4C4 - push {lr} - bl GetMultiplayerId - pop {r0} - bx r0 - thumb_func_end sub_807B4C4 - - thumb_func_start sub_807B4D0 -sub_807B4D0: @ 807B4D0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r4, 24 - lsrs r4, 24 - movs r5, 0x64 - mov r1, r9 - muls r1, r5 - ldr r0, =gPlayerParty - adds r7, r1, r0 - adds r0, r7, 0 - movs r1, 0x40 - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - adds r1, r4, 0 - muls r1, r5 - ldr r0, =gEnemyParty - adds r5, r1, r0 - adds r0, r5, 0 - movs r1, 0x40 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - cmp r6, 0xFF - beq _0807B52A - ldr r0, =gSaveBlock1Ptr - lsls r1, r6, 3 - adds r1, r6 - lsls r1, 2 - ldr r2, =0x00002be0 - adds r1, r2 - ldr r0, [r0] - adds r0, r1 - bl ClearMailStruct -_0807B52A: - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r1, r7, 0 - movs r2, 0x64 - bl memcpy - adds r0, r7, 0 - adds r1, r5, 0 - movs r2, 0x64 - bl memcpy - ldr r1, [r4] - adds r0, r5, 0 - movs r2, 0x64 - bl memcpy - movs r1, 0x46 - mov r0, sp - strb r1, [r0] - adds r0, r7, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _0807B566 - adds r0, r7, 0 - movs r1, 0x20 - mov r2, sp - bl SetMonData -_0807B566: - mov r0, r8 - cmp r0, 0xFF - beq _0807B57C - lsls r1, r0, 3 - add r1, r8 - lsls r1, 2 - ldr r0, =gUnknown_020321C0 - adds r1, r0 - adds r0, r7, 0 - bl GiveMailToMon2 -_0807B57C: - mov r0, r9 - bl sub_807B464 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0807B58E - bl sub_807B4C4 -_0807B58E: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807B4D0 - - thumb_func_start sub_807B5B8 -sub_807B5B8: @ 807B5B8 - push {r4,lr} - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r0, 0x93 - ldrb r0, [r0] - cmp r0, 0x1 - beq _0807B5D0 - cmp r0, 0x2 - beq _0807B5F6 - b _0807B600 - .pool -_0807B5D0: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0807B5F6 - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, [r4] - adds r1, 0x74 - movs r2, 0x14 - bl SendBlock - ldr r1, [r4] - adds r1, 0x93 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0807B5F6: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x93 - movs r1, 0 - strb r1, [r0] -_0807B600: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807B5B8 - - thumb_func_start sub_807B60C -sub_807B60C: @ 807B60C - push {lr} - bl sub_807BBC8 - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_807B60C - - thumb_func_start sub_807B62C -sub_807B62C: @ 807B62C - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x7 - bls _0807B638 - b _0807BA68 -_0807B638: - lsls r0, 2 - ldr r1, =_0807B648 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807B648: - .4byte _0807B668 - .4byte _0807B6DC - .4byte _0807B784 - .4byte _0807B7F8 - .4byte _0807B840 - .4byte _0807B90C - .4byte _0807B924 - .4byte _0807B9FC -_0807B668: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0xE4 - movs r0, 0 - strh r0, [r2] - adds r1, 0xE6 - movs r0, 0xB4 - strh r0, [r1] - movs r1, 0xAA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r1, =0x00005206 - movs r0, 0xC - bl SetGpuReg - ldr r0, =gTradeGba2_Pal - movs r1, 0x10 - movs r2, 0x60 - bl LoadPalette - ldr r3, =gTradeGba_Gfx - ldr r4, =0x06004000 - movs r5, 0xA1 - lsls r5, 5 - ldr r1, =0x040000d4 - ldr r6, =0x80000800 - movs r2, 0x80 - lsls r2, 5 - movs r7, 0x80 - lsls r7, 24 -_0807B6AA: - str r3, [r1] - str r4, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r2 - adds r4, r2 - subs r5, r2 - cmp r5, r2 - bhi _0807B6AA - b _0807BA4C - .pool -_0807B6DC: - ldr r4, =gUnknown_020322A0 - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0xE2 - movs r0, 0 - strh r0, [r1] - adds r2, 0xE0 - movs r1, 0xAE - lsls r1, 1 - strh r1, [r2] - movs r0, 0x16 - bl SetGpuReg - ldr r1, =0x00008502 - movs r0, 0xA - bl SetGpuReg - ldr r1, =0x00009206 - movs r0, 0xC - bl SetGpuReg - ldr r0, [r4] - adds r0, 0xFA - ldrb r0, [r0] - cmp r0, 0 - beq _0807B724 - ldr r1, =gUnknown_083369A0 - b _0807B726 - .pool -_0807B724: - ldr r1, =gUnknown_083359A0 -_0807B726: - ldr r2, =0x06002800 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x80000800 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - ldr r3, =gTradeGba_Gfx - movs r4, 0xC0 - lsls r4, 19 - movs r5, 0xA1 - lsls r5, 5 - ldr r1, =0x040000d4 - ldr r6, =0x80000800 - movs r2, 0x80 - lsls r2, 5 - movs r7, 0x80 - lsls r7, 24 -_0807B74A: - str r3, [r1] - str r4, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r2 - adds r4, r2 - subs r5, r2 - cmp r5, r2 - bhi _0807B74A - str r3, [r1] - str r4, [r1, 0x4] - lsrs r0, r5, 1 - orrs r0, r7 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r1, 0x92 - lsls r1, 5 - b _0807B820 - .pool -_0807B784: - ldr r0, =gUnknown_020322A0 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0xE0 - movs r1, 0 - strh r1, [r0] - adds r0, 0x2 - strh r1, [r0] - adds r0, 0x18 - ldrb r0, [r0] - cmp r0, 0 - bne _0807B7C0 - ldr r1, =0x00001241 - movs r0, 0 - bl SetGpuReg - ldr r0, =gUnknown_083379A0 - ldr r1, =0x06002800 - bl LZ77UnCompVram - movs r0, 0x8 - b _0807B7DA - .pool -_0807B7C0: - ldr r1, =0x00001241 - movs r0, 0 - bl SetGpuReg - ldr r1, =gUnknown_0832FFC0 - ldr r2, =0x06002800 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x80000400 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - movs r0, 0x1 -_0807B7DA: - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - b _0807BA68 - .pool -_0807B7F8: - ldr r0, =gUnknown_08337EA0 - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_08337EC0 - ldr r1, =0x06004000 - bl LZ77UnCompVram - ldr r0, =gUnknown_08338550 - ldr r1, =0x06009000 - bl LZ77UnCompVram - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0xE4 - movs r1, 0x50 - strh r1, [r0] - movs r1, 0xB2 - lsls r1, 5 -_0807B820: - movs r0, 0 - bl SetGpuReg - b _0807BA68 - .pool -_0807B840: - ldr r1, =0x00001441 - movs r0, 0 - bl SetGpuReg - ldr r1, =0x00001287 - movs r0, 0xC - bl SetGpuReg - ldr r0, =gUnknown_020322A0 - ldr r3, [r0] - adds r1, r3, 0 - adds r1, 0xD4 - movs r2, 0 - movs r0, 0x40 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x5C - strh r0, [r1] - adds r1, 0x12 - movs r0, 0x20 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x80 - lsls r0, 3 - strh r0, [r1] - adds r0, r3, 0 - adds r0, 0xEC - strh r2, [r0] - ldr r3, =gUnknown_08332F60 - ldr r4, =0x06004000 - movs r5, 0xA1 - lsls r5, 6 - ldr r1, =0x040000d4 - ldr r6, =0x80000800 - movs r2, 0x80 - lsls r2, 5 - movs r7, 0x80 - lsls r7, 24 -_0807B88C: - str r3, [r1] - str r4, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r2 - adds r4, r2 - subs r5, r2 - cmp r5, r2 - bhi _0807B88C - str r3, [r1] - str r4, [r1, 0x4] - lsrs r0, r5, 1 - orrs r0, r7 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0xFA - ldrb r0, [r0] - cmp r0, 0 - beq _0807B8EC - ldr r1, =gUnknown_083357A0 - ldr r2, =0x06009000 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x80000080 - b _0807BA64 - .pool -_0807B8EC: - ldr r1, =gUnknown_083358A0 - ldr r2, =0x06009000 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x80000080 - b _0807BA64 - .pool -_0807B90C: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0xE0 - movs r2, 0 - strh r2, [r1] - adds r0, 0xE2 - strh r2, [r0] - b _0807BA68 - .pool -_0807B924: - ldr r1, =0x00001441 - movs r0, 0 - bl SetGpuReg - ldr r1, =0x00001287 - movs r0, 0xC - bl SetGpuReg - ldr r0, =gUnknown_020322A0 - ldr r3, [r0] - adds r1, r3, 0 - adds r1, 0xD4 - movs r2, 0 - movs r0, 0x40 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x5C - strh r0, [r1] - adds r1, 0x12 - adds r0, 0xA4 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x80 - strh r0, [r1] - subs r1, 0xE - movs r0, 0x78 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0x50 - strh r0, [r1] - adds r0, r3, 0 - adds r0, 0xEC - strh r2, [r0] - ldr r3, =gUnknown_08332F60 - ldr r4, =0x06004000 - movs r5, 0xA1 - lsls r5, 6 - ldr r1, =0x040000d4 - ldr r6, =0x80000800 - movs r2, 0x80 - lsls r2, 5 - movs r7, 0x80 - lsls r7, 24 -_0807B97A: - str r3, [r1] - str r4, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r2 - adds r4, r2 - subs r5, r2 - cmp r5, r2 - bhi _0807B97A - str r3, [r1] - str r4, [r1, 0x4] - lsrs r0, r5, 1 - orrs r0, r7 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0xFA - ldrb r0, [r0] - cmp r0, 0 - beq _0807B9DC - ldr r1, =gUnknown_083357A0 - ldr r2, =0x06009000 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x80000080 - b _0807BA64 - .pool -_0807B9DC: - ldr r1, =gUnknown_083358A0 - ldr r2, =0x06009000 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x80000080 - b _0807BA64 - .pool -_0807B9FC: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0xE4 - movs r2, 0 - strh r2, [r1] - adds r0, 0xE6 - strh r2, [r0] - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - ldr r1, =0x00005206 - movs r0, 0xC - bl SetGpuReg - ldr r0, =gTradeGba2_Pal - movs r1, 0x10 - movs r2, 0x60 - bl LoadPalette - ldr r3, =gTradeGba_Gfx - ldr r4, =0x06004000 - movs r5, 0xA1 - lsls r5, 5 - ldr r1, =0x040000d4 - ldr r6, =0x80000800 - movs r2, 0x80 - lsls r2, 5 - movs r7, 0x80 - lsls r7, 24 -_0807BA3A: - str r3, [r1] - str r4, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r2 - adds r4, r2 - subs r5, r2 - cmp r5, r2 - bhi _0807BA3A -_0807BA4C: - str r3, [r1] - str r4, [r1, 0x4] - lsrs r0, r5, 1 - orrs r0, r7 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldr r1, =gUnknown_08331F60 - ldr r2, =0x06009000 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x80000800 -_0807BA64: - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] -_0807BA68: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807B62C - - thumb_func_start sub_807BA94 -sub_807BA94: @ 807BA94 - push {lr} - ldr r0, =gUnknown_08338D70 - bl LoadSpriteSheet - ldr r0, =gUnknown_08338DC0 - bl LoadSpriteSheet - ldr r0, =gUnknown_08338DF4 - bl LoadSpriteSheet - ldr r0, =gUnknown_08338E6C - bl LoadSpriteSheet - ldr r0, =gUnknown_08338D78 - bl LoadSpritePalette - ldr r0, =gUnknown_08338D80 - bl LoadSpritePalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_807BA94 - - thumb_func_start sub_807BAD8 -sub_807BAD8: @ 807BAD8 - push {r4,r5,lr} - sub sp, 0x14 - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0xEE - ldrb r0, [r0] - cmp r0, 0 - beq _0807BB68 - bl GetMultiplayerId - lsls r0, 24 - ldr r3, =gStringVar1 - movs r2, 0x80 - lsls r2, 17 - eors r2, r0 - lsrs r2, 24 - lsls r1, r2, 3 - subs r1, r2 - lsls r1, 2 - ldr r0, =gLinkPlayers + 8 - adds r1, r0 - adds r0, r3, 0 - bl StringCopy - ldr r5, =gUnknown_02032298 - ldrb r0, [r5, 0x1] - movs r1, 0x6 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - movs r4, 0x64 - muls r0, r4 - ldr r1, =gEnemyParty - adds r0, r1 - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar3 - mov r1, sp - bl StringCopy10 - ldrb r0, [r5] - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar2 - mov r1, sp - bl StringCopy10 - b _0807BBA4 - .pool -_0807BB68: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - lsls r4, r0, 4 - subs r4, r0 - lsls r4, 2 - ldr r0, =gIngameTrades - adds r4, r0 - ldr r0, =gStringVar1 - adds r1, r4, 0 - adds r1, 0x2B - bl StringCopy - ldr r0, =gStringVar3 - adds r1, r4, 0 - bl StringCopy10 - ldr r0, =gSpecialVar_0x8005 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar2 - mov r1, sp - bl StringCopy10 -_0807BBA4: - add sp, 0x14 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807BAD8 - - thumb_func_start sub_807BBC8 -sub_807BBC8: @ 807BBC8 - push {lr} - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0xFA - ldrb r0, [r0] - cmp r0, 0 - bne _0807BBE0 - bl sub_807CFC8 - b _0807BBE4 - .pool -_0807BBE0: - bl sub_807BBEC -_0807BBE4: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_807BBC8 - - thumb_func_start sub_807BBEC -sub_807BBEC: @ 807BBEC - push {r4-r7,lr} - sub sp, 0x14 - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r1, 0x94 - ldrh r5, [r1] - ldr r1, =0x0000010b - adds r7, r0, 0 - cmp r5, r1 - bls _0807BC04 - bl _0807CFB4 -_0807BC04: - lsls r0, r5, 2 - ldr r1, =_0807BC1C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807BC1C: - .4byte _0807C04C - .4byte _0807C0C4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807C120 - .4byte _0807C168 - .4byte _0807C1DC - .4byte _0807CFB4 - .4byte _0807C248 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807C26C - .4byte _0807C29C - .4byte _0807C2AE - .4byte _0807C2D0 - .4byte _0807C318 - .4byte _0807C348 - .4byte _0807C390 - .4byte _0807C3E0 - .4byte _0807C434 - .4byte _0807C4B8 - .4byte _0807C4DC - .4byte _0807C528 - .4byte _0807C574 - .4byte _0807C5D0 - .4byte _0807C630 - .4byte _0807C644 - .4byte _0807C658 - .4byte _0807C66C - .4byte _0807C794 - .4byte _0807C864 - .4byte _0807C8EC - .4byte _0807C964 - .4byte _0807C974 - .4byte _0807C994 - .4byte _0807C9E4 - .4byte _0807CA02 - .4byte _0807CA40 - .4byte _0807CA50 - .4byte _0807CAC8 - .4byte _0807CFB4 - .4byte _0807CAF0 - .4byte _0807CB30 - .4byte _0807CB70 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CB90 - .4byte _0807CBB8 - .4byte _0807CBD4 - .4byte _0807CBF4 - .4byte _0807CC9C - .4byte _0807CCD0 - .4byte _0807CD1C - .4byte _0807CDDC - .4byte _0807CE54 - .4byte _0807CEA0 - .4byte _0807CEB0 - .4byte _0807CEB6 - .4byte _0807CEDC - .4byte _0807CF38 - .4byte _0807CF5C - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CE18 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807C460 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CFB4 - .4byte _0807CE38 -_0807C04C: - ldr r3, =gSprites - ldr r0, [r7] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r4, [r7] - adds r2, r4, 0 - adds r2, 0x8E - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldr r1, =0x0000ff4c - strh r1, [r0, 0x24] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldr r2, =gMonFrontPicCoords - adds r0, r4, 0 - adds r0, 0xF0 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1] - strh r0, [r1, 0x26] - adds r1, r4, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - bl GetCurrentMapMusic - ldr r1, [r7] - adds r1, 0xF4 - strh r0, [r1] - ldr r0, =0x00000179 - bl PlayNewMapMusic - bl _0807CFB4 - .pool -_0807C0C4: - ldr r5, [r7] - adds r6, r5, 0 - adds r6, 0xE6 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - ble _0807C0F8 - ldr r2, =gSprites - adds r0, r5, 0 - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x24] - adds r1, 0x3 - strh r1, [r0, 0x24] - ldrh r0, [r6] - subs r0, 0x3 - strh r0, [r6] - bl _0807CFB4 - .pool -_0807C0F8: - ldr r2, =gSprites - adds r0, r5, 0 - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x24] - strh r1, [r6] - adds r1, r5, 0 - adds r1, 0x94 - movs r0, 0xA - strh r0, [r1] - bl _0807CFB4 - .pool -_0807C120: - ldr r4, =gStringVar4 - ldr r1, =gText_XWillBeSentToY - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r2, r0, 0 - adds r2, 0xF0 - ldrh r1, [r2] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _0807C14E - adds r0, r1, 0 - movs r1, 0 - bl PlayCry1 -_0807C14E: - ldr r3, [r4] - adds r1, r3, 0 - adds r1, 0x94 - movs r2, 0 - movs r0, 0xB - bl _0807CE06 - .pool -_0807C168: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x50 - beq _0807C178 - bl _0807CFB4 -_0807C178: - adds r0, r1, 0 - adds r0, 0x8E - ldrb r0, [r0] - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x5] - lsrs r1, 4 - movs r2, 0x2 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0x14 - str r2, [sp, 0x8] - ldr r2, =0x000fffff - str r2, [sp, 0xC] - movs r2, 0x78 - movs r3, 0x20 - bl sub_807671C - ldr r1, [r7] - adds r1, 0xD2 - strb r0, [r1] - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_ByeByeVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - bl _0807CFB4 - .pool -_0807C1DC: - ldr r5, =gSprites - ldr r0, [r7] - adds r0, 0xD2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r5, 0 - adds r4, 0x1C - adds r0, r4 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0807C1FC - bl _0807CFB4 -_0807C1FC: - ldr r0, =gSpriteTemplate_8338D28 - movs r1, 0x78 - movs r2, 0x20 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0xD3 - strb r0, [r1] - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_807E5D8 - str r1, [r0] - adds r2, 0xD2 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - ldr r1, [r7] - bl _0807CF4C - .pool -_0807C248: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x14 - strh r1, [r0] - bl _0807CFB4 - .pool -_0807C26C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807C27C - bl _0807CFB4 -_0807C27C: - movs r0, 0x4 - bl sub_807B62C - movs r0, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - bl _0807CF48 - .pool -_0807C29C: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl _0807CF44 -_0807C2AE: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807C2BE - bl _0807CFB4 -_0807C2BE: - ldr r0, [r7] - adds r0, 0x94 - movs r1, 0x17 - strh r1, [r0] - bl _0807CFB4 - .pool -_0807C2D0: - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r2, r0, 0 - adds r2, 0xEA - ldrh r1, [r2] - movs r0, 0x80 - lsls r0, 1 - cmp r1, r0 - bls _0807C2F0 - adds r0, r1, 0 - subs r0, 0x34 - strh r0, [r2] - b _0807C30C - .pool -_0807C2F0: - movs r0, 0x1 - bl sub_807B62C - ldr r3, [r4] - adds r1, r3, 0 - adds r1, 0xEA - movs r2, 0 - movs r0, 0x80 - strh r0, [r1] - subs r1, 0x56 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - str r2, [r3, 0x64] -_0807C30C: - ldr r0, =gUnknown_020322A0 - ldr r4, [r0] - bl _0807CB5C - .pool -_0807C318: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x14 - bhi _0807C328 - bl _0807CFB4 -_0807C328: - bl sub_807AB28 - ldr r0, =gSpriteTemplate_8338E74 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x91 - strb r0, [r1] - ldr r1, [r7] - bl _0807CF4C - .pool -_0807C348: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - blt _0807C368 - bl _0807CFB4 -_0807C368: - adds r0, r1, 0 - bl DestroySprite - movs r1, 0xC8 - lsls r1, 3 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x0000040c - movs r0, 0x52 - bl SetGpuReg - ldr r1, [r7] - bl _0807CF4C - .pool -_0807C390: - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xE0 - ldrh r1, [r0] - subs r1, 0x1 - strh r1, [r0] - lsls r1, 16 - movs r0, 0x9E - lsls r0, 17 - cmp r1, r0 - bne _0807C3B0 - adds r1, r2, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807C3B0: - ldr r0, [r7] - adds r0, 0xE0 - movs r2, 0 - ldrsh r1, [r0, r2] - movs r0, 0xA4 - lsls r0, 1 - cmp r1, r0 - beq _0807C3C4 - bl _0807CFB4 -_0807C3C4: - ldr r0, =gSpriteTemplate_8338DFC - movs r1, 0x80 - movs r2, 0x41 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x92 - strb r0, [r1] - bl _0807CFB4 - .pool -_0807C3E0: - ldr r0, =gUnknown_08338D88 - movs r1, 0x80 - movs r2, 0x50 - movs r3, 0x3 - bl CreateSprite - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - adds r1, 0x90 - strb r0, [r1] - ldr r0, =gSpriteTemplate_8338DC8 - movs r1, 0x80 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - ldr r1, [r4] - bl _0807CF4C - .pool -_0807C434: - ldr r2, [r7] - adds r1, r2, 0 - adds r1, 0xE0 - ldrh r0, [r1] - subs r0, 0x2 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA6 - bne _0807C44E - subs r1, 0x4C - movs r0, 0xC8 - strh r0, [r1] -_0807C44E: - ldr r1, =0x00001241 - movs r0, 0 - bl SetGpuReg - bl _0807CFB4 - .pool -_0807C460: - ldr r2, =gSprites - ldr r4, [r7] - adds r3, r4, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x2 - strh r1, [r0, 0x22] - adds r0, r4, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x2 - strh r1, [r0, 0x22] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r3, 0x22 - ldrsh r1, [r0, r3] - movs r0, 0x8 - negs r0, r0 - cmp r1, r0 - blt _0807C4A6 - bl _0807CFB4 -_0807C4A6: - adds r1, r4, 0 - adds r1, 0x94 - movs r0, 0x1D - strh r0, [r1] - bl _0807CFB4 - .pool -_0807C4B8: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x1E - strh r1, [r0] - bl _0807CFB4 - .pool -_0807C4DC: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807C4EC - bl _0807CFB4 -_0807C4EC: - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - movs r0, 0x2 - bl sub_807B62C - ldr r1, [r7] - bl _0807CF4C - .pool -_0807C528: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r5, =gSpriteTemplate_8338DC8 - adds r0, r5, 0 - movs r1, 0x6F - movs r2, 0xAA - movs r3, 0 - bl CreateSprite - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - adds r1, 0x90 - strb r0, [r1] - movs r2, 0xA - negs r2, r2 - adds r0, r5, 0 - movs r1, 0x81 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] - adds r1, 0x91 - strb r0, [r1] - ldr r1, [r4] - bl _0807CF4C - .pool -_0807C574: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807C592 - movs r0, 0x2E - bl PlaySE - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807C592: - ldr r3, =gSprites - ldr r0, =gUnknown_020322A0 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r2, 0x91 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - bl _0807CFB4 - .pool -_0807C5D0: - ldr r5, =gSprites - ldr r4, [r7] - adds r2, r4, 0 - adds r2, 0x90 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r6, r4, 0 - adds r6, 0x91 - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r5 - movs r0, 0x26 - ldrsh r1, [r3, r0] - movs r0, 0x5A - negs r0, r0 - cmp r1, r0 - ble _0807C616 - bl _0807CFB4 -_0807C616: - movs r2, 0x1 - strh r2, [r3, 0x30] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x30] - adds r1, r4, 0 - bl _0807CF4C - .pool -_0807C630: - ldr r2, =0x0000ffff - movs r0, 0x1 - movs r1, 0x10 - bl BlendPalettes - bl _0807CF48 - .pool -_0807C644: - ldr r2, =0x0000ffff - movs r0, 0x1 - movs r1, 0 - bl BlendPalettes - bl _0807CF48 - .pool -_0807C658: - ldr r2, =0x0000ffff - movs r0, 0x1 - movs r1, 0x10 - bl BlendPalettes - bl _0807CF48 - .pool -_0807C66C: - ldr r5, =gUnknown_020322A0 - ldr r0, [r5] - adds r0, 0xF0 - ldrh r0, [r0] - bl IsMonSpriteNotFlipped - lsls r0, 24 - cmp r0, 0 - bne _0807C6E4 - ldr r4, =gSprites - ldr r2, [r5] - adds r2, 0x8E - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x10 - adds r0, r1 - ldr r1, =gSpriteAffineAnimTable_8338ECC - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x1] - movs r2, 0x3 - orrs r1, r2 - strb r1, [r0, 0x1] - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - movs r2, 0x3 - movs r3, 0x3 - bl CalcCenterToCornerVec - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - bl StartSpriteAffineAnim - b _0807C6FA - .pool -_0807C6E4: - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAffineAnim -_0807C6FA: - ldr r5, =gUnknown_020322A0 - ldr r0, [r5] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - movs r1, 0 - bl StartSpriteAffineAnim - ldr r2, [r5] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x3C - strh r1, [r0, 0x20] - adds r2, 0x8F - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xB4 - strh r1, [r0, 0x20] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xC0 - strh r1, [r0, 0x22] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffe0 - strh r1, [r0, 0x22] - ldrb r0, [r3] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - ands r2, r1 - strb r2, [r0] - ldr r1, [r5] - bl _0807CF4C - .pool -_0807C794: - ldr r4, =gSprites - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - movs r5, 0 - strh r1, [r0, 0x26] - adds r2, 0x8F - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x26] - adds r0, 0xA3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _0807C7DC - movs r0, 0x2D - bl PlaySE -_0807C7DC: - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r6, 0x26 - ldrsh r1, [r0, r6] - movs r0, 0xDE - negs r0, r0 - cmp r1, r0 - blt _0807C7FC - bl _0807CFB4 -_0807C7FC: - adds r0, r2, 0 - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x30] - adds r0, r2, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x30] - adds r1, r2, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r7] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - ldr r2, =0x0000ffff - movs r0, 0x1 - movs r1, 0 - bl BlendPalettes - b _0807CFB4 - .pool -_0807C864: - ldr r4, =gSprites - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r2, 0x91 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r2, 0x26 - ldrsh r1, [r0, r2] - movs r0, 0xDE - negs r0, r0 - cmp r1, r0 - ble _0807C8A6 - b _0807CFB4 -_0807C8A6: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0x94 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x90 - ldrb r1, [r1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - b _0807CFB4 - .pool -_0807C8EC: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807C8FA - b _0807CFB4 -_0807C8FA: - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0x1 - bl sub_807B62C - ldr r0, [r7] - adds r0, 0xE0 - movs r1, 0xA6 - strh r1, [r0] - ldr r0, =gUnknown_08338D88 - movs r4, 0x14 - negs r4, r4 - movs r1, 0x80 - adds r2, r4, 0 - movs r3, 0x3 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x90 - strb r0, [r1] - ldr r0, =gSpriteTemplate_8338DC8 - movs r1, 0x80 - adds r2, r4, 0 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - b _0807CFB4 - .pool -_0807C964: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - b _0807CF44 -_0807C974: - movs r1, 0x92 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807C98C - b _0807CFB4 -_0807C98C: - b _0807CF48 - .pool -_0807C994: - ldr r2, =gSprites - ldr r4, [r7] - adds r3, r4, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - adds r0, r4, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r3, 0x26 - ldrsh r1, [r0, r3] - movs r6, 0x22 - ldrsh r0, [r0, r6] - adds r1, r0 - cmp r1, 0x40 - beq _0807C9DA - b _0807CFB4 -_0807C9DA: - adds r1, r4, 0 - b _0807CF4C - .pool -_0807C9E4: - ldr r1, [r7] - adds r5, r1, 0 - adds r5, 0xE0 - ldrh r0, [r5] - adds r0, 0x2 - strh r0, [r5] - lsls r0, 16 - asrs r0, 16 - movs r6, 0x9E - lsls r6, 1 - cmp r0, r6 - bgt _0807C9FE - b _0807CFB4 -_0807C9FE: - strh r6, [r5] - b _0807CF4C -_0807CA02: - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r3, [r7] - adds r2, r3, 0 - adds r2, 0x94 - ldrh r0, [r2] - adds r0, 0x1 - movs r1, 0 - strh r0, [r2] - str r1, [r3, 0x64] - b _0807CFB4 - .pool -_0807CA40: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0xA - beq _0807CA4E - b _0807CFB4 -_0807CA4E: - b _0807CF4C -_0807CA50: - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0xE0 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - asrs r0, 16 - movs r3, 0xAE - lsls r3, 1 - cmp r0, r3 - ble _0807CA72 - strh r3, [r2] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807CA72: - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xE0 - movs r3, 0 - ldrsh r1, [r0, r3] - movs r0, 0xA4 - lsls r0, 1 - cmp r1, r0 - beq _0807CA86 - b _0807CFB4 -_0807CA86: - adds r0, r2, 0 - adds r0, 0xFA - ldrb r0, [r0] - cmp r0, 0 - bne _0807CA92 - b _0807CFB4 -_0807CA92: - ldr r0, =gSpriteTemplate_8338DFC - movs r1, 0x80 - movs r2, 0x41 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x92 - strb r0, [r1] - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0x92 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_807AAE0 - str r1, [r0] - b _0807CFB4 - .pool -_0807CAC8: - ldr r0, =gSpriteTemplate_8338E74 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r2, =gUnknown_020322A0 - ldr r1, [r2] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r2] - adds r0, 0x94 - movs r1, 0x32 - strh r1, [r0] - b _0807CFB4 - .pool -_0807CAF0: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - blt _0807CB0E - b _0807CFB4 -_0807CB0E: - adds r0, r1, 0 - bl DestroySprite - movs r0, 0x6 - bl sub_807B62C - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0x9F - bl PlaySE - b _0807CFB4 - .pool -_0807CB30: - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0xEA - ldrh r3, [r2] - ldr r0, =0x000003ff - cmp r3, r0 - bhi _0807CB4C - adds r0, r3, 0 - adds r0, 0x34 - strh r0, [r2] - b _0807CB5A - .pool -_0807CB4C: - movs r0, 0x80 - lsls r0, 3 - strh r0, [r2] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807CB5A: - ldr r4, [r7] -_0807CB5C: - adds r0, r4, 0 - adds r0, 0xEA - ldrh r1, [r0] - movs r0, 0x80 - lsls r0, 8 - bl __divsi3 - adds r4, 0xE8 - strh r0, [r4] - b _0807CFB4 -_0807CB70: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x3C - strh r1, [r0] - b _0807CFB4 - .pool -_0807CB90: - ldr r4, =gPaletteFade - ldrb r1, [r4, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807CB9E - b _0807CFB4 -_0807CB9E: - movs r0, 0x5 - bl sub_807B62C - movs r0, 0x7 - bl sub_807B62C - ldrb r0, [r4, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r4, 0x8] - b _0807CF48 - .pool -_0807CBB8: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - b _0807CF44 - .pool -_0807CBD4: - movs r1, 0xA2 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807CBEC - b _0807CFB4 -_0807CBEC: - b _0807CF48 - .pool -_0807CBF4: - ldr r0, =gSpriteTemplate_8338D28 - movs r2, 0x8 - negs r2, r2 - movs r1, 0x78 - movs r3, 0 - bl CreateSprite - ldr r5, =gUnknown_020322A0 - ldr r1, [r5] - adds r1, 0xD3 - movs r6, 0 - strb r0, [r1] - ldr r4, =gSprites - ldr r2, [r5] - adds r2, 0xD3 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x4A - strh r1, [r0, 0x34] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_807E6AC - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, [r5] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - bl StartSpriteAffineAnim - ldr r0, [r5] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r2, =0x0000ffff - movs r1, 0x10 - bl BlendPalettes - ldr r2, [r5] - adds r1, r2, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - str r6, [r2, 0x64] - b _0807CFB4 - .pool -_0807CC9C: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, [r7] - b _0807CF4C - .pool -_0807CCD0: - ldr r2, =gSprites - ldr r3, [r7] - adds r0, r3, 0 - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0807CCEE - b _0807CFB4 -_0807CCEE: - adds r0, r3, 0 - adds r0, 0xF2 - ldrh r2, [r0] - lsls r0, r2, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - ldr r3, [r3, 0x6C] - bl HandleLoadSpecialPokePic_2 - ldr r1, [r7] - b _0807CF4C - .pool -_0807CD1C: - ldr r4, =gSprites - ldr r2, [r7] - adds r6, r2, 0 - adds r6, 0x8F - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r5, 0 - movs r1, 0x78 - strh r1, [r0, 0x20] - ldrb r0, [r6] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldr r3, =gMonFrontPicCoords - adds r2, 0xF2 - ldrh r0, [r2] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x1] - adds r0, 0x3C - strh r0, [r1, 0x22] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x24] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x26] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - bl StartSpriteAnim - ldr r3, [r7] - adds r0, r3, 0 - adds r0, 0x8F - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r1, [r1, 0x5] - lsrs r1, 4 - movs r2, 0x2 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0x14 - str r2, [sp, 0x8] - ldr r2, =0x000fffff - str r2, [sp, 0xC] - adds r3, 0xF2 - ldrh r2, [r3] - str r2, [sp, 0x10] - movs r2, 0x78 - movs r3, 0x54 - bl CreatePokeballSpriteToReleaseMon - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl FreeSpriteOamMatrix - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, [r7] - b _0807CF4C - .pool -_0807CDDC: - movs r1, 0xAA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gStringVar4 - ldr r1, =gText_XSentOverY - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r0, =gUnknown_020322A0 - ldr r3, [r0] - adds r1, r3, 0 - adds r1, 0x94 - movs r2, 0 - movs r0, 0xA7 -_0807CE06: - strh r0, [r1] - str r2, [r3, 0x64] - b _0807CFB4 - .pool -_0807CE18: - ldr r3, [r7] - ldr r0, [r3, 0x64] - adds r0, 0x1 - str r0, [r3, 0x64] - cmp r0, 0x3C - bhi _0807CE26 - b _0807CFB4 -_0807CE26: - adds r0, r3, 0 - adds r0, 0x94 - movs r2, 0 - ldr r1, =0x0000010b - strh r1, [r0] - str r2, [r3, 0x64] - b _0807CFB4 - .pool -_0807CE38: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0807CE44 - b _0807CFB4 -_0807CE44: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x44 - strh r1, [r0] - b _0807CFB4 - .pool -_0807CE54: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0xA - bne _0807CE66 - ldr r0, =0x00000173 - bl PlayFanfare -_0807CE66: - ldr r1, [r7] - ldr r0, [r1, 0x64] - cmp r0, 0xFA - beq _0807CE70 - b _0807CFB4 -_0807CE70: - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - movs r5, 0 - strh r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_TakeGoodCareOfX - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r0, [r7] - str r5, [r0, 0x64] - b _0807CFB4 - .pool -_0807CEA0: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x3C - beq _0807CEAE - b _0807CFB4 -_0807CEAE: - b _0807CF4C -_0807CEB0: - bl sub_807F14C - b _0807CF48 -_0807CEB6: - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xEE - ldrb r0, [r0] - cmp r0, 0 - beq _0807CEC6 - movs r0, 0x1 - b _0807CFB6 -_0807CEC6: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0807CFB4 - adds r1, r2, 0 - b _0807CF4C - .pool -_0807CEDC: - ldr r0, =gSpecialVar_0x8005 - ldrb r0, [r0] - movs r1, 0 - bl sub_807B4D0 - ldr r1, =gCB2_AfterEvolution - ldr r0, =sub_807B60C - str r0, [r1] - ldr r7, =gUnknown_02032298 - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x1 - movs r2, 0 - bl GetEvolutionTargetSpecies - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _0807CF48 - ldrb r3, [r7] - adds r0, r3, 0 - muls r0, r6 - adds r0, r5 - ldr r1, =gUnknown_020322A0 - ldr r1, [r1] - adds r1, 0x8F - ldrb r2, [r1] - adds r1, r4, 0 - bl TradeEvolutionScene - b _0807CF48 - .pool -_0807CF38: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 -_0807CF44: - bl BeginNormalPaletteFade -_0807CF48: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] -_0807CF4C: - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _0807CFB4 - .pool -_0807CF5C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0807CFB4 - ldr r0, [r7] - adds r0, 0xF4 - ldrh r0, [r0] - bl PlayNewMapMusic - ldr r0, [r7] - cmp r0, 0 - beq _0807CFAA - bl FreeAllWindowBuffers - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - bl FreeMonSpritesGfx - ldr r0, [r7] - bl Free - str r4, [r7] -_0807CFAA: - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - bl sub_807E784 -_0807CFB4: - movs r0, 0 -_0807CFB6: - add sp, 0x14 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_807BBEC - - thumb_func_start sub_807CFC8 -sub_807CFC8: @ 807CFC8 - push {r4-r7,lr} - sub sp, 0x14 - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r1, 0x94 - ldrh r5, [r1] - ldr r1, =0x0000010b - adds r7, r0, 0 - cmp r5, r1 - bls _0807CFE0 - bl _0807E400 -_0807CFE0: - lsls r0, r5, 2 - ldr r1, =_0807CFF8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807CFF8: - .4byte _0807D428 - .4byte _0807D4A0 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D4FC - .4byte _0807D544 - .4byte _0807D5B8 - .4byte _0807E400 - .4byte _0807D624 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D648 - .4byte _0807D678 - .4byte _0807D68A - .4byte _0807D6AC - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D7A4 - .4byte _0807D7C4 - .4byte _0807D830 - .4byte _0807D8B4 - .4byte _0807D8D8 - .4byte _0807D924 - .4byte _0807D970 - .4byte _0807D9CC - .4byte _0807DA38 - .4byte _0807DA4C - .4byte _0807DA60 - .4byte _0807DA74 - .4byte _0807DB9C - .4byte _0807DC6C - .4byte _0807DCF4 - .4byte _0807DD94 - .4byte _0807DDA4 - .4byte _0807DDC4 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807DEE8 - .4byte _0807DEF8 - .4byte _0807DF16 - .4byte _0807E400 - .4byte _0807DF3C - .4byte _0807DF7C - .4byte _0807DFBC - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807DFDC - .4byte _0807E004 - .4byte _0807E020 - .4byte _0807E040 - .4byte _0807E0E8 - .4byte _0807E11C - .4byte _0807E168 - .4byte _0807E228 - .4byte _0807E2A0 - .4byte _0807E2EC - .4byte _0807E2FC - .4byte _0807E302 - .4byte _0807E328 - .4byte _0807E384 - .4byte _0807E3A8 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D6F4 - .4byte _0807D728 - .4byte _0807D77C - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807DE1C - .4byte _0807DE84 - .4byte _0807DEC0 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E264 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807D85C - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E400 - .4byte _0807E284 -_0807D428: - ldr r3, =gSprites - ldr r0, [r7] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r4, [r7] - adds r2, r4, 0 - adds r2, 0x8E - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldr r1, =0x0000ff4c - strh r1, [r0, 0x24] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldr r2, =gMonFrontPicCoords - adds r0, r4, 0 - adds r0, 0xF0 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1] - strh r0, [r1, 0x26] - adds r1, r4, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - bl GetCurrentMapMusic - ldr r1, [r7] - adds r1, 0xF4 - strh r0, [r1] - ldr r0, =0x00000179 - bl PlayNewMapMusic - bl _0807E400 - .pool -_0807D4A0: - ldr r5, [r7] - adds r6, r5, 0 - adds r6, 0xE6 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - ble _0807D4D4 - ldr r2, =gSprites - adds r0, r5, 0 - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x24] - adds r1, 0x3 - strh r1, [r0, 0x24] - ldrh r0, [r6] - subs r0, 0x3 - strh r0, [r6] - bl _0807E400 - .pool -_0807D4D4: - ldr r2, =gSprites - adds r0, r5, 0 - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0 - strh r1, [r0, 0x24] - strh r1, [r6] - adds r1, r5, 0 - adds r1, 0x94 - movs r0, 0xA - strh r0, [r1] - bl _0807E400 - .pool -_0807D4FC: - ldr r4, =gStringVar4 - ldr r1, =gText_XWillBeSentToY - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r2, r0, 0 - adds r2, 0xF0 - ldrh r1, [r2] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _0807D52A - adds r0, r1, 0 - movs r1, 0 - bl PlayCry1 -_0807D52A: - ldr r3, [r4] - adds r1, r3, 0 - adds r1, 0x94 - movs r2, 0 - movs r0, 0xB - bl _0807E252 - .pool -_0807D544: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x50 - beq _0807D554 - bl _0807E400 -_0807D554: - adds r0, r1, 0 - adds r0, 0x8E - ldrb r0, [r0] - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r1, [r1, 0x5] - lsrs r1, 4 - movs r2, 0x2 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0x14 - str r2, [sp, 0x8] - ldr r2, =0x000fffff - str r2, [sp, 0xC] - movs r2, 0x78 - movs r3, 0x20 - bl sub_807671C - ldr r1, [r7] - adds r1, 0xD2 - strb r0, [r1] - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_ByeByeVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - bl _0807E400 - .pool -_0807D5B8: - ldr r5, =gSprites - ldr r0, [r7] - adds r0, 0xD2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r5, 0 - adds r4, 0x1C - adds r0, r4 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0807D5D8 - bl _0807E400 -_0807D5D8: - ldr r0, =gSpriteTemplate_8338D28 - movs r1, 0x78 - movs r2, 0x20 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0xD3 - strb r0, [r1] - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_807E5D8 - str r1, [r0] - adds r2, 0xD2 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite - ldr r1, [r7] - bl _0807E398 - .pool -_0807D624: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x14 - strh r1, [r0] - bl _0807E400 - .pool -_0807D648: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807D658 - bl _0807E400 -_0807D658: - movs r0, 0x4 - bl sub_807B62C - movs r0, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - bl _0807E394 - .pool -_0807D678: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl _0807E390 -_0807D68A: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807D69A - bl _0807E400 -_0807D69A: - ldr r0, [r7] - adds r0, 0x94 - movs r1, 0x17 - strh r1, [r0] - bl _0807E400 - .pool -_0807D6AC: - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r2, r0, 0 - adds r2, 0xEA - ldrh r1, [r2] - movs r0, 0x80 - lsls r0, 1 - cmp r1, r0 - bls _0807D6CC - adds r0, r1, 0 - subs r0, 0x34 - strh r0, [r2] - b _0807D6E6 - .pool -_0807D6CC: - movs r0, 0x1 - bl sub_807B62C - ldr r3, [r4] - adds r1, r3, 0 - adds r1, 0xEA - movs r2, 0 - movs r0, 0x80 - strh r0, [r1] - subs r1, 0x56 - movs r0, 0x7C - strh r0, [r1] - str r2, [r3, 0x64] -_0807D6E6: - ldr r0, =gUnknown_020322A0 - ldr r4, [r0] - bl _0807DFA8 - .pool -_0807D6F4: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x14 - bhi _0807D704 - bl _0807E400 -_0807D704: - movs r0, 0x3 - bl sub_807B62C - ldr r0, =gSpriteTemplate_8338E8C - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x91 - strb r0, [r1] - ldr r1, [r7] - bl _0807E398 - .pool -_0807D728: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - blt _0807D748 - bl _0807E400 -_0807D748: - adds r0, r1, 0 - bl DestroySprite - ldr r1, =0x00000452 - movs r0, 0x50 - bl SetGpuReg - movs r1, 0x82 - lsls r1, 3 - movs r0, 0x52 - bl SetGpuReg - ldr r0, =c3_08054588 - movs r1, 0x5 - bl CreateTask - ldr r1, [r7] - bl _0807E398 - .pool -_0807D77C: - ldr r0, =c3_08054588 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _0807D78C - bl _0807E400 -_0807D78C: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x1A - strh r1, [r0] - bl _0807E400 - .pool -_0807D7A4: - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xE0 - ldrh r1, [r0] - subs r1, 0x1 - strh r1, [r0] - lsls r1, 16 - movs r0, 0x9E - lsls r0, 17 - cmp r1, r0 - beq _0807D7BE - bl _0807E400 -_0807D7BE: - adds r1, r2, 0 - bl _0807E398 -_0807D7C4: - ldr r0, =gUnknown_08338D88 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x3 - bl CreateSprite - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - adds r1, 0x90 - strb r0, [r1] - ldr r5, =gSprites - ldr r0, [r4] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_807AA4C - str r1, [r0] - ldr r0, =gSpriteTemplate_8338DC8 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - ldr r1, [r4] - bl _0807E398 - .pool -_0807D830: - ldr r2, [r7] - adds r1, r2, 0 - adds r1, 0xE0 - ldrh r0, [r1] - subs r0, 0x3 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA6 - bne _0807D84A - subs r1, 0x4C - movs r0, 0xC8 - strh r0, [r1] -_0807D84A: - ldr r1, =0x00001241 - movs r0, 0 - bl SetGpuReg - bl _0807E400 - .pool -_0807D85C: - ldr r2, =gSprites - ldr r4, [r7] - adds r3, r4, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x2 - strh r1, [r0, 0x22] - adds r0, r4, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x22] - subs r1, 0x2 - strh r1, [r0, 0x22] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r2, 0x22 - ldrsh r1, [r0, r2] - movs r0, 0x8 - negs r0, r0 - cmp r1, r0 - blt _0807D8A2 - bl _0807E400 -_0807D8A2: - adds r1, r4, 0 - adds r1, 0x94 - movs r0, 0x1D - strh r0, [r1] - bl _0807E400 - .pool -_0807D8B4: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x1E - strh r1, [r0] - bl _0807E400 - .pool -_0807D8D8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807D8E8 - bl _0807E400 -_0807D8E8: - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - movs r0, 0x2 - bl sub_807B62C - ldr r1, [r7] - bl _0807E398 - .pool -_0807D924: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r5, =gSpriteTemplate_8338DC8 - adds r0, r5, 0 - movs r1, 0x6F - movs r2, 0xAA - movs r3, 0 - bl CreateSprite - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - adds r1, 0x90 - strb r0, [r1] - movs r2, 0xA - negs r2, r2 - adds r0, r5, 0 - movs r1, 0x81 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] - adds r1, 0x91 - strb r0, [r1] - ldr r1, [r4] - bl _0807E398 - .pool -_0807D970: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807D98E - movs r0, 0x2E - bl PlaySE - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807D98E: - ldr r3, =gSprites - ldr r0, =gUnknown_020322A0 - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r2, 0x91 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - bl _0807E400 - .pool -_0807D9CC: - ldr r5, =gSprites - ldr r4, [r7] - adds r2, r4, 0 - adds r2, 0x90 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r6, r4, 0 - adds r6, 0x91 - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r5 - movs r0, 0x26 - ldrsh r1, [r3, r0] - movs r0, 0x5A - negs r0, r0 - cmp r1, r0 - ble _0807DA12 - bl _0807E400 -_0807DA12: - movs r2, 0x1 - strh r2, [r3, 0x30] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - strh r2, [r0, 0x30] - adds r1, r4, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldr r0, =c3_0805465C - b _0807DC5A - .pool -_0807DA38: - ldr r2, =0x0000ffff - movs r0, 0x8 - movs r1, 0x10 - bl BlendPalettes - bl _0807E394 - .pool -_0807DA4C: - ldr r2, =0x0000ffff - movs r0, 0x8 - movs r1, 0x10 - bl BlendPalettes - bl _0807E394 - .pool -_0807DA60: - ldr r2, =0x0000ffff - movs r0, 0x8 - movs r1, 0x10 - bl BlendPalettes - bl _0807E394 - .pool -_0807DA74: - ldr r5, =gUnknown_020322A0 - ldr r0, [r5] - adds r0, 0xF0 - ldrh r0, [r0] - bl IsMonSpriteNotFlipped - lsls r0, 24 - cmp r0, 0 - bne _0807DAEC - ldr r4, =gSprites - ldr r2, [r5] - adds r2, 0x8E - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x10 - adds r0, r1 - ldr r1, =gSpriteAffineAnimTable_8338ECC - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x1] - movs r2, 0x3 - orrs r1, r2 - strb r1, [r0, 0x1] - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - movs r2, 0x3 - movs r3, 0x3 - bl CalcCenterToCornerVec - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - bl StartSpriteAffineAnim - b _0807DB02 - .pool -_0807DAEC: - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAffineAnim -_0807DB02: - ldr r5, =gUnknown_020322A0 - ldr r0, [r5] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - movs r1, 0 - bl StartSpriteAffineAnim - ldr r2, [r5] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x28 - strh r1, [r0, 0x20] - adds r2, 0x8F - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xC8 - strh r1, [r0, 0x20] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0xC0 - strh r1, [r0, 0x22] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =0x0000ffe0 - strh r1, [r0, 0x22] - ldrb r0, [r3] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - adds r1, 0x3E - ldrb r3, [r1] - movs r2, 0x5 - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - ands r2, r1 - strb r2, [r0] - ldr r1, [r5] - bl _0807E398 - .pool -_0807DB9C: - ldr r4, =gSprites - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - movs r5, 0 - strh r1, [r0, 0x26] - adds r2, 0x8F - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r0, [r0, 0x26] - adds r0, 0xA3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _0807DBE4 - movs r0, 0x2D - bl PlaySE -_0807DBE4: - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x8E - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r6, 0x26 - ldrsh r1, [r0, r6] - movs r0, 0xDE - negs r0, r0 - cmp r1, r0 - blt _0807DC04 - bl _0807E400 -_0807DC04: - adds r0, r2, 0 - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x30] - adds r0, r2, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x30] - adds r1, r2, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r7] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - ldr r0, =sub_807F39C -_0807DC5A: - movs r1, 0x5 - bl CreateTask - b _0807E400 - .pool -_0807DC6C: - ldr r4, =gSprites - ldr r2, [r7] - adds r3, r2, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - subs r1, 0x3 - strh r1, [r0, 0x26] - adds r2, 0x91 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrh r1, [r0, 0x26] - adds r1, 0x3 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r2, 0x26 - ldrsh r1, [r0, r2] - movs r0, 0xDE - negs r0, r0 - cmp r1, r0 - ble _0807DCAE - b _0807E400 -_0807DCAE: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0x94 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x90 - ldrb r1, [r1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - b _0807E400 - .pool -_0807DCF4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807DD02 - b _0807E400 -_0807DD02: - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0x1 - bl sub_807B62C - ldr r0, [r7] - adds r0, 0xE0 - movs r1, 0xA6 - strh r1, [r0] - movs r0, 0x3 - bl sub_807B62C - ldr r0, [r7] - adds r0, 0xE4 - movs r1, 0xCE - lsls r1, 1 - strh r1, [r0] - ldr r0, =gUnknown_08338D88 - movs r4, 0x14 - negs r4, r4 - movs r1, 0x78 - adds r2, r4, 0 - movs r3, 0x3 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x90 - strb r0, [r1] - ldr r5, =gSprites - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_807AA4C - str r1, [r0] - ldr r0, =gSpriteTemplate_8338DC8 - movs r1, 0x78 - adds r2, r4, 0 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x1 - bl StartSpriteAnim - b _0807E400 - .pool -_0807DD94: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - b _0807E390 -_0807DDA4: - movs r1, 0x92 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807DDBC - b _0807E400 -_0807DDBC: - b _0807E394 - .pool -_0807DDC4: - ldr r2, =gSprites - ldr r4, [r7] - adds r3, r4, 0 - adds r3, 0x90 - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - adds r1, 0x4 - strh r1, [r0, 0x26] - adds r0, r4, 0 - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r1, [r0, 0x26] - adds r1, 0x4 - strh r1, [r0, 0x26] - ldrb r1, [r3] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r6, 0x26 - ldrsh r1, [r0, r6] - movs r2, 0x22 - ldrsh r0, [r0, r2] - adds r1, r0 - cmp r1, 0x40 - beq _0807DE0A - b _0807E400 -_0807DE0A: - adds r0, r4, 0 - adds r0, 0x94 - movs r1, 0x90 - strh r1, [r0] - movs r0, 0 - str r0, [r4, 0x64] - b _0807E400 - .pool -_0807DE1C: - movs r1, 0xB2 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gUnknown_020322A0 - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0xE0 - ldrh r0, [r1] - adds r0, 0x3 - strh r0, [r1] - adds r1, 0x4 - ldrh r0, [r1] - adds r0, 0x3 - strh r0, [r1] - ldr r0, [r2, 0x64] - adds r0, 0x1 - str r0, [r2, 0x64] - cmp r0, 0xA - bne _0807DE60 - ldr r0, =c3_08054588 - movs r1, 0x5 - 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 r0, 0x1 - strh r0, [r1, 0xC] -_0807DE60: - ldr r1, [r4] - adds r3, r1, 0 - adds r3, 0xE0 - movs r6, 0 - ldrsh r0, [r3, r6] - movs r2, 0x9E - lsls r2, 1 - cmp r0, r2 - bgt _0807DE74 - b _0807E400 -_0807DE74: - strh r2, [r3] - b _0807E398 - .pool -_0807DE84: - ldr r0, [r7] - adds r0, 0x90 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r3, [r7] - adds r2, r3, 0 - adds r2, 0x94 - ldrh r0, [r2] - adds r0, 0x1 - movs r1, 0 - strh r0, [r2] - str r1, [r3, 0x64] - b _0807E400 - .pool -_0807DEC0: - ldr r0, =c3_08054588 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _0807DED0 - b _0807E400 -_0807DED0: - ldr r0, =gUnknown_020322A0 - ldr r2, [r0] - adds r1, r2, 0 - adds r1, 0x94 - movs r0, 0x2E - strh r0, [r1] - str r3, [r2, 0x64] - b _0807E400 - .pool -_0807DEE8: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0xA - beq _0807DEF6 - b _0807E400 -_0807DEF6: - b _0807E398 -_0807DEF8: - ldr r1, [r7] - adds r5, r1, 0 - adds r5, 0xE0 - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - lsls r0, 16 - asrs r0, 16 - movs r6, 0xAE - lsls r6, 1 - cmp r0, r6 - bgt _0807DF12 - b _0807E400 -_0807DF12: - strh r6, [r5] - b _0807E398 -_0807DF16: - ldr r0, =gSpriteTemplate_8338E74 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - ldr r2, =gUnknown_020322A0 - ldr r1, [r2] - adds r1, 0x91 - strb r0, [r1] - ldr r0, [r2] - adds r0, 0x94 - movs r1, 0x32 - strh r1, [r0] - b _0807E400 - .pool -_0807DF3C: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0x91 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 27 - cmp r0, 0 - blt _0807DF5A - b _0807E400 -_0807DF5A: - adds r0, r1, 0 - bl DestroySprite - movs r0, 0x6 - bl sub_807B62C - ldr r1, [r7] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0x9F - bl PlaySE - b _0807E400 - .pool -_0807DF7C: - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0xEA - ldrh r3, [r2] - ldr r0, =0x000003ff - cmp r3, r0 - bhi _0807DF98 - adds r0, r3, 0 - adds r0, 0x34 - strh r0, [r2] - b _0807DFA6 - .pool -_0807DF98: - movs r0, 0x80 - lsls r0, 3 - strh r0, [r2] - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0807DFA6: - ldr r4, [r7] -_0807DFA8: - adds r0, r4, 0 - adds r0, 0xEA - ldrh r1, [r0] - movs r0, 0x80 - lsls r0, 8 - bl __divsi3 - adds r4, 0xE8 - strh r0, [r4] - b _0807E400 -_0807DFBC: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x3C - strh r1, [r0] - b _0807E400 - .pool -_0807DFDC: - ldr r4, =gPaletteFade - ldrb r1, [r4, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807DFEA - b _0807E400 -_0807DFEA: - movs r0, 0x5 - bl sub_807B62C - movs r0, 0x7 - bl sub_807B62C - ldrb r0, [r4, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r4, 0x8] - b _0807E394 - .pool -_0807E004: - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - b _0807E390 - .pool -_0807E020: - movs r1, 0xA2 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0807E038 - b _0807E400 -_0807E038: - b _0807E394 - .pool -_0807E040: - ldr r0, =gSpriteTemplate_8338D28 - movs r2, 0x8 - negs r2, r2 - movs r1, 0x78 - movs r3, 0 - bl CreateSprite - ldr r5, =gUnknown_020322A0 - ldr r1, [r5] - adds r1, 0xD3 - movs r6, 0 - strb r0, [r1] - ldr r4, =gSprites - ldr r2, [r5] - adds r2, 0xD3 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x4A - strh r1, [r0, 0x34] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_807E6AC - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, [r5] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x2 - bl StartSpriteAffineAnim - ldr r0, [r5] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r2, =0x0000ffff - movs r1, 0x10 - bl BlendPalettes - ldr r2, [r5] - adds r1, r2, 0 - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - str r6, [r2, 0x64] - b _0807E400 - .pool -_0807E0E8: - ldr r2, =gSprites - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, [r7] - b _0807E398 - .pool -_0807E11C: - ldr r2, =gSprites - ldr r3, [r7] - adds r0, r3, 0 - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _0807E13A - b _0807E400 -_0807E13A: - adds r0, r3, 0 - adds r0, 0xF2 - ldrh r2, [r0] - lsls r0, r2, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - ldr r3, [r3, 0x6C] - bl HandleLoadSpecialPokePic_2 - ldr r1, [r7] - b _0807E398 - .pool -_0807E168: - ldr r4, =gSprites - ldr r2, [r7] - adds r6, r2, 0 - adds r6, 0x8F - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r5, 0 - movs r1, 0x78 - strh r1, [r0, 0x20] - ldrb r0, [r6] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldr r3, =gMonFrontPicCoords - adds r2, 0xF2 - ldrh r0, [r2] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x1] - adds r0, 0x3C - strh r0, [r1, 0x22] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x24] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r5, [r0, 0x26] - ldrb r1, [r6] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - bl StartSpriteAnim - ldr r3, [r7] - adds r0, r3, 0 - adds r0, 0x8F - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r1, [r1, 0x5] - lsrs r1, 4 - movs r2, 0x2 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0x14 - str r2, [sp, 0x8] - ldr r2, =0x000fffff - str r2, [sp, 0xC] - adds r3, 0xF2 - ldrh r2, [r3] - str r2, [sp, 0x10] - movs r2, 0x78 - movs r3, 0x54 - bl CreatePokeballSpriteToReleaseMon - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl FreeSpriteOamMatrix - ldr r0, [r7] - adds r0, 0xD3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl DestroySprite - ldr r1, [r7] - b _0807E398 - .pool -_0807E228: - movs r1, 0xAA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gStringVar4 - ldr r1, =gText_XSentOverY - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r0, =gUnknown_020322A0 - ldr r3, [r0] - adds r1, r3, 0 - adds r1, 0x94 - movs r2, 0 - movs r0, 0xA7 -_0807E252: - strh r0, [r1] - str r2, [r3, 0x64] - b _0807E400 - .pool -_0807E264: - ldr r3, [r7] - ldr r0, [r3, 0x64] - adds r0, 0x1 - str r0, [r3, 0x64] - cmp r0, 0x3C - bhi _0807E272 - b _0807E400 -_0807E272: - adds r0, r3, 0 - adds r0, 0x94 - movs r2, 0 - ldr r1, =0x0000010b - strh r1, [r0] - str r2, [r3, 0x64] - b _0807E400 - .pool -_0807E284: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0807E290 - b _0807E400 -_0807E290: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0x44 - strh r1, [r0] - b _0807E400 - .pool -_0807E2A0: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0xA - bne _0807E2B2 - ldr r0, =0x00000173 - bl PlayFanfare -_0807E2B2: - ldr r1, [r7] - ldr r0, [r1, 0x64] - cmp r0, 0xFA - beq _0807E2BC - b _0807E400 -_0807E2BC: - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - movs r5, 0 - strh r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_TakeGoodCareOfX - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - ldr r0, [r7] - str r5, [r0, 0x64] - b _0807E400 - .pool -_0807E2EC: - ldr r1, [r7] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x3C - beq _0807E2FA - b _0807E400 -_0807E2FA: - b _0807E398 -_0807E2FC: - bl sub_807F14C - b _0807E394 -_0807E302: - ldr r2, [r7] - adds r0, r2, 0 - adds r0, 0xEE - ldrb r0, [r0] - cmp r0, 0 - beq _0807E312 - movs r0, 0x1 - b _0807E402 -_0807E312: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0807E400 - adds r1, r2, 0 - b _0807E398 - .pool -_0807E328: - ldr r0, =gSpecialVar_0x8005 - ldrb r0, [r0] - movs r1, 0 - bl sub_807B4D0 - ldr r1, =gCB2_AfterEvolution - ldr r0, =sub_807B60C - str r0, [r1] - ldr r7, =gUnknown_02032298 - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x1 - movs r2, 0 - bl GetEvolutionTargetSpecies - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _0807E394 - ldrb r3, [r7] - adds r0, r3, 0 - muls r0, r6 - adds r0, r5 - ldr r1, =gUnknown_020322A0 - ldr r1, [r1] - adds r1, 0x8F - ldrb r2, [r1] - adds r1, r4, 0 - bl TradeEvolutionScene - b _0807E394 - .pool -_0807E384: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 -_0807E390: - bl BeginNormalPaletteFade -_0807E394: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] -_0807E398: - adds r1, 0x94 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _0807E400 - .pool -_0807E3A8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0807E400 - ldr r0, [r7] - adds r0, 0xF4 - ldrh r0, [r0] - bl PlayNewMapMusic - ldr r0, [r7] - cmp r0, 0 - beq _0807E3F6 - bl FreeAllWindowBuffers - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - bl FreeMonSpritesGfx - ldr r0, [r7] - bl Free - str r4, [r7] -_0807E3F6: - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - bl sub_807E784 -_0807E400: - movs r0, 0 -_0807E402: - add sp, 0x14 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_807CFC8 - - thumb_func_start c2_08053788 -c2_08053788: @ 807E414 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _0807E434 - cmp r0, 0x4 - beq _0807E444 - b _0807E4B4 - .pool -_0807E434: - movs r0, 0x4 - strb r0, [r1] - ldr r1, =gSoftResetDisabled - movs r0, 0x1 - b _0807E4B2 - .pool -_0807E444: - ldr r0, =gCB2_AfterEvolution - ldr r1, =sub_807EB50 - mov r8, r1 - str r1, [r0] - ldr r7, =gUnknown_02032298 - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - movs r1, 0x1 - movs r2, 0 - bl GetEvolutionTargetSpecies - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _0807E494 - ldrb r3, [r7] - adds r0, r3, 0 - muls r0, r6 - adds r0, r5 - ldr r1, =gUnknown_020322A0 - ldr r1, [r1] - adds r1, 0x8F - ldrb r2, [r1] - adds r1, r4, 0 - bl TradeEvolutionScene - b _0807E4AE - .pool -_0807E494: - bl sub_8077260 - cmp r0, 0 - beq _0807E4A8 - ldr r0, =sub_807F464 - bl SetMainCallback2 - b _0807E4AE - .pool -_0807E4A8: - mov r0, r8 - bl SetMainCallback2 -_0807E4AE: - ldr r1, =gUnknown_02032298 - movs r0, 0xFF -_0807E4B2: - strb r0, [r1] -_0807E4B4: - bl HasLinkErrorOccurred - lsls r0, 24 - cmp r0, 0 - bne _0807E4C2 - bl RunTasks -_0807E4C2: - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end c2_08053788 - - thumb_func_start sub_807E4DC -sub_807E4DC: @ 807E4DC - push {r4-r6,lr} - bl sub_807ACDC - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0x1 - adds r0, r5, 0 - ands r0, r6 - cmp r0, 0 - beq _0807E51A - ldr r4, =gBlockRecvBuffer - ldrh r1, [r4] - ldr r0, =0x0000dcba - cmp r1, r0 - bne _0807E504 - ldr r0, =c2_08053788 - bl SetMainCallback2 -_0807E504: - ldrh r1, [r4] - ldr r0, =0x0000abcd - cmp r1, r0 - bne _0807E514 - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x72 - strb r6, [r0] -_0807E514: - movs r0, 0 - bl ResetBlockReceivedFlag -_0807E51A: - movs r0, 0x2 - ands r0, r5 - cmp r0, 0 - beq _0807E542 - ldr r0, =gBlockRecvBuffer - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x0000abcd - cmp r1, r0 - bne _0807E53C - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x73 - movs r1, 0x1 - strb r1, [r0] -_0807E53C: - movs r0, 0x1 - bl ResetBlockReceivedFlag -_0807E542: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E4DC - - thumb_func_start sub_807E55C -sub_807E55C: @ 807E55C - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - movs r1, 0xA - bl __divsi3 - ldrh r4, [r5, 0x22] - adds r4, r0 - strh r4, [r5, 0x22] - ldrh r0, [r5, 0x30] - ldrh r2, [r5, 0x38] - adds r0, r2 - strh r0, [r5, 0x38] - movs r1, 0x38 - ldrsh r0, [r5, r1] - movs r1, 0xA - bl __divsi3 - strh r0, [r5, 0x20] - lsls r4, 16 - asrs r4, 16 - cmp r4, 0x4C - ble _0807E5AA - movs r0, 0x4C - strh r0, [r5, 0x22] - movs r2, 0x2E - ldrsh r1, [r5, r2] - movs r2, 0x32 - ldrsh r0, [r5, r2] - muls r0, r1 - negs r0, r0 - movs r1, 0x64 - bl __divsi3 - strh r0, [r5, 0x2E] - ldrh r0, [r5, 0x34] - adds r0, 0x1 - strh r0, [r5, 0x34] -_0807E5AA: - movs r1, 0x20 - ldrsh r0, [r5, r1] - cmp r0, 0x78 - bne _0807E5B6 - movs r0, 0 - strh r0, [r5, 0x30] -_0807E5B6: - ldrh r0, [r5, 0x36] - ldrh r2, [r5, 0x2E] - adds r0, r2 - strh r0, [r5, 0x2E] - movs r1, 0x34 - ldrsh r0, [r5, r1] - cmp r0, 0x4 - bne _0807E5CE - movs r0, 0x1 - strh r0, [r5, 0x3C] - ldr r0, =SpriteCallbackDummy - str r0, [r5, 0x1C] -_0807E5CE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E55C - - thumb_func_start sub_807E5D8 -sub_807E5D8: @ 807E5D8 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldr r1, =gUnknown_08339024 - movs r2, 0x2E - ldrsh r0, [r4, r2] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x26] - adds r0, r1 - strh r0, [r4, 0x26] - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0x16 - bne _0807E600 - movs r0, 0x38 - bl PlaySE -_0807E600: - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2C - bne _0807E636 - movs r0, 0x8C - bl PlaySE - ldr r0, =sub_807E64C - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x2E] - ldrb r1, [r4, 0x5] - lsrs r1, 4 - adds r1, 0x10 - movs r0, 0x1 - lsls r0, r1 - movs r1, 0x1 - negs r1, r1 - ldr r2, =0x0000ffff - str r2, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0807E636: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E5D8 - - thumb_func_start sub_807E64C -sub_807E64C: @ 807E64C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x30 - ldrsh r0, [r4, r1] - cmp r0, 0x14 - bne _0807E660 - adds r0, r4, 0 - movs r1, 0x1 - bl StartSpriteAffineAnim -_0807E660: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _0807E69E - ldr r1, =gUnknown_08339024 - movs r2, 0x2E - ldrsh r0, [r4, r2] - adds r0, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - ldrh r0, [r4, 0x26] - subs r0, r1 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x17 - bne _0807E69E - adds r0, r4, 0 - bl DestroySprite - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - adds r0, 0x94 - movs r1, 0xE - strh r1, [r0] -_0807E69E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E64C - - thumb_func_start sub_807E6AC -sub_807E6AC: @ 807E6AC - push {r4,lr} - adds r4, r0, 0 - ldrh r2, [r4, 0x32] - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0807E6DC - ldrh r0, [r4, 0x22] - adds r0, 0x4 - strh r0, [r4, 0x22] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x34 - ldrsh r1, [r4, r3] - cmp r0, r1 - ble _0807E72C - adds r0, r2, 0x1 - strh r0, [r4, 0x32] - movs r0, 0x16 - strh r0, [r4, 0x2E] - movs r0, 0x38 - bl PlaySE - b _0807E72C -_0807E6DC: - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x42 - bne _0807E6EA - movs r0, 0x39 - bl PlaySE -_0807E6EA: - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0x5C - bne _0807E6F8 - movs r0, 0x3A - bl PlaySE -_0807E6F8: - movs r3, 0x2E - ldrsh r0, [r4, r3] - cmp r0, 0x6B - bne _0807E706 - movs r0, 0x3B - bl PlaySE -_0807E706: - ldr r1, =gUnknown_08339024 - movs r2, 0x2E - ldrsh r0, [r4, r2] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r3, [r4, 0x26] - adds r0, r3 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6C - bne _0807E72C - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_0807E72C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E6AC - - thumb_func_start sub_807E73C -sub_807E73C: @ 807E73C - push {r4-r6,lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - lsls r4, r0, 4 - subs r4, r0 - lsls r4, 2 - ldr r0, =gIngameTrades - adds r4, r0 - ldr r0, =gStringVar1 - ldrh r1, [r4, 0x38] - movs r6, 0xB - muls r1, r6 - ldr r5, =gSpeciesNames - adds r1, r5 - bl StringCopy - ldr r0, =gStringVar2 - ldrh r1, [r4, 0xC] - muls r1, r6 - adds r1, r5 - bl StringCopy - ldrh r0, [r4, 0x38] - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_807E73C - - thumb_func_start sub_807E784 -sub_807E784: @ 807E784 - push {r4,lr} - sub sp, 0x20 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - lsls r4, r0, 4 - subs r4, r0 - lsls r4, 2 - ldr r0, =gIngameTrades - adds r4, r0 - ldr r0, =gSpecialVar_0x8005 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar1 - mov r1, sp - bl StringCopy10 - ldr r0, =gStringVar2 - ldrh r2, [r4, 0xC] - movs r1, 0xB - muls r1, r2 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - add sp, 0x20 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E784 - - thumb_func_start sub_807E7E8 -sub_807E7E8: @ 807E7E8 - push {r4-r7,lr} - sub sp, 0x38 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, r1, 4 - subs r2, r1 - lsls r2, 2 - ldr r1, =gIngameTrades - adds r5, r2, r1 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x38 - bl GetMonData - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - add r4, sp, 0x34 - movs r0, 0xFE - strb r0, [r4] - ldr r6, =gEnemyParty - ldrh r1, [r5, 0xC] - movs r3, 0x1 - str r3, [sp] - ldr r0, [r5, 0x24] - str r0, [sp, 0x4] - str r3, [sp, 0x8] - ldr r0, [r5, 0x18] - str r0, [sp, 0xC] - adds r0, r6, 0 - movs r3, 0x20 - bl CreateMon - adds r2, r5, 0 - adds r2, 0xE - adds r0, r6, 0 - movs r1, 0x27 - bl SetMonData - adds r2, r5, 0 - adds r2, 0xF - adds r0, r6, 0 - movs r1, 0x28 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x10 - adds r0, r6, 0 - movs r1, 0x29 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x11 - adds r0, r6, 0 - movs r1, 0x2A - bl SetMonData - adds r2, r5, 0 - adds r2, 0x12 - adds r0, r6, 0 - movs r1, 0x2B - bl SetMonData - adds r2, r5, 0 - adds r2, 0x13 - adds r0, r6, 0 - movs r1, 0x2C - bl SetMonData - adds r0, r6, 0 - movs r1, 0x2 - adds r2, r5, 0 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x2B - adds r0, r6, 0 - movs r1, 0x7 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x36 - adds r0, r6, 0 - movs r1, 0x31 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x14 - adds r0, r6, 0 - movs r1, 0x2E - bl SetMonData - adds r2, r5, 0 - adds r2, 0x1D - adds r0, r6, 0 - movs r1, 0x17 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x1E - adds r0, r6, 0 - movs r1, 0x18 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x1C - adds r0, r6, 0 - movs r1, 0x16 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x1F - adds r0, r6, 0 - movs r1, 0x21 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x20 - adds r0, r6, 0 - movs r1, 0x2F - bl SetMonData - adds r2, r5, 0 - adds r2, 0x37 - adds r0, r6, 0 - movs r1, 0x30 - bl SetMonData - adds r0, r6, 0 - movs r1, 0x23 - adds r2, r4, 0 - bl SetMonData - mov r4, sp - adds r4, 0x35 - movs r0, 0 - strb r0, [r4] - ldrh r0, [r5, 0x28] - cmp r0, 0 - beq _0807E960 - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _0807E954 - add r0, sp, 0x10 - adds r1, r5, 0 - bl sub_807E974 - ldr r0, =gUnknown_020321C0 - add r1, sp, 0x10 - ldm r1!, {r2,r3,r7} - stm r0!, {r2,r3,r7} - ldm r1!, {r2,r3,r7} - stm r0!, {r2,r3,r7} - ldm r1!, {r2,r3,r7} - stm r0!, {r2,r3,r7} - adds r0, r6, 0 - movs r1, 0x40 - adds r2, r4, 0 - bl SetMonData - adds r2, r5, 0 - adds r2, 0x28 - adds r0, r6, 0 - movs r1, 0xC - bl SetMonData - b _0807E960 - .pool -_0807E954: - adds r2, r5, 0 - adds r2, 0x28 - adds r0, r6, 0 - movs r1, 0xC - bl SetMonData -_0807E960: - ldr r0, =gEnemyParty - bl CalculateMonStats - add sp, 0x38 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E7E8 - - thumb_func_start sub_807E974 -sub_807E974: @ 807E974 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r2, =gUnknown_08338FC0 - adds r0, r6, 0 - adds r0, 0x2A - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r2, r0, r2 - adds r1, r5, 0 - movs r3, 0x8 -_0807E98E: - ldrh r0, [r2] - strh r0, [r1] - adds r2, 0x2 - adds r1, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _0807E98E - adds r4, r5, 0 - adds r4, 0x12 - adds r1, r6, 0 - adds r1, 0x2B - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - movs r1, 0 - bl PadNameString - ldr r1, [r6, 0x18] - lsrs r0, r1, 24 - strb r0, [r5, 0x1A] - lsrs r0, r1, 16 - strb r0, [r5, 0x1B] - lsrs r0, r1, 8 - strb r0, [r5, 0x1C] - strb r1, [r5, 0x1D] - ldrh r0, [r6, 0xC] - strh r0, [r5, 0x1E] - ldrh r0, [r6, 0x28] - strh r0, [r5, 0x20] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807E974 - - thumb_func_start sub_807E9D4 -sub_807E9D4: @ 807E9D4 - push {r4-r6,lr} - ldr r6, =gSpecialVar_0x8005 - ldrh r0, [r6] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _0807EA08 - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - b _0807EA0A - .pool -_0807EA08: - movs r0, 0 -_0807EA0A: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_807E9D4 - - thumb_func_start sub_807EA10 -sub_807EA10: @ 807EA10 - push {lr} - ldr r0, =gSpecialVar_0x8005 - ldrb r0, [r0] - ldr r1, =gSpecialVar_0x8004 - ldrb r1, [r1] - bl sub_807E7E8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_807EA10 - - thumb_func_start sub_807EA2C -sub_807EA2C: @ 807EA2C - push {r4-r6,lr} - bl sub_807BBC8 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x1 - bne _0807EA96 - ldr r5, =gUnknown_020322A0 - ldr r0, [r5] - adds r0, 0x8E - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r4, =gSprites - adds r0, r4 - bl DestroySprite - ldr r0, [r5] - adds r0, 0x8F - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - bl FreeSpriteOamMatrix - ldr r0, =gUnknown_02032298 - ldrb r4, [r0] - ldrb r0, [r0, 0x1] - movs r1, 0x6 - bl __umodsi3 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_807B4D0 - bl sub_8077260 - cmp r0, 0 - bne _0807EA90 - ldr r0, [r5] - adds r2, r0, 0 - adds r2, 0x74 - ldr r1, =0x0000abcd - strh r1, [r2] - adds r0, 0x93 - strb r6, [r0] -_0807EA90: - ldr r0, =sub_807EACC - bl SetMainCallback2 -_0807EA96: - bl sub_807B5B8 - bl sub_807E4DC - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807EA2C - - thumb_func_start sub_807EACC -sub_807EACC: @ 807EACC - push {r4,lr} - bl sub_807ACDC - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_8077260 - cmp r0, 0 - beq _0807EAEC - ldr r0, =c2_08053788 - bl SetMainCallback2 - b _0807EB2C - .pool -_0807EAEC: - bl sub_807E4DC - cmp r4, 0 - bne _0807EB2C - ldr r4, =gUnknown_020322A0 - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x72 - ldrh r1, [r0] - ldr r0, =0x00000101 - cmp r1, r0 - bne _0807EB2C - adds r1, r2, 0 - adds r1, 0x74 - ldr r0, =0x0000dcba - strh r0, [r1] - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, [r4] - adds r1, 0x74 - movs r2, 0x14 - bl SendBlock - ldr r0, [r4] - adds r0, 0x72 - movs r1, 0x2 - strb r1, [r0] - ldr r0, [r4] - adds r0, 0x73 - strb r1, [r0] -_0807EB2C: - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807EACC - - thumb_func_start sub_807EB50 -sub_807EB50: @ 807EB50 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x65 - bls _0807EB66 - b _0807F03A -_0807EB66: - lsls r0, 2 - ldr r1, =_0807EB78 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807EB78: - .4byte _0807ED10 - .4byte _0807ED2C - .4byte _0807ED98 - .4byte _0807F03A - .4byte _0807EE78 - .4byte _0807EF3C - .4byte _0807EF64 - .4byte _0807EF7E - .4byte _0807EFA4 - .4byte _0807EFF0 - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807EE9C - .4byte _0807EEEC - .4byte _0807EF1A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807EDC0 - .4byte _0807EE1C - .4byte _0807EE38 - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807F03A - .4byte _0807ED44 - .4byte _0807ED7C -_0807ED10: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_CommunicationStandby5 - b _0807EDA6 - .pool -_0807ED2C: - movs r0, 0 - bl sub_8077288 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x64 - b _0807EE88 - .pool -_0807ED44: - ldr r0, =gUnknown_020322A0 - ldr r3, [r0] - ldr r0, [r3, 0x64] - adds r0, 0x1 - str r0, [r3, 0x64] - cmp r0, 0xB4 - bls _0807ED60 - movs r1, 0x87 - lsls r1, 3 - adds r0, r2, r1 - movs r2, 0 - movs r1, 0x65 - strb r1, [r0] - str r2, [r3, 0x64] -_0807ED60: - bl sub_8077294 - cmp r0, 0 - bne _0807ED6A - b _0807F03A -_0807ED6A: - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - b _0807ED8E - .pool -_0807ED7C: - bl sub_8077294 - cmp r0, 0 - bne _0807ED86 - b _0807F03A -_0807ED86: - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 -_0807ED8E: - movs r1, 0x2 - strb r1, [r0] - b _0807F03A - .pool -_0807ED98: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - movs r0, 0x32 - strb r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_SavingDontTurnOffPower -_0807EDA6: - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - b _0807F03A - .pool -_0807EDC0: - bl InUnionRoom - cmp r0, 0 - bne _0807EDCE - movs r0, 0x15 - bl IncrementGameStat -_0807EDCE: - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _0807EDF6 - ldr r4, =gLinkPlayers - bl GetMultiplayerId - movs r1, 0x1 - eors r0, r1 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r4, 0x4 - adds r1, r4 - ldr r1, [r1] - movs r0, 0x2 - bl sub_801B990 -_0807EDF6: - bl SetContinueGameWarpStatusToDynamicWarp - bl sub_8153380 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - b _0807EE8A - .pool -_0807EE1C: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x5 - beq _0807EE2C - b _0807F03A -_0807EE2C: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - b _0807EFE4 - .pool -_0807EE38: - bl sub_81533AC - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _0807EE5C - bl ClearContinueGameWarpStatus2 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x4 - strb r1, [r0] - b _0807F03A - .pool -_0807EE5C: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - str r1, [r0, 0x64] - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x33 - strb r1, [r0] - b _0807F03A - .pool -_0807EE78: - bl sub_81533E0 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x28 -_0807EE88: - strb r1, [r0] -_0807EE8A: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - str r2, [r0, 0x64] - b _0807F03A - .pool -_0807EE9C: - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x32 - bhi _0807EEAC - b _0807F03A -_0807EEAC: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0807EED4 - bl Random - ldr r4, [r4] - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1E - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - str r0, [r4, 0x64] - b _0807EEDA - .pool -_0807EED4: - ldr r1, [r4] - movs r0, 0 - str r0, [r1, 0x64] -_0807EEDA: - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x29 - strb r1, [r0] - b _0807F03A - .pool -_0807EEEC: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - cmp r0, 0 - bne _0807EF14 - movs r0, 0x1 - bl sub_8077288 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x2A - strb r1, [r0] - b _0807F03A - .pool -_0807EF14: - subs r0, 0x1 - str r0, [r1, 0x64] - b _0807F03A -_0807EF1A: - bl sub_8077294 - cmp r0, 0 - bne _0807EF24 - b _0807F03A -_0807EF24: - bl sub_8153408 - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x5 - strb r1, [r0] - b _0807F03A - .pool -_0807EF3C: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x3C - bls _0807F03A - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0x2 - bl sub_8077288 - b _0807F03A - .pool -_0807EF64: - bl sub_8077294 - cmp r0, 0 - beq _0807F03A - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0807EFDC -_0807EF7E: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807F03A - movs r0, 0x3 - bl FadeOutBGM - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _0807EFE4 - .pool -_0807EFA4: - bl IsBGMStopped - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0807F03A - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _0807EFD8 - ldr r0, =gMain - ldr r1, [r0, 0x8] - ldr r0, =sub_80773AC - cmp r1, r0 - bne _0807EFD8 - movs r0, 0x3 - bl sub_8077288 - b _0807EFDC - .pool -_0807EFD8: - bl sub_800AC34 -_0807EFDC: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_0807EFE4: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0807F03A - .pool -_0807EFF0: - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _0807F028 - ldr r1, [r2, 0x8] - ldr r0, =sub_80773AC - cmp r1, r0 - bne _0807F028 - bl sub_8077294 - cmp r0, 0 - beq _0807F03A - ldr r0, =gSoftResetDisabled - movs r1, 0 - strb r1, [r0] - ldr r0, =c2_080543C4 - bl SetMainCallback2 - b _0807F03A - .pool -_0807F028: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r1, [r0] - cmp r1, 0 - bne _0807F03A - ldr r0, =gSoftResetDisabled - strb r1, [r0] - ldr r0, =c2_080543C4 - bl SetMainCallback2 -_0807F03A: - bl HasLinkErrorOccurred - lsls r0, 24 - cmp r0, 0 - bne _0807F048 - bl RunTasks -_0807F048: - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807EB50 - - thumb_func_start c2_080543C4 -c2_080543C4: @ 807F068 - push {r4,r5,lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _0807F0BE - bl FreeAllWindowBuffers - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - bl FreeMonSpritesGfx - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - bl Free - str r5, [r4] - ldr r0, =gWirelessCommType - ldrb r0, [r0] - cmp r0, 0 - beq _0807F0B6 - bl sub_800E084 -_0807F0B6: - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 -_0807F0BE: - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end c2_080543C4 - - thumb_func_start sub_807F0E4 -sub_807F0E4: @ 807F0E4 - push {lr} - sub sp, 0x4 - bl ScriptContext2_Enable - ldr r0, =sub_807F110 - movs r1, 0xA - bl CreateTask - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_807F0E4 - - thumb_func_start sub_807F110 -sub_807F110: @ 807F110 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807F134 - ldr r0, =sub_807B270 - bl SetMainCallback2 - ldr r1, =gFieldCallback - ldr r0, =sub_80AF168 - str r0, [r1] - adds r0, r4, 0 - bl DestroyTask -_0807F134: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807F110 - - thumb_func_start sub_807F14C -sub_807F14C: @ 807F14C - push {r4,r5,lr} - movs r5, 0 - movs r4, 0 -_0807F152: - ldr r0, =gUnknown_02032298 - ldrb r0, [r0, 0x1] - movs r1, 0x6 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gEnemyParty - adds r0, r1 - adds r1, r4, 0 - adds r1, 0x43 - bl GetMonData - adds r0, r5, r0 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xB - bls _0807F152 - cmp r5, 0 - beq _0807F18A - ldr r0, =0x0000089b - bl FlagSet -_0807F18A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807F14C - - thumb_func_start sub_807F19C -sub_807F19C: @ 807F19C - push {lr} - bl sub_807B170 - pop {r0} - bx r0 - thumb_func_end sub_807F19C - - thumb_func_start sub_807F1A8 -sub_807F1A8: @ 807F1A8 - push {r4-r6,lr} - sub sp, 0x14 - adds r5, r0, 0 - adds r6, r1, 0 - adds r4, r2, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0xFF - bl FillWindowPixelBuffer - ldr r2, =gUnknown_020322A0 - ldr r0, [r2] - adds r0, 0xF6 - movs r3, 0 - movs r1, 0xF - strb r1, [r0] - ldr r0, [r2] - adds r0, 0xF7 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0xF8 - movs r1, 0x6 - strb r1, [r0] - str r3, [sp] - str r3, [sp, 0x4] - ldr r0, [r2] - adds r0, 0xF6 - str r0, [sp, 0x8] - lsls r4, 24 - asrs r4, 24 - str r4, [sp, 0xC] - str r6, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0x2 - bl AddTextPrinterParameterized4 - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807F1A8 - - thumb_func_start c3_08054588 -c3_08054588: @ 807F210 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r1, =gUnknown_08339090 - movs r2, 0 - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r2, r1, 0 - movs r3, 0x4 - ldrsh r0, [r4, r3] - cmp r0, 0 - bne _0807F254 - movs r0, 0x80 - lsls r0, 1 - cmp r1, r0 - beq _0807F25C - lsls r0, r1, 1 - ldr r1, =gUnknown_08337AA0 - adds r0, r1 - b _0807F25E - .pool -_0807F254: - movs r0, 0x80 - lsls r0, 1 - cmp r1, r0 - bne _0807F26C -_0807F25C: - ldr r0, =gUnknown_08337EA0 -_0807F25E: - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - b _0807F27A - .pool -_0807F26C: - lsls r0, r2, 1 - ldr r1, =gUnknown_08337CA0 - adds r0, r1 - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette -_0807F27A: - ldr r0, =gUnknown_08339090 - movs r2, 0 - ldrsh r1, [r4, r2] - lsls r1, 1 - adds r1, r0 - ldrb r0, [r1] - cmp r0, 0 - bne _0807F298 - movs r3, 0x2 - ldrsh r0, [r4, r3] - cmp r0, 0 - bne _0807F298 - movs r0, 0xC3 - bl PlaySE -_0807F298: - movs r0, 0x2 - ldrsh r2, [r4, r0] - ldr r1, =gUnknown_08339090 - movs r3, 0 - ldrsh r0, [r4, r3] - lsls r0, 1 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r2, r0 - bne _0807F2D8 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - movs r0, 0 - strh r0, [r4, 0x2] - movs r2, 0 - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xFF - bne _0807F2DE - adds r0, r5, 0 - bl DestroyTask - b _0807F2DE - .pool -_0807F2D8: - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] -_0807F2DE: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end c3_08054588 - - thumb_func_start c3_0805465C -c3_0805465C: @ 807F2E4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r0, 0 - ldrsh r4, [r5, r0] - cmp r4, 0 - bne _0807F336 - ldr r2, =gUnknown_020322A0 - ldr r0, [r2] - adds r3, r0, 0 - adds r3, 0xFD - movs r1, 0x78 - strb r1, [r3] - adds r0, 0xFB - strb r1, [r0] - ldr r0, [r2] - adds r0, 0xFC - strb r4, [r0] - ldr r0, [r2] - adds r0, 0xFE - movs r1, 0xA0 - strb r1, [r0] - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl SetGpuRegBits - movs r0, 0x4A - movs r1, 0x10 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x13 - bl SetGpuReg -_0807F336: - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0xFD - ldrb r1, [r1] - adds r0, 0xFB - ldrb r0, [r0] - lsls r0, 8 - orrs r1, r0 - movs r0, 0x40 - bl SetGpuReg - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0xFE - ldrb r1, [r1] - adds r0, 0xFC - ldrb r0, [r0] - lsls r0, 8 - orrs r1, r0 - movs r0, 0x44 - bl SetGpuReg - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - ldr r1, [r4] - adds r1, 0xFB - ldrb r0, [r1] - subs r0, 0x5 - strb r0, [r1] - ldr r1, [r4] - adds r1, 0xFD - ldrb r0, [r1] - adds r0, 0x5 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0xFB - ldrb r0, [r0] - cmp r0, 0x4F - bhi _0807F38E - adds r0, r6, 0 - bl DestroyTask -_0807F38E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end c3_0805465C - - thumb_func_start sub_807F39C -sub_807F39C: @ 807F39C - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r1, 0 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0807F3D8 - ldr r2, =gUnknown_020322A0 - ldr r0, [r2] - adds r0, 0xFB - movs r1, 0x50 - strb r1, [r0] - ldr r0, [r2] - adds r0, 0xFD - movs r1, 0xA0 - strb r1, [r0] - movs r0, 0x4A - movs r1, 0x10 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x13 - bl SetGpuReg -_0807F3D8: - ldr r4, =gUnknown_020322A0 - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0xFD - ldrb r1, [r1] - adds r0, 0xFB - ldrb r0, [r0] - lsls r0, 8 - orrs r1, r0 - movs r0, 0x40 - bl SetGpuReg - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0xFE - ldrb r1, [r1] - adds r0, 0xFC - ldrb r0, [r0] - lsls r0, 8 - orrs r1, r0 - movs r0, 0x44 - bl SetGpuReg - ldr r0, [r4] - adds r0, 0xFB - ldrb r0, [r0] - cmp r0, 0x78 - beq _0807F44C - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - ldr r1, [r4] - adds r1, 0xFB - ldrb r0, [r1] - adds r0, 0x5 - strb r0, [r1] - ldr r1, [r4] - adds r1, 0xFD - ldrb r0, [r1] - subs r0, 0x5 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0xFB - ldrb r0, [r0] - cmp r0, 0x73 - bls _0807F45C - ldr r2, =0x0000ffff - movs r0, 0x8 - movs r1, 0 - bl BlendPalettes - b _0807F45C - .pool -_0807F44C: - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl ClearGpuRegBits - adds r0, r6, 0 - bl DestroyTask -_0807F45C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_807F39C - - thumb_func_start sub_807F464 -sub_807F464: @ 807F464 - push {r4,r5,lr} - sub sp, 0x4 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0xC - bls _0807F47A - b _0807F70C -_0807F47A: - lsls r0, 2 - ldr r1, =_0807F48C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0807F48C: - .4byte _0807F4C0 - .4byte _0807F4E8 - .4byte _0807F500 - .4byte _0807F550 - .4byte _0807F570 - .4byte _0807F5AC - .4byte _0807F5D0 - .4byte _0807F620 - .4byte _0807F64E - .4byte _0807F66C - .4byte _0807F694 - .4byte _0807F6C4 - .4byte _0807F6F8 -_0807F4C0: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_CommunicationStandby5 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - b _0807F70C - .pool -_0807F4E8: - movs r0, 0 - bl sub_8077288 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x2 - b _0807F5BC - .pool -_0807F500: - bl sub_8077294 - cmp r0, 0 - bne _0807F50A - b _0807F70C -_0807F50A: - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r5, 0 - movs r1, 0x3 - strb r1, [r0] - ldr r4, =gStringVar4 - ldr r1, =gText_SavingDontTurnOffPower - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_807F1A8 - movs r0, 0x15 - bl IncrementGameStat - bl sub_8153380 - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - str r5, [r0, 0x64] - b _0807F70C - .pool -_0807F550: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x5 - beq _0807F560 - b _0807F70C -_0807F560: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - movs r0, 0x4 - strb r0, [r1] - b _0807F70C - .pool -_0807F570: - bl sub_81533AC - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _0807F590 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x5 - strb r1, [r0] - b _0807F70C - .pool -_0807F590: - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - str r1, [r0, 0x64] - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x3 - strb r1, [r0] - b _0807F70C - .pool -_0807F5AC: - bl sub_81533E0 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0x6 -_0807F5BC: - strb r1, [r0] - ldr r0, =gUnknown_020322A0 - ldr r0, [r0] - str r2, [r0, 0x64] - b _0807F70C - .pool -_0807F5D0: - ldr r4, =gUnknown_020322A0 - ldr r1, [r4] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0xA - bhi _0807F5E0 - b _0807F70C -_0807F5E0: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0807F608 - bl Random - ldr r4, [r4] - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1E - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - str r0, [r4, 0x64] - b _0807F60E - .pool -_0807F608: - ldr r1, [r4] - movs r0, 0 - str r0, [r1, 0x64] -_0807F60E: - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x7 - strb r1, [r0] - b _0807F70C - .pool -_0807F620: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - cmp r0, 0 - bne _0807F648 - movs r0, 0x1 - bl sub_8077288 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x8 - strb r1, [r0] - b _0807F70C - .pool -_0807F648: - subs r0, 0x1 - str r0, [r1, 0x64] - b _0807F70C -_0807F64E: - bl sub_8077294 - cmp r0, 0 - beq _0807F70C - bl sub_8153408 - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x9 - strb r1, [r0] - b _0807F70C - .pool -_0807F66C: - ldr r0, =gUnknown_020322A0 - ldr r1, [r0] - ldr r0, [r1, 0x64] - adds r0, 0x1 - str r0, [r1, 0x64] - cmp r0, 0x3C - bls _0807F70C - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0x2 - bl sub_8077288 - b _0807F70C - .pool -_0807F694: - bl sub_8077294 - cmp r0, 0 - beq _0807F70C - movs r0, 0x3 - bl FadeOutBGM - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0xB - strb r1, [r0] - b _0807F70C - .pool -_0807F6C4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0807F70C - bl IsBGMStopped - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0807F70C - movs r0, 0x3 - bl sub_8077288 - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0xC - strb r1, [r0] - b _0807F70C - .pool -_0807F6F8: - bl sub_8077294 - cmp r0, 0 - beq _0807F70C - ldr r0, =gSoftResetDisabled - movs r1, 0 - strb r1, [r0] - ldr r0, =c2_080543C4 - bl SetMainCallback2 -_0807F70C: - bl HasLinkErrorOccurred - lsls r0, 24 - cmp r0, 0 - bne _0807F71A - bl RunTasks -_0807F71A: - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_807F464 - - .align 2, 0 @ Don't pad with nop. diff --git a/data/maps/BattleFrontier_Lounge6/scripts.inc b/data/maps/BattleFrontier_Lounge6/scripts.inc index 3c1852283..411291e7d 100644 --- a/data/maps/BattleFrontier_Lounge6/scripts.inc +++ b/data/maps/BattleFrontier_Lounge6/scripts.inc @@ -7,7 +7,7 @@ BattleFrontier_Lounge6_EventScript_264FED:: @ 8264FED goto_if_set FLAG_0x09C, BattleFrontier_Lounge6_EventScript_265083 setvar VAR_0x8008, 3 copyvar VAR_0x8004, VAR_0x8008 - specialvar VAR_RESULT, sub_807E73C + specialvar VAR_RESULT, GetInGameTradeSpeciesInfo copyvar VAR_0x8009, VAR_RESULT msgbox BattleFrontier_Lounge6_Text_26508D, MSGBOX_YESNO compare VAR_RESULT, 0 @@ -18,14 +18,14 @@ BattleFrontier_Lounge6_EventScript_264FED:: @ 8264FED compare VAR_0x8004, 255 goto_if_eq BattleFrontier_Lounge6_EventScript_26506B copyvar VAR_0x8005, VAR_0x800A - specialvar VAR_RESULT, sub_807E9D4 + specialvar VAR_RESULT, GetTradeSpecies copyvar VAR_0x800B, VAR_RESULT compare VAR_RESULT, VAR_0x8009 goto_if_ne BattleFrontier_Lounge6_EventScript_265075 copyvar VAR_0x8004, VAR_0x8008 copyvar VAR_0x8005, VAR_0x800A - special sub_807EA10 - special sub_807F0E4 + special CreateInGameTradePokemon + special DoInGameTradeScene waitstate msgbox BattleFrontier_Lounge6_Text_265128, MSGBOX_DEFAULT setflag FLAG_0x09C diff --git a/data/maps/FortreeCity_House1/scripts.inc b/data/maps/FortreeCity_House1/scripts.inc index 44651ae0d..a1fe9b0d3 100644 --- a/data/maps/FortreeCity_House1/scripts.inc +++ b/data/maps/FortreeCity_House1/scripts.inc @@ -7,7 +7,7 @@ FortreeCity_House1_EventScript_2162BB:: @ 82162BB goto_if_set FLAG_0x09B, FortreeCity_House1_EventScript_216355 setvar VAR_0x8008, 1 copyvar VAR_0x8004, VAR_0x8008 - specialvar VAR_RESULT, sub_807E73C + specialvar VAR_RESULT, GetInGameTradeSpeciesInfo copyvar VAR_0x8009, VAR_RESULT msgbox FortreeCity_House1_Text_21637B, MSGBOX_YESNO compare VAR_RESULT, 0 @@ -18,14 +18,14 @@ FortreeCity_House1_EventScript_2162BB:: @ 82162BB compare VAR_0x8004, 255 goto_if_eq FortreeCity_House1_EventScript_21633D copyvar VAR_0x8005, VAR_0x800A - specialvar VAR_RESULT, sub_807E9D4 + specialvar VAR_RESULT, GetTradeSpecies copyvar VAR_0x800B, VAR_RESULT compare VAR_RESULT, VAR_0x8009 goto_if_ne FortreeCity_House1_EventScript_216347 copyvar VAR_0x8004, VAR_0x8008 copyvar VAR_0x8005, VAR_0x800A - special sub_807EA10 - special sub_807F0E4 + special CreateInGameTradePokemon + special DoInGameTradeScene waitstate bufferspeciesname 0, VAR_0x8009 msgbox FortreeCity_House1_Text_216440, MSGBOX_DEFAULT diff --git a/data/maps/PacifidlogTown_House3/scripts.inc b/data/maps/PacifidlogTown_House3/scripts.inc index fb5bf8cb1..05c38216d 100644 --- a/data/maps/PacifidlogTown_House3/scripts.inc +++ b/data/maps/PacifidlogTown_House3/scripts.inc @@ -7,7 +7,7 @@ PacifidlogTown_House3_EventScript_203C11:: @ 8203C11 goto_if_set FLAG_0x09A, PacifidlogTown_House3_EventScript_203CAB setvar VAR_0x8008, 2 copyvar VAR_0x8004, VAR_0x8008 - specialvar VAR_RESULT, sub_807E73C + specialvar VAR_RESULT, GetInGameTradeSpeciesInfo copyvar VAR_0x8009, VAR_RESULT msgbox PacifidlogTown_House3_Text_203CBE, MSGBOX_YESNO compare VAR_RESULT, 0 @@ -18,14 +18,14 @@ PacifidlogTown_House3_EventScript_203C11:: @ 8203C11 compare VAR_0x8004, 255 goto_if_eq PacifidlogTown_House3_EventScript_203C93 copyvar VAR_0x8005, VAR_0x800A - specialvar VAR_RESULT, sub_807E9D4 + specialvar VAR_RESULT, GetTradeSpecies copyvar VAR_0x800B, VAR_RESULT compare VAR_RESULT, VAR_0x8009 goto_if_ne PacifidlogTown_House3_EventScript_203C9D copyvar VAR_0x8004, VAR_0x8008 copyvar VAR_0x8005, VAR_0x800A - special sub_807EA10 - special sub_807F0E4 + special CreateInGameTradePokemon + special DoInGameTradeScene waitstate bufferspeciesname 0, VAR_0x8009 msgbox PacifidlogTown_House3_Text_203D87, MSGBOX_DEFAULT diff --git a/data/maps/RustboroCity_House1/scripts.inc b/data/maps/RustboroCity_House1/scripts.inc index 26a406675..effe69665 100644 --- a/data/maps/RustboroCity_House1/scripts.inc +++ b/data/maps/RustboroCity_House1/scripts.inc @@ -7,7 +7,7 @@ RustboroCity_House1_EventScript_21593F:: @ 821593F goto_if_set FLAG_0x099, RustboroCity_House1_EventScript_2159D5 setvar VAR_0x8008, 0 copyvar VAR_0x8004, VAR_0x8008 - specialvar VAR_RESULT, sub_807E73C + specialvar VAR_RESULT, GetInGameTradeSpeciesInfo copyvar VAR_0x8009, VAR_RESULT msgbox RustboroCity_House1_Text_2159E8, MSGBOX_YESNO compare VAR_RESULT, 0 @@ -18,14 +18,14 @@ RustboroCity_House1_EventScript_21593F:: @ 821593F compare VAR_0x8004, 255 goto_if_eq RustboroCity_House1_EventScript_2159BD copyvar VAR_0x8005, VAR_0x800A - specialvar VAR_RESULT, sub_807E9D4 + specialvar VAR_RESULT, GetTradeSpecies copyvar VAR_0x800B, VAR_RESULT compare VAR_RESULT, VAR_0x8009 goto_if_ne RustboroCity_House1_EventScript_2159C7 copyvar VAR_0x8004, VAR_0x8008 copyvar VAR_0x8005, VAR_0x800A - special sub_807EA10 - special sub_807F0E4 + special CreateInGameTradePokemon + special DoInGameTradeScene waitstate msgbox RustboroCity_House1_Text_215A77, MSGBOX_DEFAULT setflag FLAG_0x099 diff --git a/data/specials.inc b/data/specials.inc index 495c1c73f..dd8a51b34 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -263,10 +263,10 @@ gSpecials:: @ 81DBA64 def_special BedroomPC def_special PlayerPC def_special FieldShowRegionMap - def_special sub_807E73C - def_special sub_807EA10 - def_special sub_807F0E4 - def_special sub_807E9D4 + def_special GetInGameTradeSpeciesInfo + def_special CreateInGameTradePokemon + def_special DoInGameTradeScene + def_special GetTradeSpecies def_special GetWeekCount def_special RetrieveLotteryNumber def_special PickLotteryCornerTicket diff --git a/data/trade.s b/data/trade.s deleted file mode 100644 index b96c5adb3..000000000 --- a/data/trade.s +++ /dev/null @@ -1,646 +0,0 @@ -#include "constants/species.h" -#include "constants/items.h" - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_0832C6A8:: @ 832C6A8 - .4byte 0x00000f2c, 0x00003d88, 0x0000001c, 0x00000024, 0x00000064, 0x00000528 - - .align 1 -gTradeMovesBoxTilemap:: @ 832C6C0 - .incbin "graphics/trade/moves_box_map.bin" - - .align 1 -gTradePartyBoxTilemap:: @ 832C8BE - .incbin "graphics/trade/party_box_map.bin" - - .align 1 -gTradeStripesBG2Tilemap:: @ 832CABC - .incbin "graphics/trade/stripes_bg2_map.bin" - - .align 1 -gTradeStripesBG3Tilemap:: @ 832D2BC - .incbin "graphics/trade/stripes_bg3_map.bin" - -gText_EmptyString7:: @ 832DABC - .string "$" - -gText_ClrWhtHltTrspntShdwDrkGry:: @ 832DABD - .string "{COLOR WHITE}{HIGHLIGHT TRANSPARENT}{SHADOW DARK_GREY}$" - -gText_MaleSymbol4:: @ 832DAC7 - .string "♂$" - -gText_FemaleSymbol4:: @ 832DAC9 - .string "♀$" - -gText_GenderlessSymbol:: @ 832DACB - .string "$" - -gText_SpaceMove:: @ 832DACC - .string " MOVE$" - -gText_NewLine3:: @ 832DAD2 - .string "\n$" - -gText_Slash2:: @ 832DAD4 - .string "/$" - -gText_Lv2:: @ 832DAD6 - .string "Lv. $" - -gText_ThreeDashes2:: @ 832DADB - .string "---$" - -gText_FourQuestionMarks:: @ 832DADF - .string "????$" - -gText_832DAE4:: @ 832DAE4 - .string "$" - -gText_IsThisTradeOkay:: @ 832DAE5 - .string "Is this trade okay?$" - -gText_Cancel6:: @ 832DAF9 - .string "CANCEL$" - -gText_ChooseAPkmn:: @ 832DB00 - .string "Choose a POKéMON.$" - -gText_Summary3:: @ 832DB12 - .string "SUMMARY$" - -gText_Trade2:: @ 832DB1A - .string "TRADE$" - -gText_CancelTrade:: @ 832DB20 - .string "Cancel trade?$" - -gJPText_832DB2E:: @ 832DB2E - .string "Bボタン で もどります$" - -gText_Summary4:: @ 832DB3B - .string "SUMMARY$" - -gText_Trade3:: @ 832DB43 - .string "TRADE$" - -gText_CommunicationStandby6:: @ 832DB49 - .string "{COLOR DARK_GREY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GREY}Communication standby…\nPlease wait.$" - -gText_TheTradeHasBeenCanceled:: @ 832DB76 - .string "{COLOR DARK_GREY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GREY}The trade has\nbeen canceled.$" - -gText_YourOnlyPkmnForBattle:: @ 832DB9C - .string "That's your only\nPOKéMON for battle.$" - -gText_WaitingForYourFriend:: @ 832DBC1 - .string "{COLOR DARK_GREY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GREY}Waiting for your friend\nto finish…$" - -gText_YourFriendWantsToTrade:: @ 832DBED - .string "Your friend wants\nto trade POKéMON.$" - - .align 2 -gOamData_832DC14:: @ 832DC14 - .2byte 0x4000, 0x8000, 0x0400, 0x0000 - - .align 2 -gOamData_832DC1C:: @ 832DC1C - .2byte 0x4000, 0xc000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_832DC24:: @ 832DC24 - .2byte 0x0000, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_832DC2C:: @ 832DC2C - .2byte 0x0020, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_832DC34:: @ 832DC34 - .4byte gSpriteAnim_832DC24 - .4byte gSpriteAnim_832DC2C - - .align 2 -gUnknown_0832DC3C:: @ 832DC3C - obj_tiles gUnknown_08DDC6E4, 0x0800, 0x012c - - .align 2 -gUnknown_0832DC44:: @ 832DC44 - obj_pal gUnknown_08DDB444, 0x0929 - - .align 2 -gSpriteAnim_832DC4C:: @ 832DC4C - .2byte 0x0000, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_832DC54:: @ 832DC54 - .2byte 0x0008, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_832DC5C:: @ 832DC5C - .2byte 0x0010, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_832DC64:: @ 832DC64 - .2byte 0x0018, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_832DC6C:: @ 832DC6C - .2byte 0x0020, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_832DC74:: @ 832DC74 - .2byte 0x0028, 0x0005, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_832DC7C:: @ 832DC7C - .4byte gSpriteAnim_832DC4C - .4byte gSpriteAnim_832DC54 - .4byte gSpriteAnim_832DC5C - .4byte gSpriteAnim_832DC64 - .4byte gSpriteAnim_832DC6C - .4byte gSpriteAnim_832DC74 - - .align 2 -gSpriteTemplate_832DC94:: @ 832DC94 - spr_template 0x012c, 0x0929, gOamData_832DC1C, gSpriteAnimTable_832DC34, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gSpriteTemplate_832DCAC:: @ 832DCAC - spr_template 0x00c8, 0x133d, gOamData_832DC14, gSpriteAnimTable_832DC7C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -TradeScreenTextPalette:: @ 832DCC4 - .incbin "graphics/trade/text.gbapal" - - .align 2 -gSpritePalette_TradeScreenText:: @ 832DCE4 - obj_pal TradeScreenTextPalette, 0x133d - -gUnknown_0832DCEC:: @ 832DCEC - .byte 0x04, 0x02, 0x0c, 0x0c, 0x00, 0x00, 0x02, 0x04, 0x0c, 0x0c, 0x00, 0x00, 0x07, 0x06, 0x01, 0x00, 0x00, 0x00, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05, 0x03, 0x0c, 0x0c, 0x00, 0x00, 0x03, 0x05 - .byte 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x07, 0x06, 0x01, 0x00, 0x00, 0x06, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x08, 0x07, 0x06 - .byte 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x05, 0x01, 0x01, 0x01, 0x00, 0x00, 0x02, 0x09, 0x08, 0x07, 0x00, 0x00, 0x08, 0x09, 0x06, 0x06, 0x00, 0x00 - .byte 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x03, 0x01, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x01 - .byte 0x01, 0x01, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x0a, 0x08, 0x06, 0x00, 0x00, 0x00, 0x0a, 0x08, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x0a, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x0c - .byte 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04, 0x03, 0x02 - .byte 0x01, 0x00, 0x0b, 0x09, 0x07, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00 - .byte 0x0b, 0x09, 0x07, 0x06, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 - -gUnknown_0832DE24:: @ 832DE24 - .byte 0x01, 0x05, 0x08, 0x05, 0x01, 0x0a, 0x08, 0x0a, 0x01, 0x0f, 0x08, 0x0f, 0x10, 0x05, 0x17, 0x05, 0x10, 0x0a, 0x17, 0x0a, 0x10, 0x0f, 0x17, 0x0f, 0x17, 0x12 - -gUnknown_0832DE3E:: @ 832DE3E - .byte 0x05, 0x04, 0x0c, 0x04, 0x05, 0x09, 0x0c, 0x09, 0x05, 0x0e, 0x0c, 0x0e, 0x14, 0x04, 0x1b, 0x04, 0x14, 0x09, 0x1b, 0x09, 0x14, 0x0e, 0x1b, 0x0e - -gUnknown_0832DE56:: @ 832DE56 - .byte 0x01, 0x03, 0x08, 0x03, 0x01, 0x08, 0x08, 0x08, 0x01, 0x0d, 0x08, 0x0d, 0x10, 0x03, 0x17, 0x03, 0x10, 0x08, 0x17, 0x08, 0x10, 0x0d, 0x17, 0x0d, 0x00, 0x0e, 0x0f, 0x1d, 0x03, 0x05, 0x03, 0x07 - .byte 0x12, 0x05, 0x12, 0x07, 0x08, 0x07, 0x16, 0x0c, 0x08, 0x07, 0x16, 0x0c, 0x06, 0x07, 0x18, 0x0c, 0x06, 0x07, 0x18, 0x0c, 0x08, 0x07, 0x16, 0x0c, 0x07, 0x07, 0x17, 0x0c, 0x00, 0x00 - - .align 2 -gUnknown_0832DE94:: @ 832DE94 - .4byte gText_Cancel6 - .4byte gText_ChooseAPkmn - .4byte gText_Summary3 - .4byte gText_Trade2 - .4byte gText_CancelTrade - .4byte gJPText_832DB2E - - .align 2 -gUnknown_0832DEAC:: @ 832DEAC - .4byte gText_Summary4, sub_807A000 - .4byte gText_Trade3, sub_807A024 - - .align 2 -gUnknown_0832DEBC:: @ 832DEBC - .4byte gText_CommunicationStandby6 - .4byte gText_TheTradeHasBeenCanceled - .4byte gText_YourOnlyPkmnForBattle - .4byte gText_OnlyPkmnForBattle - .4byte gText_WaitingForYourFriend - .4byte gText_YourFriendWantsToTrade - .4byte gText_PkmnCantBeTradedNow - .4byte gText_EggCantBeTradedNow - .4byte gText_OtherTrainersPkmnCantBeTraded - -gUnknown_0832DEE0:: @ 832DEE0 - .byte 0x00, 0x01, 0x02, 0x00 - - .align 2 -gUnknown_0832DEE4:: @ 832DEE4 - .4byte 0x000001f8, 0x00001051, 0x00002062, 0x00003073 - - .align 2 -gUnknown_0832DEF4:: @ 832DEF4 - window_template 0x00, 0x04, 0x07, 0x16, 0x04, 0x0f, 0x001e - window_template 0x00, 0x13, 0x0f, 0x0a, 0x04, 0x0f, 0x0076 - window_template 0x00, 0x00, 0x05, 0x08, 0x02, 0x0d, 0x009e - window_template 0x00, 0x07, 0x05, 0x08, 0x02, 0x0d, 0x00ae - window_template 0x00, 0x00, 0x0a, 0x08, 0x02, 0x0d, 0x00be - window_template 0x00, 0x07, 0x0a, 0x08, 0x02, 0x0d, 0x00ce - window_template 0x00, 0x00, 0x0f, 0x08, 0x02, 0x0d, 0x00de - window_template 0x00, 0x07, 0x0f, 0x08, 0x02, 0x0d, 0x00ee - window_template 0x00, 0x0f, 0x05, 0x08, 0x02, 0x0d, 0x00fe - window_template 0x00, 0x16, 0x05, 0x08, 0x02, 0x0d, 0x010e - window_template 0x00, 0x0f, 0x0a, 0x08, 0x02, 0x0d, 0x011e - window_template 0x00, 0x16, 0x0a, 0x08, 0x02, 0x0d, 0x012e - window_template 0x00, 0x0f, 0x0f, 0x08, 0x02, 0x0d, 0x013e - window_template 0x00, 0x16, 0x0f, 0x08, 0x02, 0x0d, 0x014e - window_template 0x00, 0x02, 0x05, 0x0e, 0x02, 0x0d, 0x015e - window_template 0x00, 0x03, 0x08, 0x0b, 0x08, 0x0f, 0x017a - window_template 0x00, 0x11, 0x05, 0x0e, 0x02, 0x0f, 0x01d2 - window_template 0x00, 0x12, 0x08, 0x0b, 0x08, 0x0f, 0x01ee - null_window_template - - .align 2 -gUnknown_0832DF8C:: @ 832DF8C - window_template 0x00, 0x17, 0x0d, 0x05, 0x04, 0x0f, 0x0246 - -gJPText_Shedinja:: @ 832DF94 - .string "ヌケニン$" - -gUnknown_0832DF99:: @ 832DF99 - .byte 0x04, 0x03, 0x13, 0x03, 0x00, 0x00, 0x00 - - .align 2 -gTradeBallPalette:: @ 832DFA0 - .incbin "graphics/trade/ball.gbapal" - - .align 2 -gTradeBallTiles:: @ 832DFC0 - .incbin "graphics/trade/ball.4bpp" - - .align 2 -gUnknown_832E5C0:: @ 832E5C0 - .incbin "graphics/trade/pokeball_symbol.8bpp" - - .align 2 -gUnknown_0832FFC0:: @ 832FFC0 - .incbin "graphics/trade/cable_closeup_map.bin" - - .align 2 -gUnknown_083307C0:: @ 83307C0 - .incbin "graphics/trade/pokeball_symbol_map.bin" - - .align 2 -gUnknown_083308C0:: @ 83308C0 - .incbin "graphics/trade/unknown_3308C0.gbapal" - - .align 2 -gUnknown_083308E0:: @ 83308E0 - .incbin "graphics/trade/gba.gbapal" - .incbin "graphics/trade/shadow.gbapal" - .incbin "graphics/trade/black.gbapal" - - .align 2 -gUnknown_08330940:: @ 8330940 - .incbin "graphics/trade/misc.gbapal" - - .align 2 -gTradeGlow1Tiles:: @ 8330960 - .incbin "graphics/trade/glow1.4bpp" - - .align 2 -gTradeGlow2Tiles:: @ 8330B60 - .incbin "graphics/trade/glow2.4bpp" - - .align 2 -gTradeCableEndTiles:: @ 8330D60 - .incbin "graphics/trade/cable_end.4bpp" - - .align 2 -gTradeGBAScreenTiles:: @ 8330F60 - .incbin "graphics/trade/gba_screen.4bpp" - - .align 2 -gUnknown_08331F60:: @ 8331F60 - .incbin "graphics/trade/shadow_map.bin" - - .align 2 -gUnknown_08332F60:: @ 8332F60 - .incbin "graphics/trade/gba_affine.8bpp" - - .space 0x40 - - .align 2 -gUnknown_083357A0:: @ 83357A0 - .incbin "graphics/trade/gba_affine_map_cable.bin" - - .align 2 -gUnknown_083358A0:: @ 83358A0 - .incbin "graphics/trade/gba_affine_map_wireless.bin" - - .align 2 -gUnknown_083359A0:: @ 83359A0 - .incbin "graphics/trade/gba_map_wireless.bin" - - .align 2 -gUnknown_083369A0:: @ 83369A0 - .incbin "graphics/trade/gba_map_cable.bin" - - .align 2 -gUnknown_083379A0:: @ 83379A0 - .incbin "graphics/trade/unknown_3379A0.bin.lz" - - .align 2 -gUnknown_08337AA0:: @ 8337AA0 - .incbin "graphics/trade/wireless_signal_send.gbapal" - - .align 2 -gUnknown_08337CA0:: @ 8337CA0 - .incbin "graphics/trade/wireless_signal_receive.gbapal" - - .align 2 -gUnknown_08337EA0:: @ 8337EA0 - .incbin "graphics/trade/black.gbapal" - - .align 2 -gUnknown_08337EC0:: @ 8337EC0 - .incbin "graphics/trade/wireless_signal.4bpp.lz" - - .align 2 -gUnknown_08338550:: @ 8338550 - .incbin "graphics/trade/wireless_signal.bin.lz" - - .align 2 -gOamData_8338C44:: @ 8338C44 - .2byte 0x0100, 0x4000, 0x0000, 0x0000 - - .align 2 -gSpriteAnim_8338C4C:: @ 8338C4C - .2byte 0x0000, 0x0003, 0x0004, 0x0003, 0x0008, 0x0003, 0x000c, 0x0003, 0x0010, 0x0003, 0x0014, 0x0003, 0x0018, 0x0003, 0x001c, 0x0003 - .2byte 0x0020, 0x0003, 0x0024, 0x0003, 0x0028, 0x0003, 0x002c, 0x0003, 0xfffd, 0x0001, 0x0000, 0x0003, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_8338C88:: @ 8338C88 - .2byte 0x0000, 0x0003, 0x0004, 0x0003, 0x0008, 0x0003, 0x000c, 0x0003, 0x0010, 0x0003, 0x0014, 0x0003, 0x0018, 0x0003, 0x001c, 0x0003 - .2byte 0x0020, 0x0003, 0x0024, 0x0003, 0x0028, 0x0003, 0x002c, 0x0003, 0xfffd, 0x0002, 0x0000, 0x0003, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_8338C88:: @ 8338CC4 - .4byte gSpriteAnim_8338C4C - .4byte gSpriteAnim_8338C88 - - .align 2 -gSpriteAffineAnim_8338CCC:: @ 8338CCC - .2byte 0x0000, 0x0000, 0x0100, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_8338CDC:: @ 8338CDC - .2byte 0xfff8, 0x0000, 0x1400, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_8338CEC:: @ 8338CEC - .2byte 0x0060, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0500, 0x0000, 0x0008, 0x0000, 0x1400, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnimTable_8338D0C:: @ 8338D0C - .4byte gSpriteAffineAnim_8338CCC - .4byte gSpriteAffineAnim_8338CDC - .4byte gSpriteAffineAnim_8338CEC - - .align 2 -gUnknown_08338D18:: @ 8338D18 - obj_tiles gTradeBallTiles, 0x0600, 0x15b5 - - .align 2 -gUnknown_08338D20:: @ 8338D20 - obj_pal gTradeBallPalette, 0x15b6 - - .align 2 -gSpriteTemplate_8338D28:: @ 8338D28 - spr_template 0x15b5, 0x15b6, gOamData_8338C44, gSpriteAnimTable_8338C88, NULL, gSpriteAffineAnimTable_8338D0C, sub_807E55C - - .align 2 -gOamData_8338D40:: @ 8338D40 - .2byte 0x0500, 0x8000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_8338D48:: @ 8338D48 - .2byte 0x0000, 0x00c5, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_8338D50:: @ 8338D50 - .4byte gSpriteAnim_8338D48 - - .align 2 -gSpriteAffineAnim_8338D54:: @ 8338D54 - .2byte 0xfff6, 0xfff6, 0x0500, 0x0000, 0x000a, 0x000a, 0x0500, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnimTable_8338D6C:: @ 8338D6C - .4byte gSpriteAffineAnim_8338D54 - - .align 2 -gUnknown_08338D70:: @ 8338D70 - obj_tiles gTradeGlow1Tiles, 0x0200, 0x15ae - - .align 2 -gUnknown_08338D78:: @ 8338D78 - obj_pal gUnknown_08330940, 0x15af - - .align 2 -gUnknown_08338D80:: @ 8338D80 - obj_pal gUnknown_083308E0, 0x15b3 - - .align 2 -gUnknown_08338D88:: @ 8338D88 - spr_template 0x15ae, 0x15af, gOamData_8338D40, gSpriteAnimTable_8338D50, NULL, gSpriteAffineAnimTable_8338D6C, sub_807AA28 - - .align 2 -gOamData_8338DA0:: @ 8338DA0 - .2byte 0x8000, 0x8000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_8338DA8:: @ 8338DA8 - .2byte 0x0000, 0x00c5, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_8338DB0:: @ 8338DB0 - .2byte 0x0008, 0x00c5, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_8338DB8:: @ 8338DB8 - .4byte gSpriteAnim_8338DA8 - .4byte gSpriteAnim_8338DB0 - - .align 2 -gUnknown_08338DC0:: @ 8338DC0 - obj_tiles gTradeGlow2Tiles, 0x0300, 0x15b0 - - .align 2 -gSpriteTemplate_8338DC8:: @ 8338DC8 - spr_template 0x15b0, 0x15af, gOamData_8338DA0, gSpriteAnimTable_8338DB8, NULL, gDummySpriteAffineAnimTable, sub_807AA7C - - .align 2 -gOamData_8338DE0:: @ 8338DE0 - .2byte 0x8000, 0x8000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_8338DE8:: @ 8338DE8 - .2byte 0x0000, 0x000a, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_8338DF0:: @ 8338DF0 - .4byte gSpriteAnim_8338DE8 - - .align 2 -gUnknown_08338DF4:: @ 8338DF4 - obj_tiles gTradeCableEndTiles, 0x0100, 0x15b2 - - .align 2 -gSpriteTemplate_8338DFC:: @ 8338DFC - spr_template 0x15b2, 0x15b3, gOamData_8338DE0, gSpriteAnimTable_8338DF0, NULL, gDummySpriteAffineAnimTable, sub_807AABC - - .align 2 -gOamData_8338E14:: @ 8338E14 - .2byte 0x4000, 0xc000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_8338E1C:: @ 8338E1C - .2byte 0x0000, 0x00c2, 0x0020, 0x00c2, 0x0040, 0x00c2, 0x0060, 0x00c2, 0x0040, 0x00c2, 0x0020, 0x00c2, 0x0000, 0x00c2, 0xfffd, 0x0008 - .2byte 0xffff, 0x0000 - - .align 2 -gSpriteAnim_8338E40:: @ 8338E40 - .2byte 0x0000, 0x00c2, 0x0020, 0x00c2, 0x0040, 0x00c2, 0x0060, 0x00c2, 0x0040, 0x00c2, 0x0020, 0x00c2, 0x0000, 0x00c2, 0xfffd, 0x0002 - .2byte 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_8338E64:: @ 8338E64 - .4byte gSpriteAnim_8338E1C - - .align 2 -gSpriteAnimTable_8338E68:: @ 8338E68 - .4byte gSpriteAnim_8338E40 - -gUnknown_08338E6C:: @ 8338E6C - obj_tiles gTradeGBAScreenTiles, 0x1000, 0x15b4 - - .align 2 -gSpriteTemplate_8338E74:: @ 8338E74 - spr_template 0x15b4, 0x15b3, gOamData_8338E14, gSpriteAnimTable_8338E64, NULL, gDummySpriteAffineAnimTable, sub_807AB04 - - .align 2 -gSpriteTemplate_8338E8C:: @ 8338E8C - spr_template 0x15b4, 0x15b3, gOamData_8338E14, gSpriteAnimTable_8338E68, NULL, gDummySpriteAffineAnimTable, sub_807AB04 - - .align 1 -gUnknown_08338EA4:: @ 8338EA4 - .incbin "graphics/trade/unknown_338EA4.gbapal" - - .align 2 -gSpriteAffineAnim_8338EBC:: @ 8338EBC - .2byte 0xff00, 0x0100, 0x0000, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnimTable_8338ECC:: @ 8338ECC - .4byte gSpriteAffineAnim_8338EBC - - .align 2 -gIngameTrades:: @ 8338ED0 - .string "DOTS$", 11 - .align 1 - .2byte SPECIES_SEEDOT - .byte 5, 4, 5, 4, 4, 4 - .byte 1 - .align 2 - .4byte 0x9746 - .byte 30, 5, 5, 5, 5 - .align 2 - .4byte 0x84 - .2byte ITEM_CHESTO_BERRY - .byte -1 - .string "KOBE$", 11 - .byte 0 - .byte 10 - .2byte SPECIES_RALTS - - .align 2 - .string "PLUSES$", 11 - .align 1 - .2byte SPECIES_PLUSLE - .byte 4, 4, 4, 5, 5, 4 - .byte 0 - .align 2 - .4byte 0x1210c - .byte 5, 5, 30, 5, 5 - .align 2 - .4byte 0x6f - .2byte ITEM_WOOD_MAIL - .byte 0 - .string "ROMAN$", 11 - .byte 0 - .byte 10 - .2byte SPECIES_VOLBEAT - - .align 2 - .string "SEASOR$", 11 - .align 1 - .2byte SPECIES_HORSEA - .byte 5, 4, 4, 4, 5, 4 - .byte 0 - .align 2 - .4byte 0xb4cd - .byte 5, 5, 5, 5, 30 - .align 2 - .4byte 0x7f - .2byte ITEM_WAVE_MAIL - .byte 1 - .string "SKYLAR$", 11 - .byte 0 - .byte 10 - .2byte SPECIES_BAGON - - .align 2 - .string "MEOWOW$", 11 - .align 1 - .2byte SPECIES_MEOWTH - .byte 4, 5, 4, 5, 4, 4 - .byte 0 - .align 2 - .4byte 0x16559 - .byte 5, 5, 5, 30, 5 - .align 2 - .4byte 0x8b - .2byte ITEM_RETRO_MAIL - .byte 2 - .string "ISIS$", 11 - .byte 1 - .byte 10 - .2byte SPECIES_SKITTY - - .align 2 -gUnknown_08338FC0:: @ 8338FC0 - .2byte 0x1006, 0x1232, 0x102f, 0x0161, 0x0c00, 0x0182, 0x1000, 0x1006, 0x0e3b, 0x0000, 0x0a01, 0x1000, 0x161e, 0x018b, 0x0433, 0x1611 - .2byte 0x180f, 0x0074, 0x1440, 0x0000, 0x0811, 0x102b, 0x013b, 0x2a34, 0x0c16, 0x1037, 0x1020, 0x0418, 0x0c23, 0x0000 - - .align 2 -gUnknown_08338FFC:: @ 8338FFC - window_template 0x00, 0x02, 0x0f, 0x1a, 0x04, 0x00, 0x0040 - null_window_template - - .align 2 -gUnknown_0833900C:: @ 833900C - window_template 0x00, 0x15, 0x09, 0x05, 0x04, 0x0f, 0x00bc - - .align 2 -gUnknown_08339014:: @ 8339014 - .4byte 0x000001fc, 0x00002051, 0x00002326, 0x00003063 - -gUnknown_08339024:: @ 8339024 - .byte 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfd, 0xfd, 0xfe, 0xfe, 0xfe - .byte 0xfe, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04 - .byte 0x04, 0x04, 0xfc, 0xfd, 0xfd, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0xfc, 0xfd, 0xfe, 0xff - .byte 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x02, 0x03 - -gUnknown_08339090:: @ 8339090 - .byte 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, 0x05, 0x02, 0x06, 0x02, 0x07, 0x02, 0x08, 0x02, 0x09, 0x02, 0x0a, 0x03, 0x0b, 0x03, 0x0c, 0x03, 0x0d, 0x04, 0x0e, 0x05, 0x0f, 0x02 - .byte 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, 0x05, 0x02, 0x06, 0x02, 0x07, 0x02, 0x08, 0x02, 0x09, 0x02, 0x0a, 0x03, 0x0b, 0x03, 0x0c, 0x03, 0x0d, 0x04, 0x0e, 0x05, 0x10, 0x01 - .byte 0x10, 0xff, 0x00, 0x00 diff --git a/include/battle_anim.h b/include/battle_anim.h index 9082e138b..4723fb0d5 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -122,7 +122,7 @@ s16 CloneBattlerSpriteWithBlend(u8); void obj_delete_but_dont_free_vram(struct Sprite*); u8 sub_80A89C8(int, u8, int); void sub_80A6D60(struct UnknownAnimStruct2*, const void*, u32); -void sub_80A6CC0(u32, const void*, u32); +void sub_80A6CC0(u32, const u32*, u32); void sub_80A6DAC(bool8); void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *); void sub_80A653C(struct Sprite *); @@ -148,6 +148,7 @@ void sub_80A6BFC(struct UnknownAnimStruct2 *unk, u8 unused); u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10); void sub_80A749C(struct Sprite *sprite); void sub_80A6814(u8 taskId); +void sub_80A6DEC(struct Sprite *sprite); void DestroySpriteAndFreeResources_(struct Sprite *sprite); void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId); @@ -209,7 +210,7 @@ u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, // battle_anim_utility_funcs.s void sub_8116EB4(u8); -void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u8 *arg8, const u8 *arg9, const u16 *palette); +void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette); u32 UnpackSelectedBattleAnimPalettes(s16); diff --git a/include/gba/defines.h b/include/gba/defines.h index 16f1315d0..b68a2ad1e 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -66,6 +66,4 @@ #define TOTAL_OBJ_TILE_COUNT 1024 -#define WIN_RANGE(a, b) (((a) << 8) | (b)) - #endif // GUARD_GBA_DEFINES diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index c20b69886..df79b084d 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -576,6 +576,9 @@ #define WINOUT_WINOBJ_OBJ (1 << 12) #define WINOUT_WINOBJ_CLR (1 << 13) +#define WIN_RANGE(a, b) (((a) << 8) | (b)) +#define WIN_RANGE2(a, b) ((b) | ((a) << 8)) + // BLDCNT // Bits 0-5 select layers for the 1st target #define BLDCNT_TGT1_BG0 (1 << 0) diff --git a/include/graphics.h b/include/graphics.h index 5cb6354aa..8a54ba536 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3071,7 +3071,7 @@ extern const u32 gTrainerBackPicPalette_Leaf[]; // pokeblock extern const u32 gMenuPokeblock_Gfx[]; -extern const u8 gMenuPokeblock_Pal[]; +extern const u32 gMenuPokeblock_Pal[]; extern const u32 gMenuPokeblock_Tilemap[]; extern const u32 gMenuPokeblockDevice_Gfx[]; extern const u32 gMenuPokeblockDevice_Pal[]; @@ -3859,8 +3859,8 @@ extern const u8 gFireRedMenuElements_Gfx[]; // item menu graphics extern const u32 gBagScreen_Gfx[]; -extern const u16 gBagScreenFemale_Pal[]; -extern const u16 gBagScreenMale_Pal[]; +extern const u32 gBagScreenFemale_Pal[]; +extern const u32 gBagScreenMale_Pal[]; extern const u8 gBagMenuHMIcon_Gfx[]; // item menu icons graphics @@ -3914,7 +3914,7 @@ extern const u32 gIntro2FlygonGfx[]; // party menu graphics extern const u32 gPartyMenuMisc_Gfx[]; extern const u32 gPartyMenuMisc_Tilemap[]; -extern const u8 gPartyMenuMisc_Pal[]; +extern const u32 gPartyMenuMisc_Pal[]; // berry pics extern const u32 gBerryPic_Cheri[]; @@ -4105,6 +4105,10 @@ extern const u32 gUnknown_08D83C3C[]; extern const u32 gUnknown_08D83900[]; extern const u32 gBattleFrontierGfx_DomeOptions[]; +extern const u32 gUnknown_08D854E8[]; +extern const u32 gUnknown_08D855E8[]; +extern const u32 gContest2Pal[]; + extern const u32 gBattleAnimSpriteSheet_000[]; extern const u32 gBattleAnimSpriteSheet_001[]; extern const u32 gBattleAnimSpriteSheet_002[]; @@ -4626,9 +4630,9 @@ extern const u32 gBattleAnimSpritePalette_241[]; extern const u32 gBattleAnimSpritePalette_242[]; extern const u32 gBattleAnimSpritePalette_243[]; extern const u32 gBattleAnimSpritePalette_244[]; -extern const u8 gUnknown_08C2DC68[]; -extern const u16 gUnknown_08C2DDA4[]; -extern const u8 gUnknown_08C2DDC4[]; +extern const u32 gUnknown_08C2DC68[]; +extern const u32 gUnknown_08C2DDA4[]; +extern const u32 gUnknown_08C2DDC4[]; extern const u32 gBattleAnimSpritePalette_245[]; extern const u32 gBattleAnimSpritePalette_248[]; extern const u32 gBattleAnimSpritePalette_249[]; @@ -4797,6 +4801,16 @@ extern const u32 gCableCarDoor_Gfx[]; extern const u32 gCableCarCord_Gfx[]; extern const u16 gCableCar_Pal[]; +// Trade +extern const u16 gUnknown_08DDB3E4[]; +extern const u8 gUnknown_08DDB464[]; +extern const u16 gUnknown_08DDCF04[]; +extern const u16 gTradeGba2_Pal[]; +extern const u8 gTradeGba_Gfx[]; +extern const u16 gUnknown_08DDD704[]; +extern const u8 gUnknown_08DDC6E4[]; +extern const u16 gUnknown_08DDB444[]; + // Party menu extern const u32 gPartyMenuPokeball_Gfx[]; extern const u32 gPartyMenuPokeballSmall_Gfx[]; diff --git a/include/librfu.h b/include/librfu.h index 49df42541..38c819835 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -255,6 +255,6 @@ void rfu_REQ_recvData(void); void rfu_UNI_readySendData(u8 a0); void rfu_UNI_clearRecvNewDataFlag(u8 a0); void rfu_REQ_PARENT_resumeRetransmitAndChange(void); -void rfu_NI_setSendData(u8, u8, u8 *, u8); +void rfu_NI_setSendData(u8, u8, const void *, u32); #endif // GUARD_LIBRFU_H diff --git a/include/link.h b/include/link.h index f12f0990f..9552f062c 100644 --- a/include/link.h +++ b/include/link.h @@ -240,7 +240,7 @@ void SerialCB(void); u8 GetLinkPlayerCount(void); bool32 InUnionRoom(void); void sub_800E0E8(void); -bool8 sub_800A520(void); +bool8 IsLinkTaskFinished(void); void CreateWirelessStatusIndicatorSprite(u8, u8); void sub_800ADF8(void); void sub_800B488(void); @@ -311,5 +311,6 @@ void sub_800AD10(void); void sub_800AB18(void); void sub_8009F18(void); bool8 sub_800AA60(void); +void sub_800ABF4(u16 a0); #endif // GUARD_LINK_H diff --git a/include/link_rfu.h b/include/link_rfu.h index e394e2611..715b4cdd9 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -279,5 +279,7 @@ void sub_8011DE0(u32 arg0); u8 sub_801100C(int a0); void sub_800EF7C(void); bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); +s32 sub_800E87C(u8 idx); +void sub_8011BA4(void); #endif //GUARD_LINK_RFU_H diff --git a/include/palette.h b/include/palette.h index c14e9f453..540452f3d 100644 --- a/include/palette.h +++ b/include/palette.h @@ -43,7 +43,7 @@ extern u8 gPaletteDecompressionBuffer[]; extern u16 gPlttBufferUnfaded[]; extern u16 gPlttBufferFaded[]; -void LoadCompressedPalette(const void *, u16, u16); +void LoadCompressedPalette(const u32 *, u16, u16); void LoadPalette(const void *, u16, u16); void FillPalette(u16, u16, u16); void TransferPlttBuffer(void); diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index c1bdbdf34..faffd3375 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -5,6 +5,7 @@ // Exported RAM declarations +extern u8 gUnknown_02022C2C; extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; extern u16 gUnknown_02022C3C; extern u8 gUnknown_02022C3E; diff --git a/include/strings.h b/include/strings.h index 64222cddb..7c6ca14ba 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1893,7 +1893,6 @@ extern const u8 gText_PkmnTransferredSomeonesPC[]; extern const u8 gText_PkmnTransferredLanettesPC[]; // hall of fame -extern const u8 gText_SavingDontTurnOffPower[]; extern const u8 gText_LeagueChamp[]; extern const u8 gText_HOFNumber[]; extern const u8 gText_PickNextCancel[]; @@ -1984,4 +1983,11 @@ extern const u8 gText_EggCantBeTradedNow[]; extern const u8 gText_OtherTrainerCantAcceptPkmn[]; extern const u8 gText_CantTradeWithTrainer[]; +// trade +extern const u8 gText_XWillBeSentToY[]; +extern const u8 gText_ByeByeVar1[]; +extern const u8 gText_XSentOverY[]; +extern const u8 gText_TakeGoodCareOfX[]; +extern const u8 gText_CommunicationStandby5[]; + #endif //GUARD_STRINGS_H diff --git a/include/trade.h b/include/trade.h index e3c18bffd..95a10cacf 100644 --- a/include/trade.h +++ b/include/trade.h @@ -12,8 +12,12 @@ s32 sub_807A728(void); void sub_80773AC(void); void sub_807AE50(void); -int sub_807A8D0(u32 /* probably wrong */, u16, u16, u8); -int sub_807A7E0(u32 /* probably wrong */, u32 /* probably wrong */, u16, u16, u16, u16, u8); +int sub_807A8D0(struct UnkLinkRfuStruct_02022B14Substruct a0, u16, u16, u8); +int sub_807A7E0(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6); int sub_807A918(struct Pokemon*, u16); +void sub_807B140(void); +void sub_807B154(void); +void sub_807F19C(void); +void sub_807F1A8(u8, const u8 *, u8); #endif //GUARD_TRADE_H diff --git a/include/trainer_card.h b/include/trainer_card.h index d80a5fa52..1af247d8a 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -38,5 +38,6 @@ void sub_80C3120(struct TrainerCard *arg0, u16 *arg1, u8 gameVersion); void TrainerCard_ShowLinkCard(u8 arg0, void (*callback)(void)); void TrainerCard_GenerateCardForPlayer(struct TrainerCard *); u8 sub_80C4904(u8); +void sub_80C6D80(const u8 *, u8 *, u8, u8, u8); #endif // GUARD_TRAINER_CARD_H diff --git a/include/util.h b/include/util.h index 997c8f713..9d13453c2 100644 --- a/include/util.h +++ b/include/util.h @@ -14,5 +14,6 @@ u16 CalcCRC16(u8 *data, s32 length); u16 CalcCRC16WithTable(u8 *data, u32 length); u32 CalcByteArraySum(const u8* data, u32 length); void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); +void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); #endif // GUARD_UTIL_H diff --git a/ld_script.txt b/ld_script.txt index 1ed5d75aa..c0810850e 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -81,7 +81,7 @@ SECTIONS { src/smokescreen.o(.text); src/pokeball.o(.text); src/load_save.o(.text); - asm/trade.o(.text); + src/trade.o(.text); src/berry_blender.o(.text); src/play_time.o(.text); src/new_game.o(.text); @@ -418,7 +418,7 @@ SECTIONS { src/battle_gfx_sfx_util.o(.rodata); src/battle_interface.o(.rodata); src/pokeball.o(.rodata); - data/trade.o(.rodata); + src/trade.o(.rodata); src/berry_blender.o(.rodata); src/new_game.o(.rodata); src/overworld.o(.rodata); diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c index e93e8e890..92815b56c 100644 --- a/src/battle_anim_80A5C6C.c +++ b/src/battle_anim_80A5C6C.c @@ -948,7 +948,7 @@ void sub_80A6C68(u32 bgId) CopyBgTilemapBufferToVram(unkStruct.bgId); } -void sub_80A6CC0(u32 bgId, const void *src, u32 tilesOffset) +void sub_80A6CC0(u32 bgId, const u32 *src, u32 tilesOffset) { CpuFill32(0, gUnknown_0202305C, 0x2000); LZDecompressWram(src, gUnknown_0202305C); diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index e9606172f..8306ada1c 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -3390,8 +3390,8 @@ void sub_81064F8(u8 taskId) else sub_80A6D60(&unknownStruct, &gBattleAnimBackgroundTilemap_ScaryFaceOpponent, 0); - sub_80A6CC0(unknownStruct.bgId, &gUnknown_08C249F8, unknownStruct.tilesOffset); - LoadCompressedPalette(&gUnknown_08C249D0, unknownStruct.unk8 << 4, 32); + sub_80A6CC0(unknownStruct.bgId, gUnknown_08C249F8, unknownStruct.tilesOffset); + LoadCompressedPalette(gUnknown_08C249D0, unknownStruct.unk8 << 4, 32); gTasks[taskId].func = sub_81065EC; } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index dfaba3d92..018cc48e4 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2383,8 +2383,8 @@ void sub_815BB84(u8 taskId) gBattle_BG1_Y = 0; } - sub_80A6CC0(unknownStruct.bgId, &gUnknown_08C2A634, unknownStruct.tilesOffset); - LoadCompressedPalette(&gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32); + sub_80A6CC0(unknownStruct.bgId, gUnknown_08C2A634, unknownStruct.tilesOffset); + LoadCompressedPalette(gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32); gTasks[taskId].data[10] = gBattle_BG1_X; gTasks[taskId].data[11] = gBattle_BG1_Y; @@ -2589,8 +2589,8 @@ void sub_815C0A4(u8 taskId) gBattle_BG1_Y = 0; } - sub_80A6CC0(unknownStruct.bgId, &gUnknown_08C2A634, unknownStruct.tilesOffset); - LoadCompressedPalette(&gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32); + sub_80A6CC0(unknownStruct.bgId, gUnknown_08C2A634, unknownStruct.tilesOffset); + LoadCompressedPalette(gUnknown_08C2A6D4, unknownStruct.unk8 << 4, 32); gTasks[taskId].data[10] = gBattle_BG1_X; gTasks[taskId].data[11] = gBattle_BG1_Y; gTasks[taskId].data[0]++; diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index f99b1aeac..c9d9bb99c 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -767,7 +767,7 @@ void sub_81177E4(u8 taskId) DestroyAnimVisualTask(taskId); } -void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u8 *arg8, const u8 *arg9, const u16 *palette) +void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette) { u16 species; u8 spriteId, spriteId2; diff --git a/src/battle_arena.c b/src/battle_arena.c index fb95e64d4..cfcb10a0d 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -8,6 +8,7 @@ #include "decompress.h" #include "event_data.h" #include "frontier_util.h" +#include "graphics.h" #include "gpu_regs.h" #include "item.h" #include "m4a.h" @@ -23,9 +24,6 @@ #include "constants/battle_frontier.h" #include "constants/moves.h" -extern const u32 gUnknown_08D854E8[]; -extern const u16 gUnknown_08D855E8[]; - // This file's functions. static void sub_81A58B4(void); static void sub_81A5964(void); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 6ccae2e95..12ffca381 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -869,7 +869,7 @@ static void sub_80586F8(void) } else { - if (sub_800A520()) + if (IsLinkTaskFinished()) { m4aSongNumStop(SE_HINSI); gMain.inBattle = 0; @@ -888,7 +888,7 @@ void sub_80587B0(void) { if (gBattleTypeFlags & BATTLE_TYPE_LINK) { - if (sub_800A520()) + if (IsLinkTaskFinished()) { if (gWirelessCommType == 0) sub_800AC34(); diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 06d856d28..70a53f332 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -800,7 +800,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId) } break; case 4: - if (sub_800A520()) + if (IsLinkTaskFinished()) { blockSize = gLinkBattleSendBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_LO] | (gLinkBattleSendBuffer[gTasks[taskId].data[15] + LINK_BUFF_SIZE_HI] << 8); gTasks[taskId].data[13] = 1; diff --git a/src/battle_main.c b/src/battle_main.c index 0080c09f3..df1828d18 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -17,6 +17,7 @@ #include "dma3.h" #include "event_data.h" #include "evolution_scene.h" +#include "graphics.h" #include "gpu_regs.h" #include "international_string_util.h" #include "item.h" @@ -60,7 +61,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1; extern struct MusicPlayerInfo gMPlayInfo_SE2; -extern const u16 gBattleTextboxPalette[]; extern const struct BgTemplate gBattleBgTemplates[]; extern const struct WindowTemplate *const gBattleWindowTemplates[]; extern const u8 *const gBattleScriptsForMoveEffects[]; @@ -986,7 +986,7 @@ static void CB2_HandleStartBattle(void) { if (gReceivedRemoteLinkPlayers != 0) { - if (sub_800A520()) + if (IsLinkTaskFinished()) { *(&gBattleStruct->field_180) = 0; *(&gBattleStruct->field_181) = 3; @@ -1035,7 +1035,7 @@ static void CB2_HandleStartBattle(void) } break; case 3: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1050,7 +1050,7 @@ static void CB2_HandleStartBattle(void) } break; case 7: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 2, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1065,7 +1065,7 @@ static void CB2_HandleStartBattle(void) } break; case 11: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 4, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1107,7 +1107,7 @@ static void CB2_HandleStartBattle(void) } break; case 16: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), &gRecordedBattleRngSeed, sizeof(gRecordedBattleRngSeed)); gBattleCommunication[MULTIUSE_STATE]++; @@ -1194,7 +1194,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) GetBattleTowerTrainerLanguage(&language, gTrainerBattleOpponent_B); gLinkPlayers[3].language = language; - if (sub_800A520()) + if (IsLinkTaskFinished()) { *(&gBattleStruct->field_180) = 0; *(&gBattleStruct->field_181) = 3; @@ -1234,7 +1234,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } break; case 3: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1258,7 +1258,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } break; case 5: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 2, sizeof(struct Pokemon)); gBattleCommunication[MULTIUSE_STATE]++; @@ -1282,7 +1282,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } break; case 7: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gEnemyParty, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1300,7 +1300,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } break; case 9: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gEnemyParty + 2, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1318,7 +1318,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } break; case 11: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gEnemyParty + 4, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1360,7 +1360,7 @@ static void CB2_HandleStartMultiPartnerBattle(void) } break; case 14: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), &gRecordedBattleRngSeed, sizeof(gRecordedBattleRngSeed)); gBattleCommunication[MULTIUSE_STATE]++; @@ -1440,7 +1440,7 @@ static void CB2_PreInitMultiBattle(void) switch (gBattleCommunication[MULTIUSE_STATE]) { case 0: - if (gReceivedRemoteLinkPlayers != 0 && sub_800A520()) + if (gReceivedRemoteLinkPlayers != 0 && IsLinkTaskFinished()) { gUnknown_02023058 = Alloc(sizeof(struct UnknownPokemonStruct4) * 3); sub_80379F8(0); @@ -1478,7 +1478,7 @@ static void CB2_PreInitMultiBattle(void) } break; case 2: - if (sub_800A520() && !gPaletteFade.active) + if (IsLinkTaskFinished() && !gPaletteFade.active) { gBattleCommunication[MULTIUSE_STATE]++; if (gWirelessCommType) @@ -1581,7 +1581,7 @@ static void CB2_HandleStartMultiBattle(void) { if (gReceivedRemoteLinkPlayers != 0) { - if (sub_800A520()) + if (IsLinkTaskFinished()) { *(&gBattleStruct->field_180) = 0; *(&gBattleStruct->field_181) = 3; @@ -1643,7 +1643,7 @@ static void CB2_HandleStartMultiBattle(void) break; // fall through case 3: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty, sizeof(struct Pokemon) * 2); gBattleCommunication[MULTIUSE_STATE]++; @@ -1706,7 +1706,7 @@ static void CB2_HandleStartMultiBattle(void) } break; case 5: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), gPlayerParty + 2, sizeof(struct Pokemon)); gBattleCommunication[MULTIUSE_STATE]++; @@ -1802,7 +1802,7 @@ static void CB2_HandleStartMultiBattle(void) } break; case 8: - if (sub_800A520()) + if (IsLinkTaskFinished()) { u32* ptr = (u32*)(&gBattleStruct->field_180); ptr[0] = gBattleTypeFlags; @@ -2361,7 +2361,7 @@ static void sub_8038F34(void) gBattleCommunication[MULTIUSE_STATE]++; break; case 6: - if (sub_800A520() == TRUE) + if (IsLinkTaskFinished() == TRUE) { sub_800ADF8(); BattlePutTextOnWindow(gText_LinkStandby3, 0); @@ -2371,7 +2371,7 @@ static void sub_8038F34(void) case 7: if (!IsTextPrinterActive(0)) { - if (sub_800A520() == TRUE) + if (IsLinkTaskFinished() == TRUE) gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2546,7 +2546,7 @@ static void sub_803939C(void) } break; case 6: - if (sub_800A520() == TRUE) + if (IsLinkTaskFinished() == TRUE) { HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR); if (gMain.field_439_x4) @@ -2596,7 +2596,7 @@ static void sub_803939C(void) } break; case 11: - if (sub_800A520() == TRUE && !IsTextPrinterActive(0) && --gBattleCommunication[1] == 0) + if (IsLinkTaskFinished() == TRUE && !IsTextPrinterActive(0) && --gBattleCommunication[1] == 0) { if (gMain.field_439_x4) { @@ -2612,7 +2612,7 @@ static void sub_803939C(void) { if (gMain.field_439_x4) { - if (sub_800A520() == TRUE) + if (IsLinkTaskFinished() == TRUE) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gBattleCommunication[1] = 0x20; diff --git a/src/battle_tower.c b/src/battle_tower.c index 2bb0352a8..9e546b0c8 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -2799,7 +2799,7 @@ static void sub_8164B74(void) if (battleMode == FRONTIER_MODE_LINK_MULTIS) { challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / 7; - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), &challengeNum, sizeof(challengeNum)); gSpecialVar_Result = 1; @@ -2836,7 +2836,7 @@ static void sub_8164B74(void) } break; case 2: - if (sub_800A520()) + if (IsLinkTaskFinished()) { SendBlock(bitmask_all_link_players_but_self(), &gSaveBlock2Ptr->frontier.field_CB4, sizeof(gSaveBlock2Ptr->frontier.field_CB4)); gSpecialVar_Result = 3; diff --git a/src/berry_blender.c b/src/berry_blender.c index 1ffdb1c38..ea9c6c4ff 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1240,7 +1240,7 @@ static void sub_8080018(void) sBerryBlenderData->framesToWait = 0; break; case 9: - if (sub_800A520()) + if (IsLinkTaskFinished()) { ResetBlockReceivedFlags(); if (GetMultiplayerId() == 0) @@ -1297,7 +1297,7 @@ static void sub_8080018(void) } break; case 13: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sBerryBlenderData->mainState++; sub_8082CB4(&sBerryBlenderData->bgAffineSrc); @@ -1342,7 +1342,7 @@ static void sub_8080018(void) sBerryBlenderData->mainState++; break; case 20: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sub_800A418(); sBerryBlenderData->mainState++; @@ -2412,7 +2412,7 @@ static void CB2_HandleBlenderEndGame(void) { sBerryBlenderData->gameEndState++; } - else if (sub_800A520()) + else if (IsLinkTaskFinished()) { if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType) { @@ -2593,7 +2593,7 @@ static bool8 LinkPlayAgainHandleSaving(void) sBerryBlenderData->framesToWait = 0; break; case 1: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sBerryBlenderData->field_1A0++; gSoftResetDisabled = TRUE; @@ -2612,7 +2612,7 @@ static bool8 LinkPlayAgainHandleSaving(void) } break; case 4: - if (sub_800A520()) + if (IsLinkTaskFinished()) { if (sub_8153474()) { @@ -2687,7 +2687,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void) sBerryBlenderData->gameEndState++; break; case 6: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sBerryBlenderData->framesToWait = 0; sBerryBlenderData->gameEndState++; @@ -2706,7 +2706,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void) sub_800ADF8(); break; case 9: - if (sub_800A520()) + if (IsLinkTaskFinished()) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); sBerryBlenderData->gameEndState++; diff --git a/src/cable_club.c b/src/cable_club.c index 372329c14..784426d53 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -898,7 +898,7 @@ static void sub_80B33BC(u8 taskId) data[0] = 6; break; case 6: - if (sub_800A520()) + if (IsLinkTaskFinished()) { data[0] = 7; } @@ -1123,7 +1123,7 @@ static void sub_80B3894(u8 taskId) data[0]++; break; case 3: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sub_8013F78(); DestroyTask(taskId); diff --git a/src/contest.c b/src/contest.c index 0f29f4ad9..949be7941 100644 --- a/src/contest.c +++ b/src/contest.c @@ -217,7 +217,6 @@ extern const u8 gText_0827D597[]; extern const struct ContestPokemon gContestOpponents[96]; extern const u8 gUnknown_085898A4[96]; extern const struct CompressedSpriteSheet gUnknown_08587C00; -extern const u8 gContest2Pal[]; extern const struct SpriteTemplate gSpriteTemplate_8587BE8; extern const struct CompressedSpriteSheet gUnknown_08587C08; extern const struct CompressedSpritePalette gUnknown_08587C10; @@ -474,14 +473,14 @@ void sub_80D7CB4(u8 taskId) gTasks[taskId].data[0]++; // fallthrough case 1: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sub_800ADF8(); gTasks[taskId].data[0]++; } return; case 2: - if (sub_800A520() != TRUE) + if (IsLinkTaskFinished() != TRUE) return; gTasks[taskId].data[0]++; break; diff --git a/src/egg_hatch.c b/src/egg_hatch.c index c2e57f8b5..e1d94889a 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -23,6 +23,7 @@ #include "bg.h" #include "m4a.h" #include "window.h" +#include "graphics.h" #include "constants/abilities.h" #include "daycare.h" #include "overworld.h" @@ -52,11 +53,6 @@ struct EggHatchData }; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; -extern const u8 gBattleTextboxTiles[]; -extern const u8 gBattleTextboxTilemap[]; -extern const u8 gBattleTextboxPalette[]; -extern const u16 gTradeGba2_Pal[]; // palette, gameboy advance -extern const u32 gTradeGba_Gfx[]; // tileset gameboy advance extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle extern const u8 gText_HatchedFromEgg[]; extern const u8 gText_NickHatchPrompt[]; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 2c1df814b..c97e2d10f 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -1,33 +1,34 @@ #include "global.h" +#include "alloc.h" +#include "battle.h" +#include "battle_message.h" +#include "bg.h" +#include "data2.h" +#include "decompress.h" #include "evolution_scene.h" #include "evolution_graphics.h" -#include "sprite.h" -#include "alloc.h" -#include "task.h" -#include "palette.h" +#include "gpu_regs.h" +#include "link.h" +#include "m4a.h" #include "main.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "pokedex.h" +#include "pokemon.h" +#include "scanline_effect.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "task.h" #include "text.h" #include "text_window.h" -#include "pokemon.h" -#include "string_util.h" -#include "battle.h" -#include "scanline_effect.h" -#include "decompress.h" -#include "m4a.h" -#include "menu.h" -#include "pokedex.h" -#include "constants/species.h" -#include "sound.h" -#include "constants/songs.h" -#include "overworld.h" -#include "battle_message.h" -#include "constants/battle_string_ids.h" -#include "gpu_regs.h" -#include "bg.h" -#include "link.h" -#include "util.h" #include "trig.h" -#include "data2.h" +#include "trade.h" +#include "util.h" +#include "constants/battle_string_ids.h" +#include "constants/species.h" +#include "constants/songs.h" struct EvoInfo { @@ -50,12 +51,8 @@ extern const struct CompressedSpriteSheet gMonFrontPicTable[]; // strings extern const u8 gText_CommunicationStandby5[]; -extern void sub_807B154(void); -extern void sub_807F19C(void); -extern void sub_807B140(void); extern void ShowSelectMovePokemonSummaryScreen(struct Pokemon *party, u8 monId, u8 partyCount, void *CB2_ptr, u16 move); extern u8 sub_81C1B94(void); -extern void sub_807F1A8(u8 arg0, const u8 *arg1, u8 arg2); extern void sub_800E084(void); // this file's functions diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index 5ce000587..b9e9272d4 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -215,7 +215,7 @@ static void sub_80AF234(u8 taskId) task->data[0]++; break; case 1: - if (!sub_800A520()) + if (!IsLinkTaskFinished()) { if (++task->data[1] > 1800) sub_8011170(0x6000); @@ -248,7 +248,7 @@ void sub_80AF2B4(u8 taskId) task->data[0]++; break; case 1: - if (sub_800A520()) + if (IsLinkTaskFinished()) { task->data[0]++; } diff --git a/src/field_specials.c b/src/field_specials.c index 89b6fd564..5883e0245 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3609,7 +3609,7 @@ static void sub_813B57C(u8 taskId) } break; case 1: - if (sub_800A520() == TRUE) + if (IsLinkTaskFinished() == TRUE) { if (GetMultiplayerId() == 0) { @@ -3650,7 +3650,7 @@ static void sub_813B57C(u8 taskId) } break; case 3: - if (sub_800A520() == TRUE) + if (IsLinkTaskFinished() == TRUE) { if (GetMultiplayerId() != 0) { @@ -3702,14 +3702,14 @@ static void sub_813B57C(u8 taskId) } break; case 7: - if (sub_800A520() == 1) + if (IsLinkTaskFinished() == 1) { sub_800ADF8(); gTasks[taskId].data[0]++; } break; case 8: - if (sub_800A520() == 1) + if (IsLinkTaskFinished() == 1) { gTasks[taskId].data[0]++; } diff --git a/src/fieldmap.c b/src/fieldmap.c index b1feed4bf..d2ff34b1c 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -993,7 +993,7 @@ void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u1 } else { - LoadCompressedPalette((u16*)tileset->palettes, destOffset, size); + LoadCompressedPalette((u32*)tileset->palettes, destOffset, size); nullsub_3(destOffset, size >> 1); } } diff --git a/src/graphics.c b/src/graphics.c index c0deb2883..b2de074bc 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -897,9 +897,9 @@ const u32 gBattleStatMask6_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat6 const u32 gBattleStatMask7_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat7.gbapal.lz"); const u32 gBattleStatMask8_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat8.gbapal.lz"); -const u8 gUnknown_08C2DC68[] = INCBIN_U8("graphics/battle_anims/masks/cure_bubbles.4bpp.lz"); -const u16 gUnknown_08C2DDA4[] = INCBIN_U16("graphics/battle_anims/masks/cure_bubbles.gbapal.lz"); -const u8 gUnknown_08C2DDC4[] = INCBIN_U8("graphics/battle_anims/masks/cure_bubbles.bin.lz"); +const u32 gUnknown_08C2DC68[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.4bpp.lz"); +const u32 gUnknown_08C2DDA4[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.gbapal.lz"); +const u32 gUnknown_08C2DDC4[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.bin.lz"); const u32 gBattleAnimSpritePalette_245[] = INCBIN_U32("graphics/battle_anims/sprites/245.gbapal.lz"); const u32 gBattleAnimSpriteSheet_245[] = INCBIN_U32("graphics/battle_anims/sprites/245.4bpp.lz"); diff --git a/src/link.c b/src/link.c index 79df699ef..69373f773 100644 --- a/src/link.c +++ b/src/link.c @@ -1080,7 +1080,7 @@ bool8 sub_800A4D8(u8 a0) return FALSE; } -bool8 sub_800A520(void) +bool8 IsLinkTaskFinished(void) { if (gWirelessCommType == TRUE) { diff --git a/src/link_rfu.c b/src/link_rfu.c index 5f4beadee..0625e4af4 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4123,7 +4123,7 @@ void sub_8010AAC(u8 taskId) gTasks[taskId].data[0]++; break; case 5: - if (sub_800A520() && GetBlockReceivedStatus() & 1) + if (IsLinkTaskFinished() && GetBlockReceivedStatus() & 1) { CpuFill16(0, gBlockRecvBuffer, sizeof(struct UnkRfuStruct_8010A14)); ResetBlockReceivedFlag(0); @@ -4162,7 +4162,7 @@ void sub_8010D0C(u8 taskId) } break; case 1: - if (sub_800A520()) + if (IsLinkTaskFinished()) gTasks[taskId].data[0]++; break; case 2: diff --git a/src/palette.c b/src/palette.c index 1e92f4bba..deb07b066 100644 --- a/src/palette.c +++ b/src/palette.c @@ -77,7 +77,7 @@ static const u8 sRoundedDownGrayscaleMap[] = { 31, 31 }; -void LoadCompressedPalette(const void *src, u16 offset, u16 size) +void LoadCompressedPalette(const u32 *src, u16 offset, u16 size) { LZDecompressWram(src, gPaletteDecompressionBuffer); CpuCopy16(gPaletteDecompressionBuffer, gPlttBufferUnfaded + offset, size); diff --git a/src/party_menu.c b/src/party_menu.c index 9b992fb99..00432e6db 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4579,7 +4579,7 @@ static void CursorCb_Register(u8 taskId) u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_OBEDIENCE); - switch (sub_807A8D0(*(u32 *)sub_800F7DC() /* dirty cast, probably needs to be changed */, species2, species, obedience)) + switch (sub_807A8D0(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_800F7DC(), species2, species, obedience)) { case 1: StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); @@ -4605,7 +4605,7 @@ static void CursorCb_Trade1(u8 taskId) u16 species2 = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES2); u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_SPECIES); u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_OBEDIENCE); - u32 stringId = sub_807A7E0(*(u32 *)sub_800F7DC() /* dirty cast, probably needs to be changed */, *(u32 *)&gUnknown_02022C38 /* dirty cast, probably needs to be changed */, species2, gUnknown_02022C3C, gUnknown_02022C3E, species, obedience); + u32 stringId = sub_807A7E0(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_800F7DC(), gUnknown_02022C38, species2, gUnknown_02022C3C, gUnknown_02022C3E, species, obedience); if (stringId != 0) { diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index c4546fffc..14d5aa9dc 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1271,7 +1271,7 @@ static bool8 SummaryScreen_DecompressGraphics(void) pssData->unk40F0++; break; case 12: - LoadCompressedPalette(&gMoveTypes_Pal, 0x1D0, 0x60); + LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60); pssData->unk40F0 = 0; return TRUE; } diff --git a/src/record_mixing.c b/src/record_mixing.c index c3637b1a3..189033685 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -1003,7 +1003,7 @@ static void sub_80E7FF8(u8 taskId) task->data[0] ++; break; case 9: - if (sub_800A520()) + if (IsLinkTaskFinished()) DestroyTask(taskId); break; } diff --git a/src/rock.c b/src/rock.c index ff3840fb3..ebf477ec1 100644 --- a/src/rock.c +++ b/src/rock.c @@ -421,7 +421,7 @@ void AnimTask_LoadSandstormBackground(u8 taskId) sub_80A6B30(&unknownStruct); sub_80A6CC0(unknownStruct.bgId, gUnknown_08D8D58C, unknownStruct.tilesOffset); sub_80A6D60(&unknownStruct, gUnknown_08D8D410, 0); - LoadCompressedPalette(&gBattleAnimSpritePalette_261, unknownStruct.unk8 * 16, 32); + LoadCompressedPalette(gBattleAnimSpritePalette_261, unknownStruct.unk8 * 16, 32); if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) var0 = 1; diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c index d3c6ec6d1..813d143d2 100644 --- a/src/rom_8011DC0.c +++ b/src/rom_8011DC0.c @@ -1838,7 +1838,7 @@ void sub_8014790(u8 taskId) } break; case 3: - if (sub_800A520()) + if (IsLinkTaskFinished()) { DestroyTask(taskId); sub_80149D8(); @@ -2095,7 +2095,7 @@ void sub_8014A40(u8 taskId) data->state++; break; case 17: - if (sub_800A520()) + if (IsLinkTaskFinished()) DestroyTask(taskId); break; } @@ -2264,7 +2264,7 @@ void sub_8014F48(u8 taskId) sub_800ADF8(); break; case 12: - if (sub_800A520()) + if (IsLinkTaskFinished()) DestroyTask(taskId); break; } @@ -2443,7 +2443,7 @@ void sub_80152F4(u8 taskId) sub_800ADF8(); break; case 14: - if (sub_800A520()) + if (IsLinkTaskFinished()) DestroyTask(taskId); break; } @@ -2836,7 +2836,7 @@ void sub_80156E0(u8 taskId) } break; case 41: - if (sub_800A520()) + if (IsLinkTaskFinished()) { if (GetMultiplayerId() == 0) { @@ -3033,7 +3033,7 @@ void sub_80156E0(u8 taskId) data->state = 15; break; case 15: - if (sub_800A520()) + if (IsLinkTaskFinished()) data->state = 16; break; case 16: diff --git a/src/save.c b/src/save.c index b234c230d..cfbe5b848 100644 --- a/src/save.c +++ b/src/save.c @@ -77,7 +77,7 @@ extern void DoSaveFailedScreen(u8); // save_failed_screen extern bool32 ProgramFlashSectorAndVerify(u8 sector, u8 *data); extern void save_serialize_map(void); extern void sub_800ADF8(void); -extern bool8 sub_800A520(void); +extern bool8 IsLinkTaskFinished(void); // iwram common u16 gLastWrittenSector; @@ -914,7 +914,7 @@ void sub_8153688(u8 taskId) taskData[0] = 2; break; case 2: - if (sub_800A520()) + if (IsLinkTaskFinished()) { if (taskData[2] == 0) save_serialize_map(); @@ -951,7 +951,7 @@ void sub_8153688(u8 taskId) taskData[0] = 8; break; case 8: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sub_8153408(); taskData[0] = 9; @@ -962,7 +962,7 @@ void sub_8153688(u8 taskId) taskData[0] = 10; break; case 10: - if (sub_800A520()) + if (IsLinkTaskFinished()) taskData[0]++; break; case 11: diff --git a/src/scrcmd.c b/src/scrcmd.c index dd14c1eef..837259a7f 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -54,8 +54,7 @@ typedef u16 (*SpecialFunc)(void); typedef void (*NativeFunc)(void); -extern const u8 *gUnknown_020375C0; - +EWRAM_DATA const u8 *gUnknown_020375C0 = NULL; static EWRAM_DATA u32 gUnknown_020375C4 = 0; static EWRAM_DATA u16 sPauseCounter = 0; static EWRAM_DATA u16 sMovingNpcId = 0; diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 102e80064..15e91ac98 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -451,7 +451,7 @@ static void sub_80F9088(u8 taskId) switch (gTasks[taskId].data[0]) { case 0: - if (sub_800A520()) + if (IsLinkTaskFinished()) { sub_800ADF8(); gTasks[taskId].data[0]++; @@ -461,7 +461,7 @@ static void sub_80F9088(u8 taskId) gTasks[taskId].data[0]++; break; default: - if (sub_800A520() == 1) + if (IsLinkTaskFinished() == 1) { EnableBothScriptContexts(); DestroyTask(taskId); diff --git a/src/trade.c b/src/trade.c new file mode 100644 index 000000000..ccdd43986 --- /dev/null +++ b/src/trade.c @@ -0,0 +1,6389 @@ +#include "global.h" +#include "alloc.h" +#include "battle_anim.h" +#include "battle_interface.h" +#include "bg.h" +#include "cable_club.h" +#include "data2.h" +#include "daycare.h" +#include "decompress.h" +#include "event_data.h" +#include "evolution_scene.h" +#include "field_screen_effect.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "international_string_util.h" +#include "librfu.h" +#include "link.h" +#include "link_rfu.h" +#include "load_save.h" +#include "mail.h" +#include "main.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "pokeball.h" +#include "pokedex.h" +#include "pokemon_icon.h" +#include "pokemon_summary_screen.h" +#include "random.h" +#include "rom_8011DC0.h" +#include "save.h" +#include "script.h" +#include "sound.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text.h" +#include "text_window.h" +#include "trainer_card.h" +#include "trade.h" +#include "util.h" +#include "window.h" +#include "constants/easy_chat.h" +#include "constants/items.h" +#include "constants/moves.h" +#include "constants/species.h" +#include "constants/songs.h" +#include "constants/rgb.h" + +#define Trade_SendData(ptr) (SendBlock(bitmask_all_link_players_but_self(), ptr->linkData, 20)) + +struct InGameTrade { + /*0x00*/ u8 name[11]; + /*0x0C*/ u16 species; + /*0x0E*/ u8 ivs[6]; + /*0x14*/ bool8 secondAbility; + /*0x18*/ u32 otId; + /*0x1C*/ u8 stats[5]; + /*0x24*/ u32 personality; + /*0x28*/ u16 heldItem; + /*0x2A*/ u8 mailNum; + /*0x2B*/ u8 otName[11]; + /*0x36*/ u8 otGender; + /*0x37*/ u8 sheen; + /*0x38*/ u16 playerSpecies; +}; + +static EWRAM_DATA u8 *gUnknown_02032184 = NULL; +static EWRAM_DATA u8 *gUnknown_02032188[14] = {NULL}; +EWRAM_DATA struct MailStruct gUnknown_020321C0[PARTY_SIZE] = {0}; +EWRAM_DATA u8 gUnknown_02032298[2] = {0}; +static EWRAM_DATA struct { + /*0x0000*/ u8 unk_0; + /*0x0001*/ u8 unk_1; + /*0x0002*/ u8 filler_2[0x28 - 2]; + /*0x0028*/ u8 partyIcons[2][PARTY_SIZE]; + /*0x0034*/ u8 tradeMenuCursorSpriteIdx; + /*0x0035*/ u8 tradeMenuCursorPosition; + /*0x0036*/ u8 partyCounts[2]; + /*0x0038*/ bool8 tradeMenuOptionsActive[12]; + /*0x0044*/ u8 unk_44; + /*0x0045*/ u8 unk_45[2][PARTY_SIZE]; + /*0x0051*/ u8 unk_51[2][PARTY_SIZE]; + /*0x005D*/ u8 unk_5D[2][PARTY_SIZE]; + /*0x0069*/ u8 unk_69; + /*0x006A*/ u8 filler_6A[0x6F - 0x6A]; + /*0x006F*/ u8 unk_6F; + /*0x0070*/ u8 unk_70; + /*0x0071*/ u8 filler_71; + /*0x0072*/ u16 unk_72; + /*0x0074*/ u8 unk_74[2]; + /*0x0076*/ u8 unk_76[2]; + /*0x0078*/ u8 unk_78; + /*0x0079*/ u8 unk_79; + /*0x007A*/ u8 unk_7A; + /*0x007B*/ u8 unk_7B; + /*0x007C*/ u8 filler_7C[0x7E - 0x7C]; + /*0x007E*/ u8 unk_7E; + /*0x007F*/ u8 filler_7F; + /*0x0080*/ u16 linkData[20]; + /*0x00A8*/ u8 unk_A8; + /*0x00A9*/ u8 unk_A9[11]; + /*0x00B4*/ u8 filler_B4[0x8D0-0xB4]; + /*0x08D0*/ struct { + bool8 unk_0; + u16 unk_2; + u8 unk_4; + } unk_8D0[4]; + /*0x08F0*/ u16 tilemapBuffer[0x400]; +} *gUnknown_0203229C = {NULL}; +static EWRAM_DATA struct { + /*0x00*/ struct Pokemon mon; + /*0x64*/ u32 timer; + /*0x68*/ u32 unk_68[2]; + /*0x70*/ u8 filler_70[2]; + /*0x72*/ u8 unk_72; + /*0x73*/ u8 unk_73; + /*0x74*/ u16 linkData[10]; + /*0x88*/ u8 unk_88; + /*0x89*/ u8 unk_89; + /*0x8A*/ u16 unk_8A; + /*0x8C*/ u16 unk_8C; + /*0x8E*/ u8 pokePicSpriteIdxs[2]; + /*0x90*/ u8 unk_90; + /*0x91*/ u8 unk_91; + /*0x92*/ u8 unk_92; + /*0x93*/ u8 unk_93; + /*0x94*/ u16 state; + /*0x96*/ u8 filler_96[0xD2 - 0x96]; + /*0xD2*/ u8 unk_D2; + /*0xD3*/ u8 unk_D3; + /*0xD4*/ u16 unk_D4; + /*0xD6*/ u16 unk_D6; + /*0xD8*/ u16 unk_D8; + /*0xDA*/ u16 unk_DA; + /*0xDC*/ u16 unk_DC; + /*0xDE*/ u16 unk_DE; + /*0xE0*/ s16 bg1vofs; + /*0xE2*/ s16 bg1hofs; + /*0xE4*/ s16 bg2vofs; + /*0xE6*/ s16 bg2hofs; + /*0xE8*/ u16 unk_E8; + /*0xEA*/ u16 unk_EA; + /*0xEC*/ u16 unk_EC; + /*0xEE*/ bool8 isLinkTrade; + /*0xF0*/ u16 tradeSpecies[2]; + /*0xF4*/ u16 cachedMapMusic; + /*0xF6*/ u8 unk_F6[3]; + /*0xF9*/ u8 filler_F9; + /*0xFA*/ u8 unk_FA; + /*0xFB*/ u8 unk_FB; + /*0xFC*/ u8 unk_FC; + /*0xFD*/ u8 unk_FD; + /*0xFE*/ u8 unk_FE; +} *gUnknown_020322A0 = {NULL}; + +static bool32 sub_8077260(void); +static void sub_80773D0(void); +static void sub_807811C(void); +static void sub_807825C(void); +static void sub_80782B8(u8); +static void sub_8078388(void); +static bool8 shedinja_maker_maybe(void); +static void sub_8078C34(void); +static void sub_80795AC(void); +static void sub_807967C(u8); +static void sub_80796B4(u8); +static u8 sub_8079A3C(u8 *, u8, u8); +static void sub_8079AA4(u8 *, u8, u8); +static void sub_8079BE0(u8); +static void sub_8079C4C(u8, u8, u8, u8, u8, u8); +static void sub_8079E44(u8); +static void sub_8079F74(void); +static void sub_8079F88(u8); +static void sub_807A000(u8 taskId); +static void sub_807A024(u8 taskId); +static void sub_807A048(u16, u8); +static u32 sub_807A09C(void); +static void sub_807A0C4(void); +static void sub_807A19C(u8); +static bool8 sub_807A1F0(void); +static void sub_807A308(const u8 *, u8 *, u8); +static void sub_807A320(u8); +static void sub_807A468(u8); +static void sub_807A53C(void); +static void sub_807A5B0(void); +static u32 sub_807A5F4(struct Pokemon *, int, int); +static void sub_807AA28(struct Sprite *sprite); +static void sub_807AA7C(struct Sprite *sprite); +static void sub_807AABC(struct Sprite *sprite); +static void sub_807AAE0(struct Sprite *sprite); +static void sub_807AB04(struct Sprite *sprite); +static void sub_807B170(void); +static void sub_807B60C(void); +static void sub_807B62C(u8); +static void sub_807BA94(void); +static void SetTradeSceneStrings(void); +static u8 sub_807BBC8(void); +static u8 sub_807BBEC(void); +static u8 sub_807CFC8(void); +static void sub_807E55C(struct Sprite *sprite); +static void sub_807E5D8(struct Sprite *sprite); +static void sub_807E64C(struct Sprite *sprite); +static void sub_807E6AC(struct Sprite *sprite); +static void sub_807E784(void); +static void sub_807E974(struct MailStruct *mail, const struct InGameTrade *trade); +static void sub_807EA2C(void); +static void sub_807EACC(void); +static void sub_807EB50(void); +static void c2_080543C4(void); +static void sub_807F110(u8); +static void sub_807F14C(void); +static void c3_08054588(u8); +static void c3_0805465C(u8); +static void sub_807F39C(u8); +static void sub_807F464(void); + +static const u32 sUnref_0832C6A8[] = +{ + 0x00000F2C, + 0x00003D88, + 0x0000001C, + 0x00000024, + 0x00000064, + 0x00000528 +}; +static const u16 gTradeMovesBoxTilemap[] = INCBIN_U16("graphics/trade/moves_box_map.bin"); +static const u16 gTradePartyBoxTilemap[] = INCBIN_U16("graphics/trade/party_box_map.bin"); +static const u8 gTradeStripesBG2Tilemap[] = INCBIN_U8("graphics/trade/stripes_bg2_map.bin"); +static const u8 gTradeStripesBG3Tilemap[] = INCBIN_U8("graphics/trade/stripes_bg3_map.bin"); +static const u8 gText_EmptyString7[] = _(""); +static const u8 gText_ClrWhtHltTrspntShdwDrkGry[] = _("{COLOR WHITE}{HIGHLIGHT TRANSPARENT}{SHADOW DARK_GREY}"); +const u8 gText_MaleSymbol4[] = _("♂"); +const u8 gText_FemaleSymbol4[] = _("♀"); +const u8 gText_GenderlessSymbol[] = _(""); +static const u8 gText_SpaceMove[] = _(" MOVE"); +static const u8 gText_NewLine3[] = _("\n"); +static const u8 gText_Slash2[] = _("/"); +static const u8 gText_Lv2[] = _("Lv. "); +static const u8 gText_ThreeDashes2[] = _("---"); +static const u8 gText_FourQuestionMarks[] = _("????"); +static const u8 gText_832DAE4[] = _(""); +static const u8 gText_IsThisTradeOkay[] = _("Is this trade okay?"); +static const u8 gText_Cancel6[] = _("CANCEL"); +static const u8 gText_ChooseAPkmn[] = _("Choose a POKéMON."); +static const u8 gText_Summary3[] = _("SUMMARY"); +static const u8 gText_Trade2[] = _("TRADE"); +static const u8 gText_CancelTrade[] = _("Cancel trade?"); +static const u8 gJPText_832DB2E[] = _("Bボタン で もどります"); +static const u8 gText_Summary4[] = _("SUMMARY"); +static const u8 gText_Trade3[] = _("TRADE"); +static const u8 gText_CommunicationStandby6[] = _("{COLOR DARK_GREY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GREY}Communication standby…\nPlease wait."); +static const u8 gText_TheTradeHasBeenCanceled[] = _("{COLOR DARK_GREY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GREY}The trade has\nbeen canceled."); +static const u8 gText_YourOnlyPkmnForBattle[] = _("That's your only\nPOKéMON for battle."); +static const u8 gText_WaitingForYourFriend[] = _("{COLOR DARK_GREY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GREY}Waiting for your friend\nto finish…"); +static const u8 gText_YourFriendWantsToTrade[] = _("Your friend wants\nto trade POKéMON."); + +static const struct OamData gOamData_832DC14 = { + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 1 +}; + +static const struct OamData gOamData_832DC1C = { + .shape = ST_OAM_H_RECTANGLE, + .size = 3, + .priority = 1 +}; + +static const union AnimCmd gSpriteAnim_832DC24[] = { + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_832DC2C[] = { + ANIMCMD_FRAME(32, 5), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_832DC34[] = { + gSpriteAnim_832DC24, + gSpriteAnim_832DC2C +}; + +static const struct SpriteSheet gUnknown_0832DC3C = { + gUnknown_08DDC6E4, 0x800, 300 +}; + +static const struct SpritePalette gUnknown_0832DC44 = { + gUnknown_08DDB444, 2345 +}; + +static const union AnimCmd gSpriteAnim_832DC4C[] = { + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_832DC54[] = { + ANIMCMD_FRAME(8, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_832DC5C[] = { + ANIMCMD_FRAME(16, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_832DC64[] = { + ANIMCMD_FRAME(24, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_832DC6C[] = { + ANIMCMD_FRAME(32, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_832DC74[] = { + ANIMCMD_FRAME(40, 5), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_832DC7C[] = { + gSpriteAnim_832DC4C, + gSpriteAnim_832DC54, + gSpriteAnim_832DC5C, + gSpriteAnim_832DC64, + gSpriteAnim_832DC6C, + gSpriteAnim_832DC74 +}; + +static const struct SpriteTemplate gSpriteTemplate_832DC94 = +{ + .tileTag = 300, + .paletteTag = 2345, + .oam = &gOamData_832DC1C, + .anims = gSpriteAnimTable_832DC34, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct SpriteTemplate gSpriteTemplate_832DCAC = +{ + .tileTag = 200, + .paletteTag = 4925, + .oam = &gOamData_832DC14, + .anims = gSpriteAnimTable_832DC7C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const u16 TradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal"); +static const struct SpritePalette gSpritePalette_TradeScreenText = +{ + TradeScreenTextPalette, 4925 +}; + +// This is used to determine the next mon to select when the D-Pad is +// pressed in a given direction. +// Note that the mons are laid out like this. +// 0-5 are the player's party and 6-11 are the trading partner's party. +// 12 is the cancel button. +// 0 1 6 7 +// 2 3 8 9 +// 4 5 10 11 +// 12 + +static const u8 gTradeNextSelectedMonTable[][4][6] = +{ + { + {4, 2, 12, 12, 0, 0}, + {2, 4, 12, 12, 0, 0}, + {7, 6, 1, 0, 0, 0}, + {1, 6, 7, 0, 0, 0} + }, + { + {5, 3, 12, 12, 0, 0}, + {3, 5, 12, 12, 0, 0}, + {0, 7, 6, 1, 0, 0}, + {6, 7, 0, 1, 0, 0} + }, + { + {0, 0, 0, 0, 0, 0}, + {4, 0, 0, 0, 0, 0}, + {9, 8, 7, 6, 0, 0}, + {3, 1, 0, 0, 0, 0} + }, + { + {1, 1, 1, 1, 0, 0}, + {5, 1, 1, 1, 0, 0}, + {2, 9, 8, 7, 0, 0}, + {8, 9, 6, 6, 0, 0} + }, + { + {2, 2, 2, 2, 0, 0}, + {0, 0, 0, 0, 0, 0}, + {11, 10, 9, 8, 7, 6}, + {5, 3, 1, 0, 0, 0} + }, + { + {3, 3, 3, 3, 0, 0}, + {1, 1, 1, 1, 0, 0}, + {4, 4, 4, 4, 0, 0}, + {10, 8, 6, 0, 0, 0} + }, + { + {10, 8, 12, 0, 0, 0}, + {8, 10, 12, 0, 0, 0}, + {1, 0, 0, 0, 0, 0}, + {7, 0, 1, 0, 0, 0} + }, + { + {12, 0, 0, 0, 0, 0}, + {9, 12, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0} + }, + { + {6, 0, 0, 0, 0, 0}, + {10, 6, 0, 0, 0, 0}, + {3, 2, 1, 0, 0, 0}, + {9, 7, 0, 0, 0, 0} + }, + { + {7, 0, 0, 0, 0, 0}, + {11, 12, 0, 0, 0, 0}, + {8, 0, 0, 0, 0, 0}, + {2, 1, 0, 0, 0, 0} + }, + { + {8, 0, 0, 0, 0, 0}, + {6, 0, 0, 0, 0, 0}, + {5, 4, 3, 2, 1, 0}, + {11, 9, 7, 0, 0, 0} + }, + { + {9, 0, 0, 0, 0, 0}, + {12, 0, 0, 0, 0, 0}, + {10, 0, 0, 0, 0, 0}, + {4, 2, 0, 0, 0, 0} + }, + { + {11, 9, 7, 6, 0, 0}, + {7, 6, 0, 0, 0, 0}, + {12, 0, 0, 0, 0, 0}, + {12, 0, 0, 0, 0, 0} + } +}; + +static const u8 gTradeMonSpriteCoords[][2] = +{ + // Your party + {1, 5 }, + {8, 5 }, + {1, 10}, + {8, 10}, + {1, 15}, + {8, 15}, + + // Friend's party + {16, 5 }, + {23, 5 }, + {16, 10}, + {23, 10}, + {16, 15}, + {23, 15}, + + {23, 18} // CANCEL +}; + +static const u8 gTradeLevelDisplayCoords[][6][2] = { + { + // Your party + {5, 4}, + {12, 4}, + {5, 9}, + {12, 9}, + {5, 14}, + {12, 14}, + }, + { + // Friend's party + {20, 4}, + {27, 4}, + {20, 9}, + {27, 9}, + {20, 14}, + {27, 14} + } +}; + +static const u8 gTradeMonBoxCoords[][6][2] = { + { + // Your party + {1, 3}, + {8, 3}, + {1, 8}, + {8, 8}, + {1, 13}, + {8, 13}, + }, + { + // Friend's party + {16, 3}, + {23, 3}, + {16, 8}, + {23, 8}, + {16, 13}, + {23, 13} + } +}; + +static const u8 sUnref_0832DE6E[] = { + 0x00, 0x0e, + 0x0f, 0x1d, + 0x03, 0x05, + 0x03, 0x07, + 0x12, 0x05, + 0x12, 0x07, + 0x08, 0x07, + 0x16, 0x0c, + 0x08, 0x07, + 0x16, 0x0c, + 0x06, 0x07, + 0x18, 0x0c, + 0x06, 0x07, + 0x18, 0x0c, + 0x08, 0x07, + 0x16, 0x0c, + 0x07, 0x07, + 0x17, 0x0c +}; + +static const u8 *const gUnknown_0832DE94[] = +{ + gText_Cancel6, + gText_ChooseAPkmn, + gText_Summary3, + gText_Trade2, + gText_CancelTrade, + gJPText_832DB2E +}; + +static const struct MenuAction gUnknown_0832DEAC[] = { + {gText_Summary4, sub_807A000}, + {gText_Trade3, sub_807A024} +}; + +static const u8 *const gUnknown_0832DEBC[] = { + gText_CommunicationStandby6, + gText_TheTradeHasBeenCanceled, + gText_YourOnlyPkmnForBattle, + gText_OnlyPkmnForBattle, + gText_WaitingForYourFriend, + gText_YourFriendWantsToTrade, + gText_PkmnCantBeTradedNow, + gText_EggCantBeTradedNow, + gText_OtherTrainersPkmnCantBeTraded +}; + +static const u8 gUnknown_0832DEE0[] = { 0, 1, 2 }; + +static const struct BgTemplate gUnknown_0832DEE4[] = +{ + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 5, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 6, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 7, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, +}; + +static const struct WindowTemplate gUnknown_0832DEF4[] = +{ + { + .bg = 0, + .tilemapLeft = 4, + .tilemapTop = 7, + .width = 22, + .height = 4, + .paletteNum = 15, + .baseBlock = 30 + }, + { + .bg = 0, + .tilemapLeft = 19, + .tilemapTop = 15, + .width = 10, + .height = 4, + .paletteNum = 15, + .baseBlock = 118 + }, + { + .bg = 0, + .tilemapLeft = 0, + .tilemapTop = 5, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 158 + }, + { + .bg = 0, + .tilemapLeft = 7, + .tilemapTop = 5, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 174 + }, + { + .bg = 0, + .tilemapLeft = 0, + .tilemapTop = 10, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 190 + }, + { + .bg = 0, + .tilemapLeft = 7, + .tilemapTop = 10, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 206 + }, + { + .bg = 0, + .tilemapLeft = 0, + .tilemapTop = 15, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 222 + }, + { + .bg = 0, + .tilemapLeft = 7, + .tilemapTop = 15, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 238 + }, + { + .bg = 0, + .tilemapLeft = 15, + .tilemapTop = 5, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 254 + }, + { + .bg = 0, + .tilemapLeft = 22, + .tilemapTop = 5, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 270 + }, + { + .bg = 0, + .tilemapLeft = 15, + .tilemapTop = 10, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 286 + }, + { + .bg = 0, + .tilemapLeft = 22, + .tilemapTop = 10, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 302 + }, + { + .bg = 0, + .tilemapLeft = 15, + .tilemapTop = 15, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 318 + }, + { + .bg = 0, + .tilemapLeft = 22, + .tilemapTop = 15, + .width = 8, + .height = 2, + .paletteNum = 13, + .baseBlock = 334 + }, + { + .bg = 0, + .tilemapLeft = 2, + .tilemapTop = 5, + .width = 14, + .height = 2, + .paletteNum = 13, + .baseBlock = 350 + }, + { + .bg = 0, + .tilemapLeft = 3, + .tilemapTop = 8, + .width = 11, + .height = 8, + .paletteNum = 15, + .baseBlock = 378 + }, + { + .bg = 0, + .tilemapLeft = 17, + .tilemapTop = 5, + .width = 14, + .height = 2, + .paletteNum = 15, + .baseBlock = 466 + }, + { + .bg = 0, + .tilemapLeft = 18, + .tilemapTop = 8, + .width = 11, + .height = 8, + .paletteNum = 15, + .baseBlock = 494 + }, + DUMMY_WIN_TEMPLATE, +}; + +static const struct WindowTemplate gUnknown_0832DF8C = +{ + .bg = 0, + .tilemapLeft = 23, + .tilemapTop = 13, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 582 +}; + +static const u8 gJPText_Shedinja[] = _("ヌケニン"); +static const u8 gUnknown_0832DF99[][2] = +{ + {4, 3}, + {19, 3}, + {0, 0} +}; + +static const u16 gTradeBallPalette[] = INCBIN_U16("graphics/trade/ball.gbapal"); +static const u8 gTradeBallTiles[] = INCBIN_U8("graphics/trade/ball.4bpp"); +static const u8 gUnknown_832E5C0[] = INCBIN_U8("graphics/trade/pokeball_symbol.8bpp"); +static const u16 gUnknown_0832FFC0[] = INCBIN_U16("graphics/trade/cable_closeup_map.bin"); +static const u16 gUnknown_083307C0[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); +static const u16 sUnref_083308C0[] = INCBIN_U16("graphics/trade/unknown_3308C0.gbapal"); +static const u16 gUnknown_083308E0[] = INCBIN_U16("graphics/trade/gba.gbapal"); +static const u16 gUnref_08330900[] = INCBIN_U16("graphics/trade/shadow.gbapal"); +static const u16 gUnref_08330920[] = INCBIN_U16("graphics/trade/black.gbapal"); +static const u16 gUnknown_08330940[] = INCBIN_U16("graphics/trade/misc.gbapal"); +static const u8 gTradeGlow1Tiles[] = INCBIN_U8("graphics/trade/glow1.4bpp"); +static const u8 gTradeGlow2Tiles[] = INCBIN_U8("graphics/trade/glow2.4bpp"); +static const u8 gTradeCableEndTiles[] = INCBIN_U8("graphics/trade/cable_end.4bpp"); +static const u8 gTradeGBAScreenTiles[] = INCBIN_U8("graphics/trade/gba_screen.4bpp"); +const u16 gUnknown_08331F60[] = INCBIN_U16("graphics/trade/shadow_map.bin"); +static const u8 gUnknown_08332F60[] = INCBIN_U8("graphics/trade/gba_affine.8bpp"); +static const u8 sFiller_08335760[64] = {}; +static const u8 gUnknown_083357A0[] = INCBIN_U8("graphics/trade/gba_affine_map_cable.bin"); +static const u8 gUnknown_083358A0[] = INCBIN_U8("graphics/trade/gba_affine_map_wireless.bin"); +static const u16 gUnknown_083359A0[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin"); +static const u16 gUnknown_083369A0[] = INCBIN_U16("graphics/trade/gba_map_cable.bin"); +static const u32 gUnknown_083379A0[] = INCBIN_U32("graphics/trade/unknown_3379A0.bin.lz"); +static const u16 gUnknown_08337AA0[] = INCBIN_U16("graphics/trade/wireless_signal_send.gbapal"); +static const u16 gUnknown_08337CA0[] = INCBIN_U16("graphics/trade/wireless_signal_receive.gbapal"); +static const u16 gUnknown_08337EA0[] = INCBIN_U16("graphics/trade/black.gbapal"); +static const u32 gUnknown_08337EC0[] = INCBIN_U32("graphics/trade/wireless_signal.4bpp.lz"); +static const u32 gUnknown_08338550[] = INCBIN_U32("graphics/trade/wireless_signal.bin.lz"); + +static const struct OamData gOamData_8338C44 = { + .affineMode = 1, + .size = 1 +}; + +static const union AnimCmd gSpriteAnim_8338C4C[] = { + ANIMCMD_FRAME( 0, 3), + ANIMCMD_FRAME( 4, 3), + ANIMCMD_FRAME( 8, 3), + ANIMCMD_FRAME(12, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_FRAME(20, 3), + ANIMCMD_FRAME(24, 3), + ANIMCMD_FRAME(28, 3), + ANIMCMD_FRAME(32, 3), + ANIMCMD_FRAME(36, 3), + ANIMCMD_FRAME(40, 3), + ANIMCMD_FRAME(44, 3), + ANIMCMD_LOOP(1), + ANIMCMD_FRAME( 0, 3), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_8338C88[] = { + ANIMCMD_FRAME( 0, 3), + ANIMCMD_FRAME( 4, 3), + ANIMCMD_FRAME( 8, 3), + ANIMCMD_FRAME(12, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_FRAME(20, 3), + ANIMCMD_FRAME(24, 3), + ANIMCMD_FRAME(28, 3), + ANIMCMD_FRAME(32, 3), + ANIMCMD_FRAME(36, 3), + ANIMCMD_FRAME(40, 3), + ANIMCMD_FRAME(44, 3), + ANIMCMD_LOOP(2), + ANIMCMD_FRAME( 0, 3), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_8338C88[] = { + gSpriteAnim_8338C4C, + gSpriteAnim_8338C88 +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8338CCC[] = { + AFFINEANIMCMD_FRAME(0, 0, 0, 1), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8338CDC[] = { + AFFINEANIMCMD_FRAME(-8, 0, 0, 20), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8338CEC[] = { + AFFINEANIMCMD_FRAME(0x60, 0x100, 0, 0), + AFFINEANIMCMD_FRAME( 0, 0, 0, 5), + AFFINEANIMCMD_FRAME( 8, 0, 0, 20), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_8338D0C[] = { + gSpriteAffineAnim_8338CCC, + gSpriteAffineAnim_8338CDC, + gSpriteAffineAnim_8338CEC +}; + +static const struct SpriteSheet gUnknown_08338D18 = { + gTradeBallTiles, 0x600, 5557 +}; + +static const struct SpritePalette gUnknown_08338D20 = { + gTradeBallPalette, 5558 +}; + +static const struct SpriteTemplate gSpriteTemplate_8338D28 = { + 5557, + 5558, + &gOamData_8338C44, + gSpriteAnimTable_8338C88, + NULL, + gSpriteAffineAnimTable_8338D0C, + sub_807E55C +}; + +static const struct OamData gOamData_8338D40 = { + .affineMode = 1, + .objMode = 1, + .size = 2, + .priority = 1 +}; + +static const union AnimCmd gSpriteAnim_8338D48[] = { + ANIMCMD_FRAME(0, 5, .hFlip = TRUE, .vFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_8338D50[] = { + gSpriteAnim_8338D48 +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8338D54[] = { + AFFINEANIMCMD_FRAME(-10, -10, 0, 5), + AFFINEANIMCMD_FRAME(10, 10, 0, 5), + AFFINEANIMCMD_JUMP(0) +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_8338D6C[] = { + gSpriteAffineAnim_8338D54 +}; + +static const struct SpriteSheet gUnknown_08338D70 = { + gTradeGlow1Tiles, 0x200, 5550 +}; + +static const struct SpritePalette gUnknown_08338D78 = { + gUnknown_08330940, 5551 +}; + +static const struct SpritePalette gUnknown_08338D80 = { + gUnknown_083308E0, 5555 +}; + +static const struct SpriteTemplate gUnknown_08338D88 = { + 5550, + 5551, + &gOamData_8338D40, + gSpriteAnimTable_8338D50, + NULL, + gSpriteAffineAnimTable_8338D6C, + sub_807AA28 +}; + +static const struct OamData gOamData_8338DA0 = { + .shape = ST_OAM_V_RECTANGLE, + .size = 2, + .priority = 1 +}; + +static const union AnimCmd gSpriteAnim_8338DA8[] = { + ANIMCMD_FRAME(0, 5, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_8338DB0[] = { + ANIMCMD_FRAME(8, 5, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_8338DB8[] = { + gSpriteAnim_8338DA8, + gSpriteAnim_8338DB0 +}; + +static const struct SpriteSheet gUnknown_08338DC0 = { + gTradeGlow2Tiles, 0x300, 5552 +}; + +static const struct SpriteTemplate gSpriteTemplate_8338DC8 = { + 5552, + 5551, + &gOamData_8338DA0, + gSpriteAnimTable_8338DB8, + NULL, + gDummySpriteAffineAnimTable, + sub_807AA7C +}; + +static const struct OamData gOamData_8338DE0 = { + .shape = ST_OAM_V_RECTANGLE, + .size = 2, + .priority = 1 +}; + +static const union AnimCmd gSpriteAnim_8338DE8[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_8338DF0[] = { + gSpriteAnim_8338DE8 +}; + +static const struct SpriteSheet gUnknown_08338DF4 = { + gTradeCableEndTiles, 0x100, 5554 +}; + +static const struct SpriteTemplate gSpriteTemplate_8338DFC = { + 5554, + 5555, + &gOamData_8338DE0, + gSpriteAnimTable_8338DF0, + NULL, + gDummySpriteAffineAnimTable, + sub_807AABC +}; + +static const struct OamData gOamData_8338E14 = { + .shape = ST_OAM_H_RECTANGLE, + .size = 3, + .priority = 1 +}; + +static const union AnimCmd gSpriteAnim_8338E1C[] = { + ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(96, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_LOOP(8), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_8338E40[] = { + ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(96, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_LOOP(2), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_8338E64[] = { + gSpriteAnim_8338E1C +}; + +static const union AnimCmd *const gSpriteAnimTable_8338E68[] = { + gSpriteAnim_8338E40 +}; + +static const struct SpriteSheet gUnknown_08338E6C = { + gTradeGBAScreenTiles, 0x1000, 5556 +}; + +static const struct SpriteTemplate gSpriteTemplate_8338E74 = { + 5556, + 5555, + &gOamData_8338E14, + gSpriteAnimTable_8338E64, + NULL, + gDummySpriteAffineAnimTable, + sub_807AB04 +}; + +static const struct SpriteTemplate gSpriteTemplate_8338E8C = { + 5556, + 5555, + &gOamData_8338E14, + gSpriteAnimTable_8338E68, + NULL, + gDummySpriteAffineAnimTable, + sub_807AB04 +}; + +static const u16 gUnknown_08338EA4[] = INCBIN_U16("graphics/trade/unknown_338EA4.gbapal"); + +static const union AffineAnimCmd gSpriteAffineAnim_8338EBC[] = { + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_JUMP(0) +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_8338ECC[] = { + gSpriteAffineAnim_8338EBC +}; + +static const struct InGameTrade gIngameTrades[] = { + { + _("DOTS"), SPECIES_SEEDOT, + 5, 4, 5, 4, 4, 4, + TRUE, 38726, + 30, 5, 5, 5, 5, + 0x84, + ITEM_CHESTO_BERRY, -1, + _("KOBE"), MALE, 10, + SPECIES_RALTS + }, { + _("PLUSES"), SPECIES_PLUSLE, + 4, 4, 4, 5, 5, 4, + FALSE, 73996, + 5, 5, 30, 5, 5, + 0x6F, + ITEM_WOOD_MAIL, 0, + _("ROMAN"), MALE, 10, + SPECIES_VOLBEAT + }, { + _("SEASOR"), + SPECIES_HORSEA, + 5, 4, 4, 4, 5, 4, + FALSE, 46285, + 5, 5, 5, 5, 30, + 0x7F, + ITEM_WAVE_MAIL, 1, + _("SKYLAR"), MALE, 10, + SPECIES_BAGON + }, { + _("MEOWOW"), + SPECIES_MEOWTH, + 4, 5, 4, 5, 4, 4, + FALSE, 91481, + 5, 5, 5, 30, 5, + 0x8B, + ITEM_RETRO_MAIL, 2, + _("ISIS"), FEMALE, 10, + SPECIES_SKITTY + } +}; + +static const u16 gIngameTradeMail[][10] = { + { + EC_WORD_BE, + EC_WORD_NICE, + EC_WORD_TO, + EC_POKEMON(PLUSLE), + EC_WORD_EXCL, + EC_POKEMON(VOLBEAT), + EC_WORD_WILL, + EC_WORD_BE, + EC_WORD_FANTASTIC, + 0 + }, { + EC_WORD_I, + EC_WORD_WILL, + EC_WORD_MAKE, + EC_POKEMON(BAGON), + EC_WORD_TOUGH, + EC_WORD_PLEASE, + EC_WORD_TRAIN, + EC_POKEMON(HORSEA), + EC_WORD_WELL, + 0 + }, { + EC_WORD_THANK_YOU, + EC_WORD_FOR, + EC_POKEMON(SKITTY), + EC_POKEMON2(MEOWTH), + EC_WORD_CRIES, + EC_WORD_IN, + EC_WORD_A, + EC_WORD_CUTE, + EC_WORD_WAY, + 0 + } +}; + +static const struct WindowTemplate gUnknown_08338FFC[] = +{ + { + .bg = 0, + .tilemapLeft = 2, + .tilemapTop = 15, + .width = 26, + .height = 4, + .paletteNum = 0, + .baseBlock = 64 + }, + DUMMY_WIN_TEMPLATE +}; + +const struct WindowTemplate gUnknown_0833900C = +{ + .bg = 0, + .tilemapLeft = 21, + .tilemapTop = 9, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 188 +}; + +static const struct BgTemplate gUnknown_08339014[] = +{ + { + .bg = 0, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 5, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 1, + .mapBaseIndex = 18, + .screenSize = 1, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 6, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, +}; + +static const s8 gTradeBallVerticalVelocityTable[] = { + 0, 0, 1, 0, + 1, 0, 1, 1, + 1, 1, 2, 2, + 2, 2, 3, 3, + 3, 3, 4, 4, + 4, 4, -4, -4, + -4, -3, -3, -3, + -3, -2, -2, -2, + -2, -1, -1, -1, + -1, 0, -1, 0, + -1, 0, 0, 0, + 0, 0, 1, 0, + 1, 0, 1, 1, + 1, 1, 2, 2, + 2, 2, 3, 3, + 3, 3, 4, 4, + 4, 4, -4, -3, + -3, -2, -2, -1, + -1, -1, 0, -1, + 0, 0, 0, 0, + 0, 0, 1, 0, + 1, 1, 1, 2, + 2, 3, 3, 4, + -4, -3, -2, -1, + -1, -1, 0, 0, + 0, 0, 1, 0, + 1, 1, 2, 3 +}; + +static const u8 gUnknown_08339090[][2] = +{ + {0, 1}, + {1, 1}, + {2, 1}, + {3, 1}, + {4, 1}, + {5, 2}, + {6, 2}, + {7, 2}, + {8, 2}, + {9, 2}, + {10, 3}, + {11, 3}, + {12, 3}, + {13, 4}, + {14, 5}, + {15, 2}, + {0, 1}, + {1, 1}, + {2, 1}, + {3, 1}, + {4, 1}, + {5, 2}, + {6, 2}, + {7, 2}, + {8, 2}, + {9, 2}, + {10, 3}, + {11, 3}, + {12, 3}, + {13, 4}, + {14, 5}, + {16, 1}, + {16, -1}, + {0, 0} +}; + +// external to this file +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const struct MonCoords gMonFrontPicCoords[]; + +static bool8 sub_8077170(const void *a0, u32 a1) +{ + if (gUnknown_02022C2C == 29) + { + rfu_NI_setSendData(gUnknown_03004140.unk_00, 84, a0, a1); + return TRUE; + } + else + { + return SendBlock(0, a0, a1); + } +} + +static void sub_80771AC(u8 a0) +{ + sub_800A4D8(a0); +} + +static bool32 sub_80771BC(void) +{ + if (gUnknown_02022C2C == 29) + { + if (gUnknown_03007880[sub_800E87C(gUnknown_03004140.unk_00)]->unk_0 == 0) + { + return TRUE; + } + else + { + return FALSE; + } + } + else + { + return IsLinkTaskFinished(); + } +} + +static u32 _GetBlockReceivedStatus(void) +{ + return GetBlockReceivedStatus(); +} + +static void sub_8077210(void) +{ + if (sub_8077260()) + { + rfu_clearSlot(12, gUnknown_03004140.unk_00); + } + else + { + ResetBlockReceivedFlags(); + } +} + +static void sub_8077234(u32 a0) +{ + if (sub_8077260()) + { + rfu_clearSlot(12, gUnknown_03004140.unk_00); + } + else + { + ResetBlockReceivedFlag(a0); + } +} + +static bool32 sub_8077260(void) +{ + if (gWirelessCommType && gUnknown_02022C2C == 29) + { + return TRUE; + } + else + { + return FALSE; + } +} + +static void sub_8077288(u8 unused) +{ + sub_800ADF8(); +} + +static bool32 _IsLinkTaskFinished(void) +{ + return IsLinkTaskFinished(); +} + +static void sub_80772A4(void) +{ + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + ResetPaletteFade(); + + gPaletteFade.bufferTransferDisabled = TRUE; + + SetVBlankCallback(sub_807811C); + LoadPalette(gUnknown_0860F074, 0xF0, 20); + LoadPalette(gUnknown_0860F074, 0xD0, 20); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_0832DEE4, ARRAY_COUNT(gUnknown_0832DEE4)); + SetBgTilemapBuffer(1, gUnknown_0203229C->tilemapBuffer); + + if (InitWindows(gUnknown_0832DEF4)) + { + u32 i; + + DeactivateAllTextPrinters(); + + for (i = 0; i < 18; i++) + { + ClearWindowTilemap(i); + FillWindowPixelBuffer(i, 0); + } + + FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 15); + LoadUserWindowBorderGfx_(0, 20, 0xC0); + LoadUserWindowBorderGfx(2, 1, 0xE0); + LoadMonIconPalettes(); + gUnknown_0203229C->unk_69 = 0; + gUnknown_0203229C->unk_6F = 0; + gUnknown_0203229C->unk_70 = 0; + gUnknown_0203229C->unk_74[0] = 0; + gUnknown_0203229C->unk_74[1] = 0; + gUnknown_0203229C->unk_7A = 0; + gUnknown_0203229C->unk_7B = 0; + gUnknown_0203229C->unk_A8 = 0; + } +} + +void sub_80773AC(void) +{ + SetMainCallback2(sub_80773D0); + gMain.callback1 = NULL; + gEnemyPartyCount = 0; +} + +static void sub_80773D0(void) +{ + int i; + struct SpriteTemplate temp; + u8 id; + u32 xPos; + + switch (gMain.state) + { + case 0: + gUnknown_0203229C = AllocZeroed(sizeof(*gUnknown_0203229C)); + sub_80772A4(); + gUnknown_02032184 = AllocZeroed(0xE00); + + for (i = 0; i < 14; i++) + { + gUnknown_02032188[i] = &gUnknown_02032184[i * 256]; + } + + gMain.state++; + break; + case 1: + gPaletteFade.bufferTransferDisabled = FALSE; + + for (i = 0; i < PARTY_SIZE; i++) + { + CreateMon(&gEnemyParty[i], SPECIES_NONE, 0, 0x20, FALSE, 0, 0, 0); + } + + sub_807A19C(0); + ShowBg(0); + + if (!gReceivedRemoteLinkPlayers) + { + gLinkType = 0x1122; + gUnknown_0203229C->unk_A8 = 0; + + if (gWirelessCommType) + { + sub_800B488(); + OpenLink(); + sub_8011BA4(); + } + else + { + OpenLink(); + gMain.state++; + CreateTask(task00_08081A90, 1); + } + } + else + { + gMain.state = 4; + } + break; + case 2: + gUnknown_0203229C->unk_A8++; + if (gUnknown_0203229C->unk_A8 > 11) + { + gUnknown_0203229C->unk_A8 = 0; + gMain.state++; + } + break; + case 3: + if (GetLinkPlayerCount_2() >= sub_800AA48()) + { + if (IsLinkMaster()) + { + if (++gUnknown_0203229C->unk_A8 > 30) + { + sub_800A620(); + gMain.state++; + } + } + else + { + gMain.state++; + } + } + break; + case 4: + if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE) + { + sub_8011BD0(); + CalculatePlayerPartyCount(); + gMain.state++; + gUnknown_0203229C->unk_A8 = 0; + if (gWirelessCommType) + { + sub_801048C(TRUE); + sub_800ADF8(); + } + } + break; + case 5: + if (gWirelessCommType) + { + if (sub_8010500()) + { + gMain.state++; + sub_800E0E8(); + CreateWirelessStatusIndicatorSprite(0, 0); + } + } + else + { + gMain.state++; + } + break; + case 6: + if (shedinja_maker_maybe()) + { + sub_807A5B0(); + gMain.state++; + } + break; + case 7: + CalculateEnemyPartyCount(); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + gUnknown_0203229C->partyCounts[0] = gPlayerPartyCount; + gUnknown_0203229C->partyCounts[1] = gEnemyPartyCount; + + for (i = 0; i < gUnknown_0203229C->partyCounts[0]; i++) + { + struct Pokemon *mon = &gPlayerParty[i]; + gUnknown_0203229C->partyIcons[0][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2), + sub_80D3014, + (gTradeMonSpriteCoords[i][0] * 8) + 14, + (gTradeMonSpriteCoords[i][1] * 8) - 12, + 1, + GetMonData(mon, MON_DATA_PERSONALITY), + TRUE); + } + + for (i = 0; i < gUnknown_0203229C->partyCounts[1]; i++) + { + struct Pokemon *mon = &gEnemyParty[i]; + gUnknown_0203229C->partyIcons[1][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), + sub_80D3014, + (gTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14, + (gTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12, + 1, + GetMonData(mon, MON_DATA_PERSONALITY), + FALSE); + } + gMain.state++; + break; + case 8: + LoadHeldItemIcons(); + sub_81B5D4C(&gUnknown_0203229C->partyCounts[0], gUnknown_0203229C->partyIcons[0], 0); + gMain.state++; + break; + case 9: + sub_81B5D4C(&gUnknown_0203229C->partyCounts[0], gUnknown_0203229C->partyIcons[0], 1); + gMain.state++; + break; + case 10: + sub_80C6D80(gSaveBlock2Ptr->playerName, gUnknown_02032188[0], 0, 0, 3); + id = GetMultiplayerId(); + sub_80C6D80(gLinkPlayers[id ^ 1].name, gUnknown_02032188[3], 0, 0, 3); + sub_80C6D80(gUnknown_0832DE94[0], gUnknown_02032188[6], 0, 0, 2); + sub_807A308(gUnknown_0832DE94[1], gUnknown_02032188[8], 24); + gMain.state++; + gUnknown_0203229C->unk_A8 = 0; + break; + case 11: + if (sub_807A1F0()) + gMain.state++; + break; + case 12: + xPos = GetStringCenterAlignXOffset(1, gSaveBlock2Ptr->playerName, 120); + for (i = 0; i < 3; i++) + { + temp = gSpriteTemplate_832DCAC; + temp.tileTag += i; + CreateSprite(&temp, xPos + (i * 32) + 16, 10, 1); + } + + xPos = GetStringCenterAlignXOffset(1, gLinkPlayers[GetMultiplayerId() ^ 1].name, 120); + for (i = 0; i < 3; i++) + { + temp = gSpriteTemplate_832DCAC; + temp.tileTag += i + 3; + CreateSprite(&temp, xPos + (i * 32) + 136, 10, 1); + } + gMain.state++; + break; + case 13: + temp = gSpriteTemplate_832DCAC; + temp.tileTag += 6; + CreateSprite(&temp, 215, 152, 1); + temp = gSpriteTemplate_832DCAC; + temp.tileTag += 7; + CreateSprite(&temp, 247, 152, 1); + + for (i = 0; i < PARTY_SIZE; i++) + { + temp = gSpriteTemplate_832DCAC; + temp.tileTag += i + 8; + CreateSprite(&temp, (i * 32) + 24, 150, 1); + } + + gUnknown_0203229C->tradeMenuCursorSpriteIdx = CreateSprite(&gSpriteTemplate_832DC94, gTradeMonSpriteCoords[0][0] * 8 + 32, gTradeMonSpriteCoords[0][1] * 8, 2); + gUnknown_0203229C->tradeMenuCursorPosition = 0; + gMain.state++; + rbox_fill_rectangle(0); + break; + case 14: + sub_807A320(0); + sub_8079BE0(0); + gUnknown_0203229C->unk_0 = 0; + gUnknown_0203229C->unk_1 = 0; + sub_8078388(); + gMain.state++; + PlayBGM(MUS_P_SCHOOL); + break; + case 15: + sub_807A320(1); + sub_8079BE0(1); + gMain.state++; + // fallthrough + case 16: + sub_80782B8(0); + gMain.state++; + break; + case 17: + sub_80782B8(1); + gMain.state++; + break; + case 18: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + gMain.state++; + break; + case 19: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + sub_80782B8(2); + gMain.state++; + break; + case 20: + sub_807A468(0); + gMain.state++; + break; + case 21: + sub_807A468(1); + sub_807A53C(); + gMain.state++; + break; + case 22: + if (!gPaletteFade.active) + { + gMain.callback1 = sub_8078C34; + SetMainCallback2(sub_807825C); + } + break; + } + + RunTextPrinters(); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_8077B74(void) +{ + int i; + struct SpriteTemplate temp; + u8 id; + u32 xPos; + + switch (gMain.state) + { + case 0: + sub_80772A4(); + gMain.state++; + break; + case 1: + gMain.state++; + gUnknown_0203229C->unk_A8 = 0; + break; + case 2: + gMain.state++; + break; + case 3: + gMain.state++; + break; + case 4: + CalculatePlayerPartyCount(); + gMain.state++; + break; + case 5: + if (gWirelessCommType) + { + sub_800E0E8(); + CreateWirelessStatusIndicatorSprite(0, 0); + } + gMain.state++; + break; + case 6: + gMain.state++; + break; + case 7: + CalculateEnemyPartyCount(); + gUnknown_0203229C->partyCounts[0] = gPlayerPartyCount; + gUnknown_0203229C->partyCounts[1] = gEnemyPartyCount; + ClearWindowTilemap(0); + sub_8079BE0(0); + sub_8079BE0(1); + + for (i = 0; i < gUnknown_0203229C->partyCounts[0]; i++) + { + struct Pokemon *mon = &gPlayerParty[i]; + gUnknown_0203229C->partyIcons[0][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), + sub_80D3014, + (gTradeMonSpriteCoords[i][0] * 8) + 14, + (gTradeMonSpriteCoords[i][1] * 8) - 12, + 1, + GetMonData(mon, MON_DATA_PERSONALITY), + TRUE); + } + + for (i = 0; i < gUnknown_0203229C->partyCounts[1]; i++) + { + struct Pokemon *mon = &gEnemyParty[i]; + gUnknown_0203229C->partyIcons[1][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES2, NULL), + sub_80D3014, + (gTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14, + (gTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12, + 1, + GetMonData(mon, MON_DATA_PERSONALITY), + FALSE); + } + gMain.state++; + break; + case 8: + LoadHeldItemIcons(); + sub_81B5D4C(&gUnknown_0203229C->partyCounts[0], gUnknown_0203229C->partyIcons[0], 0); + gMain.state++; + break; + case 9: + sub_81B5D4C(&gUnknown_0203229C->partyCounts[0], gUnknown_0203229C->partyIcons[0], 1); + gMain.state++; + break; + case 10: + sub_80C6D80(gSaveBlock2Ptr->playerName, gUnknown_02032188[0], 0, 0, 3); + id = GetMultiplayerId(); + sub_80C6D80(gLinkPlayers[id ^ 1].name, gUnknown_02032188[3], 0, 0, 3); + sub_80C6D80(gUnknown_0832DE94[0], gUnknown_02032188[6], 0, 0, 2); + sub_807A308(gUnknown_0832DE94[1], gUnknown_02032188[8], 24); + gMain.state++; + gUnknown_0203229C->unk_A8 = 0; + break; + case 11: + if (sub_807A1F0()) + gMain.state++; + break; + case 12: + xPos = GetStringCenterAlignXOffset(1, gSaveBlock2Ptr->playerName, 120); + for (i = 0; i < 3; i++) + { + temp = gSpriteTemplate_832DCAC; + temp.tileTag += i; + CreateSprite(&temp, xPos + (i * 32) + 16, 10, 1); + } + + xPos = GetStringCenterAlignXOffset(1, gLinkPlayers[GetMultiplayerId() ^ 1].name, 120); + for (i = 0; i < 3; i++) + { + temp = gSpriteTemplate_832DCAC; + temp.tileTag += i + 3; + CreateSprite(&temp, xPos + (i * 32) + 136, 10, 1); + } + gMain.state++; + break; + case 13: + temp = gSpriteTemplate_832DCAC; + temp.tileTag += 6; + CreateSprite(&temp, 215, 152, 1); + temp = gSpriteTemplate_832DCAC; + temp.tileTag += 7; + CreateSprite(&temp, 247, 152, 1); + + for (i = 0; i < PARTY_SIZE; i++) + { + temp = gSpriteTemplate_832DCAC; + temp.tileTag += i + 8; + CreateSprite(&temp, (i * 32) + 24, 150, 1); + } + + if (gUnknown_0203229C->tradeMenuCursorPosition < PARTY_SIZE) + gUnknown_0203229C->tradeMenuCursorPosition = gUnknown_0203CF20; + else + gUnknown_0203229C->tradeMenuCursorPosition = gUnknown_0203CF20 + PARTY_SIZE; + + gUnknown_0203229C->tradeMenuCursorSpriteIdx = CreateSprite(&gSpriteTemplate_832DC94, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][0] * 8 + 32, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][1] * 8, 2); + gMain.state = 16; + break; + case 16: + sub_80782B8(0); + gMain.state++; + break; + case 17: + sub_80782B8(1); + gUnknown_0203229C->unk_0 = 0; + gUnknown_0203229C->unk_1 = 0; + sub_8078388(); + gMain.state++; + break; + case 18: + gPaletteFade.bufferTransferDisabled = FALSE; + BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + gMain.state++; + break; + case 19: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + sub_80782B8(2); + gMain.state++; + break; + case 20: + gMain.state++; + break; + case 21: + sub_807A53C(); + gMain.state++; + break; + case 22: + if (!gPaletteFade.active) + { + SetMainCallback2(sub_807825C); + } + break; + } + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_807811C(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +static void sub_8078130(void) +{ + if (++gUnknown_0203229C->unk_A8 > 15) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_0203229C->unk_6F = 10; + } +} + +static void sub_807816C(void) +{ + if (!gPaletteFade.active) + { + gUnknown_02032298[0] = gUnknown_0203229C->tradeMenuCursorPosition; + gUnknown_02032298[1] = gUnknown_0203229C->unk_7E; + + if (gWirelessCommType) + { + gUnknown_0203229C->unk_6F = 16; + } + else + { + sub_800ABF4(32); + gUnknown_0203229C->unk_6F = 13; + } + } +} + +static void sub_80781C8(void) +{ + gMain.savedCallback = sub_80773AC; + + if (gWirelessCommType) + { + if (sub_8010500()) + { + Free(gUnknown_02032184); + FreeAllWindowBuffers(); + Free(gUnknown_0203229C); + gMain.callback1 = NULL; + sub_800E084(); + SetMainCallback2(sub_807AE50); + } + } + else + { + if (!gReceivedRemoteLinkPlayers) + { + Free(gUnknown_02032184); + FreeAllWindowBuffers(); + Free(gUnknown_0203229C); + gMain.callback1 = NULL; + SetMainCallback2(sub_807AE50); + } + } +} + +static void sub_807825C(void) +{ + u8 temp; + + sub_80795AC(); + sub_807A0C4(); + sub_80796B4(0); + sub_80796B4(1); + + SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_0203229C->unk_0++); + SetGpuReg(REG_OFFSET_BG3HOFS, gUnknown_0203229C->unk_1--); + + RunTextPrintersAndIsPrinter0Active(); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_80782B8(u8 a0) +{ + int i; + + switch (a0) + { + case 0: + LoadPalette(gUnknown_08DDB3E4, 0, 0x60); + LoadBgTiles(1, gUnknown_08DDB464, 0x1280, 0); + CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DDCF04, 0, 0, 32, 20, 0); + LoadBgTilemap(2, gTradeStripesBG2Tilemap, 0x800, 0); + break; + case 1: + LoadBgTilemap(3, gTradeStripesBG3Tilemap, 0x800, 0); + sub_8079E44(0); + sub_8079E44(1); + CopyBgTilemapBufferToVram(1); + break; + case 2: + for (i = 0; i < 4; i++) + { + SetGpuReg(REG_OFFSET_BG0HOFS + (i * 2), 0); + } + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + break; + } +} + +static void sub_8078388(void) +{ + int i; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (i < gUnknown_0203229C->partyCounts[0]) + { + gSprites[gUnknown_0203229C->partyIcons[0][i]].invisible = FALSE; + gUnknown_0203229C->tradeMenuOptionsActive[i] = TRUE; + } + else + { + gUnknown_0203229C->tradeMenuOptionsActive[i] = FALSE; + } + + if (i < gUnknown_0203229C->partyCounts[1]) + { + gSprites[gUnknown_0203229C->partyIcons[1][i]].invisible = FALSE; + gUnknown_0203229C->tradeMenuOptionsActive[i + PARTY_SIZE] = TRUE; + } + else + { + gUnknown_0203229C->tradeMenuOptionsActive[i + PARTY_SIZE] = FALSE; + } + } + + gUnknown_0203229C->unk_44 = 1; +} + +// why not just use memcpy? +static void Trade_Memcpy(void *dataDest, const void *dataSrc, u32 count) +{ + u8 *dest = dataDest; + const u8 *src = dataSrc; + u32 i; + + for (i = 0; i < count; i++) + { + dest[i] = src[i]; + } +} + +static bool8 shedinja_maker_maybe(void) +{ + u8 id = GetMultiplayerId(); + int i; + struct Pokemon *mon; + + switch (gUnknown_0203229C->unk_69) + { + case 0: + Trade_Memcpy(gBlockSendBuffer, &gPlayerParty[0], 2 * sizeof(struct Pokemon)); + gUnknown_0203229C->unk_69++; + gUnknown_0203229C->unk_A8 = 0; + break; + case 1: + if (sub_80771BC()) + { + if (_GetBlockReceivedStatus() == 0) + { + gUnknown_0203229C->unk_69++; + } + else + { + sub_8077210(); + gUnknown_0203229C->unk_69++; + } + } + break; + case 3: + if (id == 0) + { + sub_80771AC(1); + } + gUnknown_0203229C->unk_69++; + break; + case 4: + if (_GetBlockReceivedStatus() == 3) + { + Trade_Memcpy(&gEnemyParty[0], gBlockRecvBuffer[id ^ 1], 2 * sizeof(struct Pokemon)); + sub_8077210(); + gUnknown_0203229C->unk_69++; + } + break; + case 5: + Trade_Memcpy(gBlockSendBuffer, &gPlayerParty[2], 2 * sizeof(struct Pokemon)); + gUnknown_0203229C->unk_69++; + break; + case 7: + if (id == 0) + { + sub_80771AC(1); + } + gUnknown_0203229C->unk_69++; + break; + case 8: + if (_GetBlockReceivedStatus() == 3) + { + Trade_Memcpy(&gEnemyParty[2], gBlockRecvBuffer[id ^ 1], 200); + sub_8077210(); + gUnknown_0203229C->unk_69++; + } + break; + case 9: + Trade_Memcpy(gBlockSendBuffer, &gPlayerParty[4], 200); + gUnknown_0203229C->unk_69++; + break; + case 11: + if (id == 0) + { + sub_80771AC(1); + } + gUnknown_0203229C->unk_69++; + break; + case 12: + if (_GetBlockReceivedStatus() == 3) + { + Trade_Memcpy(&gEnemyParty[4], gBlockRecvBuffer[id ^ 1], 200); + sub_8077210(); + gUnknown_0203229C->unk_69++; + } + break; + case 13: + Trade_Memcpy(gBlockSendBuffer, gSaveBlock1Ptr->mail, 220); + gUnknown_0203229C->unk_69++; + break; + case 15: + if (id == 0) + { + sub_80771AC(3); + } + gUnknown_0203229C->unk_69++; + break; + case 16: + if (_GetBlockReceivedStatus() == 3) + { + Trade_Memcpy(gUnknown_020321C0, gBlockRecvBuffer[id ^ 1], 216); + sub_8077210(); + gUnknown_0203229C->unk_69++; + } + break; + case 17: + Trade_Memcpy(gBlockSendBuffer, gSaveBlock1Ptr->giftRibbons, 11); + gUnknown_0203229C->unk_69++; + break; + case 19: + if (id == 0) + { + sub_80771AC(4); + } + gUnknown_0203229C->unk_69++; + break; + case 20: + if (_GetBlockReceivedStatus() == 3) + { + Trade_Memcpy(gUnknown_0203229C->unk_A9, gBlockRecvBuffer[id ^ 1], 11); + sub_8077210(); + gUnknown_0203229C->unk_69++; + } + break; + case 21: + for (i = 0, mon = gEnemyParty; i < PARTY_SIZE; mon++, i++) + { + u8 name[POKEMON_NAME_LENGTH + 1]; + u16 species = GetMonData(mon, MON_DATA_SPECIES); + + if (species != SPECIES_NONE) + { + if (species == SPECIES_SHEDINJA && GetMonData(mon, MON_DATA_LANGUAGE) != LANGUAGE_JAPANESE) + { + GetMonData(mon, MON_DATA_NICKNAME, name); + + if (!StringCompareWithoutExtCtrlCodes(name, gJPText_Shedinja)) + { + SetMonData(mon, MON_DATA_NICKNAME, gSpeciesNames[SPECIES_SHEDINJA]); + } + } + } + } + return TRUE; + case 2: + case 6: + case 10: + case 14: + case 18: + gUnknown_0203229C->unk_A8++; + if (gUnknown_0203229C->unk_A8 > 10) + { + gUnknown_0203229C->unk_A8 = 0; + gUnknown_0203229C->unk_69++; + } + break; + } + return FALSE; +} + +static void sub_80787B8(void) +{ + sub_807A308(gText_IsThisTradeOkay, (void *)(OBJ_VRAM0 + (gUnknown_0203229C->unk_72 * 32)), 24); +} + +static void sub_80787E0(u8 a0, u8 a1) +{ + if (a1 & 1) + { + switch (gBlockRecvBuffer[0][0]) + { + case 0xEEAA: + gUnknown_0203229C->unk_78 = 2; + break; + case 0xAABB: + gUnknown_0203229C->unk_78 = 1; + break; + case 0xBBBB: + gUnknown_0203229C->unk_7A = 1; + break; + case 0xBBCC: + gUnknown_0203229C->unk_7A = 2; + break; + } + sub_8077234(0); + } + + if (a1 & 2) + { + switch (gBlockRecvBuffer[1][0]) + { + case 0xEEAA: + gUnknown_0203229C->unk_79 = 2; + break; + case 0xAABB: + gUnknown_0203229C->unk_7E = gBlockRecvBuffer[1][1] + 6; + gUnknown_0203229C->unk_79 = 1; + break; + case 0xBBBB: + gUnknown_0203229C->unk_7B = 1; + break; + case 0xBBCC: + gUnknown_0203229C->unk_7B = 2; + break; + } + sub_8077234(1); + } +} + +static void sub_8078900(u8 a0, u8 a1) +{ + if (a1 & 1) + { + switch (gBlockRecvBuffer[0][0]) + { + case 0xEEBB: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + sub_807A19C(4); + gUnknown_0203229C->unk_6F = 11; + break; + case 0xEECC: + sub_807A19C(5); + gUnknown_0203229C->unk_6F = 8; + break; + case 0xDDDD: + gUnknown_0203229C->unk_7E = gBlockRecvBuffer[0][1] + 6; + rbox_fill_rectangle(0); + sub_807967C(gUnknown_0203229C->tradeMenuCursorPosition); + sub_807967C(gUnknown_0203229C->unk_7E); + gUnknown_0203229C->unk_6F = 7; + break; + case 0xCCDD: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_0203229C->unk_6F = 10; + break; + case 0xDDEE: + sub_807A19C(1); + gUnknown_0203229C->unk_6F = 8; + } + sub_8077234(0); + } + + if (a1 & 2) + sub_8077234(1); +} + +static void sub_80789FC(void) +{ + if (gUnknown_0203229C->unk_78 && gUnknown_0203229C->unk_79) + { + if (gUnknown_0203229C->unk_78 == 1 && gUnknown_0203229C->unk_79 == 1) + { + gUnknown_0203229C->unk_6F = 6; + gUnknown_0203229C->linkData[0] = 0xDDDD; + gUnknown_0203229C->linkData[1] = gUnknown_0203229C->tradeMenuCursorPosition; + sub_807A048(5, 0); + gUnknown_0203229C->unk_78 = gUnknown_0203229C->unk_79 = 0; + } + else if (gUnknown_0203229C->unk_78 == 1 && gUnknown_0203229C->unk_79 == 2) + { + sub_807A19C(1); + gUnknown_0203229C->linkData[0] = 0xEECC; + gUnknown_0203229C->linkData[1] = 0; + sub_807A048(5, 0); + gUnknown_0203229C->unk_7A = gUnknown_0203229C->unk_7B = 0; + gUnknown_0203229C->unk_78 = gUnknown_0203229C->unk_79 = 0; + gUnknown_0203229C->unk_6F = 8; + } + else if (gUnknown_0203229C->unk_78 == 2 && gUnknown_0203229C->unk_79 == 1) + { + sub_807A19C(5); + gUnknown_0203229C->linkData[0] = 0xDDEE; + gUnknown_0203229C->linkData[1] = 0; + sub_807A048(5, 0); + gUnknown_0203229C->unk_7A = gUnknown_0203229C->unk_7B = 0; + gUnknown_0203229C->unk_78 = gUnknown_0203229C->unk_79 = 0; + gUnknown_0203229C->unk_6F = 8; + } + else if (gUnknown_0203229C->unk_78 == 2 && gUnknown_0203229C->unk_79 == 2) + { + gUnknown_0203229C->linkData[0] = 0xEEBB; + gUnknown_0203229C->linkData[1] = 0; + sub_807A048(5, 0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_0203229C->unk_78 = gUnknown_0203229C->unk_79 = 0; + gUnknown_0203229C->unk_6F = 11; + } + } + + if (gUnknown_0203229C->unk_7A && gUnknown_0203229C->unk_7B) + { + if (gUnknown_0203229C->unk_7A == 1 && gUnknown_0203229C->unk_7B == 1) + { + gUnknown_0203229C->linkData[0] = 0xCCDD; + gUnknown_0203229C->linkData[1] = 0; + sub_807A048(5, 0); + gUnknown_0203229C->unk_7A = 0; + gUnknown_0203229C->unk_7B = 0; + gUnknown_0203229C->unk_6F = 9; + } + + if (gUnknown_0203229C->unk_7A == 2 || gUnknown_0203229C->unk_7B == 2) + { + sub_807A19C(1); + gUnknown_0203229C->linkData[0] = 0xDDEE; + gUnknown_0203229C->linkData[1] = 0; + sub_807A048(5, 0); + gUnknown_0203229C->unk_7A = 0; + gUnknown_0203229C->unk_7B = 0; + gUnknown_0203229C->unk_6F = 8; + } + } +} + +static void sub_8078BFC(u16 *a0, u16 a1, u16 a2) +{ + a0[0] = a1; + a0[1] = a2; + sub_807A048(5, 0); +} + +static void sub_8078C10(u16 a0, u16 a1) +{ + sub_8078BFC(gUnknown_0203229C->linkData, a0, a1); +} + +static void sub_8078C34(void) +{ + u8 mpId = GetMultiplayerId(); + u8 status; + + if ((status = _GetBlockReceivedStatus())) + { + if (mpId == 0) + sub_80787E0(mpId, status); + else + sub_8078900(mpId, status); + } + + if (mpId == 0) + sub_80789FC(); +} + +static u8 sub_8078C6C(u8 oldPosition, u8 direction) +{ + int i; + u8 newPosition = 0; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_0203229C->tradeMenuOptionsActive[gTradeNextSelectedMonTable[oldPosition][direction][i]] == TRUE) + { + newPosition = gTradeNextSelectedMonTable[oldPosition][direction][i]; + break; + } + } + + return newPosition; +} + +static void TradeMenuMoveCursor(u8 *tradeMenuCursorPosition, u8 direction) +{ + u8 newPosition = sub_8078C6C(*tradeMenuCursorPosition, direction); + + if (newPosition == 12) // CANCEL + { + StartSpriteAnim(&gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx], 1); + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].pos1.x = 224; + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].pos1.y = 160; + } + else + { + StartSpriteAnim(&gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx], 0); + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].pos1.x = gTradeMonSpriteCoords[newPosition][0] * 8 + 32; + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].pos1.y = gTradeMonSpriteCoords[newPosition][1] * 8; + } + + if (*tradeMenuCursorPosition != newPosition) + { + PlaySE(SE_SELECT); + } + + *tradeMenuCursorPosition = newPosition; +} + +static void sub_8078D78(void) +{ + sub_807A19C(0); + gUnknown_0203229C->unk_6F = 100; + + if (GetMultiplayerId() == 1) + { + sub_8078C10(0xAABB, gUnknown_0203229C->tradeMenuCursorPosition); + } + else + { + gUnknown_0203229C->unk_78 = 1; + } +} + +static void sub_8078DBC(void) +{ + if (gMain.newAndRepeatedKeys & DPAD_UP) + { + TradeMenuMoveCursor(&gUnknown_0203229C->tradeMenuCursorPosition, 0); + } + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + TradeMenuMoveCursor(&gUnknown_0203229C->tradeMenuCursorPosition, 1); + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + TradeMenuMoveCursor(&gUnknown_0203229C->tradeMenuCursorPosition, 2); + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + TradeMenuMoveCursor(&gUnknown_0203229C->tradeMenuCursorPosition, 3); + } + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + + if (gUnknown_0203229C->tradeMenuCursorPosition < 6) + { + sub_8098858(1, 1, 14); + FillWindowPixelBuffer(1, 0x11); + PrintMenuTable(1, 2, gUnknown_0832DEAC); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(1, 2, 0); + PutWindowTilemap(1); + CopyWindowToVram(1, 3); + gUnknown_0203229C->unk_6F = 1; + } + else if (gUnknown_0203229C->tradeMenuCursorPosition < 12) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_0203229C->unk_6F = 2; + } + else if (gUnknown_0203229C->tradeMenuCursorPosition == 12) + { + CreateYesNoMenu(&gUnknown_0832DF8C, 1, 14, 0); + gUnknown_0203229C->unk_6F = 4; + sub_807A308(gUnknown_0832DE94[4], (void *)(OBJ_VRAM0 + gUnknown_0203229C->unk_72 * 32), 24); + } + } +} + +static void sub_8078EF8(void) +{ + sub_8079F74(); + gUnknown_0203229C->unk_6F = 0; + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].invisible = FALSE; + sub_807A308(gUnknown_0832DE94[1], (void *)(OBJ_VRAM0 + gUnknown_0203229C->unk_72 * 32), 24); +} + +static void sub_8078F50(void) +{ + switch (Menu_ProcessInputNoWrap()) + { + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + sub_8078EF8(); + break; + case MENU_NOTHING_CHOSEN: + break; + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_0203229C->unk_6F = 2; + break; + case 1: + switch (sub_807A5F4(gPlayerParty, gPlayerPartyCount, gUnknown_0203229C->tradeMenuCursorPosition)) + { + case 0: + sub_8078D78(); + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].invisible = TRUE; + break; + case 1: + sub_807A048(3, 3); + gUnknown_0203229C->unk_6F = 8; + break; + case 2: + case 4: + sub_807A048(3, 6); + gUnknown_0203229C->unk_6F = 8; + break; + case 3: + case 5: + sub_807A048(3, 7); + gUnknown_0203229C->unk_6F = 8; + break; + } + break; + } +} + +static void sub_8079034(void) +{ + if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) + { + PlaySE(SE_SELECT); + sub_8078EF8(); + } +} + +static void sub_807905C(void) +{ + if (!gPaletteFade.active) + { + if (gUnknown_0203229C->tradeMenuCursorPosition < PARTY_SIZE) + { + ShowPokemonSummaryScreen(PSS_MODE_UNK1, gPlayerParty, gUnknown_0203229C->tradeMenuCursorPosition, gUnknown_0203229C->partyCounts[0] - 1, sub_8077B74); + } + else + { + ShowPokemonSummaryScreen(PSS_MODE_UNK1, gEnemyParty, gUnknown_0203229C->tradeMenuCursorPosition - PARTY_SIZE, gUnknown_0203229C->partyCounts[1] - 1, sub_8077B74); + } + FreeAllWindowBuffers(); + } +} + +static u8 sub_80790D4(u8 *a0, u8 a1, u8 a2, u8 a3) +{ + int i; + u16 species; + u8 res = 0; + + for (i = 0; i < a1; i++) + { + if (a2 != i) + { + res += a0[i]; + } + } + + a3 %= PARTY_SIZE; + species = GetMonData(&gEnemyParty[a3], MON_DATA_SPECIES); + + if (species == SPECIES_DEOXYS || species == SPECIES_MEW) + { + if (!GetMonData(&gEnemyParty[a3], MON_DATA_OBEDIENCE)) + { + return 2; + } + } + + if (!IsNationalPokedexEnabled()) + { + if (gUnknown_0203229C->unk_51[1][a3] || !IsSpeciesInHoennDex(species)) + { + return 2; + } + } + + if (res) + { + res = 1; + } + + return res; +} + +static bool32 sub_8079174(void) +{ + int i; + u8 arr[12]; + + for (i = 0; i < gUnknown_0203229C->partyCounts[0]; i++) + { + arr[i] = gUnknown_0203229C->unk_45[0][i]; + } + + switch (sub_80790D4(arr, gUnknown_0203229C->partyCounts[0], gUnknown_0203229C->tradeMenuCursorPosition, gUnknown_0203229C->unk_7E)) + { + case 0: + sub_807A048(3, 3); + sub_8078C10(0xBBCC, 0); + break; + case 1: + sub_807A048(3, 1); + sub_8078C10(0xBBBB, 0); + break; + case 2: + sub_807A048(3, 8); + return TRUE; + } + + return FALSE; +} + +static void sub_8079218(void) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + if (!sub_8079174()) + { + gUnknown_0203229C->unk_6F = 100; + } + else + { + gUnknown_0203229C->unk_6F = 17; + } + PutWindowTilemap(17); + break; + case 1: + case MENU_B_PRESSED: + sub_807A048(3, 1); + if (sub_80771BC()) + sub_8078C10(0xBBCC, 0); + gUnknown_0203229C->unk_6F = 100; + PutWindowTilemap(17); + break; + } +} + +static void sub_807929C(void) +{ + int i; + + for (i = 0; i < gUnknown_0203229C->partyCounts[1] - 4; i++) + { + PutWindowTilemap(i + 12); + CopyWindowToVram(i + 12, 1); + } +} + +static void sub_80792E4(void) +{ + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + sub_807A19C(4); + sub_8078C10(0xEEAA, 0); + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].invisible = TRUE; + gUnknown_0203229C->unk_6F = 100; + sub_807929C(); + break; + case 1: + case MENU_B_PRESSED: + PlaySE(SE_SELECT); + sub_8078EF8(); + break; + } +} + +static void sub_807935C(void) +{ + if (GetMultiplayerId() == 0) + { + rbox_fill_rectangle(0); + sub_807967C(gUnknown_0203229C->tradeMenuCursorPosition); + sub_807967C(gUnknown_0203229C->unk_7E); + } + gUnknown_0203229C->unk_6F = 7; +} + +static void sub_8079398(void) +{ + if (gUnknown_0203229C->unk_74[0] == 5 && gUnknown_0203229C->unk_74[1] == 5) + { + sub_80787B8(); + gUnknown_0203229C->unk_6F = 14; + } +} + +static void DisplayMessageAndContinueTask(void) +{ + gUnknown_0203229C->unk_A8++; + + if (gUnknown_0203229C->unk_A8 > 120) + { + CreateYesNoMenu(&gUnknown_0832DF8C, 1, 14, 0); + gUnknown_0203229C->unk_A8 = 0; + gUnknown_0203229C->unk_6F = 3; + } +} + +static void sub_8079408(void) +{ + int i; + + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + rbox_fill_rectangle(0); + rbox_fill_rectangle(1); + + for (i = 0; i < 4; i++) + { + FillWindowPixelBuffer(i + 14, 0); + rbox_fill_rectangle(i + 14); + } + + sub_8079F88(0); + sub_8079F88(1); + gUnknown_0203229C->unk_6F = 0; + gSprites[gUnknown_0203229C->tradeMenuCursorSpriteIdx].invisible = FALSE; + } +} + +static void sub_8079490(void) +{ + if (!gPaletteFade.active) + { + if (gWirelessCommType) + { + sub_800ADF8(); + } + else + { + sub_800ABF4(12); + } + + gUnknown_0203229C->unk_6F = 12; + } +} + +static void sub_80794CC(void) +{ + if (gWirelessCommType) + { + if (sub_80771BC() && sub_807A09C() == 0) + { + Free(gUnknown_02032184); + Free(gUnknown_0203229C); + FreeAllWindowBuffers(); + sub_800E084(); + SetMainCallback2(c2_8056854); + } + } + else + { + if (!gReceivedRemoteLinkPlayers) + { + Free(gUnknown_02032184); + Free(gUnknown_0203229C); + FreeAllWindowBuffers(); + SetMainCallback2(c2_8056854); + } + } +} + +static void sub_8079550(void) +{ + if (!sub_801048C(FALSE) && sub_807A09C() == 0) + { + sub_800ADF8(); + gUnknown_0203229C->unk_6F = 13; + } +} + +static void sub_807957C(void) +{ + if (gMain.newKeys & A_BUTTON) + { + sub_8078C10(0xBBCC, 0); + gUnknown_0203229C->unk_6F = 100; + } +} + +static void sub_80795AC(void) +{ + switch (gUnknown_0203229C->unk_6F) + { + case 0: + sub_8078DBC(); + break; + case 1: + sub_8078F50(); + break; + case 2: + sub_807905C(); + break; + case 3: + sub_8079218(); + break; + case 4: + sub_80792E4(); + break; + case 6: + sub_807935C(); + break; + case 7: + sub_8079398(); + break; + case 8: + sub_8079408(); + break; + case 9: + sub_8078130(); + break; + case 10: + sub_807816C(); + break; + case 11: + sub_8079490(); + break; + case 12: + sub_80794CC(); + break; + case 13: + sub_80781C8(); + break; + case 14: + DisplayMessageAndContinueTask(); + break; + case 15: + sub_8079034(); + break; + case 16: + sub_8079550(); + break; + case 17: + sub_807957C(); + break; + } +} + +static void sub_807967C(u8 a0) +{ + u8 whichParty = a0 / PARTY_SIZE; + + if (gUnknown_0203229C->unk_74[whichParty] == 0) + { + gUnknown_0203229C->unk_74[whichParty] = 1; + gUnknown_0203229C->unk_76[whichParty] = a0; + } +} + +static void sub_80796B4(u8 a0) +{ + s8 nameStringWidth; + u8 nickname[20]; + u8 movesString[56]; + u8 i; + u8 partyIdx; + u8 whichParty; + u8 monIdx = gUnknown_0203229C->unk_76[a0]; + + whichParty = 1; + if (gUnknown_0203229C->unk_76[a0] < PARTY_SIZE) + whichParty = 0; + partyIdx = monIdx % PARTY_SIZE; + nameStringWidth = 0; + + switch (gUnknown_0203229C->unk_74[a0]) + { + case 1: + for (i = 0; i < gUnknown_0203229C->partyCounts[a0]; i++) + { + gSprites[gUnknown_0203229C->partyIcons[0][i + (whichParty * PARTY_SIZE)]].invisible = TRUE; + } + + for (i = 0; i < 6; i++) + { + ClearWindowTilemap(i + (a0 * 6 + 2)); + } + + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].invisible = FALSE; + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].data[0] = 20; + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].data[2] = (gTradeMonSpriteCoords[whichParty * PARTY_SIZE][0] + gTradeMonSpriteCoords[whichParty * PARTY_SIZE + 1][0]) / 2 * 8 + 14; + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].data[4] = (gTradeMonSpriteCoords[whichParty * PARTY_SIZE][1] * 8) - 12; + StoreSpriteCallbackInData6(&gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]], sub_80D3014); + gUnknown_0203229C->unk_74[a0]++; + sub_80A6DEC(&gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]]); + CopyToBgTilemapBufferRect_ChangePalette(1, gTradePartyBoxTilemap, a0 * 15, 0, 15, 17, 0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(0); + + if (whichParty == 0) + sub_8079F74(); + break; + case 2: + if (gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].callback == sub_80D3014) + gUnknown_0203229C->unk_74[a0] = 3; + break; + case 3: + CopyToBgTilemapBufferRect_ChangePalette(1, gTradeMovesBoxTilemap, whichParty * 15, 0, 15, 17, 0); + CopyBgTilemapBufferToVram(1); + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].pos1.x = (gTradeMonSpriteCoords[whichParty * PARTY_SIZE][0] + gTradeMonSpriteCoords[whichParty * PARTY_SIZE + 1][0]) / 2 * 8 + 14; + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].pos1.y = (gTradeMonSpriteCoords[whichParty * PARTY_SIZE][1] * 8) - 12; + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].pos2.x = 0; + gSprites[gUnknown_0203229C->partyIcons[0][partyIdx + (whichParty * PARTY_SIZE)]].pos2.y = 0; + nameStringWidth = sub_8079A3C(nickname, whichParty, partyIdx); + AddTextPrinterParameterized3((a0 * 2) + 14, 0, (80 - nameStringWidth) / 2, 4, gUnknown_0832DEE0, 0, nickname); + sub_8079AA4(movesString, whichParty, partyIdx); + AddTextPrinterParameterized4((a0 * 2) + 15, 1, 0, 0, 0, 0, gUnknown_0832DEE0, 0, movesString); + PutWindowTilemap((a0 * 2) + 14); + CopyWindowToVram((a0 * 2) + 14, 3); + PutWindowTilemap((a0 * 2) + 15); + CopyWindowToVram((a0 * 2) + 15, 3); + gUnknown_0203229C->unk_74[a0]++; + break; + case 4: + sub_8079C4C(a0, partyIdx, gUnknown_0832DF99[a0][0] + 4, gUnknown_0832DF99[a0][1] + 1, gUnknown_0832DF99[a0][0], gUnknown_0832DF99[a0][1]); + gUnknown_0203229C->unk_74[a0]++; + break; + } +} + +static u8 sub_8079A3C(u8 *str, u8 whichParty, u8 monIdx) +{ + u8 nickname[12]; + + if (whichParty == 0) + GetMonData(&gPlayerParty[monIdx], MON_DATA_NICKNAME, nickname); + else + GetMonData(&gEnemyParty[monIdx], MON_DATA_NICKNAME, nickname); + + StringCopy10(str, nickname); + return GetStringWidth(0, str, GetFontAttribute(0, FONTATTR_LETTER_SPACING)); +} + +static void sub_8079AA4(u8 *a0, u8 a1, u8 a2) +{ + u16 arr[4]; + u16 i; + + if (!gUnknown_0203229C->unk_51[a1][a2]) + { + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (!a1) + { + arr[i] = GetMonData(&gPlayerParty[a2], i + MON_DATA_MOVE1, NULL); + } + else + { + arr[i] = GetMonData(&gEnemyParty[a2], i + MON_DATA_MOVE1, NULL); + } + } + + StringCopy(a0, gText_EmptyString7); + + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (arr[i] != MOVE_NONE) + { + StringAppend(a0, gMoveNames[arr[i]]); + } + + StringAppend(a0, gText_NewLine3); + } + } + else + { + StringCopy(a0, gText_EmptyString7); + StringAppend(a0, gText_FourQuestionMarks); + } +} + +static void sub_8079B84(u8 whichParty, u8 windowId, u8 *str) +{ + u8 xPos; + windowId += (whichParty * PARTY_SIZE) + 2; + xPos = GetStringCenterAlignXOffset(0, str, 64); + AddTextPrinterParameterized3(windowId, 0, xPos, 4, gUnknown_0832DEE0, 0, str); + PutWindowTilemap(windowId); + CopyWindowToVram(windowId, 3); +} + +static void sub_8079BE0(u8 whichParty) +{ + u8 i; + u8 sp[20]; + u8 sp14[32]; + struct Pokemon *mons = whichParty == 0 ? gPlayerParty : gEnemyParty; + + for (i = 0; i < gUnknown_0203229C->partyCounts[whichParty]; i++) + { + GetMonData(&mons[i], MON_DATA_NICKNAME, sp); + StringCopy10(sp14, sp); + sub_8079B84(whichParty, i, sp14); + } +} + +static void sub_8079C4C(u8 whichParty, u8 monIdx, u8 a2, u8 a3, u8 a4, u8 a5) +{ + u8 level; + u32 r2; + u8 gender; + u8 nickname[12]; + + CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_08DDD704, a4, a5, 6, 3, 0); + CopyBgTilemapBufferToVram(1); + + if (whichParty == 0) + level = GetMonData(&gPlayerParty[monIdx], MON_DATA_LEVEL, NULL); + else + level = GetMonData(&gEnemyParty[monIdx], MON_DATA_LEVEL, NULL); + + if (gUnknown_0203229C->unk_51[whichParty][monIdx] == 0) + { + if (level / 10 != 0) + gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32)] = (level / 10) + 0x60; + + gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) + 1] = (level % 10) + 0x70; + } + else + { + gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 32] = gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 33]; + gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 31] = gUnknown_0203229C->tilemapBuffer[a2 + (a3 * 32) - 36] | 0x400; + } + + if (gUnknown_0203229C->unk_51[whichParty][monIdx] != 0) + { + r2 = 0x480; + } + else + { + if (whichParty == 0) + { + gender = GetMonGender(&gPlayerParty[monIdx]); + GetMonData(&gPlayerParty[monIdx], MON_DATA_NICKNAME, nickname); + } + else + { + gender = GetMonGender(&gEnemyParty[monIdx]); + GetMonData(&gEnemyParty[monIdx], MON_DATA_NICKNAME, nickname); + } + + switch (gender) + { + case MON_MALE: + r2 = !NameHasGenderSymbol(nickname, MON_MALE) ? 0x84 : 0x83; + break; + case MON_FEMALE: + r2 = !NameHasGenderSymbol(nickname, MON_FEMALE) ? 0x85 : 0x83; + break; + default: + r2 = 0x83; + break; + } + } + gUnknown_0203229C->tilemapBuffer[(a3 - 1) * 32 + a2 + 1] = r2; +} + +// Very close but loop preamble not working. +#ifdef NONMATCHING +static void sub_8079E44(u8 whichParty) +{ + int i; + + for (i = 0; i < gUnknown_0203229C->partyCounts[whichParty]; i++) + { + sub_8079C4C(whichParty, i, gTradeLevelDisplayCoords[whichParty][i][0], gTradeLevelDisplayCoords[whichParty][i][1], gTradeMonBoxCoords[whichParty][i][0], gTradeMonBoxCoords[whichParty][i][1]); + } +} +#else +NAKED +static void sub_8079E44(u8 whichParty) +{ + asm_unified("push {r4-r7,lr}\n\ + sub sp, 0x8\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + movs r7, 0\n\ + ldr r0, =gUnknown_0203229C\n\ + ldr r0, [r0]\n\ + adds r0, 0x36\n\ + adds r0, r6\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + bge _08079E94\n\ + lsls r0, r6, 1\n\ + adds r0, r6\n\ + ldr r1, =gTradeLevelDisplayCoords\n\ + lsls r0, 2\n\ + adds r5, r0, r1\n\ + ldr r1, =gTradeMonBoxCoords\n\ + adds r4, r0, r1\n\ +_08079E6A:\n\ + lsls r1, r7, 24\n\ + lsrs r1, 24\n\ + ldrb r2, [r5]\n\ + ldrb r3, [r5, 0x1]\n\ + ldrb r0, [r4]\n\ + str r0, [sp]\n\ + ldrb r0, [r4, 0x1]\n\ + str r0, [sp, 0x4]\n\ + adds r0, r6, 0\n\ + bl sub_8079C4C\n\ + adds r5, 0x2\n\ + adds r4, 0x2\n\ + adds r7, 0x1\n\ + ldr r0, =gUnknown_0203229C\n\ + ldr r0, [r0]\n\ + adds r0, 0x36\n\ + adds r0, r6\n\ + ldrb r0, [r0]\n\ + cmp r7, r0\n\ + blt _08079E6A\n\ +_08079E94:\n\ + add sp, 0x8\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NONMATCHING + +static void sub_8079EA8(u8 whichParty) +{ + int i; + + for (i = 0; i < gUnknown_0203229C->partyCounts[whichParty]; i++) + { + gSprites[gUnknown_0203229C->partyIcons[whichParty][i]].invisible = FALSE; + gSprites[gUnknown_0203229C->partyIcons[whichParty][i]].pos1.x = gTradeMonSpriteCoords[(whichParty * PARTY_SIZE) + i][0] * 8 + 14; + gSprites[gUnknown_0203229C->partyIcons[whichParty][i]].pos1.y = gTradeMonSpriteCoords[(whichParty * PARTY_SIZE) + i][1] * 8 - 12; + gSprites[gUnknown_0203229C->partyIcons[whichParty][i]].pos2.x = 0; + gSprites[gUnknown_0203229C->partyIcons[whichParty][i]].pos2.y = 0; + } +} + +static void sub_8079F74(void) +{ + rbox_fill_rectangle(1); + sub_8079BE0(1); +} + +static void sub_8079F88(u8 a0) +{ + CopyToBgTilemapBufferRect_ChangePalette(1, gTradePartyBoxTilemap, a0 * 15, 0, 15, 17, 0); + CopyBgTilemapBufferToVram(1); + sub_8079E44(a0); + sub_8079BE0(a0); + sub_8079EA8(a0); + sub_807A308(gUnknown_0832DE94[1], (void *)(OBJ_VRAM0 + (gUnknown_0203229C->unk_72 * 32)), 24); + gUnknown_0203229C->unk_74[a0] = 0; +} + +static void sub_807A000(u8 taskId) +{ + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); +} + +static void sub_807A024(u8 taskId) +{ + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); +} + +static void sub_807A048(u16 a0, u8 a1) +{ + int i; + + for (i = 0; i < 4; i++) + { + if (!gUnknown_0203229C->unk_8D0[i].unk_0) + { + gUnknown_0203229C->unk_8D0[i].unk_2 = a0; + gUnknown_0203229C->unk_8D0[i].unk_4 = a1; + gUnknown_0203229C->unk_8D0[i].unk_0 = TRUE; + break; + } + } +} + +static u32 sub_807A09C(void) +{ + u32 acc = 0; + int i; + + for (i = 0; i < 4; i++) + { + acc += gUnknown_0203229C->unk_8D0[i].unk_0; + } + + return acc; +} + +static void sub_807A0C4(void) +{ + int i; + + for (i = 0; i < 4; i++) + { + if (gUnknown_0203229C->unk_8D0[i].unk_0) + { + if (gUnknown_0203229C->unk_8D0[i].unk_2) + { + gUnknown_0203229C->unk_8D0[i].unk_2--; + } + else + { + switch (gUnknown_0203229C->unk_8D0[i].unk_4) + { + case 0: + sub_8077170(gUnknown_0203229C->linkData, 20); + break; + case 1: + sub_807A19C(0); + break; + case 2: + sub_807A19C(2); + break; + case 3: + case 4: + case 5: + sub_807A19C(3); + break; + case 6: + sub_807A19C(6); + break; + case 7: + sub_807A19C(7); + break; + case 8: + sub_807A19C(8); + break; + } + gUnknown_0203229C->unk_8D0[i].unk_0 = 0; + } + } + } +} + +static void sub_807A19C(u8 a0) +{ + FillWindowPixelBuffer(0, 0x11); + AddTextPrinterParameterized(0, 1, gUnknown_0832DEBC[a0], 0, 1, TEXT_SPEED_FF, NULL); + sub_8098858(0, 20, 12); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); +} + +static bool8 sub_807A1F0(void) +{ + struct SpriteSheet sheet; + + if (gUnknown_0203229C->unk_A8 < 14) + { + sheet.data = gUnknown_02032188[gUnknown_0203229C->unk_A8]; + sheet.size = 0x100; + sheet.tag = 200 + gUnknown_0203229C->unk_A8; + } + + switch (gUnknown_0203229C->unk_A8) + { + case 0 ... 7: + LoadSpriteSheet(&sheet); + gUnknown_0203229C->unk_A8++; + break; + case 8: + gUnknown_0203229C->unk_72 = LoadSpriteSheet(&sheet); + gUnknown_0203229C->unk_A8++; + break; + case 9 ... 13: + LoadSpriteSheet(&sheet); + gUnknown_0203229C->unk_A8++; + break; + case 14: + LoadSpritePalette(&gSpritePalette_TradeScreenText); + gUnknown_0203229C->unk_A8++; + break; + case 15: + LoadSpritePalette(&gUnknown_0832DC44); + gUnknown_0203229C->unk_A8++; + break; + case 16: + LoadSpriteSheet(&gUnknown_0832DC3C); + gUnknown_0203229C->unk_A8++; + break; + case 17: + gUnknown_0203229C->unk_A8 = 0; + return TRUE; + } + + return FALSE; +} + +static void sub_807A308(const u8 *a0, u8 *a1, u8 unused) +{ + sub_80C6D80(a0, a1, 0, 0, 6); +} + +static void sub_807A320(u8 who) +{ + int i; + + switch (who) + { + case 0: + for (i = 0; i < gUnknown_0203229C->partyCounts[who]; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) == TRUE) + { + gUnknown_0203229C->unk_45[who][i] = 0; + gUnknown_0203229C->unk_51[who][i] = 1; + } + else if (GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0) + { + gUnknown_0203229C->unk_45[who][i] = 0; + gUnknown_0203229C->unk_51[who][i] = 0; + } + else + { + gUnknown_0203229C->unk_45[who][i] = 1; + gUnknown_0203229C->unk_51[who][i] = 0; + } + } + break; + case 1: + for (i = 0; i < gUnknown_0203229C->partyCounts[who]; i++) + { + if (GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG) == TRUE) + { + gUnknown_0203229C->unk_45[who][i] = 0; + gUnknown_0203229C->unk_51[who][i] = 1; + } + else if (GetMonData(&gEnemyParty[i], MON_DATA_HP) == 0) + { + gUnknown_0203229C->unk_45[who][i] = 0; + gUnknown_0203229C->unk_51[who][i] = 0; + } + else + { + gUnknown_0203229C->unk_45[who][i] = 1; + gUnknown_0203229C->unk_51[who][i] = 0; + } + } + break; + } +} + +static void sub_807A468(u8 who) +{ + u16 i, curHp, maxHp; + + switch (who) + { + case 0: + for (i = 0; i < gUnknown_0203229C->partyCounts[0]; i++) + { + curHp = GetMonData(&gPlayerParty[i], MON_DATA_HP); + maxHp = GetMonData(&gPlayerParty[i], MON_DATA_MAX_HP); + gUnknown_0203229C->unk_5D[0][i] = GetHPBarLevel(curHp, maxHp); + } + break; + case 1: + for (i = 0; i < gUnknown_0203229C->partyCounts[1]; i++) + { + curHp = GetMonData(&gEnemyParty[i], MON_DATA_HP); + maxHp = GetMonData(&gEnemyParty[i], MON_DATA_MAX_HP); + gUnknown_0203229C->unk_5D[1][i] = GetHPBarLevel(curHp, maxHp); + } + break; + } +} + +static void sub_807A53C(void) +{ + int i, j; + + for (i = 0; i < 2; i++) + { + for (j = 0; j < gUnknown_0203229C->partyCounts[i]; j++) + { + sub_80D32C8(&gSprites[gUnknown_0203229C->partyIcons[i][j]], 4 - gUnknown_0203229C->unk_5D[i][j]); + } + } +} + +static void sub_807A5B0(void) +{ + int i; + + for (i = 0; i < 11; i++) + { + if (gSaveBlock1Ptr->giftRibbons[i] == 0 && gUnknown_0203229C->unk_A9[i] != 0) + { + if (gUnknown_0203229C->unk_A9[i] < 64) + gSaveBlock1Ptr->giftRibbons[i] = gUnknown_0203229C->unk_A9[i]; + } + } +} + +static u32 sub_807A5F4(struct Pokemon *monList, int a1, int monIdx) +{ + int i, sum; + struct LinkPlayer *player; + u32 species[6]; + u32 species2[6]; + + for (i = 0; i < a1; i++) + { + species2[i] = GetMonData(&monList[i], MON_DATA_SPECIES2); + species[i] = GetMonData(&monList[i], MON_DATA_SPECIES); + } + + if (!IsNationalPokedexEnabled()) + { + if (species2[monIdx] == SPECIES_EGG) + { + return 3; + } + + if (!IsSpeciesInHoennDex(species2[monIdx])) + { + return 2; + } + } + + player = &gLinkPlayers[GetMultiplayerId() ^ 1]; + if ((player->version & 0xFF) != VERSION_RUBY && + (player->version & 0xFF) != VERSION_SAPPHIRE) + { + if ((player->name[10] & 0xF) == 0) + { + if (species2[monIdx] == SPECIES_EGG) + { + return 5; + } + + if (!IsSpeciesInHoennDex(species2[monIdx])) + { + return 4; + } + } + } + + if (species[monIdx] == SPECIES_DEOXYS || species[monIdx] == SPECIES_MEW) + { + if (!GetMonData(&monList[monIdx], MON_DATA_OBEDIENCE)) + { + return 4; + } + } + + for (i = 0; i < a1; i++) + { + if (species2[i] == SPECIES_EGG) + { + species2[i] = SPECIES_NONE; + } + } + + for (sum = 0, i = 0; i < a1; i++) + { + if (i != monIdx) + { + sum += species2[i]; + } + } + + if (sum != 0) + { + return 0; + } + else + { + return 1; + } +} + +#ifdef NONMATCHING +s32 sub_807A728(void) +{ + s32 val; + u16 version; + + if (gReceivedRemoteLinkPlayers) + { + val = 0; + version = (gLinkPlayers[GetMultiplayerId() ^ 1].version & 0xFF); + + if (version == VERSION_RUBY || version == VERSION_SAPPHIRE || version == VERSION_EMERALD) + { + // this value could actually be anything 0 or less + val = 0; + } + else if (version == VERSION_FIRE_RED || version == VERSION_LEAF_GREEN) + { + val = 2; + } + + if (val > 0) + { + if (gLinkPlayers[GetMultiplayerId()].name[10] & 0xF0) + { + if (val == 2) + { + if (gLinkPlayers[GetMultiplayerId() ^ 1].name[10] & 0xF0) + { + return 0; + } + else + { + return 2; + } + } + } + else + { + return 1; + } + } + } + return 0; +} +#else +NAKED +s32 sub_807A728(void) +{ + asm_unified("push {r4-r7,lr}\n\ + ldr r0, =gReceivedRemoteLinkPlayers\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _0807A7B4\n\ + movs r4, 0\n\ + bl GetMultiplayerId\n\ + ldr r5, =gLinkPlayers\n\ + movs r7, 0x1\n\ + eors r0, r7\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + lsls r1, r0, 3\n\ + subs r1, r0\n\ + lsls r1, 2\n\ + adds r1, r5\n\ + ldrb r1, [r1]\n\ + subs r0, r1, 0x1\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + cmp r0, 0x2\n\ + bls _0807A7B4\n\ + subs r0, r1, 0x4\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + cmp r0, 0x1\n\ + bhi _0807A762\n\ + movs r4, 0x2\n\ +_0807A762:\n\ + cmp r4, 0\n\ + ble _0807A7B4\n\ + bl GetMultiplayerId\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + lsls r1, r0, 3\n\ + subs r1, r0\n\ + lsls r1, 2\n\ + adds r1, r5\n\ + ldrb r1, [r1, 0x12]\n\ + movs r6, 0xF0\n\ + adds r0, r6, 0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _0807A7B0\n\ + cmp r4, 0x2\n\ + bne _0807A7B4\n\ + bl GetMultiplayerId\n\ + eors r0, r7\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + lsls r1, r0, 3\n\ + subs r1, r0\n\ + lsls r1, 2\n\ + adds r1, r5\n\ + ldrb r1, [r1, 0x12]\n\ + adds r0, r6, 0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0807A7B4\n\ + movs r0, 0x2\n\ + b _0807A7B6\n\ + .pool\n\ +_0807A7B0:\n\ + movs r0, 0x1\n\ + b _0807A7B6\n\ +_0807A7B4:\n\ + movs r0, 0\n\ +_0807A7B6:\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); +} +#endif // NONMATCHING + +static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet) +{ + if (species == SPECIES_DEOXYS || species == SPECIES_MEW) + { + if (!isObedientBitSet) + return TRUE; + } + return FALSE; +} + +int sub_807A7E0(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 species1, u16 species2, u8 type, u16 species3, u8 isObedientBitSet) +{ + u8 r9 = a0.unk_01_0; + u8 r2 = a0.unk_00_7; + u8 r10 = a1.unk_01_0; + u8 r0 = a1.unk_00_7; + u8 r1 = a1.unk_01_2; + + if (r1 != 3) + { + if (!r2) + { + return 8; + } + else if (!r0) + { + return 9; + } + } + + if (IsDeoxysOrMewUntradable(species3, isObedientBitSet)) + { + return 4; + } + + if (species2 == SPECIES_EGG) + { + if (species1 != species2) + { + return 2; + } + } + else + { + if (gBaseStats[species1].type1 != type && gBaseStats[species1].type2 != type) + { + return 1; + } + } + + if (species1 == SPECIES_EGG && species1 != species2) + { + return 3; + } + + if (!r9) + { + if (species1 == SPECIES_EGG) + { + return 6; + } + + if (!IsSpeciesInHoennDex(species1)) + { + return 4; + } + + if (!IsSpeciesInHoennDex(species2)) + { + return 5; + } + } + + if (!r10 && !IsSpeciesInHoennDex(species1)) + { + return 7; + } + + return 0; +} + +int sub_807A8D0(struct UnkLinkRfuStruct_02022B14Substruct a0, u16 species, u16 a2, u8 a3) +{ + u8 unk = a0.unk_01_0; + + if (IsDeoxysOrMewUntradable(a2, a3)) + { + return 1; + } + + if (unk) + { + return 0; + } + + if (species == SPECIES_EGG) + { + return 2; + } + + if (IsSpeciesInHoennDex(species)) + { + return 0; + } + + return 1; +} + +// r6/r7 flip. Ugh. +#ifdef NONMATCHING +int sub_807A918(struct Pokemon *mon, u16 monIdx) +{ + int i, version, versions, unk, unk2; + int speciesArray[PARTY_SIZE]; + + for (i = 0; i < gPlayerPartyCount; i++) + { + speciesArray[i] = GetMonData(&mon[i], MON_DATA_SPECIES2); + if (speciesArray[i] == SPECIES_EGG) + { + speciesArray[i] = 0; + } + } + + versions = 0; + unk = 1; + for (i = 0; i < GetLinkPlayerCount(); i++) + { + version = gLinkPlayers[i].version & 0xFF; + if (version == VERSION_FIRE_RED || + version == VERSION_LEAF_GREEN) + { + versions = 0; + } + else + { + versions |= 1; + } + } + + for (i = 0; i < GetLinkPlayerCount(); i++) + { + struct LinkPlayer *player = &gLinkPlayers[i]; + if ((player->name[8] & 0xF) == 0) + { + unk = 0; + } + + if (versions && (player->name[8] / 16)) + { + unk = 0; + } + } + + if (unk == 0) + { + if (!IsSpeciesInHoennDex(speciesArray[monIdx])) + { + return 2; + } + + if (speciesArray[monIdx] == SPECIES_NONE) + { + return 3; + } + } + + unk2 = 0; + for (i = 0; i < gPlayerPartyCount; i++) + { + if (monIdx != i) + { + unk2 += speciesArray[i]; + } + } + + if (!unk2) + { + return 1; + } + else + { + return 0; + } +} +#else +NAKED +int sub_807A918(struct Pokemon *mon, u16 a1) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0x18\n\ + adds r6, r0, 0\n\ + lsls r1, 16\n\ + lsrs r1, 16\n\ + mov r8, r1\n\ + movs r5, 0\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + cmp r5, r0\n\ + bge _0807A95A\n\ + mov r4, sp\n\ +_0807A934:\n\ + movs r0, 0x64\n\ + muls r0, r5\n\ + adds r0, r6, r0\n\ + movs r1, 0x41\n\ + bl GetMonData\n\ + str r0, [r4]\n\ + movs r1, 0xCE\n\ + lsls r1, 1\n\ + cmp r0, r1\n\ + bne _0807A94E\n\ + movs r0, 0\n\ + str r0, [r4]\n\ +_0807A94E:\n\ + adds r4, 0x4\n\ + adds r5, 0x1\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + cmp r5, r0\n\ + blt _0807A934\n\ +_0807A95A:\n\ + movs r7, 0\n\ + movs r6, 0x1\n\ + movs r5, 0\n\ + ldr r4, =gLinkPlayers\n\ + b _0807A980\n\ + .pool\n\ +_0807A96C:\n\ + ldrb r0, [r4]\n\ + subs r0, 0x4\n\ + cmp r0, 0x1\n\ + bhi _0807A978\n\ + movs r7, 0\n\ + b _0807A97C\n\ +_0807A978:\n\ + movs r0, 0x1\n\ + orrs r7, r0\n\ +_0807A97C:\n\ + adds r4, 0x1C\n\ + adds r5, 0x1\n\ +_0807A980:\n\ + bl GetLinkPlayerCount\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r5, r0\n\ + blt _0807A96C\n\ + movs r5, 0\n\ + movs r4, 0\n\ + b _0807A9B4\n\ +_0807A992:\n\ + ldr r0, =gLinkPlayers\n\ + adds r2, r4, r0\n\ + ldrb r1, [r2, 0x10]\n\ + movs r0, 0xF\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + bne _0807A9A2\n\ + movs r6, 0\n\ +_0807A9A2:\n\ + cmp r7, 0\n\ + beq _0807A9B0\n\ + ldrb r0, [r2, 0x10]\n\ + lsrs r0, 4\n\ + cmp r0, 0\n\ + beq _0807A9B0\n\ + movs r6, 0\n\ +_0807A9B0:\n\ + adds r4, 0x1C\n\ + adds r5, 0x1\n\ +_0807A9B4:\n\ + bl GetLinkPlayerCount\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r5, r0\n\ + blt _0807A992\n\ + cmp r6, 0\n\ + bne _0807A9EA\n\ + mov r1, r8\n\ + lsls r0, r1, 2\n\ + mov r1, sp\n\ + adds r4, r1, r0\n\ + ldrh r0, [r4]\n\ + bl IsSpeciesInHoennDex\n\ + cmp r0, 0\n\ + bne _0807A9E0\n\ + movs r0, 0x2\n\ + b _0807AA1A\n\ + .pool\n\ +_0807A9E0:\n\ + ldr r0, [r4]\n\ + cmp r0, 0\n\ + bne _0807A9EA\n\ + movs r0, 0x3\n\ + b _0807AA1A\n\ +_0807A9EA:\n\ + movs r2, 0\n\ + movs r5, 0\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + cmp r2, r0\n\ + bge _0807AA0A\n\ + adds r3, r0, 0\n\ + mov r1, sp\n\ +_0807A9FA:\n\ + cmp r8, r5\n\ + beq _0807AA02\n\ + ldr r0, [r1]\n\ + adds r2, r0\n\ +_0807AA02:\n\ + adds r1, 0x4\n\ + adds r5, 0x1\n\ + cmp r5, r3\n\ + blt _0807A9FA\n\ +_0807AA0A:\n\ + cmp r2, 0\n\ + beq _0807AA18\n\ + movs r0, 0\n\ + b _0807AA1A\n\ + .pool\n\ +_0807AA18:\n\ + movs r0, 0x1\n\ +_0807AA1A:\n\ + add sp, 0x18\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); +} +#endif // NONMATCHING + +static void sub_807AA28(struct Sprite *sprite) +{ + if (++sprite->data[0] == 10) + { + PlaySE(SE_BOWA); + sprite->data[0] = 0; + } +} + +static void sub_807AA4C(struct Sprite *sprite) +{ + if (!sprite->invisible && ++sprite->data[0] == 10) + { + PlaySE(SE_W207B); + sprite->data[0] = 0; + } +} + +static void sub_807AA7C(struct Sprite *sprite) +{ + if (!sprite->data[1]) + { + if (++sprite->data[0] == 12) + sprite->data[0] = 0; + + LoadPalette(&gUnknown_08338EA4[sprite->data[0]], (sprite->oam.paletteNum + 16) * 16 + 4, 2); + } +} + +static void sub_807AABC(struct Sprite *sprite) +{ + sprite->data[0]++; + sprite->pos2.y++; + + if (sprite->data[0] == 10) + DestroySprite(sprite); +} + +static void sub_807AAE0(struct Sprite *sprite) +{ + sprite->data[0]++; + sprite->pos2.y--; + + if (sprite->data[0] == 10) + DestroySprite(sprite); +} + +static void sub_807AB04(struct Sprite *sprite) +{ + if (++sprite->data[0] == 15) + { + PlaySE(SE_W107); + sprite->data[0] = 0; + } +} + +static void sub_807AB28(void) +{ + struct BgAffineDstData affine; + + DoBgAffineSet(&affine, gUnknown_020322A0->unk_D4 * 0x100, gUnknown_020322A0->unk_D6 * 0x100, gUnknown_020322A0->unk_DC, gUnknown_020322A0->unk_DE, gUnknown_020322A0->unk_E8, gUnknown_020322A0->unk_E8, gUnknown_020322A0->unk_EC); + SetGpuReg(REG_OFFSET_BG2PA, affine.pa); + SetGpuReg(REG_OFFSET_BG2PB, affine.pb); + SetGpuReg(REG_OFFSET_BG2PC, affine.pc); + SetGpuReg(REG_OFFSET_BG2PD, affine.pd); + SetGpuReg(REG_OFFSET_BG2X_L, affine.dx); + SetGpuReg(REG_OFFSET_BG2X_H, affine.dx >> 16); + SetGpuReg(REG_OFFSET_BG2Y_L, affine.dy); + SetGpuReg(REG_OFFSET_BG2Y_H, affine.dy >> 16); +} + +static void sub_807ABCC(void) +{ + u16 dispcnt; + + SetGpuReg(REG_OFFSET_BG1VOFS, gUnknown_020322A0->bg1vofs); + SetGpuReg(REG_OFFSET_BG1HOFS, gUnknown_020322A0->bg1hofs); + + dispcnt = GetGpuReg(REG_OFFSET_DISPCNT); + if ((dispcnt & 7) == DISPCNT_MODE_0) + { + SetGpuReg(REG_OFFSET_BG2VOFS, gUnknown_020322A0->bg2vofs); + SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_020322A0->bg2hofs); + } + else + { + sub_807AB28(); + } +} + +static void sub_807AC24(void) +{ + sub_807ABCC(); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +static void sub_807AC3C(void) +{ + gUnknown_020322A0->unk_8A = 0; + gUnknown_020322A0->unk_88 = 0; + gUnknown_020322A0->unk_89 = 0; +} + +static void sub_807AC64(void) +{ + if (gUnknown_020322A0->unk_88 == gUnknown_020322A0->unk_89) + gUnknown_020322A0->unk_8A++; + else + gUnknown_020322A0->unk_8A = 0; + + if (gUnknown_020322A0->unk_8A > 300) + { + CloseLink(); + SetMainCallback2(CB2_LinkError); + gUnknown_020322A0->unk_8A = 0; + gUnknown_020322A0->unk_89 = 0; + gUnknown_020322A0->unk_88 = 0; + } + + gUnknown_020322A0->unk_89 = gUnknown_020322A0->unk_88; +} + +static u32 sub_807ACDC(void) +{ + if (gReceivedRemoteLinkPlayers) + return GetMultiplayerId(); + return 0; +} + +static void sub_807ACFC(u8 whichParty, u8 a1) +{ + int pos = 0; + struct Pokemon *mon = NULL; + u16 species; + u32 personality; + + if (whichParty == 0) + { + mon = &gPlayerParty[gUnknown_02032298[0]]; + pos = 1; + } + + if (whichParty == 1) + { + mon = &gEnemyParty[gUnknown_02032298[1] % PARTY_SIZE]; + pos = 3; + } + + switch (a1) + { + case 0: + species = GetMonData(mon, MON_DATA_SPECIES2); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + + if (whichParty == 0) + HandleLoadSpecialPokePic_2(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[1], species, personality); + else + HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[whichParty * 2 + 1], species, personality); + + LoadCompressedSpritePalette(GetMonSpritePalStruct(mon)); + gUnknown_020322A0->tradeSpecies[whichParty] = species; + gUnknown_020322A0->unk_68[whichParty] = personality; + break; + case 1: + SetMultiuseSpriteTemplateToPokemon(GetMonSpritePalStruct(mon)->tag, pos); + gUnknown_020322A0->pokePicSpriteIdxs[whichParty] = CreateSprite(&gMultiuseSpriteTemplate, 120, 60, 6); + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[whichParty]].invisible = TRUE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[whichParty]].callback = SpriteCallbackDummy; + break; + } +} + +void sub_807AE50(void) +{ + switch (gMain.state) + { + case 0: + if (!gReceivedRemoteLinkPlayers) + { + gLinkType = 0x1144; + CloseLink(); + } + gUnknown_020322A0 = AllocZeroed(sizeof(*gUnknown_020322A0)); + AllocateMonSpritesGfx(); + ResetTasks(); + ResetSpriteData(); + FreeAllSpritePalettes(); + SetVBlankCallback(sub_807AC24); + sub_807B170(); + sub_807AC3C(); + gMain.state++; + gUnknown_020322A0->unk_8C = 0; + gUnknown_020322A0->state = 0; + gUnknown_020322A0->isLinkTrade = TRUE; + gUnknown_020322A0->unk_D4 = 64; + gUnknown_020322A0->unk_D6 = 64; + gUnknown_020322A0->unk_D8 = 0; + gUnknown_020322A0->unk_DA = 0; + gUnknown_020322A0->unk_DC = 120; + gUnknown_020322A0->unk_DE = 80; + gUnknown_020322A0->unk_E8 = 256; + gUnknown_020322A0->unk_EC = 0; + break; + case 1: + if (!gReceivedRemoteLinkPlayers) + { + gUnknown_020322A0->unk_FA = 1; + OpenLink(); + gMain.state++; + gUnknown_020322A0->timer = 0; + } + else + { + gMain.state = 4; + } + break; + case 2: + if (++gUnknown_020322A0->timer > 60) + { + gUnknown_020322A0->timer = 0; + gMain.state++; + } + break; + case 3: + if (IsLinkMaster()) + { + if (GetLinkPlayerCount_2() >= sub_800AA48()) + { + if (++gUnknown_020322A0->timer > 30) + { + sub_800A620(); + gMain.state++; + } + } + else + { + sub_807AC64(); + } + } + else + { + gMain.state++; + } + break; + case 4: + sub_807AC64(); + if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE) + gMain.state++; + break; + case 5: + gUnknown_020322A0->unk_72 = 0; + gUnknown_020322A0->unk_73 = 0; + gUnknown_020322A0->unk_93 = 0; + sub_807ACFC(0, 0); + gMain.state++; + break; + case 6: + sub_807ACFC(0, 1); + gMain.state++; + break; + case 7: + sub_807ACFC(1, 0); + gMain.state++; + break; + case 8: + sub_807ACFC(1, 1); + sub_807B154(); + gMain.state++; + break; + case 9: + sub_807BA94(); + LoadSpriteSheet(&gUnknown_08338D18); + LoadSpritePalette(&gUnknown_08338D20); + gMain.state++; + break; + case 10: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + ShowBg(0); + gMain.state++; + break; + case 11: + sub_807B140(); + SetTradeSceneStrings(); + gMain.state++; + break; + case 12: + if (!gPaletteFade.active) + { + if (gWirelessCommType) + { + sub_800E0E8(); + CreateWirelessStatusIndicatorSprite(0, 0); + } + SetMainCallback2(sub_807EA2C); + } + break; + } + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void sub_807B140(void) +{ + sub_807B62C(5); + sub_807B62C(0); +} + +void sub_807B154(void) +{ + FillWindowPixelBuffer(0, 0xFF); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); +} + +static void sub_807B170(void) +{ + SetGpuReg(REG_OFFSET_DISPCNT, 0); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_08339014, ARRAY_COUNT(gUnknown_08339014)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + SetBgTilemapBuffer(0, Alloc(0x800)); + SetBgTilemapBuffer(1, Alloc(0x800)); + SetBgTilemapBuffer(3, Alloc(0x800)); + DeactivateAllTextPrinters(); + DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0); + LZDecompressWram(gBattleTextboxTilemap, gDecompressionBuffer); + CopyToBgTilemapBuffer(0, gDecompressionBuffer, 0x800, 0); + LoadCompressedPalette(gBattleTextboxPalette, 0, 0x20); + InitWindows(gUnknown_08338FFC); + DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0); + LZDecompressWram(gBattleTextboxTilemap, gDecompressionBuffer); + CopyToBgTilemapBuffer(0, gDecompressionBuffer, 0x800, 0); + LoadCompressedPalette(gBattleTextboxPalette, 0, 0x20); +} + +// In-game trade init +static void sub_807B270(void) +{ + u8 otName[11]; + + switch (gMain.state) + { + case 0: + gUnknown_02032298[0] = gSpecialVar_0x8005; + gUnknown_02032298[1] = 6; + StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName); + GetMonData(&gEnemyParty[0], MON_DATA_OT_NAME, otName); + StringCopy(gLinkPlayers[1].name, otName); + gLinkPlayers[0].language = LANGUAGE_ENGLISH; + gLinkPlayers[1].language = GetMonData(&gEnemyParty[0], MON_DATA_LANGUAGE); + gUnknown_020322A0 = AllocZeroed(sizeof(*gUnknown_020322A0)); + AllocateMonSpritesGfx(); + ResetTasks(); + ResetSpriteData(); + FreeAllSpritePalettes(); + SetVBlankCallback(sub_807AC24); + sub_807B170(); + gUnknown_020322A0->isLinkTrade = FALSE; + gUnknown_020322A0->unk_8C = 0; + gUnknown_020322A0->state = 0; + gUnknown_020322A0->unk_D4 = 64; + gUnknown_020322A0->unk_D6 = 64; + gUnknown_020322A0->unk_D8 = 0; + gUnknown_020322A0->unk_DA = 0; + gUnknown_020322A0->unk_DC = 120; + gUnknown_020322A0->unk_DE = 80; + gUnknown_020322A0->unk_E8 = 256; + gUnknown_020322A0->unk_EC = 0; + gUnknown_020322A0->timer = 0; + gMain.state = 5; + break; + case 5: + sub_807ACFC(0, 0); + gMain.state++; + break; + case 6: + sub_807ACFC(0, 1); + gMain.state++; + break; + case 7: + sub_807ACFC(1, 0); + ShowBg(0); + gMain.state++; + break; + case 8: + sub_807ACFC(1, 1); + FillWindowPixelBuffer(0, 0xFF); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); + gMain.state++; + break; + case 9: + sub_807BA94(); + LoadSpriteSheet(&gUnknown_08338D18); + LoadSpritePalette(&gUnknown_08338D20); + gMain.state++; + break; + case 10: + ShowBg(0); + gMain.state++; + break; + case 11: + sub_807B62C(5); + sub_807B62C(0); + SetTradeSceneStrings(); + gMain.state++; + break; + case 12: + SetMainCallback2(sub_807B60C); + break; + } + + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_807B464(u8 partyIdx) +{ + struct Pokemon *mon = &gPlayerParty[partyIdx]; + + if (!GetMonData(mon, MON_DATA_IS_EGG)) + { + u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL); + u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); + species = SpeciesToNationalPokedexNum(species); + GetSetPokedexFlag(species, FLAG_SET_SEEN); + HandleSetPokedexFlag(species, FLAG_SET_CAUGHT, personality); + } +} + +static void sub_807B4C4(void) +{ + u8 mpId = GetMultiplayerId(); + // Originally in Ruby but commented out + /*if (gLinkPlayers[mpId ^ 1].lp_field_2 == 0x8000) + EnableNationalPokedex();*/ +} + +static void sub_807B4D0(u8 a0, u8 a1) +{ + u8 friendship; + + struct Pokemon *playerMon = &gPlayerParty[a0]; + u16 playerMail = GetMonData(playerMon, MON_DATA_MAIL); + + struct Pokemon *partnerMon = &gEnemyParty[a1]; + u16 partnerMail = GetMonData(partnerMon, MON_DATA_MAIL); + + if (playerMail != 0xFF) + ClearMailStruct(&gSaveBlock1Ptr->mail[playerMail]); + + // This is where the actual trade happens!! + gUnknown_020322A0->mon = *playerMon; + *playerMon = *partnerMon; + *partnerMon = gUnknown_020322A0->mon; + + friendship = 70; + if (!GetMonData(playerMon, MON_DATA_IS_EGG)) + SetMonData(playerMon, MON_DATA_FRIENDSHIP, &friendship); + + if (partnerMail != 0xFF) + GiveMailToMon2(playerMon, &gUnknown_020321C0[partnerMail]); + + sub_807B464(a0); + if (gReceivedRemoteLinkPlayers) + sub_807B4C4(); +} + +static void sub_807B5B8(void) +{ + switch (gUnknown_020322A0->unk_93) + { + case 1: + if (IsLinkTaskFinished()) + { + Trade_SendData(gUnknown_020322A0); + gUnknown_020322A0->unk_93++; + } + // fallthrough + case 2: + gUnknown_020322A0->unk_93 = 0; + break; + } +} + +static void sub_807B60C(void) +{ + sub_807BBC8(); + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_807B62C(u8 a0) +{ + switch (a0) + { + case 0: + gUnknown_020322A0->bg2vofs = 0; + gUnknown_020322A0->bg2hofs = 180; + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG0_ON | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | + BGCNT_CHARBASE(1) | + BGCNT_16COLOR | + BGCNT_SCREENBASE(18) | + BGCNT_TXT512x256); + LoadPalette(gTradeGba2_Pal, 16, 0x60); + DmaCopyLarge16(3, gTradeGba_Gfx, (void *) BG_CHAR_ADDR(1), 0x1420, 0x1000); + DmaCopy16Defvars(3, gUnknown_08331F60, (void *) BG_SCREEN_ADDR(18), 0x1000); + break; + case 1: + gUnknown_020322A0->bg1hofs = 0; + gUnknown_020322A0->bg1vofs = 348; + SetGpuReg(REG_OFFSET_BG1VOFS, 348); + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(2) | + BGCNT_CHARBASE(0) | + BGCNT_16COLOR | + BGCNT_SCREENBASE(5) | + BGCNT_TXT256x512); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | + BGCNT_CHARBASE(1) | + BGCNT_16COLOR | + BGCNT_SCREENBASE(18) | + BGCNT_TXT256x512); + + if (gUnknown_020322A0->unk_FA) + { + DmaCopy16Defvars(3, gUnknown_083369A0, (void *) BG_SCREEN_ADDR(5), 0x1000); + } + else + { + DmaCopy16Defvars(3, gUnknown_083359A0, (void *) BG_SCREEN_ADDR(5), 0x1000); + } + + DmaCopyLarge16(3, gTradeGba_Gfx, (void *) BG_CHAR_ADDR(0), 0x1420, 0x1000); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + break; + case 2: + gUnknown_020322A0->bg1vofs = 0; + gUnknown_020322A0->bg1hofs = 0; + if (!gUnknown_020322A0->unk_FA) + { + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + LZ77UnCompVram(gUnknown_083379A0, (void *) BG_SCREEN_ADDR(5)); + BlendPalettes(0x8, 16, RGB_BLACK); + } + else + { + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + DmaCopy16Defvars(3, gUnknown_0832FFC0, (void *) BG_SCREEN_ADDR(5), 0x800); + BlendPalettes(0x1, 16, RGB_BLACK); + } + break; + case 3: + LoadPalette(gUnknown_08337EA0, 48, 0x20); + LZ77UnCompVram(gUnknown_08337EC0, (void *) BG_CHAR_ADDR(1)); + LZ77UnCompVram(gUnknown_08338550, (void *) BG_SCREEN_ADDR(18)); + gUnknown_020322A0->bg2vofs = 80; + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + break; + case 4: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(3) | + BGCNT_CHARBASE(1) | + BGCNT_256COLOR | + BGCNT_SCREENBASE(18) | + BGCNT_AFF128x128); + gUnknown_020322A0->unk_D4 = 64; + gUnknown_020322A0->unk_D6 = 92; + gUnknown_020322A0->unk_E8 = 32; + gUnknown_020322A0->unk_EA = 1024; + gUnknown_020322A0->unk_EC = 0; + + DmaCopyLarge16(3, gUnknown_08332F60, (void *) BG_CHAR_ADDR(1), 0x2840, 0x1000); + + if (gUnknown_020322A0->unk_FA) + { + DmaCopy16Defvars(3, gUnknown_083357A0, (void *) BG_SCREEN_ADDR(18), 0x100); + } + else + { + DmaCopy16Defvars(3, gUnknown_083358A0, (void *) BG_SCREEN_ADDR(18), 0x100); + } + break; + case 5: + gUnknown_020322A0->bg1vofs = 0; + gUnknown_020322A0->bg1hofs = 0; + break; + case 6: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(3) | + BGCNT_CHARBASE(1) | + BGCNT_256COLOR | + BGCNT_SCREENBASE(18) | + BGCNT_AFF128x128); + gUnknown_020322A0->unk_D4 = 64; + gUnknown_020322A0->unk_D6 = 92; + gUnknown_020322A0->unk_E8 = 256; + gUnknown_020322A0->unk_EA = 128; + gUnknown_020322A0->unk_DC = 120; + gUnknown_020322A0->unk_DE = 80; + gUnknown_020322A0->unk_EC = 0; + + DmaCopyLarge16(3, gUnknown_08332F60, (void *) BG_CHAR_ADDR(1), 0x2840, 0x1000); + + if (gUnknown_020322A0->unk_FA) + { + DmaCopy16Defvars(3, gUnknown_083357A0, (void *) BG_SCREEN_ADDR(18), 0x100); + } + else + { + DmaCopy16Defvars(3, gUnknown_083358A0, (void *) BG_SCREEN_ADDR(18), 0x100); + } + break; + case 7: + gUnknown_020322A0->bg2vofs = 0; + gUnknown_020322A0->bg2hofs = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | + BGCNT_CHARBASE(1) | + BGCNT_16COLOR | + BGCNT_SCREENBASE(18) | + BGCNT_TXT512x256); + LoadPalette(gTradeGba2_Pal, 16, 0x60); + DmaCopyLarge16(3, gTradeGba_Gfx, (void *) BG_CHAR_ADDR(1), 0x1420, 0x1000); + DmaCopy16Defvars(3, gUnknown_08331F60, (void *) BG_SCREEN_ADDR(18), 0x1000); + break; + } +} + +static void sub_807BA94(void) +{ + LoadSpriteSheet(&gUnknown_08338D70); + LoadSpriteSheet(&gUnknown_08338DC0); + LoadSpriteSheet(&gUnknown_08338DF4); + LoadSpriteSheet(&gUnknown_08338E6C); + LoadSpritePalette(&gUnknown_08338D78); + LoadSpritePalette(&gUnknown_08338D80); +} + +static void SetTradeSceneStrings(void) +{ + /*Sets the variable strings printed on the + *actual trading screen. For use in strings + *like "[Pokemon] will be sent to [Trainer]." + */ + u8 mpId; + u8 name[20]; + const struct InGameTrade *ingameTrade; + + if (gUnknown_020322A0->isLinkTrade) + { + mpId = GetMultiplayerId(); + StringCopy(gStringVar1, gLinkPlayers[mpId ^ 1].name); + GetMonData(&gEnemyParty[gUnknown_02032298[1] % PARTY_SIZE], MON_DATA_NICKNAME, name); + StringCopy10(gStringVar3, name); + GetMonData(&gPlayerParty[gUnknown_02032298[0]], MON_DATA_NICKNAME, name); + StringCopy10(gStringVar2, name); + } + else + { + ingameTrade = &gIngameTrades[gSpecialVar_0x8004]; + StringCopy(gStringVar1, ingameTrade->otName); + StringCopy10(gStringVar3, ingameTrade->name); + GetMonData(&gPlayerParty[gSpecialVar_0x8005], MON_DATA_NICKNAME, name); + StringCopy10(gStringVar2, name); + } +} + +static u8 sub_807BBC8(void) +{ + if (gUnknown_020322A0->unk_FA) + { + return sub_807BBEC(); + } + else + { + return sub_807CFC8(); + } +} + +static bool8 sub_807BBEC(void) +{ + u16 evoTarget; + + switch (gUnknown_020322A0->state) + { + case 0: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = FALSE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x = -180; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y = gMonFrontPicCoords[gUnknown_020322A0->tradeSpecies[0]].y_offset; + gUnknown_020322A0->state++; + gUnknown_020322A0->cachedMapMusic = GetCurrentMapMusic(); + PlayNewMapMusic(MUS_SHINKA); + break; + case 1: + if (gUnknown_020322A0->bg2hofs > 0) + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x += 3; + gUnknown_020322A0->bg2hofs -= 3; + } + else + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x = 0; + gUnknown_020322A0->bg2hofs = 0; + gUnknown_020322A0->state = 10; + } + break; + case 10: + StringExpandPlaceholders(gStringVar4, gText_XWillBeSentToY); + sub_807F1A8(0, gStringVar4, 0); + + if (gUnknown_020322A0->tradeSpecies[0] != SPECIES_EGG) + { + PlayCry1(gUnknown_020322A0->tradeSpecies[0], 0); + } + + gUnknown_020322A0->state = 11; + gUnknown_020322A0->timer = 0; + break; + case 11: + if (++gUnknown_020322A0->timer == 80) + { + gUnknown_020322A0->unk_D2 = sub_807671C(gUnknown_020322A0->pokePicSpriteIdxs[0], gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].oam.paletteNum, 120, 32, 2, 1, 0x14, 0xfffff); + gUnknown_020322A0->state++; + StringExpandPlaceholders(gStringVar4, gText_ByeByeVar1); + sub_807F1A8(0, gStringVar4, 0); + } + break; + case 12: + if (gSprites[gUnknown_020322A0->unk_D2].callback == SpriteCallbackDummy) + { + gUnknown_020322A0->unk_D3 = CreateSprite(&gSpriteTemplate_8338D28, 120, 32, 0); + gSprites[gUnknown_020322A0->unk_D3].callback = sub_807E5D8; + DestroySprite(&gSprites[gUnknown_020322A0->unk_D2]); + gUnknown_020322A0->state++; + } + break; + case 13: + // The game waits here for the sprite to finish its animation sequence. + break; + case 14: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->state = 20; + break; + case 20: + if (!gPaletteFade.active) + { + sub_807B62C(4); + FillWindowPixelBuffer(0, 0xFF); + CopyWindowToVram(0, 3); + gUnknown_020322A0->state++; + } + break; + case 21: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 22: + if (!gPaletteFade.active) + { + gUnknown_020322A0->state = 23; + } + break; + case 23: + if (gUnknown_020322A0->unk_EA > 0x100) + { + gUnknown_020322A0->unk_EA -= 0x34; + } + else + { + sub_807B62C(1); + gUnknown_020322A0->unk_EA = 0x80; + gUnknown_020322A0->state++; + gUnknown_020322A0->timer = 0; + } + gUnknown_020322A0->unk_E8 = 0x8000 / gUnknown_020322A0->unk_EA; + break; + case 24: + if (++gUnknown_020322A0->timer > 20) + { + sub_807AB28(); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338E74, 120, 80, 0); + gUnknown_020322A0->state++; + } + break; + case 25: + if (gSprites[gUnknown_020322A0->unk_91].animEnded) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | + BLDCNT_TGT2_BG1 | + BLDCNT_TGT2_BG2); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 4)); + gUnknown_020322A0->state++; + } + break; + case 26: + if (--gUnknown_020322A0->bg1vofs == 316) + { + gUnknown_020322A0->state++; + } + if (gUnknown_020322A0->bg1vofs == 328) + { + gUnknown_020322A0->unk_92 = CreateSprite(&gSpriteTemplate_8338DFC, 128, 65, 0); + } + break; + case 27: + gUnknown_020322A0->unk_90 = CreateSprite(&gUnknown_08338D88, 128, 80, 3); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 128, 80, 0); + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_91], 1); + gUnknown_020322A0->state++; + break; + case 28: + if ((gUnknown_020322A0->bg1vofs -= 2) == 166) + { + gUnknown_020322A0->state = 200; + } + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + break; + case 200: + gSprites[gUnknown_020322A0->unk_90].pos1.y -= 2; + gSprites[gUnknown_020322A0->unk_91].pos1.y -= 2; + if (gSprites[gUnknown_020322A0->unk_90].pos1.y < -8) + { + gUnknown_020322A0->state = 29; + } + break; + case 29: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + gUnknown_020322A0->state = 30; + break; + case 30: + if (!gPaletteFade.active) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + sub_807B62C(2); + gUnknown_020322A0->state++; + } + break; + case 31: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->unk_90 = CreateSprite(&gSpriteTemplate_8338DC8, 111, 170, 0); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 129, -10, 0); + gUnknown_020322A0->state++; + break; + case 32: + if (!gPaletteFade.active) + { + PlaySE(SE_TK_WARPOUT); + gUnknown_020322A0->state++; + } + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + break; + case 33: + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y <= -90) + { + gSprites[gUnknown_020322A0->unk_90].data[1] = 1; + gSprites[gUnknown_020322A0->unk_91].data[1] = 1; + gUnknown_020322A0->state++; + } + break; + case 34: + BlendPalettes(0x1, 16, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 35: + BlendPalettes(0x1, 0, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 36: + BlendPalettes(0x1, 16, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 37: + if (!IsMonSpriteNotFlipped(gUnknown_020322A0->tradeSpecies[0])) + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].affineAnims = gSpriteAffineAnimTable_8338ECC; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].oam.affineMode = 3; + CalcCenterToCornerVec(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0, 3, 3); + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0); + } + else + { + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0); + } + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]], 0); + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos1.x = 60; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.x = 180; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos1.y = 192; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.y = -32; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = FALSE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].invisible = FALSE; + gUnknown_020322A0->state++; + break; + case 38: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y -= 3; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.y += 3; + if (gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y < -160 && gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y >= -163) + { + PlaySE(SE_TK_WARPIN); + } + if (gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y < -222) + { + gSprites[gUnknown_020322A0->unk_90].data[1] = 0; + gSprites[gUnknown_020322A0->unk_91].data[1] = 0; + gUnknown_020322A0->state++; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = TRUE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].invisible = TRUE; + BlendPalettes(0x1, 0, RGB_WHITEALPHA); + } + break; + case 39: + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y <= -222) + { + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + gUnknown_020322A0->state++; + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + } + break; + case 40: + if (!gPaletteFade.active) + { + gUnknown_020322A0->state++; + sub_807B62C(1); + gUnknown_020322A0->bg1vofs = 166; + gUnknown_020322A0->unk_90 = CreateSprite(&gUnknown_08338D88, 128, -20, 3); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 128, -20, 0); + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_91], 1); + } + break; + case 41: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 42: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + if (!gPaletteFade.active) + { + gUnknown_020322A0->state++; + } + break; + case 43: + gSprites[gUnknown_020322A0->unk_90].pos2.y += 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y + gSprites[gUnknown_020322A0->unk_90].pos1.y == 64) + { + gUnknown_020322A0->state++; + } + break; + case 44: + if ((gUnknown_020322A0->bg1vofs += 2) > 316) + { + gUnknown_020322A0->bg1vofs = 316; + gUnknown_020322A0->state++; + } + break; + case 45: + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + gUnknown_020322A0->state++; + gUnknown_020322A0->timer = 0; + break; + case 46: + if (++gUnknown_020322A0->timer == 10) + { + gUnknown_020322A0->state++; + } + break; + case 47: + if (++gUnknown_020322A0->bg1vofs > 348) + { + gUnknown_020322A0->bg1vofs = 348; + gUnknown_020322A0->state++; + } + if (gUnknown_020322A0->bg1vofs == 328 && gUnknown_020322A0->unk_FA) + { + gUnknown_020322A0->unk_92 = CreateSprite(&gSpriteTemplate_8338DFC, 128, 65, 0); + gSprites[gUnknown_020322A0->unk_92].callback = sub_807AAE0; + } + break; + case 48: + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338E74, 120, 80, 0); + gUnknown_020322A0->state = 50; + break; + case 50: + if (gSprites[gUnknown_020322A0->unk_91].animEnded) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + sub_807B62C(6); + gUnknown_020322A0->state++; + PlaySE(SE_W028); + } + break; + case 51: + if (gUnknown_020322A0->unk_EA < 0x400) + { + gUnknown_020322A0->unk_EA += 0x34; + } + else + { + gUnknown_020322A0->unk_EA = 0x400; + gUnknown_020322A0->state++; + } + gUnknown_020322A0->unk_E8 = 0x8000 / gUnknown_020322A0->unk_EA; + break; + case 52: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->state = 60; + break; + + case 60: + if (!gPaletteFade.active) + { + sub_807B62C(5); + sub_807B62C(7); + gPaletteFade.bufferTransferDisabled = TRUE; + gUnknown_020322A0->state++; + } + break; + case 61: + gPaletteFade.bufferTransferDisabled = FALSE; + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 62: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + if (!gPaletteFade.active) + { + gUnknown_020322A0->state++; + } + break; + case 63: + gUnknown_020322A0->unk_D3 = CreateSprite(&gSpriteTemplate_8338D28, 120, -8, 0); + gSprites[gUnknown_020322A0->unk_D3].data[3] = 74; + gSprites[gUnknown_020322A0->unk_D3].callback = sub_807E6AC; + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_D3], 1); + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->unk_D3], 2); + BlendPalettes(1 << (16 + gSprites[gUnknown_020322A0->unk_D3].oam.paletteNum), 16, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + gUnknown_020322A0->timer = 0; + break; + case 64: + BeginNormalPaletteFade(1 << (16 + gSprites[gUnknown_020322A0->unk_D3].oam.paletteNum), 1, 16, 0, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 65: + if (gSprites[gUnknown_020322A0->unk_D3].callback == SpriteCallbackDummy) + { + HandleLoadSpecialPokePic_2(&gMonFrontPicTable[gUnknown_020322A0->tradeSpecies[1]], gMonSpritesGfxPtr->sprites[3], gUnknown_020322A0->tradeSpecies[1], gUnknown_020322A0->unk_68[1]); + gUnknown_020322A0->state++; + } + break; + case 66: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.x = 120; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.y = gMonFrontPicCoords[gUnknown_020322A0->tradeSpecies[1]].y_offset + 60; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.x = 0; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.y = 0; + StartSpriteAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]], 0); + CreatePokeballSpriteToReleaseMon(gUnknown_020322A0->pokePicSpriteIdxs[1], gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].oam.paletteNum, 120, 84, 2, 1, 20, 0xFFFFF, gUnknown_020322A0->tradeSpecies[1]); + FreeSpriteOamMatrix(&gSprites[gUnknown_020322A0->unk_D3]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_D3]); + gUnknown_020322A0->state++; + break; + case 67: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG0_ON | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + StringExpandPlaceholders(gStringVar4, gText_XSentOverY); + sub_807F1A8(0, gStringVar4, 0); + gUnknown_020322A0->state = 167; + gUnknown_020322A0->timer = 0; + break; + // 167 and 267 are extra cases added in for animations + case 167: + if (++gUnknown_020322A0->timer > 60) + { + gUnknown_020322A0->state = 267; + gUnknown_020322A0->timer = 0; + } + break; + case 267: + if (IsCryFinished()) + { + gUnknown_020322A0->state = 68; + } + break; + case 68: + if (++gUnknown_020322A0->timer == 10) + { + PlayFanfare(MUS_FANFA5); + } + if (gUnknown_020322A0->timer == 250) + { + gUnknown_020322A0->state++; + StringExpandPlaceholders(gStringVar4, gText_TakeGoodCareOfX); + sub_807F1A8(0, gStringVar4, 0); + gUnknown_020322A0->timer = 0; + } + break; + case 69: + if (++gUnknown_020322A0->timer == 60) + { + gUnknown_020322A0->state++; + } + break; + case 70: + sub_807F14C(); + gUnknown_020322A0->state++; + break; + case 71: + if (gUnknown_020322A0->isLinkTrade) + { + return TRUE; + } + else if (gMain.newKeys & A_BUTTON) + { + gUnknown_020322A0->state++; + } + break; + case 72: // Only if in-game trade + sub_807B4D0(gSpecialVar_0x8005, 0); + gCB2_AfterEvolution = sub_807B60C; + evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gUnknown_02032298[0]], TRUE, ITEM_NONE); + if (evoTarget != SPECIES_NONE) + { + TradeEvolutionScene(&gPlayerParty[gUnknown_02032298[0]], evoTarget, gUnknown_020322A0->pokePicSpriteIdxs[1], gUnknown_02032298[0]); + } + gUnknown_020322A0->state++; + break; + case 73: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 74: + if (!gPaletteFade.active) + { + PlayNewMapMusic(gUnknown_020322A0->cachedMapMusic); + if (gUnknown_020322A0) + { + FreeAllWindowBuffers(); + Free(GetBgTilemapBuffer(3)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(0)); + FreeMonSpritesGfx(); + FREE_AND_SET_NULL(gUnknown_020322A0); + } + SetMainCallback2(CB2_ReturnToField); + sub_807E784(); + } + break; + } + return FALSE; +} + +static bool8 sub_807CFC8(void) +{ + u16 evoTarget; + + switch (gUnknown_020322A0->state) + { + case 0: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = FALSE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x = -180; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y = gMonFrontPicCoords[gUnknown_020322A0->tradeSpecies[0]].y_offset; + gUnknown_020322A0->state++; + gUnknown_020322A0->cachedMapMusic = GetCurrentMapMusic(); + PlayNewMapMusic(MUS_SHINKA); + break; + case 1: + if (gUnknown_020322A0->bg2hofs > 0) + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x += 3; + gUnknown_020322A0->bg2hofs -= 3; + } + else + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.x = 0; + gUnknown_020322A0->bg2hofs = 0; + gUnknown_020322A0->state = 10; + } + break; + case 10: + StringExpandPlaceholders(gStringVar4, gText_XWillBeSentToY); + sub_807F1A8(0, gStringVar4, 0); + + if (gUnknown_020322A0->tradeSpecies[0] != SPECIES_EGG) + { + PlayCry1(gUnknown_020322A0->tradeSpecies[0], 0); + } + + gUnknown_020322A0->state = 11; + gUnknown_020322A0->timer = 0; + break; + case 11: + if (++gUnknown_020322A0->timer == 80) + { + gUnknown_020322A0->unk_D2 = sub_807671C(gUnknown_020322A0->pokePicSpriteIdxs[0], gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].oam.paletteNum, 120, 32, 2, 1, 0x14, 0xfffff); + gUnknown_020322A0->state++; + StringExpandPlaceholders(gStringVar4, gText_ByeByeVar1); + sub_807F1A8(0, gStringVar4, 0); + } + break; + case 12: + if (gSprites[gUnknown_020322A0->unk_D2].callback == SpriteCallbackDummy) + { + gUnknown_020322A0->unk_D3 = CreateSprite(&gSpriteTemplate_8338D28, 120, 32, 0); + gSprites[gUnknown_020322A0->unk_D3].callback = sub_807E5D8; + DestroySprite(&gSprites[gUnknown_020322A0->unk_D2]); + gUnknown_020322A0->state++; + } + break; + case 13: + // The game waits here for the sprite to finish its animation sequence. + break; + case 14: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->state = 20; + break; + case 20: + if (!gPaletteFade.active) + { + sub_807B62C(4); + FillWindowPixelBuffer(0, 0xFF); + CopyWindowToVram(0, 3); + gUnknown_020322A0->state++; + } + break; + case 21: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 22: + if (!gPaletteFade.active) + { + gUnknown_020322A0->state = 23; + } + break; + case 23: + if (gUnknown_020322A0->unk_EA > 0x100) + { + gUnknown_020322A0->unk_EA -= 0x34; + } + else + { + sub_807B62C(1); + gUnknown_020322A0->unk_EA = 0x80; + gUnknown_020322A0->state = 124; + gUnknown_020322A0->timer = 0; + } + gUnknown_020322A0->unk_E8 = 0x8000 / gUnknown_020322A0->unk_EA; + break; + case 124: + if (++gUnknown_020322A0->timer > 20) + { + sub_807B62C(3); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338E8C, 120, 80, 0); + gUnknown_020322A0->state++; + } + break; + case 125: + if (gSprites[gUnknown_020322A0->unk_91].animEnded) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | + BLDCNT_TGT1_OBJ | + BLDCNT_EFFECT_BLEND | + BLDCNT_TGT2_BG2); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 4)); + CreateTask(c3_08054588, 5); + gUnknown_020322A0->state++; + } + break; + case 126: + if (!FuncIsActiveTask(c3_08054588)) + { + gUnknown_020322A0->state = 26; + } + break; + case 26: + if (--gUnknown_020322A0->bg1vofs == 316) + { + gUnknown_020322A0->state++; + } + break; + case 27: + gUnknown_020322A0->unk_90 = CreateSprite(&gUnknown_08338D88, 120, 80, 3); + gSprites[gUnknown_020322A0->unk_90].callback = sub_807AA4C; + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 120, 80, 0); + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_91], 1); + gUnknown_020322A0->state++; + break; + case 28: + if ((gUnknown_020322A0->bg1vofs -= 3) == 166) + { + gUnknown_020322A0->state = 200; + } + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + break; + case 200: + gSprites[gUnknown_020322A0->unk_90].pos1.y -= 2; + gSprites[gUnknown_020322A0->unk_91].pos1.y -= 2; + if (gSprites[gUnknown_020322A0->unk_90].pos1.y < -8) + { + gUnknown_020322A0->state = 29; + } + break; + case 29: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + gUnknown_020322A0->state = 30; + break; + case 30: + if (!gPaletteFade.active) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + sub_807B62C(2); + gUnknown_020322A0->state++; + } + break; + case 31: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->unk_90 = CreateSprite(&gSpriteTemplate_8338DC8, 111, 170, 0); + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 129, -10, 0); + gUnknown_020322A0->state++; + break; + case 32: + if (!gPaletteFade.active) + { + PlaySE(SE_TK_WARPOUT); + gUnknown_020322A0->state++; + } + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + break; + case 33: + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y <= -90) + { + gSprites[gUnknown_020322A0->unk_90].data[1] = 1; + gSprites[gUnknown_020322A0->unk_91].data[1] = 1; + gUnknown_020322A0->state++; + CreateTask(c3_0805465C, 5); + } + break; + case 34: + BlendPalettes(0x8, 16, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 35: + BlendPalettes(0x8, 16, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 36: + BlendPalettes(0x8, 16, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 37: + if (!IsMonSpriteNotFlipped(gUnknown_020322A0->tradeSpecies[0])) + { + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].affineAnims = gSpriteAffineAnimTable_8338ECC; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].oam.affineMode = 3; + CalcCenterToCornerVec(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0, 3, 3); + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0); + } + else + { + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]], 0); + } + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]], 0); + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos1.x = 40; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.x = 200; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos1.y = 192; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.y = -32; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = FALSE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].invisible = FALSE; + gUnknown_020322A0->state++; + break; + case 38: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y -= 3; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.y += 3; + if (gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y < -160 && gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y >= -163) + { + PlaySE(SE_TK_WARPIN); + } + if (gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].pos2.y < -222) + { + gSprites[gUnknown_020322A0->unk_90].data[1] = 0; + gSprites[gUnknown_020322A0->unk_91].data[1] = 0; + gUnknown_020322A0->state++; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]].invisible = TRUE; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].invisible = TRUE; + CreateTask(sub_807F39C, 5); + } + break; + case 39: + gSprites[gUnknown_020322A0->unk_90].pos2.y -= 3; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 3; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y <= -222) + { + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + gUnknown_020322A0->state++; + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + } + break; + case 40: + if (!gPaletteFade.active) + { + gUnknown_020322A0->state++; + sub_807B62C(1); + gUnknown_020322A0->bg1vofs = 166; + sub_807B62C(3); + gUnknown_020322A0->bg2vofs = 412; + gUnknown_020322A0->unk_90 = CreateSprite(&gUnknown_08338D88, 120, -20, 3); + gSprites[gUnknown_020322A0->unk_90].callback = sub_807AA4C; + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338DC8, 120, -20, 0); + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_91], 1); + } + break; + case 41: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 42: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_OBJ_ON); + if (!gPaletteFade.active) + { + gUnknown_020322A0->state++; + } + break; + case 43: + gSprites[gUnknown_020322A0->unk_90].pos2.y += 4; + gSprites[gUnknown_020322A0->unk_91].pos2.y += 4; + if (gSprites[gUnknown_020322A0->unk_90].pos2.y + gSprites[gUnknown_020322A0->unk_90].pos1.y == 64) + { + gUnknown_020322A0->state = 144; + gUnknown_020322A0->timer = 0; + } + break; + case 144: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG1_ON | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + gUnknown_020322A0->bg1vofs += 3; + gUnknown_020322A0->bg2vofs += 3; + if (++gUnknown_020322A0->timer == 10) + { + u8 taskId = CreateTask(c3_08054588, 5); + gTasks[taskId].data[2] = 1; + } + if (gUnknown_020322A0->bg1vofs > 316) + { + gUnknown_020322A0->bg1vofs = 316; + gUnknown_020322A0->state++; + } + break; + case 145: + DestroySprite(&gSprites[gUnknown_020322A0->unk_90]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + gUnknown_020322A0->state++; + gUnknown_020322A0->timer = 0; + break; + case 146: + if (!FuncIsActiveTask(c3_08054588)) + { + gUnknown_020322A0->state = 46; + gUnknown_020322A0->timer = 0; + } + break; + case 46: + if (++gUnknown_020322A0->timer == 10) + { + gUnknown_020322A0->state++; + } + break; + case 47: + if (++gUnknown_020322A0->bg1vofs > 348) + { + gUnknown_020322A0->bg1vofs = 348; + gUnknown_020322A0->state++; + } + break; + case 48: + gUnknown_020322A0->unk_91 = CreateSprite(&gSpriteTemplate_8338E74, 120, 80, 0); + gUnknown_020322A0->state = 50; + break; + case 50: + if (gSprites[gUnknown_020322A0->unk_91].animEnded) + { + DestroySprite(&gSprites[gUnknown_020322A0->unk_91]); + sub_807B62C(6); + gUnknown_020322A0->state++; + PlaySE(SE_W028); + } + break; + case 51: + if (gUnknown_020322A0->unk_EA < 0x400) + { + gUnknown_020322A0->unk_EA += 0x34; + } + else + { + gUnknown_020322A0->unk_EA = 0x400; + gUnknown_020322A0->state++; + } + gUnknown_020322A0->unk_E8 = 0x8000 / gUnknown_020322A0->unk_EA; + break; + case 52: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->state = 60; + break; + case 60: + if (!gPaletteFade.active) + { + sub_807B62C(5); + sub_807B62C(7); + gPaletteFade.bufferTransferDisabled = TRUE; + gUnknown_020322A0->state++; + } + break; + case 61: + gPaletteFade.bufferTransferDisabled = FALSE; + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 62: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + if (!gPaletteFade.active) + { + gUnknown_020322A0->state++; + } + break; + case 63: + gUnknown_020322A0->unk_D3 = CreateSprite(&gSpriteTemplate_8338D28, 120, -8, 0); + gSprites[gUnknown_020322A0->unk_D3].data[3] = 74; + gSprites[gUnknown_020322A0->unk_D3].callback = sub_807E6AC; + StartSpriteAnim(&gSprites[gUnknown_020322A0->unk_D3], 1); + StartSpriteAffineAnim(&gSprites[gUnknown_020322A0->unk_D3], 2); + BlendPalettes(1 << (16 + gSprites[gUnknown_020322A0->unk_D3].oam.paletteNum), 16, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + gUnknown_020322A0->timer = 0; + break; + case 64: + BeginNormalPaletteFade(1 << (16 + gSprites[gUnknown_020322A0->unk_D3].oam.paletteNum), 1, 16, 0, RGB_WHITEALPHA); + gUnknown_020322A0->state++; + break; + case 65: + if (gSprites[gUnknown_020322A0->unk_D3].callback == SpriteCallbackDummy) + { + HandleLoadSpecialPokePic_2(&gMonFrontPicTable[gUnknown_020322A0->tradeSpecies[1]], gMonSpritesGfxPtr->sprites[3], gUnknown_020322A0->tradeSpecies[1], gUnknown_020322A0->unk_68[1]); + gUnknown_020322A0->state++; + } + break; + case 66: + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.x = 120; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos1.y = gMonFrontPicCoords[gUnknown_020322A0->tradeSpecies[1]].y_offset + 60; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.x = 0; + gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].pos2.y = 0; + StartSpriteAnim(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]], 0); + CreatePokeballSpriteToReleaseMon(gUnknown_020322A0->pokePicSpriteIdxs[1], gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]].oam.paletteNum, 120, 84, 2, 1, 20, 0xFFFFF, gUnknown_020322A0->tradeSpecies[1]); + FreeSpriteOamMatrix(&gSprites[gUnknown_020322A0->unk_D3]); + DestroySprite(&gSprites[gUnknown_020322A0->unk_D3]); + gUnknown_020322A0->state++; + break; + case 67: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_BG0_ON | + DISPCNT_BG2_ON | + DISPCNT_OBJ_ON); + StringExpandPlaceholders(gStringVar4, gText_XSentOverY); + sub_807F1A8(0, gStringVar4, 0); + gUnknown_020322A0->state = 167; + gUnknown_020322A0->timer = 0; + break; + // 167 and 267 are extra cases added in for animations + case 167: + if (++gUnknown_020322A0->timer > 60) + { + gUnknown_020322A0->state = 267; + gUnknown_020322A0->timer = 0; + } + break; + case 267: + if (IsCryFinished()) + { + gUnknown_020322A0->state = 68; + } + break; + case 68: + if (++gUnknown_020322A0->timer == 10) + { + PlayFanfare(MUS_FANFA5); + } + if (gUnknown_020322A0->timer == 250) + { + gUnknown_020322A0->state++; + StringExpandPlaceholders(gStringVar4, gText_TakeGoodCareOfX); + sub_807F1A8(0, gStringVar4, 0); + gUnknown_020322A0->timer = 0; + } + break; + case 69: + if (++gUnknown_020322A0->timer == 60) + { + gUnknown_020322A0->state++; + } + break; + case 70: + sub_807F14C(); + gUnknown_020322A0->state++; + break; + case 71: + if (gUnknown_020322A0->isLinkTrade) + { + return TRUE; + } + else if (gMain.newKeys & A_BUTTON) + { + gUnknown_020322A0->state++; + } + break; + case 72: // Only if in-game trade + sub_807B4D0(gSpecialVar_0x8005, 0); + gCB2_AfterEvolution = sub_807B60C; + evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gUnknown_02032298[0]], TRUE, ITEM_NONE); + if (evoTarget != SPECIES_NONE) + { + TradeEvolutionScene(&gPlayerParty[gUnknown_02032298[0]], evoTarget, gUnknown_020322A0->pokePicSpriteIdxs[1], gUnknown_02032298[0]); + } + gUnknown_020322A0->state++; + break; + case 73: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_020322A0->state++; + break; + case 74: + if (!gPaletteFade.active) + { + PlayNewMapMusic(gUnknown_020322A0->cachedMapMusic); + if (gUnknown_020322A0) + { + FreeAllWindowBuffers(); + Free(GetBgTilemapBuffer(3)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(0)); + FreeMonSpritesGfx(); + FREE_AND_SET_NULL(gUnknown_020322A0); + } + SetMainCallback2(CB2_ReturnToField); + sub_807E784(); + } + break; + } + return FALSE; +} + +static void c2_08053788(void) +{ + u16 evoTarget; + switch (gMain.state) + { + case 0: + gMain.state = 4; + gSoftResetDisabled = TRUE; + break; + case 4: + gCB2_AfterEvolution = sub_807EB50; + evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gUnknown_02032298[0]], TRUE, ITEM_NONE); + if (evoTarget != SPECIES_NONE) + TradeEvolutionScene(&gPlayerParty[gUnknown_02032298[0]], evoTarget, gUnknown_020322A0->pokePicSpriteIdxs[1], gUnknown_02032298[0]); + else if (sub_8077260()) + SetMainCallback2(sub_807F464); + else + SetMainCallback2(sub_807EB50); + gUnknown_02032298[0] = 255; + break; + } + if (!HasLinkErrorOccurred()) + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_807E4DC(void) +{ + u8 blockReceivedStatus; + sub_807ACDC(); + blockReceivedStatus = GetBlockReceivedStatus(); + if (blockReceivedStatus & 0x01) + { + if (gBlockRecvBuffer[0][0] == 0xDCBA) + { + SetMainCallback2(c2_08053788); + } + if (gBlockRecvBuffer[0][0] == 0xABCD) + { + gUnknown_020322A0->unk_72 = 1; + } + ResetBlockReceivedFlag(0); + } + if (blockReceivedStatus & 0x02) + { + if (gBlockRecvBuffer[1][0] == 0xABCD) + { + gUnknown_020322A0->unk_73 = 1; + } + ResetBlockReceivedFlag(1); + } +} + +static void sub_807E55C(struct Sprite *sprite) +{ + sprite->pos1.y += sprite->data[0] / 10; + sprite->data[5] += sprite->data[1]; + sprite->pos1.x = sprite->data[5] / 10; + if (sprite->pos1.y > 0x4c) + { + sprite->pos1.y = 0x4c; + sprite->data[0] = -(sprite->data[0] * sprite->data[2]) / 100; + sprite->data[3] ++; + } + if (sprite->pos1.x == 0x78) + sprite->data[1] = 0; + sprite->data[0] += sprite->data[4]; + if (sprite->data[3] == 4) + { + sprite->data[7] = 1; + sprite->callback = SpriteCallbackDummy; + } +} + +static void sub_807E5D8(struct Sprite *sprite) +{ + sprite->pos2.y += gTradeBallVerticalVelocityTable[sprite->data[0]]; + if (sprite->data[0] == 22) + PlaySE(SE_KON); + if (++ sprite->data[0] == 44) + { + PlaySE(SE_W025); + sprite->callback = sub_807E64C; + sprite->data[0] = 0; + BeginNormalPaletteFade(1 << (16 + sprite->oam.paletteNum), -1, 0, 16, RGB_WHITEALPHA); + } +} + +static void sub_807E64C(struct Sprite *sprite) +{ + if (sprite->data[1] == 20) + StartSpriteAffineAnim(sprite, 1); + if (++ sprite->data[1] > 20) + { + sprite->pos2.y -= gTradeBallVerticalVelocityTable[sprite->data[0]]; + if (++ sprite->data[0] == 23) + { + DestroySprite(sprite); + gUnknown_020322A0->state = 14; // Resume the master trade animation + } + } +} + +static void sub_807E6AC(struct Sprite *sprite) +{ + if (sprite->data[2] == 0) + { + if ((sprite->pos1.y += 4) > sprite->data[3]) + { + sprite->data[2] ++; + sprite->data[0] = 0x16; + PlaySE(SE_KON); + } + } + else + { + if (sprite->data[0] == 0x42) + PlaySE(SE_KON2); + if (sprite->data[0] == 0x5c) + PlaySE(SE_KON3); + if (sprite->data[0] == 0x6b) + PlaySE(SE_KON4); + sprite->pos2.y += gTradeBallVerticalVelocityTable[sprite->data[0]]; + if (++sprite->data[0] == 0x6c) + sprite->callback = SpriteCallbackDummy; + } +} + +u16 GetInGameTradeSpeciesInfo(void) +{ + const struct InGameTrade *inGameTrade = &gIngameTrades[gSpecialVar_0x8004]; + StringCopy(gStringVar1, gSpeciesNames[inGameTrade->playerSpecies]); + StringCopy(gStringVar2, gSpeciesNames[inGameTrade->species]); + return inGameTrade->playerSpecies; +} + +static void sub_807E784(void) +{ + u8 nickname[32]; + const struct InGameTrade *inGameTrade = &gIngameTrades[gSpecialVar_0x8004]; + GetMonData(&gPlayerParty[gSpecialVar_0x8005], MON_DATA_NICKNAME, nickname); + StringCopy10(gStringVar1, nickname); + StringCopy(gStringVar2, gSpeciesNames[inGameTrade->species]); +} + +static void _CreateInGameTradePokemon(u8 whichPlayerMon, u8 whichInGameTrade) +{ + const struct InGameTrade *inGameTrade = &gIngameTrades[whichInGameTrade]; + u8 level = GetMonData(&gPlayerParty[whichPlayerMon], MON_DATA_LEVEL); + + struct MailStruct mail; + u8 metLocation = 0xFE; + u8 isMail; + struct Pokemon *pokemon = &gEnemyParty[0]; + + CreateMon(pokemon, inGameTrade->species, level, 32, TRUE, inGameTrade->personality, TRUE, inGameTrade->otId); + + SetMonData(pokemon, MON_DATA_HP_IV, &inGameTrade->ivs[0]); + SetMonData(pokemon, MON_DATA_ATK_IV, &inGameTrade->ivs[1]); + SetMonData(pokemon, MON_DATA_DEF_IV, &inGameTrade->ivs[2]); + SetMonData(pokemon, MON_DATA_SPEED_IV, &inGameTrade->ivs[3]); + SetMonData(pokemon, MON_DATA_SPATK_IV, &inGameTrade->ivs[4]); + SetMonData(pokemon, MON_DATA_SPDEF_IV, &inGameTrade->ivs[5]); + SetMonData(pokemon, MON_DATA_NICKNAME, inGameTrade->name); + SetMonData(pokemon, MON_DATA_OT_NAME, inGameTrade->otName); + SetMonData(pokemon, MON_DATA_OT_GENDER, &inGameTrade->otGender); + SetMonData(pokemon, MON_DATA_ALT_ABILITY, &inGameTrade->secondAbility); + SetMonData(pokemon, MON_DATA_BEAUTY, &inGameTrade->stats[1]); + SetMonData(pokemon, MON_DATA_CUTE, &inGameTrade->stats[2]); + SetMonData(pokemon, MON_DATA_COOL, &inGameTrade->stats[0]); + SetMonData(pokemon, MON_DATA_SMART, &inGameTrade->stats[3]); + SetMonData(pokemon, MON_DATA_TOUGH, &inGameTrade->stats[4]); + SetMonData(pokemon, MON_DATA_SHEEN, &inGameTrade->sheen); + SetMonData(pokemon, MON_DATA_MET_LOCATION, &metLocation); + + isMail = FALSE; + if (inGameTrade->heldItem != ITEM_NONE) + { + if (ItemIsMail(inGameTrade->heldItem)) + { + sub_807E974(&mail, inGameTrade); + gUnknown_020321C0[0] = mail; + SetMonData(pokemon, MON_DATA_MAIL, &isMail); + SetMonData(pokemon, MON_DATA_HELD_ITEM, &inGameTrade->heldItem); + } + else + { + SetMonData(pokemon, MON_DATA_HELD_ITEM, &inGameTrade->heldItem); + } + } + CalculateMonStats(&gEnemyParty[0]); +} + +static void sub_807E974(struct MailStruct *mail, const struct InGameTrade *trade) { + s32 i; + + for (i = 0; i < 9; i++) + { + mail->words[i] = gIngameTradeMail[trade->mailNum][i]; + } + + StringCopy(mail->playerName, trade->otName); + PadNameString(mail->playerName, CHAR_SPACE); + + mail->trainerId[0] = trade->otId >> 24; + mail->trainerId[1] = trade->otId >> 16; + mail->trainerId[2] = trade->otId >> 8; + mail->trainerId[3] = trade->otId; + mail->species = trade->species; + mail->itemId = trade->heldItem; +} + +u16 GetTradeSpecies(void) +{ + if (GetMonData(&gPlayerParty[gSpecialVar_0x8005], MON_DATA_IS_EGG)) + return SPECIES_NONE; + return GetMonData(&gPlayerParty[gSpecialVar_0x8005], MON_DATA_SPECIES); +} + +void CreateInGameTradePokemon(void) +{ + _CreateInGameTradePokemon(gSpecialVar_0x8005, gSpecialVar_0x8004); +} + +static void sub_807EA2C(void) +{ + if (sub_807BBC8() == TRUE) + { + DestroySprite(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[0]]); + FreeSpriteOamMatrix(&gSprites[gUnknown_020322A0->pokePicSpriteIdxs[1]]); + sub_807B4D0(gUnknown_02032298[0], gUnknown_02032298[1] % 6); + if (!sub_8077260()) + { + gUnknown_020322A0->linkData[0] = 0xABCD; + gUnknown_020322A0->unk_93 = 1; + } + SetMainCallback2(sub_807EACC); + } + sub_807B5B8(); + sub_807E4DC(); + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_807EACC(void) +{ + u8 mpId = sub_807ACDC(); + if (sub_8077260()) + { + SetMainCallback2(c2_08053788); + } + else + { + sub_807E4DC(); + if (mpId == 0 && gUnknown_020322A0->unk_72 == 1 && gUnknown_020322A0->unk_73 == 1) + { + gUnknown_020322A0->linkData[0] = 0xDCBA; + Trade_SendData(gUnknown_020322A0); + gUnknown_020322A0->unk_72 = 2; + gUnknown_020322A0->unk_73 = 2; + } + } + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void sub_807EB50(void) +{ + switch (gMain.state) + { + case 0: + gMain.state++; + StringExpandPlaceholders(gStringVar4, gText_CommunicationStandby5); + sub_807F1A8(0, gStringVar4, 0); + break; + case 1: + sub_8077288(0); + gMain.state = 100; + gUnknown_020322A0->timer = 0; + break; + case 100: + if (++gUnknown_020322A0->timer > 180) + { + gMain.state = 101; + gUnknown_020322A0->timer = 0; + } + if (_IsLinkTaskFinished()) + { + gMain.state = 2; + } + break; + case 101: + if (_IsLinkTaskFinished()) + { + gMain.state = 2; + } + break; + case 2: + gMain.state = 50; + StringExpandPlaceholders(gStringVar4, gText_SavingDontTurnOffPower); + sub_807F1A8(0, gStringVar4, 0); + break; + case 50: + if (!InUnionRoom()) + IncrementGameStat(GAME_STAT_POKEMON_TRADES); + if (gWirelessCommType) + { + sub_801B990(2, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId); + } + SetContinueGameWarpStatusToDynamicWarp(); + sub_8153380(); + gMain.state++; + gUnknown_020322A0->timer = 0; + break; + case 51: + if (++gUnknown_020322A0->timer == 5) + { + gMain.state++; + } + break; + case 52: + if (sub_81533AC()) + { + ClearContinueGameWarpStatus2(); + gMain.state = 4; + } + else + { + gUnknown_020322A0->timer = 0; + gMain.state = 51; + } + break; + case 4: + sub_81533E0(); + gMain.state = 40; + gUnknown_020322A0->timer = 0; + break; + case 40: + if (++gUnknown_020322A0->timer > 50) + { + if (GetMultiplayerId() == 0) + { + gUnknown_020322A0->timer = Random() % 30; + } + else + { + gUnknown_020322A0->timer = 0; + } + gMain.state = 41; + } + break; + case 41: + if (gUnknown_020322A0->timer == 0) + { + sub_8077288(1); + gMain.state = 42; + } + else + { + gUnknown_020322A0->timer--; + } + break; + case 42: + if (_IsLinkTaskFinished()) + { + sub_8153408(); + gMain.state = 5; + } + break; + case 5: + if (++gUnknown_020322A0->timer > 60) + { + gMain.state++; + sub_8077288(2); + } + break; + case 6: + if (_IsLinkTaskFinished()) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gMain.state ++; + } + break; + case 7: + if (!gPaletteFade.active) + { + FadeOutBGM(3); + gMain.state++; + } + break; + case 8: + if (IsBGMStopped() == TRUE) + { + if (gWirelessCommType && gMain.savedCallback == sub_80773AC) + { + sub_8077288(3); + } + else + { + sub_800AC34(); + } + gMain.state++; + } + break; + case 9: + if (gWirelessCommType && gMain.savedCallback == sub_80773AC) + { + if (_IsLinkTaskFinished()) + { + gSoftResetDisabled = FALSE; + SetMainCallback2(c2_080543C4); + } + } + else if (!gReceivedRemoteLinkPlayers) + { + gSoftResetDisabled = FALSE; + SetMainCallback2(c2_080543C4); + } + break; + } + if (!HasLinkErrorOccurred()) + { + RunTasks(); + } + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void c2_080543C4(void) +{ + if (!gPaletteFade.active) + { + FreeAllWindowBuffers(); + Free(GetBgTilemapBuffer(3)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(0)); + FreeMonSpritesGfx(); + FREE_AND_SET_NULL(gUnknown_020322A0); + if (gWirelessCommType) + sub_800E084(); + SetMainCallback2(gMain.savedCallback); + } + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void DoInGameTradeScene(void) +{ + ScriptContext2_Enable(); + CreateTask(sub_807F110, 10); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); +} + +static void sub_807F110(u8 taskId) +{ + if (!gPaletteFade.active) + { + SetMainCallback2(sub_807B270); + gFieldCallback = sub_80AF168; + DestroyTask(taskId); + } +} + +static void sub_807F14C(void) +{ + u8 i; + u8 numRibbons = 0; + for (i = 0; i < 12; i ++) + { + numRibbons += GetMonData(&gEnemyParty[gUnknown_02032298[1] % 6], MON_DATA_CHAMPION_RIBBON + i); + } + if (numRibbons != 0) + FlagSet(FLAG_SYS_RIBBON_GET); +} + +void sub_807F19C(void) +{ + sub_807B170(); +} + +void sub_807F1A8(u8 windowId, const u8 *str, u8 speed) +{ + FillWindowPixelBuffer(windowId, 0xFF); + gUnknown_020322A0->unk_F6[0] = 15; + gUnknown_020322A0->unk_F6[1] = 1; + gUnknown_020322A0->unk_F6[2] = 6; + AddTextPrinterParameterized4(windowId, 1, 0, 2, 0, 0, gUnknown_020322A0->unk_F6, speed, str); + CopyWindowToVram(windowId, 3); +} + +static void c3_08054588(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + u16 unk = gUnknown_08339090[data[0]][0] * 16; + + if (!data[2]) + { + if (unk == 0x100) + LoadPalette(gUnknown_08337EA0, 0x30, 32); + else + LoadPalette(&gUnknown_08337AA0[unk], 0x30, 32); + } + else + { + if (unk == 0x100) + LoadPalette(gUnknown_08337EA0, 0x30, 32); + else + LoadPalette(&gUnknown_08337CA0[unk], 0x30, 32); + } + + if (gUnknown_08339090[data[0]][0] == 0 && data[1] == 0) + PlaySE(SE_W215); + + if (data[1] == gUnknown_08339090[data[0]][1]) + { + data[0]++; + data[1] = 0; + if (gUnknown_08339090[data[0]][1] == 0xFF) + { + DestroyTask(taskId); + } + } + else + { + data[1]++; + } +} + +static void c3_0805465C(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[0] == 0) + { + gUnknown_020322A0->unk_FB = gUnknown_020322A0->unk_FD = 120; + gUnknown_020322A0->unk_FC = 0; + gUnknown_020322A0->unk_FE = 160; + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_OBJ); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | + WININ_WIN0_BG1 | + WININ_WIN0_OBJ); + } + + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE2(gUnknown_020322A0->unk_FB, gUnknown_020322A0->unk_FD)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE2(gUnknown_020322A0->unk_FC, gUnknown_020322A0->unk_FE)); + + data[0]++; + gUnknown_020322A0->unk_FB -= 5; + gUnknown_020322A0->unk_FD += 5; + + if (gUnknown_020322A0->unk_FB < 80) + { + DestroyTask(taskId); + } +} + +static void sub_807F39C(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[0] == 0) + { + gUnknown_020322A0->unk_FB = 80; + gUnknown_020322A0->unk_FD = 160; + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_OBJ); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | + WININ_WIN0_BG1 | + WININ_WIN0_OBJ); + } + + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE2(gUnknown_020322A0->unk_FB, gUnknown_020322A0->unk_FD)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE2(gUnknown_020322A0->unk_FC, gUnknown_020322A0->unk_FE)); + + if (gUnknown_020322A0->unk_FB != 120) + { + data[0]++; + gUnknown_020322A0->unk_FB += 5; + gUnknown_020322A0->unk_FD -= 5; + + if (gUnknown_020322A0->unk_FB >= 116) + BlendPalettes(0x8, 0, RGB_WHITEALPHA); + } + else + { + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + DestroyTask(taskId); + } +} + +static void sub_807F464(void) +{ + switch (gMain.state) + { + case 0: + gMain.state = 1; + StringExpandPlaceholders(gStringVar4, gText_CommunicationStandby5); + sub_807F1A8(0, gStringVar4, 0); + break; + case 1: + sub_8077288(0); + gMain.state = 2; + gUnknown_020322A0->timer = 0; + break; + case 2: + if (_IsLinkTaskFinished()) + { + gMain.state = 3; + StringExpandPlaceholders(gStringVar4, gText_SavingDontTurnOffPower); + sub_807F1A8(0, gStringVar4, 0); + IncrementGameStat(GAME_STAT_POKEMON_TRADES); + sub_8153380(); + gUnknown_020322A0->timer = 0; + } + break; + case 3: + if (++gUnknown_020322A0->timer == 5) + { + gMain.state = 4; + } + break; + case 4: + if (sub_81533AC()) + { + gMain.state = 5; + } + else + { + gUnknown_020322A0->timer = 0; + gMain.state = 3; + } + break; + case 5: + sub_81533E0(); + gMain.state = 6; + gUnknown_020322A0->timer = 0; + break; + case 6: + if (++gUnknown_020322A0->timer > 10) + { + if (GetMultiplayerId() == 0) + { + gUnknown_020322A0->timer = Random() % 30; + } + else + { + gUnknown_020322A0->timer = 0; + } + gMain.state = 7; + } + break; + case 7: + if (gUnknown_020322A0->timer == 0) + { + sub_8077288(1); + gMain.state = 8; + } + else + { + gUnknown_020322A0->timer--; + } + break; + case 8: + if (_IsLinkTaskFinished()) + { + sub_8153408(); + gMain.state = 9; + } + break; + case 9: + if (++gUnknown_020322A0->timer > 60) + { + gMain.state++; + sub_8077288(2); + } + break; + case 10: + if (_IsLinkTaskFinished()) + { + FadeOutBGM(3); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gMain.state = 11; + } + break; + case 11: + if (!gPaletteFade.active && IsBGMStopped() == TRUE) + { + sub_8077288(3); + gMain.state = 12; + } + break; + case 12: + if (_IsLinkTaskFinished()) + { + gSoftResetDisabled = FALSE; + SetMainCallback2(c2_080543C4); + } + break; + } + + if (!HasLinkErrorOccurred()) + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} diff --git a/sym_ewram.txt b/sym_ewram.txt index 7e61267f6..96a107711 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -111,25 +111,7 @@ gUnknown_02022D00: @ 2022D00 .include "src/random.o" .include "src/daycare.o" .include "src/load_save.o" - -gUnknown_02032184: @ 2032184 - .space 0x4 - -gUnknown_02032188: @ 2032188 - .space 0x38 - -gUnknown_020321C0: @ 20321C0 - .space 0xD8 - -gUnknown_02032298: @ 2032298 - .space 0x4 - -gUnknown_0203229C: @ 203229C - .space 0x4 - -gUnknown_020322A0: @ 20322A0 - .space 0x4 - + .include "src/trade.o" .include "src/berry_blender.o" .include "src/new_game.o" .include "src/overworld.o" @@ -138,11 +120,6 @@ gUnknown_020322A0: @ 20322A0 .include "src/field_player_avatar.o" .include "src/event_object_movement.o" .include "src/field_message_box.o" - - .align 2 -gUnknown_020375C0: @ 20375C0 - .space 0x4 - .include "src/scrcmd.o" .include "src/field_control_avatar.o" .include "src/event_data.o" @@ -152,7 +129,7 @@ gUnknown_020375C0: @ 20375C0 .include "src/sound.o" .include "src/battle_anim.o" .include "src/battle_anim_80A5C6C.o" - + .space 0xC .include "src/field_weather.o" .include "src/field_weather_effect.o"