diff --git a/asm/battle_1.s b/asm/battle_1.s index 9a981e222..9665b0d11 100644 --- a/asm/battle_1.s +++ b/asm/battle_1.s @@ -1888,7 +1888,7 @@ sub_8035C4C: @ 8035C4C bne _08035C68 ldr r0, =gText_Draw movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035C68: @@ -1964,10 +1964,10 @@ _08035CE2: _08035CFC: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D20: @@ -1985,19 +1985,19 @@ _08035D20: _08035D36: ldr r0, =gText_Win movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _08035D68 .pool _08035D58: ldr r0, =gText_Win movs r1, 0x17 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Loss movs r1, 0x16 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08035D68: pop {r0} bx r0 @@ -2068,14 +2068,14 @@ _08035DDC: _08035DE6: adds r0, r1, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 b _08035E14 _08035DF4: adds r0, r1, 0 movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x4 str r0, [sp] @@ -2085,7 +2085,7 @@ _08035DF4: _08035E08: adds r0, r1, 0 movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 _08035E14: @@ -2099,7 +2099,7 @@ _08035E1A: _08035E22: adds r0, r1, 0 movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r1, [r4, 0x18] movs r0, 0x8 str r0, [sp] @@ -2139,14 +2139,14 @@ _08035E66: adds r1, r0, r4 adds r0, r1, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter lsls r0, r6, 3 subs r0, r6 lsls r0, 2 adds r1, r0, r4 adds r0, r1, 0 movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0x7 str r4, [sp] adds r0, r7, 0 diff --git a/asm/battle_controller_linkopponent.s b/asm/battle_controller_linkopponent.s index d4e248d8c..3c7915861 100644 --- a/asm/battle_controller_linkopponent.s +++ b/asm/battle_controller_linkopponent.s @@ -5045,7 +5045,7 @@ sub_8066FF4: @ 8066FF4 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 diff --git a/asm/battle_controller_linkpartner.s b/asm/battle_controller_linkpartner.s index adc5cdb84..9962c0bdb 100644 --- a/asm/battle_controller_linkpartner.s +++ b/asm/battle_controller_linkpartner.s @@ -4354,7 +4354,7 @@ sub_814D590: @ 814D590 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 diff --git a/asm/battle_controller_opponent.s b/asm/battle_controller_opponent.s index b66e373ca..1536ba75c 100644 --- a/asm/battle_controller_opponent.s +++ b/asm/battle_controller_opponent.s @@ -5185,7 +5185,7 @@ sub_8061F34: @ 8061F34 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index 10b675714..4788be082 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -1247,7 +1247,7 @@ _08057F80: bl battle_menu_cursor_related_2 ldr r0, =gText_BattleSwitchWhich movs r1, 0xB - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldr r0, =gActiveBank ldrb r0, [r0] @@ -4244,11 +4244,11 @@ sub_80599D4: @ 80599D4 movs r0, 0x5 bl PlaySE ldrb r0, [r4] - bl BattleDestroyCursorAt + bl BattleDestroyYesNoCursorAt movs r0, 0 strb r0, [r4] movs r0, 0 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt _08059A02: ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -4263,11 +4263,11 @@ _08059A02: movs r0, 0x5 bl PlaySE ldrb r0, [r4] - bl BattleDestroyCursorAt + bl BattleDestroyYesNoCursorAt movs r0, 0x1 strb r0, [r4] movs r0, 0x1 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt _08059A2C: ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -4281,7 +4281,7 @@ _08059A2C: movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0x5 bl PlaySE ldr r0, =gUnknown_03005D74 @@ -4314,7 +4314,7 @@ _08059A7A: movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0x5 bl PlaySE bl PlayerBufferExecCompleted @@ -4355,7 +4355,7 @@ _08059AC4: lsls r1, 24 lsrs r1, 24 adds r0, r7, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrh r0, [r4] cmp r0, 0 beq _08059AF4 @@ -4382,7 +4382,7 @@ sub_8059B18: @ 8059B18 bl StringCopy adds r0, r4, 0 movs r1, 0x7 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 @@ -4432,7 +4432,7 @@ sub_8059B3C: @ 8059B3C bl ConvertIntToDecimalStringN adds r0, r6, 0 movs r1, 0x9 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08059B98: pop {r4-r7} pop {r0} @@ -4481,7 +4481,7 @@ sub_8059BB0: @ 8059BB0 bl StringCopy adds r0, r6, 0 movs r1, 0xA - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4-r6} pop {r0} bx r0 @@ -4718,7 +4718,7 @@ b_link_standby_message: @ 8059DC0 strh r1, [r0] ldr r0, =gText_LinkStandby movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter _08059DE0: pop {r0} bx r0 @@ -8458,7 +8458,7 @@ sub_805BF80: @ 805BF80 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r5] lsls r0, 2 @@ -8534,7 +8534,7 @@ dp01t_12_6_battle_menu: @ 805C044 bl sub_817F2A8 ldr r0, =gText_BattleMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _0805C062: lsls r0, r4, 24 @@ -8554,7 +8554,7 @@ _0805C062: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 @@ -8577,15 +8577,15 @@ sub_805C0B0: @ 805C0B0 movs r1, 0x8 movs r2, 0x1D movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow ldr r0, =gText_BattleYesNoChoice movs r1, 0xC - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gUnknown_03005D74 movs r0, 0x1 strb r0, [r1] movs r0, 0x1 - bl BattleCreateCursorAt + bl BattleCreateYesNoCursorAt ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_player_partner.s b/asm/battle_controller_player_partner.s index f82e1c3c3..4d24f101f 100644 --- a/asm/battle_controller_player_partner.s +++ b/asm/battle_controller_player_partner.s @@ -4966,7 +4966,7 @@ sub_81BDA4C: @ 81BDA4C bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_recorded_opponent.s b/asm/battle_controller_recorded_opponent.s index f98c10a6c..9afc8ee2f 100644 --- a/asm/battle_controller_recorded_opponent.s +++ b/asm/battle_controller_recorded_opponent.s @@ -4722,7 +4722,7 @@ sub_8188E90: @ 8188E90 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_recorded_player.s b/asm/battle_controller_recorded_player.s index 6f3976205..7dd4d59d4 100644 --- a/asm/battle_controller_recorded_player.s +++ b/asm/battle_controller_recorded_player.s @@ -4822,7 +4822,7 @@ sub_818C43C: @ 818C43C bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 diff --git a/asm/battle_controller_safari.s b/asm/battle_controller_safari.s index d7efd69fe..9c16ae343 100644 --- a/asm/battle_controller_safari.s +++ b/asm/battle_controller_safari.s @@ -792,7 +792,7 @@ dp01t_10_6_message: @ 81599DC bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -862,7 +862,7 @@ sub_8159A94: @ 8159A94 str r1, [r0] ldr r0, =gText_SafariZoneMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _08159AAE: lsls r0, r4, 24 @@ -882,7 +882,7 @@ _08159AAE: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 diff --git a/asm/battle_controller_wally.s b/asm/battle_controller_wally.s index e1d92de0d..d7c1cc666 100644 --- a/asm/battle_controller_wally.s +++ b/asm/battle_controller_wally.s @@ -3606,7 +3606,7 @@ sub_816A3B8: @ 816A3B8 bl BufferStringBattle ldr r0, =gDisplayedStringBattle movs r1, 0 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r1, =gBattleBankFunc ldrb r0, [r4] lsls r0, 2 @@ -3676,7 +3676,7 @@ dp01t_12_1_battle_menu: @ 816A470 str r1, [r0] ldr r0, =gText_BattleMenu movs r1, 0x2 - bl sub_814F9EC + bl BattleHandleAddTextPrinter movs r4, 0 _0816A48A: lsls r0, r4, 24 @@ -3696,7 +3696,7 @@ _0816A48A: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x1 - bl sub_814F9EC + bl BattleHandleAddTextPrinter pop {r4} pop {r0} bx r0 diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 37ddc7ac6..ac92b3c2a 100755 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -20557,7 +20557,7 @@ _081A5306: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow b _081A553E .pool _081A531C: @@ -20582,29 +20582,29 @@ _081A5328: ldr r4, =gDisplayedStringBattle adds r0, r4, 0 movs r1, 0xF - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Vs movs r1, 0x10 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_OpponentMon1Name bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x11 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Mind movs r1, 0x12 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Skill movs r1, 0x13 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Body movs r1, 0x14 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldr r0, =gText_Judgement bl BattleStringExpandPlaceholdersToDisplayedString adds r0, r4, 0 movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter b _081A553E .pool _081A53B4: @@ -20688,7 +20688,7 @@ _081A5464: bl BattleStringExpandPlaceholdersToDisplayedString ldr r0, =gDisplayedStringBattle movs r1, 0x15 - bl sub_814F9EC + bl BattleHandleAddTextPrinter ldrb r0, [r5] adds r0, 0x1 strb r0, [r5] @@ -20733,7 +20733,7 @@ _081A54D4: movs r1, 0 movs r2, 0x18 movs r3, 0xD - bl sub_8056A3C + bl HandleBattleWindow movs r0, 0 bl CopyBgTilemapBufferToVram ldr r0, =gMPlay_BGM diff --git a/asm/evolution_scene.s b/asm/evolution_scene.s deleted file mode 100644 index 23d0f5b36..000000000 --- a/asm/evolution_scene.s +++ /dev/null @@ -1,3650 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start sub_813DF70 -sub_813DF70: @ 813DF70 - push {r4-r6,lr} - sub sp, 0xC - ldr r2, =gTasks - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - muls r2, r1 - ldr r1, =gPlayerParty - adds r4, r2, r1 - ldrh r6, [r0, 0xC] - ldr r0, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0x7 - bls _0813DFA2 - b _0813E1C8 -_0813DFA2: - lsls r0, 2 - ldr r1, =_0813DFC0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813DFC0: - .4byte _0813DFE0 - .4byte _0813E050 - .4byte _0813E078 - .4byte _0813E07E - .4byte _0813E0A8 - .4byte _0813E0F0 - .4byte _0813E160 - .4byte _0813E198 -_0813DFE0: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - bl SetVBlankCallback - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r1, =gReservedSpritePaletteCount - movs r0, 0x4 - strb r0, [r1] - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gBattle_BG1_X - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - ldr r2, =gBattle_BG3_X - movs r3, 0x80 - lsls r3, 1 - adds r0, r3, 0 - strh r0, [r2] - ldr r0, =gBattle_BG3_Y - strh r1, [r0] - b _0813E180 - .pool -_0813E050: - bl ResetPaletteFade - ldr r0, =EvoDummyFunc - bl SetHBlankCallback - ldr r0, =sub_813FD64 - bl SetVBlankCallback - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _0813E188 - .pool -_0813E078: - bl sub_807F19C - b _0813E180 -_0813E07E: - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - b _0813E188 - .pool -_0813E0A8: - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - adds r5, r0, 0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r4, r0, 0 - lsls r0, r6, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x10] - adds r2, r6, 0 - bl DecompressPicFromTable_2 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r4, 0 - bl GetMonSpritePalStructFromOtIdPersonality - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - b _0813E180 - .pool -_0813E0F0: - adds r0, r6, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gEvoStructPtr - ldr r1, [r1] - lsls r2, r0, 24 - lsrs r2, 24 - strb r0, [r1, 0x1] - ldr r3, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r1, =gMain - movs r3, 0x87 - lsls r3, 3 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_807B154 - b _0813E1C8 - .pool -_0813E160: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0813E174 - bl sub_800E0E8 - movs r0, 0 - movs r1, 0 - bl sub_800DFB4 -_0813E174: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes -_0813E180: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_0813E188: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0813E1C8 - .pool -_0813E198: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl sub_807B140 - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - ldr r0, =sub_813E3C0 - bl SetMainCallback2 - movs r1, 0x9A - lsls r1, 5 - movs r0, 0 - bl SetGpuReg -_0813E1C8: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813DF70 - - thumb_func_start sub_813E1D4 -sub_813E1D4: @ 813E1D4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar1 - mov r1, sp - bl StringCopy10 - ldr r0, =gStringVar2 - movs r1, 0xB - muls r1, r5 - ldr r2, =gSpeciesNames - adds r1, r2 - bl StringCopy - ldr r1, =gAffineAnimsDisabled - movs r0, 0x1 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - mov r8, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r7, r0, 0 - adds r0, r4, 0 - movs r1, 0x1 - bl GetMonData - mov r10, r0 - ldr r1, =gEvoStructPtr - mov r9, r1 - movs r0, 0x64 - bl AllocZeroed - mov r2, r9 - str r0, [r2] - movs r4, 0 - strb r6, [r0] - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x8] - adds r2, r5, 0 - bl DecompressPicFromTable_2 - adds r0, r5, 0 - mov r1, r10 - adds r2, r7, 0 - bl GetMonSpritePalStructFromOtIdPersonality - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - movs r2, 0x20 - bl LoadCompressedPalette - adds r0, r5, 0 - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0202499C - ldr r1, =gDummySpriteAffineAnimTable - str r1, [r0, 0x10] - movs r1, 0x78 - movs r2, 0x40 - movs r3, 0x1E - bl CreateSprite - mov r1, r9 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r6, r1, 24 - strb r0, [r2, 0x1] - ldr r3, =gSprites - lsls r1, r6, 4 - adds r1, r6 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x1C - adds r0, r1, r0 - ldr r2, =SpriteCallbackDummy_2 - str r2, [r0] - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x5] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - bl LoadEvoSparkleSpriteAndPal - ldr r0, =sub_813F1B8 - movs r1, 0 - bl CreateTask - mov r1, r9 - ldr r2, [r1] - lsls r1, r0, 24 - lsrs r6, r1, 24 - strb r0, [r2, 0x2] - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x8] - mov r2, r8 - strh r2, [r0, 0xA] - strh r5, [r0, 0xC] - movs r1, 0x1 - strh r1, [r0, 0x10] - strh r4, [r0, 0x1A] - mov r1, sp - ldrh r1, [r1, 0x14] - strh r1, [r0, 0x1C] - ldr r0, =gBattle_BG0_X - strh r4, [r0] - ldr r0, =gBattle_BG0_Y - strh r4, [r0] - ldr r0, =gBattle_BG1_X - strh r4, [r0] - ldr r0, =gBattle_BG1_Y - strh r4, [r0] - ldr r0, =gBattle_BG2_X - strh r4, [r0] - ldr r0, =gBattle_BG2_Y - strh r4, [r0] - ldr r1, =gBattle_BG3_X - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gBattle_BG3_Y - strh r4, [r0] - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2] - ldr r0, =sub_813FD64 - bl SetVBlankCallback - ldr r0, =sub_813E3C0 - bl SetMainCallback2 - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813E1D4 - - thumb_func_start CB2_EvolutionSceneUpdate -CB2_EvolutionSceneUpdate: @ 813E3A4 - push {lr} - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end CB2_EvolutionSceneUpdate - - thumb_func_start sub_813E3C0 -sub_813E3C0: @ 813E3C0 - push {lr} - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - bl RunTasks - pop {r0} - bx r0 - thumb_func_end sub_813E3C0 - - thumb_func_start evovle_mon_internal_maybe -evovle_mon_internal_maybe: @ 813E3DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - str r1, [sp, 0x4] - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - movs r0, 0 - str r0, [sp] - mov r0, r10 - lsls r0, 2 - str r0, [sp, 0x8] - add r0, r10 - lsls r7, r0, 3 - ldr r1, =gEvolutionTable - adds r1, r7 - mov r8, r1 - ldrh r0, [r1] - cmp r0, 0xD - beq _0813E40C - b _0813E546 -_0813E40C: - ldr r6, =gPlayerPartyCount - ldrb r0, [r6] - cmp r0, 0x5 - bls _0813E416 - b _0813E546 -_0813E416: - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - mov r9, r0 - ldr r1, [sp, 0x4] - movs r2, 0x64 - bl CopyMon - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - ldr r1, =gEvolutionTable - adds r2, r1, r7 - adds r2, 0xC - movs r1, 0xB - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - mov r1, r8 - ldrh r2, [r1, 0xC] - movs r1, 0xB - muls r2, r1 - ldr r1, =gSpeciesNames - adds r2, r1 - movs r1, 0x2 - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0xC - mov r2, sp - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x8 - mov r2, sp - bl SetMonData - ldrb r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0xA - mov r2, sp - bl SetMonData - movs r4, 0x32 - ldr r0, [sp, 0x8] - mov r8, r0 - adds r5, r6, 0 -_0813E484: - ldrb r1, [r5] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - adds r4, 0x1 - cmp r4, 0x36 - ble _0813E484 - movs r4, 0x43 - ldr r7, =gPlayerPartyCount -_0813E4A0: - ldrb r0, [r7] - movs r6, 0x64 - muls r0, r6 - ldr r5, =gPlayerParty - adds r0, r5 - adds r1, r4, 0 - mov r2, sp - bl SetMonData - adds r4, 0x1 - cmp r4, 0x4F - ble _0813E4A0 - ldr r4, =gPlayerPartyCount - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x37 - mov r2, sp - bl SetMonData - movs r0, 0xFF - str r0, [sp] - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - movs r1, 0x40 - mov r2, sp - bl SetMonData - ldrb r0, [r4] - muls r0, r6 - adds r0, r5 - bl CalculateMonStats - bl CalculatePlayerPartyCount - ldr r0, =gEvolutionTable - mov r4, r8 - add r4, r10 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - mov r0, r9 - movs r1, 0xB - bl GetMonData - ldr r1, =0x0000012f - cmp r0, r1 - bne _0813E546 - mov r0, r9 - movs r1, 0x3 - bl GetMonData - cmp r0, 0x1 - bne _0813E546 - ldr r0, [sp, 0x4] - movs r1, 0xB - bl GetMonData - movs r1, 0x97 - lsls r1, 1 - cmp r0, r1 - bne _0813E546 - ldr r2, =gUnknown_085B58C4 - mov r0, r9 - movs r1, 0x2 - bl SetMonData -_0813E546: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end evovle_mon_internal_maybe - - thumb_func_start Task_EvolutionScene -Task_EvolutionScene: @ 813E570 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r3, r0, r2 - movs r0, 0x1C - ldrsh r1, [r3, r0] - movs r0, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r1, r0 - mov r9, r1 - ldr r0, =gMain - ldrh r1, [r0, 0x2C] - adds r5, r2, 0 - adds r6, r0, 0 - cmp r1, 0x2 - bne _0813E5F0 - movs r1, 0x8 - ldrsh r0, [r3, r1] - cmp r0, 0x8 - bne _0813E5F0 - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E5F0 - ldrh r1, [r3, 0xE] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0813E5F0 - movs r0, 0x11 - strh r0, [r3, 0x8] - ldrb r1, [r4, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - strh r2, [r0, 0x18] - bl sub_8140134 - bl _0813F1A4 - .pool -_0813E5F0: - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r0, r5 - movs r2, 0x8 - ldrsh r0, [r0, r2] - mov r8, r1 - cmp r0, 0x16 - bls _0813E606 - bl _0813F1A4 -_0813E606: - lsls r0, 2 - ldr r1, =_0813E614 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813E614: - .4byte _0813E670 - .4byte _0813E6D4 - .4byte _0813E714 - .4byte _0813E740 - .4byte _0813E770 - .4byte _0813E7B0 - .4byte _0813E7E8 - .4byte _0813E828 - .4byte _0813E860 - .4byte _0813E8A4 - .4byte _0813E8C0 - .4byte _0813E8EC - .4byte _0813E918 - .4byte _0813E964 - .4byte _0813E990 - .4byte _0813EA1C - .4byte _0813EAC8 - .4byte _0813EB34 - .4byte _0813EB74 - .4byte _0813EBA8 - .4byte _0813EC10 - .4byte _0813EC6C - .4byte _0813ECA8 -_0813E670: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gSprites - ldr r0, =gEvoStructPtr - ldr r0, [r0] - 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, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - bl _0813F1A4 - .pool -_0813E6D4: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E6E4 - bl _0813F1A4 -_0813E6E4: - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnIsEvolving - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E714: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813E724 - bl _0813F1A4 -_0813E724: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - ldr r1, =gTasks - mov r3, r8 - adds r4, r3, r7 - lsls r4, 3 - adds r4, r1 - b _0813EB90 - .pool -_0813E740: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813E752 - bl _0813F1A4 -_0813E752: - movs r0, 0xBC - lsls r0, 1 - bl PlaySE - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E770: - bl IsSEPlaying - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0813E780 - bl _0813F1A4 -_0813E780: - ldr r0, =0x00000179 - bl PlayNewMapMusic - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - str r4, [sp] - movs r0, 0x1C - movs r1, 0x4 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - bl _0813F1A4 - .pool -_0813E7B0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E7C0 - bl _0813F1A4 -_0813E7C0: - movs r0, 0 - bl sub_8140000 - movs r0, 0x11 - bl LaunchTask_PreEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E7E8: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E7FE - bl _0813F1A4 -_0813E7FE: - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r5 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - ldr r0, =gEvoStructPtr - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x3] - bl LaunchTask_PreEvoSparklesSet2 - strb r0, [r4, 0x2] - bl _0813F1A4 - .pool -_0813E828: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E83E - bl _0813F1A4 -_0813E83E: - ldr r0, =gEvoStructPtr - ldr r1, [r0] - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - bl sub_817C3A0 - strb r0, [r4, 0x2] - mov r0, r8 - adds r1, r0, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E860: - ldr r2, =gEvoStructPtr - ldr r1, [r2] - ldrb r0, [r1, 0x3] - subs r0, 0x1 - strb r0, [r1, 0x3] - lsls r0, 24 - cmp r0, 0 - beq _0813E874 - bl _0813F1A4 -_0813E874: - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1, 0x3] - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813E890 - bl _0813F1A4 -_0813E890: - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E8A4: - bl LaunchTask_PostEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E8C0: - ldr r6, =gBattleCommunication - ldrb r0, [r6, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813E8D6 - bl _0813F1A4 -_0813E8D6: - mov r0, r8 - adds r4, r0, r7 - lsls r4, 3 - adds r4, r5 - ldrh r0, [r4, 0xC] - bl LaunchTask_PostEvoSparklesSet2AndFlash - strb r0, [r6, 0x2] - b _0813EB96 - .pool -_0813E8EC: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813E902 - bl _0813F1A4 -_0813E902: - movs r0, 0x21 - bl PlaySE - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813E918: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813E926 - bl _0813F1A4 -_0813E926: - bl m4aMPlayAllStop - ldr r0, =gPlttBufferUnfaded + 0x40 - ldr r1, =gEvoStructPtr - ldr r1, [r1] - adds r1, 0x4 - movs r2, 0x60 - bl memcpy - bl sub_8140174 - movs r0, 0 - str r0, [sp] - movs r0, 0x1C - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813E964: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813E974 - bl _0813F1A4 -_0813E974: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0, 0x1] - mov r1, r8 - adds r4, r1, r7 - lsls r4, 3 - adds r4, r5 - ldrh r1, [r4, 0xC] - b _0813EB92 - .pool -_0813E990: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813E99E - bl _0813F1A4 -_0813E99E: - ldr r4, =gStringVar4 - ldr r1, =gText_CongratsPkmnEvolved - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0 - bl sub_814F9EC - ldr r0, =0x00000173 - bl PlayBGM - ldr r2, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - adds r2, r1 - adds r2, 0xC - mov r0, r9 - movs r1, 0xB - bl SetMonData - mov r0, r9 - bl CalculateMonStats - ldrh r1, [r4, 0xA] - ldrh r2, [r4, 0xC] - mov r0, r9 - bl EvolutionRenameMon - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - movs r0, 0xE - bl IncrementGameStat - b _0813F1A4 - .pool -_0813EA1C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EA2A - b _0813F1A4 -_0813EA2A: - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r4, r0, r1 - ldrb r1, [r4, 0x10] - mov r0, r9 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0 - beq _0813EAA8 - movs r3, 0x1A - ldrsh r5, [r4, r3] - cmp r5, 0 - bne _0813EAA8 - ldrh r1, [r4, 0xE] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0813EA5E - bl StopMapMusic - bl sub_8085784 -_0813EA5E: - ldrh r0, [r4, 0xE] - movs r1, 0x80 - orrs r0, r1 - strh r0, [r4, 0xE] - strh r5, [r4, 0x10] - strh r5, [r4, 0x14] - mov r0, r9 - movs r1, 0x2 - add r2, sp, 0x4 - bl GetMonData - ldr r0, =gBattleTextBuff1 - add r1, sp, 0x4 - bl StringCopy10 - ldr r0, =0x0000ffff - cmp r6, r0 - bne _0813EA94 - movs r0, 0x16 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EA94: - ldr r0, =0x0000fffe - cmp r6, r0 - bne _0813EA9C - b _0813F1A4 -_0813EA9C: - movs r0, 0x14 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EAA8: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813EC52 - .pool -_0813EAC8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r2, 0x80 - adds r0, r2, 0 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _0813EADC - b _0813F1A4 -_0813EADC: - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r4, r0, r5 - ldrh r1, [r4, 0xE] - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - bne _0813EAF6 - bl StopMapMusic - bl sub_8085784 -_0813EAF6: - movs r1, 0x1A - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _0813EB06 - ldrh r0, [r4, 0xA] - mov r1, r9 - bl evovle_mon_internal_maybe -_0813EB06: - adds r0, r7, 0 - bl DestroyTask - bl FreeMonSpritesGfx - ldr r4, =gEvoStructPtr - ldr r0, [r4] - bl Free - str r6, [r4] - bl FreeAllWindowBuffers - ldr r0, =gUnknown_030061E8 - ldr r0, [r0] - bl SetMainCallback2 - b _0813F1A4 - .pool -_0813EB34: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813EB48 - b _0813F1A4 -_0813EB48: - bl m4aMPlayAllStop - ldr r0, =0x0006001c - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r5 - b _0813EC52 - .pool -_0813EB74: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EB82 - b _0813F1A4 -_0813EB82: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - mov r3, r8 - adds r4, r3, r7 - lsls r4, 3 - adds r4, r5 -_0813EB90: - ldrh r1, [r4, 0xA] -_0813EB92: - bl sub_81401E0 -_0813EB96: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0813F1A4 - .pool -_0813EBA8: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813EBB8 - b _0813F1A4 -_0813EBB8: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r3, 0x1A - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _0813EBE4 - ldr r0, =gStringVar4 - ldr r1, =gText_EllipsisQuestionMark - bl StringExpandPlaceholders - b _0813EBEC - .pool -_0813EBE4: - ldr r0, =gStringVar4 - ldr r1, =gText_PkmnStoppedEvolving - bl StringExpandPlaceholders -_0813EBEC: - ldr r0, =gStringVar4 - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x1A] - b _0813F16E - .pool -_0813EC10: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EC1E - b _0813F1A4 -_0813EC1E: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813EC2A - b _0813F1A4 -_0813EC2A: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =0x0000016f - bl PlayFanfare - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0xC] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x40 - strh r0, [r1, 0x10] -_0813EC52: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0813F1A4 - .pool -_0813EC6C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EC7A - b _0813F1A4 -_0813EC7A: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813EC86 - b _0813F1A4 -_0813EC86: - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - cmp r0, 0 - beq _0813EC9E - b _0813F1A4 -_0813EC9E: - movs r0, 0xF - strh r0, [r1, 0x8] - b _0813F1A4 - .pool -_0813ECA8: - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r0, r5 - movs r1, 0x14 - ldrsh r0, [r0, r1] - cmp r0, 0xC - bls _0813ECBA - b _0813F1A4 -_0813ECBA: - lsls r0, 2 - ldr r1, =_0813ECC8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813ECC8: - .4byte _0813ECFC - .4byte _0813ED48 - .4byte _0813ED90 - .4byte _0813EDCE - .4byte _0813EE34 - .4byte _0813EF30 - .4byte _0813EF88 - .4byte _0813F05C - .4byte _0813F090 - .4byte _0813F0D8 - .4byte _0813F120 - .4byte _0813F154 - .4byte _0813F180 -_0813ECFC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813ED0A - b _0813F1A4 -_0813ED0A: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813ED16 - b _0813F1A4 -_0813ED16: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x10] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813ED48: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813ED56 - b _0813F1A4 -_0813ED56: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813ED62 - b _0813F1A4 -_0813ED62: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x14] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813ED90: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813EDCE - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813EDCE - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x18] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 - strh r0, [r1, 0x16] - movs r0, 0xA - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x14] - adds r0, 0x1 - strh r0, [r1, 0x14] -_0813EDCE: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813EDDC - b _0813F1A4 -_0813EDDC: - bl IsSEPlaying - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0813EDEA - b _0813F1A4 -_0813EDEA: - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - ldr r0, =gText_BattleYesNoChoice - movs r1, 0xC - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x14] - ldr r0, =gBattleCommunication - strb r2, [r0, 0x1] - movs r0, 0 - bl BattleCreateCursorAt - b _0813F1A4 - .pool -_0813EE34: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0813EE5C - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x1] - cmp r0, 0 - beq _0813EE5C - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt - movs r0, 0 - strb r0, [r4, 0x1] - bl BattleCreateCursorAt -_0813EE5C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EE84 - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x1] - cmp r0, 0 - bne _0813EE84 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4, 0x1] - bl BattleDestroyCursorAt - movs r0, 0x1 - strb r0, [r4, 0x1] - bl BattleCreateCursorAt -_0813EE84: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - cmp r0, 0 - beq _0813EEF2 - str r2, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - ldr r0, =gBattleCommunication - ldrb r2, [r0, 0x1] - cmp r2, 0 - beq _0813EECC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x18] - strh r0, [r1, 0x14] - b _0813EEF2 - .pool -_0813EECC: - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x16] - strh r0, [r1, 0x14] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _0813EEF2 - movs r0, 0x1 - negs r0, r0 - str r2, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0813EEF2: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0813EF00 - b _0813F1A4 -_0813EF00: - movs r0, 0x1 - str r0, [sp] - movs r0, 0x18 - movs r1, 0x8 - movs r2, 0x1D - movs r3, 0xD - bl sub_8056A3C - movs r0, 0x5 - bl PlaySE - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x18] - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813EF30: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EF3E - b _0813F1A4 -_0813EF3E: - bl FreeAllWindowBuffers - ldr r0, =gPlayerParty - ldr r1, =gTasks - mov r3, r8 - adds r5, r3, r7 - lsls r5, 3 - adds r5, r1 - ldrb r1, [r5, 0x1C] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =CB2_EvolutionSceneLoadGraphics - ldr r4, =gMoveToLearn - ldrh r4, [r4] - str r4, [sp] - bl sub_81BFA38 - ldrh r0, [r5, 0x14] - adds r0, 0x1 - strh r0, [r5, 0x14] - b _0813F1A4 - .pool -_0813EF88: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813EF96 - b _0813F1A4 -_0813EF96: - ldr r1, [r6, 0x4] - ldr r0, =CB2_EvolutionSceneUpdate - cmp r1, r0 - beq _0813EFA0 - b _0813F1A4 -_0813EFA0: - bl sub_81C1B94 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bne _0813EFC8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0xA - b _0813F1A2 - .pool -_0813EFC8: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r9 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl IsHMMove2 - cmp r0, 0 - beq _0813F014 - ldr r0, =gBattleStringsTable - ldr r3, =0x000004cc - adds r0, r3 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0xC - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813F014: - ldr r1, =gBattleTextBuff2 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - strb r4, [r1, 0x2] - lsrs r0, r4, 8 - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - lsls r4, r6, 24 - lsrs r4, 24 - mov r0, r9 - adds r1, r4, 0 - bl RemoveMonPPBonus - ldr r0, =gMoveToLearn - ldrh r1, [r0] - mov r0, r9 - adds r2, r4, 0 - bl SetMonMoveSlot - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F05C: - ldr r0, =gBattleStringsTable - movs r1, 0xCF - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F090: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F09E - b _0813F1A4 -_0813F09E: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F0AA - b _0813F1A4 -_0813F0AA: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x1C] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813F1A2 - .pool -_0813F0D8: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F1A4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F1A4 - ldr r0, =gBattleStringsTable - movs r1, 0xD0 - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x14 - strh r1, [r0, 0x8] - b _0813F1A4 - .pool -_0813F120: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x20] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r3, r8 - adds r0, r3, r7 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0xB - strh r1, [r0, 0x16] - strh r2, [r0, 0x18] - movs r1, 0x3 - strh r1, [r0, 0x14] - b _0813F1A4 - .pool -_0813F154: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x24] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r0, =gDisplayedStringBattle - movs r1, 0 - bl sub_814F9EC - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 -_0813F16E: - movs r1, 0xF - strh r1, [r0, 0x8] - b _0813F1A4 - .pool -_0813F180: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F1A4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F1A4 - ldr r0, =gTasks - mov r3, r8 - adds r1, r3, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 -_0813F1A2: - strh r0, [r1, 0x14] -_0813F1A4: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end Task_EvolutionScene - - thumb_func_start sub_813F1B8 -sub_813F1B8: @ 813F1B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r3, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r3 - movs r1, 0x1C - ldrsh r2, [r0, r1] - movs r1, 0x64 - muls r2, r1 - ldr r1, =gPlayerParty - adds r2, r1 - mov r9, r2 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r5, r3, 0 - cmp r0, 0x14 - bls _0813F1EC - bl _0813FCC4 -_0813F1EC: - lsls r0, 2 - ldr r1, =_0813F204 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813F204: - .4byte _0813F258 - .4byte _0813F284 - .4byte _0813F2AC - .4byte _0813F2DC - .4byte _0813F314 - .4byte _0813F380 - .4byte _0813F3C0 - .4byte _0813F3F0 - .4byte _0813F42C - .4byte _0813F448 - .4byte _0813F474 - .4byte _0813F498 - .4byte _0813F4E4 - .4byte _0813F570 - .4byte _0813F624 - .4byte _0813F668 - .4byte _0813F6D0 - .4byte _0813F704 - .4byte _0813F748 - .4byte _0813F7A4 - .4byte _0813F7E4 -_0813F258: - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnIsEvolving - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F284: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F294 - bl _0813FCC4 -_0813F294: - ldr r0, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r0 - ldrh r0, [r4, 0xA] - movs r1, 0 - bl PlayCry1 - b _0813F6F2 - .pool -_0813F2AC: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813F2BA - bl _0813FCC4 -_0813F2BA: - ldr r0, =0x00000179 - bl m4aSongNumStop - movs r0, 0xBC - lsls r0, 1 - bl PlaySE - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F2DC: - bl IsSEPlaying - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - beq _0813F2EC - bl _0813FCC4 -_0813F2EC: - ldr r0, =0x00000179 - bl PlayBGM - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - str r5, [sp] - movs r0, 0x1C - movs r1, 0x4 - b _0813F9C8 - .pool -_0813F314: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813F324 - bl _0813FCC4 -_0813F324: - movs r0, 0x1 - bl sub_8140000 - ldr r2, =gSprites - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - adds r6, r0, 0 - adds r6, 0x10 - adds r0, r6, 0 - bl LaunchTask_PreEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - ldr r1, =0x00000603 - movs r0, 0xE - bl SetGpuReg - bl _0813FCC4 - .pool -_0813F380: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F396 - bl _0813FCC4 -_0813F396: - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r5 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - ldr r0, =gEvoStructPtr - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x3] - bl LaunchTask_PreEvoSparklesSet2 - strb r0, [r4, 0x2] - bl _0813FCC4 - .pool -_0813F3C0: - ldr r4, =gBattleCommunication - ldrb r0, [r4, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F3D6 - bl _0813FCC4 -_0813F3D6: - ldr r0, =gEvoStructPtr - ldr r1, [r0] - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - bl sub_817C3A0 - strb r0, [r4, 0x2] - b _0813F6AC - .pool -_0813F3F0: - ldr r2, =gEvoStructPtr - ldr r1, [r2] - ldrb r0, [r1, 0x3] - subs r0, 0x1 - strb r0, [r1, 0x3] - lsls r0, 24 - cmp r0, 0 - beq _0813F404 - bl _0813FCC4 -_0813F404: - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1, 0x3] - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F420 - bl _0813FCC4 -_0813F420: - b _0813F6AC - .pool -_0813F42C: - bl LaunchTask_PostEvoSparklesSet1 - ldr r1, =gBattleCommunication - strb r0, [r1, 0x2] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - b _0813F6B4 - .pool -_0813F448: - ldr r6, =gBattleCommunication - ldrb r0, [r6, 0x2] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r5 - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _0813F45E - bl _0813FCC4 -_0813F45E: - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r5 - ldrh r0, [r4, 0xC] - bl LaunchTask_PostEvoSparklesSet2AndFlash_Trade - strb r0, [r6, 0x2] - b _0813F6F2 - .pool -_0813F474: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F48A - bl _0813FCC4 -_0813F48A: - movs r0, 0x21 - bl PlaySE - b _0813F6AC - .pool -_0813F498: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F4A6 - bl _0813FCC4 -_0813F4A6: - ldr r0, =gUnknown_0203AB84 - ldr r0, [r0] - bl Free - ldr r5, =gEvoStructPtr - ldr r0, [r5] - ldrb r0, [r0, 0x1] - ldr r1, =gTasks - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r1 - ldrh r1, [r4, 0xC] - bl sub_81401E0 - ldr r0, =gPlttBufferUnfaded + 0x40 - ldr r1, [r5] - adds r1, 0x4 - movs r2, 0x60 - bl memcpy - b _0813F6F2 - .pool -_0813F4E4: - bl IsCryFinished - lsls r0, 24 - cmp r0, 0 - bne _0813F4F2 - bl _0813FCC4 -_0813F4F2: - ldr r4, =gStringVar4 - ldr r1, =gText_CongratsPkmnEvolved - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =0x00000173 - bl PlayFanfare - ldr r2, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - adds r2, r1 - adds r2, 0xC - mov r0, r9 - movs r1, 0xB - bl SetMonData - mov r0, r9 - bl CalculateMonStats - ldrh r1, [r4, 0xA] - ldrh r2, [r4, 0xC] - mov r0, r9 - bl EvolutionRenameMon - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x2 - bl GetSetPokedexFlag - ldrh r0, [r4, 0xC] - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl GetSetPokedexFlag - movs r0, 0xE - bl IncrementGameStat - b _0813FCC4 - .pool -_0813F570: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F57E - b _0813FCC4 -_0813F57E: - bl IsFanfareTaskInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813F58C - b _0813FCC4 -_0813F58C: - ldr r1, =gTasks - lsls r4, r7, 2 - adds r0, r4, r7 - lsls r0, 3 - adds r5, r0, r1 - ldrb r1, [r5, 0x10] - mov r0, r9 - bl MonTryLearningNewMove - lsls r0, 16 - lsrs r6, r0, 16 - mov r8, r4 - cmp r6, 0 - beq _0813F5FC - movs r0, 0x1A - ldrsh r2, [r5, r0] - cmp r2, 0 - bne _0813F5FC - ldrh r1, [r5, 0xE] - movs r0, 0x80 - orrs r0, r1 - strh r0, [r5, 0xE] - strh r2, [r5, 0x10] - strh r2, [r5, 0x14] - mov r0, r9 - movs r1, 0x2 - add r2, sp, 0x4 - bl GetMonData - ldr r0, =gBattleTextBuff1 - add r1, sp, 0x4 - bl StringCopy10 - ldr r0, =0x0000ffff - cmp r6, r0 - bne _0813F5E8 - movs r0, 0x14 - strh r0, [r5, 0x8] - b _0813FCC4 - .pool -_0813F5E8: - ldr r0, =0x0000fffe - cmp r6, r0 - bne _0813F5F0 - b _0813FCC4 -_0813F5F0: - movs r0, 0x12 - strh r0, [r5, 0x8] - b _0813FCC4 - .pool -_0813F5FC: - ldr r0, =0x00000179 - bl PlayBGM - ldr r1, =gText_CommunicationStandby5 - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - b _0813F78C - .pool -_0813F624: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _0813F634 - b _0813FCC4 -_0813F634: - adds r0, r7, 0 - bl DestroyTask - ldr r4, =gEvoStructPtr - ldr r0, [r4] - bl Free - str r5, [r4] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =gUnknown_030061E8 - ldr r0, [r0] - bl SetMainCallback2 - b _0813FCC4 - .pool -_0813F668: - ldr r0, =gBattleCommunication - ldrb r1, [r0, 0x2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r5 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _0813F67C - b _0813FCC4 -_0813F67C: - bl m4aMPlayAllStop - ldr r2, =gSprites - ldr r0, =gEvoStructPtr - ldr r0, [r0] - 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, =0x0004001c - orrs r0, r1 - ldr r1, =0x00007fff - str r1, [sp] - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade -_0813F6AC: - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r5 -_0813F6B4: - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813F6D0: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813F6DE - b _0813FCC4 -_0813F6DE: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - adds r4, r5 - ldrh r1, [r4, 0xA] - bl sub_81401E0 -_0813F6F2: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0813FCC4 - .pool -_0813F704: - ldr r0, =gEvoStructPtr - ldr r0, [r0] - ldrb r0, [r0] - bl sub_8140208 - cmp r0, 0 - bne _0813F714 - b _0813FCC4 -_0813F714: - ldr r4, =gStringVar4 - ldr r1, =gText_EllipsisQuestionMark - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x1A] - b _0813FC8C - .pool -_0813F748: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F756 - b _0813FCC4 -_0813F756: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F762 - b _0813FCC4 -_0813F762: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =0x0000016f - bl PlayFanfare - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0xC] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x40 - strh r0, [r1, 0x10] -_0813F78C: - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0813FCC4 - .pool -_0813F7A4: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F7B2 - b _0813FCC4 -_0813F7B2: - bl IsFanfareTaskInactive - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813F7C0 - b _0813FCC4 -_0813F7C0: - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - cmp r0, 0 - beq _0813F7D8 - b _0813FCC4 -_0813F7D8: - movs r0, 0xD - strh r0, [r1, 0x8] - b _0813FCC4 - .pool -_0813F7E4: - lsls r1, r7, 2 - adds r0, r1, r7 - lsls r0, 3 - adds r0, r5 - movs r2, 0x14 - ldrsh r0, [r0, r2] - mov r8, r1 - cmp r0, 0xB - bls _0813F7F8 - b _0813FCC4 -_0813F7F8: - lsls r0, 2 - ldr r1, =_0813F808 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813F808: - .4byte _0813F838 - .4byte _0813F884 - .4byte _0813F8CC - .4byte _0813F90C - .4byte _0813F96C - .4byte _0813FA24 - .4byte _0813FAA8 - .4byte _0813FBA4 - .4byte _0813FBEC - .4byte _0813FC38 - .4byte _0813FC70 - .4byte _0813FCA0 -_0813F838: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F846 - b _0813FCC4 -_0813F846: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F852 - b _0813FCC4 -_0813F852: - bl BufferMoveToLearnIntoBattleTextBuff2 - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x10] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813F884: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F892 - b _0813FCC4 -_0813F892: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813F89E - b _0813FCC4 -_0813F89E: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x14] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813F8CC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813F90C - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813F90C - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x18] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 - strh r0, [r1, 0x16] - movs r0, 0x9 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x14] - adds r0, 0x1 - strh r0, [r1, 0x14] -_0813F90C: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813F91A - b _0813FCC4 -_0813F91A: - bl IsSEPlaying - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0813F928 - b _0813FCC4 -_0813F928: - movs r0, 0 - movs r1, 0xA8 - movs r2, 0xE0 - bl sub_809882C - ldr r0, =gUnknown_0833900C - movs r1, 0xA8 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - ldr r3, =gBattleCommunication - strb r4, [r3, 0x1] - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x14] - strb r2, [r3, 0x1] - b _0813FCC4 - .pool -_0813F96C: - bl sub_8198C58 - lsls r0, 24 - asrs r6, r0, 24 - cmp r6, 0 - beq _0813F98C - cmp r6, 0 - bgt _0813F986 - movs r0, 0x1 - negs r0, r0 - cmp r6, r0 - beq _0813F9E4 - b _0813FCC4 -_0813F986: - cmp r6, 0x1 - beq _0813F9E4 - b _0813FCC4 -_0813F98C: - ldr r0, =gBattleCommunication - strb r6, [r0, 0x1] - ldr r0, =gBattleStringsTable - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x16] - strh r1, [r0, 0x14] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x5 - beq _0813F9C0 - b _0813FCC4 -_0813F9C0: - movs r0, 0x1 - negs r0, r0 - str r6, [sp] - movs r1, 0 -_0813F9C8: - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0813FCC4 - .pool -_0813F9E4: - ldr r1, =gBattleCommunication - movs r0, 0x1 - strb r0, [r1, 0x1] - ldr r0, =gBattleStringsTable - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x18] - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FA24: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813FA32 - b _0813FCC4 -_0813FA32: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0813FA3E - bl sub_800E084 -_0813FA3E: - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - bl FreeAllWindowBuffers - ldr r0, =gPlayerParty - ldr r1, =gTasks - mov r2, r8 - adds r5, r2, r7 - lsls r5, 3 - adds r5, r1 - ldrb r1, [r5, 0x1C] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =sub_813DF70 - ldr r4, =gMoveToLearn - ldrh r4, [r4] - str r4, [sp] - bl sub_81BFA38 - ldrh r0, [r5, 0x14] - adds r0, 0x1 - strh r0, [r5, 0x14] - b _0813FCC4 - .pool -_0813FAA8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0813FAB6 - b _0813FCC4 -_0813FAB6: - ldr r0, =gMain - ldr r1, [r0, 0x4] - ldr r0, =sub_813E3C0 - cmp r1, r0 - beq _0813FAC2 - b _0813FCC4 -_0813FAC2: - bl sub_81C1B94 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bne _0813FAEC - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x9 - b _0813FCC2 - .pool -_0813FAEC: - adds r1, r6, 0 - adds r1, 0xD - mov r0, r9 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r4, 0 - bl IsHMMove2 - cmp r0, 0 - beq _0813FB3C - ldr r0, =gBattleStringsTable - ldr r1, =0x000004cc - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0xB - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FB3C: - ldr r1, =gBattleTextBuff2 - movs r0, 0xFD - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - strb r4, [r1, 0x2] - lsrs r0, r4, 8 - strb r0, [r1, 0x3] - movs r0, 0xFF - strb r0, [r1, 0x4] - lsls r4, r6, 24 - lsrs r4, 24 - mov r0, r9 - adds r1, r4, 0 - bl RemoveMonPPBonus - ldr r0, =gMoveToLearn - ldrh r1, [r0] - mov r0, r9 - adds r2, r4, 0 - bl SetMonMoveSlot - ldr r0, =gBattleStringsTable - movs r1, 0xCF - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813FBA4: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - beq _0813FBB2 - b _0813FCC4 -_0813FBB2: - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _0813FBBE - b _0813FCC4 -_0813FBBE: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x1C] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - b _0813FCC2 - .pool -_0813FBEC: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813FCC4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813FCC4 - ldr r0, =gBattleStringsTable - movs r1, 0xD0 - lsls r1, 2 - adds r0, r1 - ldr r0, [r0] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x12 - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813FC38: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x20] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - movs r1, 0xA - strh r1, [r0, 0x16] - strh r2, [r0, 0x18] - movs r1, 0x3 - strh r1, [r0, 0x14] - b _0813FCC4 - .pool -_0813FC70: - ldr r0, =gBattleStringsTable - ldr r0, [r0, 0x24] - bl BattleStringExpandPlaceholdersToDisplayedString - ldr r1, =gDisplayedStringBattle - movs r0, 0 - movs r2, 0x1 - bl sub_807F1A8 - ldr r1, =gTasks - mov r2, r8 - adds r0, r2, r7 - lsls r0, 3 - adds r0, r1 -_0813FC8C: - movs r1, 0xD - strh r1, [r0, 0x8] - b _0813FCC4 - .pool -_0813FCA0: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813FCC4 - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - bne _0813FCC4 - ldr r0, =gTasks - mov r2, r8 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - movs r0, 0x5 -_0813FCC2: - strh r0, [r1, 0x14] -_0813FCC4: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813F1B8 - - thumb_func_start EvoDummyFunc -EvoDummyFunc: @ 813FCD8 - bx lr - thumb_func_end EvoDummyFunc - - thumb_func_start VBlankCB_EvolutionScene -VBlankCB_EvolutionScene: @ 813FCDC - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_80BA0A8 - pop {r0} - bx r0 - .pool - thumb_func_end VBlankCB_EvolutionScene - - thumb_func_start sub_813FD64 -sub_813FD64: @ 813FD64 - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_80BA0A8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FD64 - - thumb_func_start sub_813FDEC -sub_813FDEC: @ 813FDEC - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r0, 0xC - ldrsh r5, [r4, r0] - cmp r5, 0 - bne _0813FE9A - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0813FE9A - ldrh r1, [r4] - adds r0, r1, 0x1 - strh r0, [r4] - lsls r1, 16 - asrs r1, 16 - ldr r3, =gUnknown_085B58C9 - movs r2, 0x4 - ldrsh r0, [r4, r2] - lsls r2, r0, 2 - adds r0, r3, 0x3 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r1, r0 - ble _0813FE8C - adds r0, r3, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - movs r2, 0x2 - ldrsh r1, [r4, r2] - cmp r0, r1 - bne _0813FE74 - ldrh r0, [r4, 0x6] - adds r0, 0x1 - strh r0, [r4, 0x6] - movs r0, 0x6 - ldrsh r2, [r4, r0] - movs r1, 0x4 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r1, r3, 0x2 - adds r0, r1 - ldrb r0, [r0] - cmp r2, r0 - bne _0813FE5E - strh r5, [r4, 0x6] - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] -_0813FE5E: - movs r2, 0x4 - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0] - b _0813FE8A - .pool -_0813FE74: - ldr r0, =gUnknown_0203AB84 - lsls r1, 5 - ldr r0, [r0] - adds r0, r1 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - strh r5, [r4] - ldrh r0, [r4, 0x2] - adds r0, 0x1 -_0813FE8A: - strh r0, [r4, 0x2] -_0813FE8C: - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bne _0813FE9A - adds r0, r6, 0 - bl DestroyTask -_0813FE9A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FDEC - - thumb_func_start sub_813FEA4 -sub_813FEA4: @ 813FEA4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =sub_813FEE8 - movs r1, 0x7 - bl CreateTask - lsls r0, 24 - lsrs r2, r0, 24 - cmp r4, 0 - bne _0813FED0 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0xC] - b _0813FEDE - .pool -_0813FED0: - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0xC] -_0813FEDE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FEA4 - - thumb_func_start sub_813FEE8 -sub_813FEE8: @ 813FEE8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gBattle_BG1_X - mov r8, r0 - ldr r1, =gBattle_BG1_Y - mov r9, r1 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0xC - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _0813FF28 - ldr r7, =gBattle_BG2_X - ldr r6, =gBattle_BG2_Y - b _0813FF2C - .pool -_0813FF28: - ldr r7, =gBattle_BG3_X - ldr r6, =gBattle_BG3_Y -_0813FF2C: - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r1 - ldrh r0, [r4, 0x8] - adds r0, 0x5 - movs r1, 0xFF - ands r0, r1 - strh r0, [r4, 0x8] - adds r0, 0x80 - ands r0, r1 - strh r0, [r4, 0xA] - movs r1, 0x8 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Cos - adds r0, 0x8 - mov r2, r8 - strh r0, [r2] - movs r1, 0x8 - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Sin - adds r0, 0x10 - mov r2, r9 - strh r0, [r2] - movs r1, 0xA - ldrsh r0, [r4, r1] - movs r1, 0x4 - bl Cos - adds r0, 0x8 - strh r0, [r7] - movs r2, 0xA - ldrsh r0, [r4, r2] - movs r1, 0x4 - bl Sin - adds r0, 0x10 - strh r0, [r6] - ldr r0, =sub_813FDEC - bl FuncIsActiveTask - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0813FFA6 - adds r0, r5, 0 - bl DestroyTask - mov r0, r8 - strh r4, [r0] - mov r1, r9 - strh r4, [r1] - movs r2, 0x80 - lsls r2, 1 - adds r0, r2, 0 - strh r0, [r7] - strh r4, [r6] -_0813FFA6: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FEE8 - - thumb_func_start sub_813FFC0 -sub_813FFC0: @ 813FFC0 - push {r4-r7,lr} - adds r6, r0, 0 - movs r1, 0 - ldr r5, =gUnknown_085B5884 - ldr r7, =gUnknown_085B58D9 -_0813FFCA: - lsls r0, r1, 4 - adds r4, r1, 0x1 - adds r2, r0, r7 - lsls r0, r1, 5 - adds r1, r0, r6 - movs r3, 0xF -_0813FFD6: - ldrb r0, [r2] - lsls r0, 1 - adds r0, r5 - ldrh r0, [r0] - strh r0, [r1] - adds r2, 0x1 - adds r1, 0x2 - subs r3, 0x1 - cmp r3, 0 - bge _0813FFD6 - adds r1, r4, 0 - cmp r1, 0x31 - ble _0813FFCA - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813FFC0 - - thumb_func_start sub_8140000 -sub_8140000: @ 8140000 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203AB84 - movs r0, 0xC8 - lsls r0, 3 - bl AllocZeroed - str r0, [r4] - bl sub_813FFC0 - cmp r5, 0 - bne _08140028 - movs r6, 0x1 - movs r4, 0x2 - b _0814002C - .pool -_08140028: - movs r6, 0x1 - movs r4, 0x3 -_0814002C: - ldr r0, =gUnknown_085B51E4 - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_085B4134 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl copy_decompressed_tile_data_to_vram_autofree - ldr r1, =gUnknown_085B482C - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gUnknown_085B4D10 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - adds r0, r4, 0 - bl CopyBgTilemapBufferToVram - cmp r5, 0 - bne _081400C4 - ldr r1, =0x00000442 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000808 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xBA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - adds r0, r6, 0 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - adds r0, r4, 0 - movs r1, 0x7 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - b _081400DE - .pool -_081400C4: - ldr r1, =0x00000842 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000808 - movs r0, 0x52 - bl SetGpuReg - movs r1, 0xDA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg -_081400DE: - ldr r0, =sub_813FDEC - movs r1, 0x5 - bl CreateTask - adds r0, r5, 0 - bl sub_813FEA4 - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140000 - - thumb_func_start sub_8140100 -sub_8140100: @ 8140100 - push {lr} - ldr r0, =sub_813FDEC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - beq _0814011E - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x14] -_0814011E: - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x20 - bl FillPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140100 - - thumb_func_start sub_8140134 -sub_8140134: @ 8140134 - push {lr} - ldr r0, =sub_813FDEC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08140148 - bl DestroyTask -_08140148: - ldr r0, =sub_813FEE8 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _0814015A - bl DestroyTask -_0814015A: - movs r0, 0 - movs r1, 0xA0 - movs r2, 0x20 - bl FillPalette - bl sub_8140174 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140134 - - thumb_func_start sub_8140174 -sub_8140174: @ 8140174 - push {lr} - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - movs r0, 0x1 - movs r1, 0x5 - bl sub_80391E0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1 - movs r1, 0x7 - bl SetBgAttribute - movs r0, 0x2 - movs r1, 0x5 - bl sub_80391E0 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x2 - movs r1, 0x7 - bl SetBgAttribute - movs r1, 0xCA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gUnknown_0203AB84 - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140174 - - thumb_func_start sub_81401E0 -sub_81401E0: @ 81401E0 - push {lr} - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - movs r2, 0 - movs r3, 0 - bl DoMonFrontSpriteAnimation - pop {r0} - bx r0 - .pool - thumb_func_end sub_81401E0 - - thumb_func_start sub_8140208 -sub_8140208: @ 8140208 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r2, 0x1C - adds r1, r2 - ldr r1, [r1] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _08140230 - movs r0, 0 - b _08140232 - .pool -_08140230: - movs r0, 0x1 -_08140232: - pop {r1} - bx r1 - thumb_func_end sub_8140208 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/party_menu.s b/asm/party_menu.s index f2e681b9b..e92a638e5 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -13861,7 +13861,7 @@ sub_81B7810: @ 81B7810 cmp r4, 0 beq _081B7860 bl sub_81B06F4 - ldr r0, =gUnknown_030061E8 + ldr r0, =gCB2_AfterEvolution ldr r1, [r6] str r1, [r0] ldrb r3, [r6, 0x9] @@ -14307,7 +14307,7 @@ sub_81B7C74: @ 81B7C74 lsrs r5, r0, 24 movs r0, 0x5 bl PlaySE - ldr r2, =gUnknown_030061E8 + ldr r2, =gCB2_AfterEvolution ldr r1, =gUnknown_0203CEC8 ldr r0, [r1] str r0, [r2] diff --git a/asm/trade.s b/asm/trade.s index 51b517a0b..ebb624d90 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -10590,7 +10590,7 @@ _0807CEDC: ldrb r0, [r0] movs r1, 0 bl sub_807B4D0 - ldr r1, =gUnknown_030061E8 + ldr r1, =gCB2_AfterEvolution ldr r0, =sub_807B60C str r0, [r1] ldr r7, =gUnknown_02032298 @@ -10615,7 +10615,7 @@ _0807CEDC: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807CF48 .pool _0807CF38: @@ -12695,7 +12695,7 @@ _0807E328: ldrb r0, [r0] movs r1, 0 bl sub_807B4D0 - ldr r1, =gUnknown_030061E8 + ldr r1, =gCB2_AfterEvolution ldr r0, =sub_807B60C str r0, [r1] ldr r7, =gUnknown_02032298 @@ -12720,7 +12720,7 @@ _0807E328: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807E394 .pool _0807E384: @@ -12810,7 +12810,7 @@ _0807E434: b _0807E4B2 .pool _0807E444: - ldr r0, =gUnknown_030061E8 + ldr r0, =gCB2_AfterEvolution ldr r1, =sub_807EB50 mov r8, r1 str r1, [r0] @@ -12836,7 +12836,7 @@ _0807E444: adds r1, 0x8F ldrb r2, [r1] adds r1, r4, 0 - bl sub_813E1D4 + bl TradeEvolutionScene b _0807E4AE .pool _0807E494: diff --git a/include/battle_message.h b/include/battle_message.h index 3b154c5a6..3f9b38cad 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -204,7 +204,7 @@ struct StringInfoBattle void BufferStringBattle(u16 stringID); u32 BattleStringExpandPlaceholdersToDisplayedString(const u8* src); u32 BattleStringExpandPlaceholders(const u8* src, u8* dst); -void sub_814F9EC(const u8* text, u8 arg1); +void BattleHandleAddTextPrinter(const u8* text, u8 arg1); void SetPpNumbersPaletteInMoveSelection(void); u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp); @@ -215,6 +215,7 @@ extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT]; extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT]; extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT]; +extern const u8* const gBattleStringsTable[]; extern const u8* const gStatNamesTable[]; extern const u8* const gPokeblockWasTooXStringTable[]; extern const u8* const gRefereeStringsTable[]; diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 590944f02..9684425fe 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -46,10 +46,10 @@ u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef); u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility); u8 BankGetTurnOrder(u8 bank); void SetMoveEffect(bool8 primary, u8 certain); -void BattleDestroyCursorAt(u8 cursorPosition); -void BattleCreateCursorAt(u8 cursorPosition); +void BattleDestroyYesNoCursorAt(u8 cursorPosition); +void BattleCreateYesNoCursorAt(u8 cursorPosition); void BufferMoveToLearnIntoBattleTextBuff2(void); -void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); bool8 UproarWakeUpCheck(u8 bank); extern void (* const gBattleScriptingCommandsTable[])(void); diff --git a/include/evolution_scene.h b/include/evolution_scene.h index 48bd6ebe1..5f8c534b9 100644 --- a/include/evolution_scene.h +++ b/include/evolution_scene.h @@ -1,8 +1,8 @@ #ifndef GUARD_EVOLUTION_SCENE_H #define GUARD_EVOLUTION_SCENE_H -void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); +void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID); void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID); extern void (*gCB2_AfterEvolution)(void); diff --git a/ld_script.txt b/ld_script.txt index 98fc00ce4..624b9f2c3 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -181,7 +181,6 @@ SECTIONS { asm/battle_records.o(.text); asm/pokedex_area_screen.o(.text); src/evolution_scene.o(.text); - asm/evolution_scene.o(.text); asm/roulette.o(.text); asm/pokedex_cry_screen.o(.text); src/coins.o(.text); diff --git a/src/battle_2.c b/src/battle_2.c index 16c07114a..212c7253e 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -85,7 +85,7 @@ extern u16 gTrainerBattleOpponent_B; extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT]; extern void (*gPreBattleCallback1)(void); extern void (*gBattleMainFunc)(void); -extern void (*gUnknown_030061E8)(void); +extern void (*gCB2_AfterEvolution)(void); extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for? extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for? extern u8 gUnknown_02039B28[]; // possibly a struct? @@ -2121,7 +2121,7 @@ static void sub_8038F34(void) if (sub_800A520() == TRUE) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2247,17 +2247,17 @@ static void sub_803939C(void) case 3: if (!gPaletteFade.active) { - sub_814F9EC(gText_RecordBattleToPass, 0); + BattleHandleAddTextPrinter(gText_RecordBattleToPass, 0); gBattleCommunication[MULTIUSE_STATE]++; } break; case 4: if (!IsTextPrinterActive(0)) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); gBattleCommunication[MULTIUSE_STATE]++; } break; @@ -2267,9 +2267,9 @@ static void sub_803939C(void) if (gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } } else if (gMain.newKeys & DPAD_DOWN) @@ -2277,9 +2277,9 @@ static void sub_803939C(void) if (gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } } else if (gMain.newKeys & A_BUTTON) @@ -2287,7 +2287,7 @@ static void sub_803939C(void) PlaySE(SE_SELECT); if (gBattleCommunication[CURSOR_POSITION] == 0) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattleCommunication[1] = MoveRecordedBattleToSaveData(); gBattleCommunication[MULTIUSE_STATE] = 10; } @@ -2305,11 +2305,11 @@ static void sub_803939C(void) case 6: if (sub_800A520() == TRUE) { - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -2340,14 +2340,14 @@ static void sub_803939C(void) { PlaySE(SE_SAVE); BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordedOnPass); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } else { BattleStringExpandPlaceholdersToDisplayedString(gText_BattleRecordCouldntBeSaved); - sub_814F9EC(gDisplayedStringBattle, 0); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gBattleCommunication[1] = 0x80; gBattleCommunication[MULTIUSE_STATE]++; } @@ -2358,7 +2358,7 @@ static void sub_803939C(void) if (gMain.field_439_x4) { sub_800ADF8(); - sub_814F9EC(gText_LinkStandby3, 0); + BattleHandleAddTextPrinter(gText_LinkStandby3, 0); } gBattleCommunication[MULTIUSE_STATE]++; } @@ -3690,7 +3690,7 @@ static void TryDoEventsBeforeFirstTurn(void) TurnValuesCleanUp(FALSE); SpecialStatusesClear(); *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; ResetSentPokesToOpponentValue(); @@ -3797,7 +3797,7 @@ void BattleTurnPassed(void) *(gBattleStruct->field_5C + i) = 6; *(&gBattleStruct->field_91) = gAbsentBankFlags; - sub_814F9EC(gText_EmptyString3, 0); + BattleHandleAddTextPrinter(gText_EmptyString3, 0); gBattleMainFunc = HandleTurnActionSelectionState; gRandomTurnNumber = Random(); @@ -4939,7 +4939,7 @@ static void HandleEndTurn_FinishBattle(void) BeginFastPaletteFade(3); FadeOutMapMusic(5); gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions; - gUnknown_030061E8 = BattleMainCB2; + gCB2_AfterEvolution = BattleMainCB2; } else { diff --git a/src/battle_message.c b/src/battle_message.c index aeff721d6..d0c7b118d 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2209,7 +2209,7 @@ static void sub_814F950(u8* dst) } } -void sub_814F9EC(const u8 *text, u8 arg1) +void BattleHandleAddTextPrinter(const u8 *text, u8 arg1) { const u8 *r8 = gUnknown_085CD660[gBattleScripting.field_24]; bool32 r9; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 28357d984..22e2d6a0c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6114,33 +6114,33 @@ static void atk5A_yesnoboxlearnmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); if (gBattleCommunication[1] == 0) { - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, 1); BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); gBattleScripting.learnMoveState++; } @@ -6214,7 +6214,7 @@ static void atk5A_yesnoboxlearnmove(void) } break; case 5: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattlescriptCurrInstr += 5; break; case 6: @@ -6231,26 +6231,26 @@ static void atk5B_yesnoboxstoplearningmove(void) switch (gBattleScripting.learnMoveState) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleScripting.learnMoveState++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { @@ -6261,13 +6261,13 @@ static void atk5B_yesnoboxstoplearningmove(void) else gBattlescriptCurrInstr += 5; - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, 1); } else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 1); - sub_8056A3C(0x18, 0x8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, 1); } break; } @@ -6527,38 +6527,38 @@ static void atk67_yesnobox(void) switch (gBattleCommunication[0]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[0]++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & B_BUTTON) { gBattleCommunication[CURSOR_POSITION] = 1; PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattlescriptCurrInstr++; } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - sub_8056A3C(0x18, 8, 0x1D, 0xD, 1); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); gBattlescriptCurrInstr++; } break; @@ -6674,7 +6674,7 @@ static void atk6C_draw_lvlupbox(void) SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, 0); ShowBg(0); ShowBg(1); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x80); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, 0x80); gBattleScripting.atk6C_state = 4; break; case 4: @@ -6704,7 +6704,7 @@ static void atk6C_draw_lvlupbox(void) if (gMain.newKeys != 0) { PlaySE(SE_SELECT); - sub_8056A3C(0x12, 7, 0x1D, 0x13, 0x81); + HandleBattleWindow(0x12, 7, 0x1D, 0x13, 0x81); gBattleScripting.atk6C_state++; } break; @@ -7148,7 +7148,7 @@ static void atk76_various(void) break; case 16: BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); - sub_814F9EC(gDisplayedStringBattle, 0x16); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0x16); break; case 17: if (IsTextPrinterActive(0x16)) @@ -11238,7 +11238,7 @@ static void atkF2_display_dex_info(void) } } -void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) +void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) { s32 destY, destX; u16 var = 0; @@ -11286,7 +11286,7 @@ void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags) } } -void BattleCreateCursorAt(u8 cursorPosition) +void BattleCreateYesNoCursorAt(u8 cursorPosition) { u16 src[2]; src[0] = 1; @@ -11296,7 +11296,7 @@ void BattleCreateCursorAt(u8 cursorPosition) CopyBgTilemapBufferToVram(0); } -void BattleDestroyCursorAt(u8 cursorPosition) +void BattleDestroyYesNoCursorAt(u8 cursorPosition) { u16 src[2]; src[0] = 0x1016; @@ -11311,26 +11311,26 @@ static void atkF3_nickname_caught_poke(void) switch (gBattleCommunication[MULTIUSE_STATE]) { case 0: - sub_8056A3C(0x18, 8, 0x1D, 0xD, 0); - sub_814F9EC(gText_BattleYesNoChoice, 0xC); + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); gBattleCommunication[MULTIUSE_STATE]++; gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); break; case 1: if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 0; - BattleCreateCursorAt(0); + BattleCreateYesNoCursorAt(0); } if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0) { PlaySE(SE_SELECT); - BattleDestroyCursorAt(gBattleCommunication[CURSOR_POSITION]); + BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]); gBattleCommunication[CURSOR_POSITION] = 1; - BattleCreateCursorAt(1); + BattleCreateYesNoCursorAt(1); } if (gMain.newKeys & A_BUTTON) { diff --git a/src/evolution_scene.c b/src/evolution_scene.c index d86258444..e53981eeb 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -23,16 +23,21 @@ #include "battle_message.h" #include "gpu_regs.h" #include "bg.h" +#include "link.h" +#include "blend_palette.h" +#include "trig.h" struct EvoInfo { u8 preEvoSpriteID; u8 postEvoSpriteID; u8 evoTaskID; + u8 field_3; u16 savedPalette[48]; }; -extern struct EvoInfo *gEvoStructPtr; +static EWRAM_DATA struct EvoInfo *sEvoStructPtr = NULL; +static EWRAM_DATA u16 *sEvoMovingBgPtr = NULL; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; @@ -42,31 +47,66 @@ extern u16 gBattle_BG2_X; extern u16 gBattle_BG2_Y; extern u16 gBattle_BG3_X; extern u16 gBattle_BG3_Y; -extern u16 gBattle_WIN0H; -extern u16 gBattle_WIN0V; -extern u16 gBattle_WIN1H; -extern u16 gBattle_WIN1V; extern u8 gBattleTerrain; extern struct SpriteTemplate gUnknown_0202499C; +extern bool8 gAffineAnimsDisabled; +extern u16 gMoveToLearn; +extern u8 gBattleCommunication[]; +#define sEvoCursorPos gBattleCommunication[1] // when learning a new move +#define sEvoGraphicsTaskID gBattleCommunication[2] + +extern const struct WindowTemplate gUnknown_0833900C; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const u8 gUnknown_085B58C9[][4]; +extern const u16 gUnknown_085B5884[]; +extern const u8 gUnknown_085B58D9[]; +extern const u16 gUnknown_085B51E4[]; +extern const u32 gUnknown_085B4134[]; +extern const u32 gUnknown_085B482C[]; +extern const u32 gUnknown_085B4D10[]; +// strings +extern const u8 gUnknown_085B58C4[]; +extern const u8 gText_PkmnIsEvolving[]; +extern const u8 gText_CongratsPkmnEvolved[]; +extern const u8 gText_BattleYesNoChoice[]; +extern const u8 gText_PkmnStoppedEvolving[]; +extern const u8 gText_EllipsisQuestionMark[]; +extern const u8 gText_CommunicationStandby5[]; + +extern void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, bool32 arg2, u16 arg3, u8 arg4); +extern u32 sub_80391E0(u8, u8); extern void SpriteCallbackDummy_2(struct Sprite *sprite); extern void sub_80356D0(void); +extern void sub_807B154(void); extern void sub_806A068(u16, u8); +extern void sub_807F19C(void); +extern void sub_807B140(void); +extern void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); +extern void sub_8085784(void); +extern void sub_81BFA38(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 -void Task_EvolutionScene(u8 taskID); -void Task_TradeEvolutionScene(u8 taskID); -void CB2_EvolutionSceneUpdate(void); -void CB2_TradeEvolutionSceneUpdate(void); -void EvoDummyFunc(void); -void EvoDummyFunc2(void); -void VBlankCB_EvolutionScene(void); -void VBlankCB_TradeEvolutionScene(void); -void sub_81150D8(void); +static void Task_EvolutionScene(u8 taskID); +static void Task_TradeEvolutionScene(u8 taskID); +static void CB2_EvolutionSceneUpdate(void); +static void CB2_TradeEvolutionSceneUpdate(void); +static void EvoDummyFunc(void); +static void VBlankCB_EvolutionScene(void); +static void VBlankCB_TradeEvolutionScene(void); +static void sub_81150D8(void); +static void sub_8140134(void); +static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId); +static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId); +static void InitMovingBackgroundTask(bool8 isLink); +static void sub_813FEE8(u8 taskId); +static void sub_8140174(void); -void CB2_BeginEvolutionScene(void) +static void CB2_BeginEvolutionScene(void) { UpdatePaletteFade(); RunTasks(); @@ -87,7 +127,7 @@ void CB2_BeginEvolutionScene(void) #define TASK_BIT_CAN_STOP 0x1 #define TASK_BIT_LEARN_MOVE 0x80 -void Task_BeginEvolutionScene(u8 taskID) +static void Task_BeginEvolutionScene(u8 taskID) { struct Pokemon* mon = NULL; switch (gTasks[taskID].tState) @@ -167,7 +207,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, gReservedSpritePaletteCount = 4; - gEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); + sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); AllocateMonSpritesGfx(); GetMonData(mon, MON_DATA_NICKNAME, name); @@ -186,7 +226,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, sub_806A068(currSpecies, 1); gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; - gEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + sEvoStructPtr->preEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 1; @@ -201,14 +241,14 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, sub_806A068(speciesToEvolve, 3); gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; - gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; gSprites[ID].invisible = 1; LoadEvoSparkleSpriteAndPal(); - gEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0); + sEvoStructPtr->evoTaskID = ID = CreateTask(Task_EvolutionScene, 0); gTasks[ID].tState = 0; gTasks[ID].tPreEvoSpecies = currSpecies; gTasks[ID].tPostEvoSpecies = speciesToEvolve; @@ -217,7 +257,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, gTasks[ID].tEvoWasStopped = FALSE; gTasks[ID].tPartyID = partyID; - memcpy(&gEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60); + memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], 0x60); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); @@ -227,15 +267,15 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, SetMainCallback2(CB2_EvolutionSceneUpdate); } -void CB2_EvolutionSceneLoadGraphics(void) +static void CB2_EvolutionSceneLoadGraphics(void) { u8 ID; const struct CompressedSpritePalette* pokePal; u16 postEvoSpecies; u32 TiD, PiD; - struct Pokemon* Mon = &gPlayerParty[gTasks[gEvoStructPtr->evoTaskID].tPartyID]; + struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; - postEvoSpecies = gTasks[gEvoStructPtr->evoTaskID].tPostEvoSpecies; + postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; TiD = GetMonData(Mon, MON_DATA_OT_ID); PiD = GetMonData(Mon, MON_DATA_PERSONALITY); @@ -279,7 +319,7 @@ void CB2_EvolutionSceneLoadGraphics(void) sub_806A068(postEvoSpecies, 3); gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; - gEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); gSprites[ID].callback = SpriteCallbackDummy_2; gSprites[ID].oam.paletteNum = 2; @@ -297,3 +337,1170 @@ void CB2_EvolutionSceneLoadGraphics(void) ShowBg(2); ShowBg(3); } + +static void CB2_TradeEvolutionSceneLoadGraphics(void) +{ + struct Pokemon* Mon = &gPlayerParty[gTasks[sEvoStructPtr->evoTaskID].tPartyID]; + u16 postEvoSpecies = gTasks[sEvoStructPtr->evoTaskID].tPostEvoSpecies; + + switch (gMain.state) + { + case 0: + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetHBlankCallback(NULL); + SetVBlankCallback(NULL); + ResetSpriteData(); + FreeAllSpritePalettes(); + gReservedSpritePaletteCount = 4; + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + gMain.state++; + break; + case 1: + ResetPaletteFade(); + SetHBlankCallback(EvoDummyFunc); + SetVBlankCallback(VBlankCB_TradeEvolutionScene); + gMain.state++; + break; + case 2: + sub_807F19C(); + gMain.state++; + break; + case 3: + FillBgTilemapBufferRect(1, 0, 0, 0, 0x20, 0x20, 0x11); + CopyBgTilemapBufferToVram(1); + gMain.state++; + break; + case 4: + { + const struct CompressedSpritePalette* pokePal; + u32 TiD = GetMonData(Mon, MON_DATA_OT_ID); + u32 PiD = GetMonData(Mon, MON_DATA_PERSONALITY); + DecompressPicFromTable_2(&gMonFrontPicTable[postEvoSpecies], + gMonSpritesGfxPtr->sprites[3], + postEvoSpecies); + pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, TiD, PiD); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + gMain.state++; + } + break; + case 5: + { + u8 ID; + + sub_806A068(postEvoSpecies, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gMain.state++; + sub_807B154(); + } + break; + case 6: + if (gLinkVSyncDisabled) + { + sub_800E0E8(); + sub_800DFB4(0, 0); + } + BlendPalettes(-1,0x10, 0); + gMain.state++; + break; + case 7: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + sub_807B140(); + ShowBg(0); + ShowBg(1); + SetMainCallback2(CB2_TradeEvolutionSceneUpdate); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_1D_MAP); + break; + } +} + +void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID) +{ + u8 name[20]; + u16 currSpecies; + u32 TiD, PiD; + const struct CompressedSpritePalette* pokePal; + u8 ID; + + GetMonData(mon, MON_DATA_NICKNAME, name); + StringCopy10(gStringVar1, name); + StringCopy(gStringVar2, gSpeciesNames[speciesToEvolve]); + + gAffineAnimsDisabled = TRUE; + + // preEvo sprite + currSpecies = GetMonData(mon, MON_DATA_SPECIES); + PiD = GetMonData(mon, MON_DATA_PERSONALITY); + TiD = GetMonData(mon, MON_DATA_OT_ID); + + sEvoStructPtr = AllocZeroed(sizeof(struct EvoInfo)); + sEvoStructPtr->preEvoSpriteID = preEvoSpriteID; + + DecompressPicFromTable_2(&gMonFrontPicTable[speciesToEvolve], + gMonSpritesGfxPtr->sprites[1], + speciesToEvolve); + + pokePal = GetMonSpritePalStructFromOtIdPersonality(speciesToEvolve, TiD, PiD); + LoadCompressedPalette(pokePal->data, 0x120, 0x20); + + sub_806A068(speciesToEvolve, 1); + gUnknown_0202499C.affineAnims = gDummySpriteAffineAnimTable; + sEvoStructPtr->postEvoSpriteID = ID = CreateSprite(&gUnknown_0202499C, 120, 64, 30); + + gSprites[ID].callback = SpriteCallbackDummy_2; + gSprites[ID].oam.paletteNum = 2; + gSprites[ID].invisible = 1; + + LoadEvoSparkleSpriteAndPal(); + + sEvoStructPtr->evoTaskID = ID = CreateTask(Task_TradeEvolutionScene, 0); + gTasks[ID].tState = 0; + gTasks[ID].tPreEvoSpecies = currSpecies; + gTasks[ID].tPostEvoSpecies = speciesToEvolve; + gTasks[ID].tLearnsFirstMove = TRUE; + gTasks[ID].tEvoWasStopped = FALSE; + gTasks[ID].tPartyID = partyID; + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 256; + gBattle_BG3_Y = 0; + + gTextFlags.flag_1 = 1; + + SetVBlankCallback(VBlankCB_TradeEvolutionScene); + SetMainCallback2(CB2_TradeEvolutionSceneUpdate); +} + +static void CB2_EvolutionSceneUpdate(void) +{ + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); + RunTasks(); +} + +static void CB2_TradeEvolutionSceneUpdate(void) +{ + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); + RunTasks(); +} + +static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) +{ + u32 data = 0; + if (gEvolutionTable[preEvoSpecies].evolutions[0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < 6) + { + s32 i; + struct Pokemon* Shedinja = &gPlayerParty[gPlayerPartyCount]; + const struct EvolutionData* EvoTable; + const struct EvolutionData* Evos; + + CopyMon(&gPlayerParty[gPlayerPartyCount], mon, sizeof(struct Pokemon)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_SPECIES, (&gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_NICKNAME, (gSpeciesNames[gEvolutionTable[preEvoSpecies].evolutions[1].targetSpecies])); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_HELD_ITEM, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, (&data)); + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_10, (&data)); + + for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + 5; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); + for (i = MON_DATA_CHAMPION_RIBBON; i <= MON_DATA_FATEFUL_ENCOUNTER; i++) + SetMonData(&gPlayerParty[gPlayerPartyCount], i, (&data)); + + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_STATUS, (&data)); + data = 0xFF; + SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MAIL, (&data)); + + CalculateMonStats(&gPlayerParty[gPlayerPartyCount]); + CalculatePlayerPartyCount(); + + // can't match it otherwise, ehh + EvoTable = gEvolutionTable; + Evos = EvoTable + preEvoSpecies; + GetSetPokedexFlag(SpeciesToNationalPokedexNum(Evos->evolutions[1].targetSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(Evos->evolutions[1].targetSpecies), FLAG_SET_CAUGHT); + + if (GetMonData(Shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA + && GetMonData(Shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE + && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK) + SetMonData(Shedinja, MON_DATA_NICKNAME, gUnknown_085B58C4); + } +} + +static void Task_EvolutionScene(u8 taskID) +{ + u32 var; + struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + + // check if B Button was held, so the evolution gets stopped + if (gMain.heldKeys == B_BUTTON + && gTasks[taskID].tState == 8 + && gTasks[sEvoGraphicsTaskID].isActive + && gTasks[taskID].tBits & TASK_BIT_CAN_STOP) + { + gTasks[taskID].tState = 17; + gTasks[sEvoGraphicsTaskID].EvoGraphicsTaskEvoStop = TRUE; + sub_8140134(); + return; + } + + switch (gTasks[taskID].tState) + { + case 0: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + gSprites[sEvoStructPtr->preEvoSpriteID].invisible = 0; + gTasks[taskID].tState++; + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + break; + case 1: // print 'whoa, poke is evolving!!!' msg + if (!gPaletteFade.active) + { + StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); + BattleHandleAddTextPrinter(gStringVar4, 0); + gTasks[taskID].tState++; + } + break; + case 2: // wait for string, animate mon(and play its cry) + if (!IsTextPrinterActive(0)) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 3: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) // wait for animation, play tu du SE + { + PlaySE(BGM_ME_SHINKA); + gTasks[taskID].tState++; + } + break; + case 4: // play evolution music and fade screen black + if (!IsSEPlaying()) + { + PlayNewMapMusic(BGM_SHINKA); + gTasks[taskID].tState++; + BeginNormalPaletteFade(0x1C, 4, 0, 0x10, 0); + } + break; + case 5: // launch moving bg task, preapre evo sparkles + if (!gPaletteFade.active) + { + InitMovingBackgroundTask(FALSE); + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(17); + gTasks[taskID].tState++; + } + break; + case 6: // another set of evo sparkles + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + gTasks[taskID].tState++; + sEvoStructPtr->field_3 = 1; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + } + break; + case 7: // launch task that flashes pre evo with post evo sprites + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); + gTasks[taskID].tState++; + } + break; + case 8: // wait for the above task to finish + if (--sEvoStructPtr->field_3 == 0) + { + sEvoStructPtr->field_3 = 3; + if (!gTasks[sEvoGraphicsTaskID].isActive) + gTasks[taskID].tState++; + } + break; + case 9: // post evo sparkles + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); + gTasks[taskID].tState++; + break; + case 10: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash(gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 11: // play tu du sound after evolution + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + PlaySE(SE_EXP); + gTasks[taskID].tState++; + } + break; + case 12: // stop music, return screen to pre-fade state + if (IsSEPlaying()) + { + m4aMPlayAllStop(); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); + sub_8140174(); + BeginNormalPaletteFade(0x1C, 0, 0x10, 0, 0); + gTasks[taskID].tState++; + } + break; + case 13: // animate mon + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 14: // congratulations string and rename prompt + if (IsCryFinished()) + { + StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); + BattleHandleAddTextPrinter(gStringVar4, 0); + PlayBGM(BGM_FANFA5); + gTasks[taskID].tState++; + SetMonData(mon, MON_DATA_SPECIES, (void*)(&gTasks[taskID].tPostEvoSpecies)); + CalculateMonStats(mon); + EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); + } + break; + case 15: // check if it wants to learn a new move + if (!IsTextPrinterActive(0)) + { + var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); + if (var != 0 && !gTasks[taskID].tEvoWasStopped) + { + u8 text[20]; + + if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + { + StopMapMusic(); + sub_8085784(); + } + + gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskID].tLearnsFirstMove = FALSE; + gTasks[taskID].tLearnMoveState = 0; + GetMonData(mon, MON_DATA_NICKNAME, text); + StringCopy10(gBattleTextBuff1, text); + + if (var == 0xFFFF) // no place to learn it + gTasks[taskID].tState = 22; + else if (var == 0xFFFE) // it already knows that move + break; + else + gTasks[taskID].tState = 20; // has less than 4 moves, so it's been learned + } + else // no move to learn + { + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskID].tState++; + } + } + break; + case 16: // task has finished, return + if (!gPaletteFade.active) + { + if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE)) + { + StopMapMusic(); + sub_8085784(); + } + if (!gTasks[taskID].tEvoWasStopped) + CreateShedinja(gTasks[taskID].tPreEvoSpecies, mon); + + DestroyTask(taskID); + FreeMonSpritesGfx(); + Free(sEvoStructPtr); + sEvoStructPtr = NULL; + FreeAllWindowBuffers(); + SetMainCallback2(gCB2_AfterEvolution); + } + break; + case 17: // evolution has been canceled, stop music and re-fade palette + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + m4aMPlayAllStop(); + BeginNormalPaletteFade(0x6001C, 0, 0x10, 0, 0x7FFF); + gTasks[taskID].tState++; + } + break; + case 18: // animate pokemon trying to evolve again, evolution has been stopped + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 19: // after the animation, print the string 'WHOA IT DID NOT EVOLVE!!!' + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + { + if (gTasks[taskID].tEvoWasStopped) + StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); + else // Fire Red leftover probably + StringExpandPlaceholders(gStringVar4, gText_PkmnStoppedEvolving); + + BattleHandleAddTextPrinter(gStringVar4, 0); + gTasks[taskID].tEvoWasStopped = TRUE; + gTasks[taskID].tState = 15; + } + break; + case 20: // pokemon learned a new move, print string and play a fanfare + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + PlayFanfare(BGM_FANFA1); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskID].tState++; + } + break; + case 21: // wait a bit and check if can learn another move + if (!IsTextPrinterActive(0) && !IsSEPlaying() && --gTasks[taskID].tLearnsFirstMove == 0) + gTasks[taskID].tState = 15; + break; + case 22: // try to learn a new move + switch (gTasks[taskID].tLearnMoveState) + { + case 0: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 1: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 2: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tData7 = 5; + gTasks[taskID].tData8 = 10; + gTasks[taskID].tLearnMoveState++; + } + case 3: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 0); + BattleHandleAddTextPrinter(gText_BattleYesNoChoice, 0xC); + gTasks[taskID].tLearnMoveState++; + sEvoCursorPos = 0; + BattleCreateYesNoCursorAt(0); + } + break; + case 4: + if (gMain.newKeys & DPAD_UP && sEvoCursorPos != 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(sEvoCursorPos); + sEvoCursorPos = 0; + BattleCreateYesNoCursorAt(0); + } + if (gMain.newKeys & DPAD_DOWN && sEvoCursorPos == 0) + { + PlaySE(SE_SELECT); + BattleDestroyYesNoCursorAt(sEvoCursorPos); + sEvoCursorPos = 1; + BattleCreateYesNoCursorAt(1); + } + if (gMain.newKeys & A_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); + PlaySE(SE_SELECT); + + if (sEvoCursorPos != 0) + { + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + } + else + { + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; + if (gTasks[taskID].tLearnMoveState == 5) + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + } + } + if (gMain.newKeys & B_BUTTON) + { + HandleBattleWindow(0x18, 8, 0x1D, 0xD, 1); + PlaySE(SE_SELECT); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + } + break; + case 5: + if (!gPaletteFade.active) + { + FreeAllWindowBuffers(); + sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + gPlayerPartyCount - 1, CB2_EvolutionSceneLoadGraphics, + gMoveToLearn); + gTasks[taskID].tLearnMoveState++; + } + break; + case 6: + if (!gPaletteFade.active && gMain.callback2 == CB2_EvolutionSceneUpdate) + { + var = sub_81C1B94(); // moveID + if (var == 4) + { + gTasks[taskID].tLearnMoveState = 10; + } + else + { + u16 move = GetMonData(mon, var + MON_DATA_MOVE1); + if (IsHMMove2(move)) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState = 12; + } + else + { + PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) + + RemoveMonPPBonus(mon, var); + SetMonMoveSlot(mon, gMoveToLearn, var); + gTasks[taskID].tLearnMoveState++; + } + } + } + break; + case 7: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + break; + case 8: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tLearnMoveState++; + } + break; + case 9: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tState = 20; + } + break; + case 10: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tData7 = 11; + gTasks[taskID].tData8 = 0; + gTasks[taskID].tLearnMoveState = 3; + break; + case 11: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); + gTasks[taskID].tState = 15; + break; + case 12: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + gTasks[taskID].tLearnMoveState = 5; + break; + } + break; + } +} + +static void Task_TradeEvolutionScene(u8 taskID) +{ + u32 var = 0; + struct Pokemon* mon = &gPlayerParty[gTasks[taskID].tPartyID]; + + switch (gTasks[taskID].tState) + { + case 0: + StringExpandPlaceholders(gStringVar4, gText_PkmnIsEvolving); + sub_807F1A8(0, gStringVar4, 1); + gTasks[taskID].tState++; + break; + case 1: + if (!IsTextPrinterActive(0)) + { + PlayCry1(gTasks[taskID].tPreEvoSpecies, 0); + gTasks[taskID].tState++; + } + break; + case 2: + if (IsCryFinished()) + { + m4aSongNumStop(BGM_SHINKA); + PlaySE(BGM_ME_SHINKA); + gTasks[taskID].tState++; + } + break; + case 3: + if (!IsSEPlaying()) + { + PlayBGM(BGM_SHINKA); + gTasks[taskID].tState++; + BeginNormalPaletteFade(0x1C, 4, 0, 0x10, 0); + } + break; + case 4: + if (!gPaletteFade.active) + { + InitMovingBackgroundTask(TRUE); + var = gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet1(var); + gTasks[taskID].tState++; + SetGpuReg(REG_OFFSET_BG3CNT, 0x603); + } + break; + case 5: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + gTasks[taskID].tState++; + sEvoStructPtr->field_3 = 1; + sEvoGraphicsTaskID = LaunchTask_PreEvoSparklesSet2(); + } + break; + case 6: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = sub_817C3A0(sEvoStructPtr->preEvoSpriteID, sEvoStructPtr->postEvoSpriteID); + gTasks[taskID].tState++; + } + break; + case 7: + if (--sEvoStructPtr->field_3 == 0) + { + sEvoStructPtr->field_3 = 3; + if (!gTasks[sEvoGraphicsTaskID].isActive) + gTasks[taskID].tState++; + } + break; + case 8: + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet1(); + gTasks[taskID].tState++; + break; + case 9: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + sEvoGraphicsTaskID = LaunchTask_PostEvoSparklesSet2AndFlash_Trade(gTasks[taskID].tPostEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 10: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + PlaySE(SE_EXP); + gTasks[taskID].tState++; + } + break; + case 11: + if (IsSEPlaying()) + { + Free(sEvoMovingBgPtr); + EvoScene_DoMonAnimation(sEvoStructPtr->postEvoSpriteID, gTasks[taskID].tPostEvoSpecies); + memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, 0x60); + gTasks[taskID].tState++; + } + break; + case 12: + if (IsCryFinished()) + { + StringExpandPlaceholders(gStringVar4, gText_CongratsPkmnEvolved); + sub_807F1A8(0, gStringVar4, 1); + PlayFanfare(BGM_FANFA5); + gTasks[taskID].tState++; + SetMonData(mon, MON_DATA_SPECIES, (&gTasks[taskID].tPostEvoSpecies)); + CalculateMonStats(mon); + EvolutionRenameMon(mon, gTasks[taskID].tPreEvoSpecies, gTasks[taskID].tPostEvoSpecies); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_SEEN); + GetSetPokedexFlag(SpeciesToNationalPokedexNum(gTasks[taskID].tPostEvoSpecies), FLAG_SET_CAUGHT); + IncrementGameStat(GAME_STAT_EVOLVED_POKEMON); + } + break; + case 13: + if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE) + { + var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); + if (var != 0 && !gTasks[taskID].tEvoWasStopped) + { + u8 text[20]; + + gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE; + gTasks[taskID].tLearnsFirstMove = FALSE; + gTasks[taskID].tLearnMoveState = 0; + GetMonData(mon, MON_DATA_NICKNAME, text); + StringCopy10(gBattleTextBuff1, text); + + if (var == 0xFFFF) + gTasks[taskID].tState = 20; + else if (var == 0xFFFE) + break; + else + gTasks[taskID].tState = 18; + } + else + { + PlayBGM(BGM_SHINKA); + sub_807F1A8(0, gText_CommunicationStandby5, 1); + gTasks[taskID].tState++; + } + } + break; + case 14: + if (!IsTextPrinterActive(0)) + { + DestroyTask(taskID); + Free(sEvoStructPtr); + sEvoStructPtr = NULL; + gTextFlags.flag_1 = 0; + SetMainCallback2(gCB2_AfterEvolution); + } + break; + case 15: + if (!gTasks[sEvoGraphicsTaskID].isActive) + { + m4aMPlayAllStop(); + BeginNormalPaletteFade((1 << (gSprites[sEvoStructPtr->preEvoSpriteID].oam.paletteNum + 16)) | (0x4001C), 0, 0x10, 0, 0x7FFF); + gTasks[taskID].tState++; + } + break; + case 16: + if (!gPaletteFade.active) + { + EvoScene_DoMonAnimation(sEvoStructPtr->preEvoSpriteID, gTasks[taskID].tPreEvoSpecies); + gTasks[taskID].tState++; + } + break; + case 17: + if (EvoScene_IsMonAnimFinished(sEvoStructPtr->preEvoSpriteID)) + { + StringExpandPlaceholders(gStringVar4, gText_EllipsisQuestionMark); + sub_807F1A8(0, gStringVar4, 1); + gTasks[taskID].tEvoWasStopped = 1; + gTasks[taskID].tState = 13; + } + break; + case 18: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + PlayFanfare(BGM_FANFA1); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter + gTasks[taskID].tState++; + } + break; + case 19: + if (!IsTextPrinterActive(0) && IsFanfareTaskInactive() == TRUE && --gTasks[taskID].tLearnsFirstMove == 0) + gTasks[taskID].tState = 13; + break; + case 20: + switch (gTasks[taskID].tLearnMoveState) + { + case 0: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BufferMoveToLearnIntoBattleTextBuff2(); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 1: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 2: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tData7 = 5; + gTasks[taskID].tData8 = 9; + gTasks[taskID].tLearnMoveState++; + } + case 3: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + sub_809882C(0, 0xA8, 0xE0); + CreateYesNoMenu(&gUnknown_0833900C, 0xA8, 0xE, 0); + sEvoCursorPos = 0; + gTasks[taskID].tLearnMoveState++; + sEvoCursorPos = 0; + } + break; + case 4: + switch (sub_8198C58()) + { + case 0: + sEvoCursorPos = 0; + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; + if (gTasks[taskID].tLearnMoveState == 5) + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + break; + case 1: + case -1: + sEvoCursorPos = 1; + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; + break; + } + break; + case 5: + if (!gPaletteFade.active) + { + if (gLinkVSyncDisabled) + sub_800E084(); + + Free(GetBgTilemapBuffer(3)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(0)); + FreeAllWindowBuffers(); + + sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + gPlayerPartyCount - 1, CB2_TradeEvolutionSceneLoadGraphics, + gMoveToLearn); + gTasks[taskID].tLearnMoveState++; + } + break; + case 6: + if (!gPaletteFade.active && gMain.callback2 == CB2_TradeEvolutionSceneUpdate) + { + var = sub_81C1B94(); // moveID + if (var == 4) + { + gTasks[taskID].tLearnMoveState = 9; + } + else + { + u16 move = GetMonData(mon, var + MON_DATA_MOVE1); + if (IsHMMove2(move)) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState = 11; + } + else + { + PREPARE_MOVE_BUFFER(gBattleTextBuff2, move) + + RemoveMonPPBonus(mon, var); + SetMonMoveSlot(mon, gMoveToLearn, var); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + } + } + break; + case 7: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tLearnMoveState++; + } + break; + case 8: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + { + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tState = 18; + } + break; + case 9: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tData7 = 10; + gTasks[taskID].tData8 = 0; + gTasks[taskID].tLearnMoveState = 3; + break; + case 10: + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + sub_807F1A8(0, gDisplayedStringBattle, 1); + gTasks[taskID].tState = 13; + break; + case 11: + if (!IsTextPrinterActive(0) && !IsSEPlaying()) + gTasks[taskID].tLearnMoveState = 5; + break; + } + break; + } +} + +#undef tState +#undef tPreEvoSpecies +#undef tPostEvoSpecies +#undef tCanStop +#undef tBits +#undef tLearnsFirstMove +#undef tLearnMoveState +#undef tData7 +#undef tData8 +#undef tEvoWasStopped +#undef tPartyID + +static void EvoDummyFunc(void) +{ +} + +static void VBlankCB_EvolutionScene(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_80BA0A8(); +} + +static void VBlankCB_TradeEvolutionScene(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_80BA0A8(); +} + +static void sub_813FDEC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (data[6] != 0) + return; + if (data[5]++ < 20) + return; + + if (data[0]++ > gUnknown_085B58C9[data[2]][3]) + { + if (gUnknown_085B58C9[data[2]][1] == data[1]) + { + data[3]++; + if (data[3] == gUnknown_085B58C9[data[2]][2]) + { + data[3] = 0; + data[2]++; + } + data[1] = gUnknown_085B58C9[data[2]][0]; + } + else + { + LoadPalette(&sEvoMovingBgPtr[data[1] * 16], 0xA0, 0x20); + data[0] = 0; + data[1]++; + } + } + + if (data[2] == 4) + DestroyTask(taskId); +} + +static void sub_813FEA4(bool8 isLink) +{ + u8 taskId = CreateTask(sub_813FEE8, 7); + + if (!isLink) + gTasks[taskId].data[2] = 0; + else + gTasks[taskId].data[2] = 1; +} + +static void sub_813FEE8(u8 taskId) +{ + u16 *outer_X, *outer_Y; + + u16 *inner_X = &gBattle_BG1_X; + u16 *inner_Y = &gBattle_BG1_Y; + + if (!gTasks[taskId].data[2]) + { + outer_X = &gBattle_BG2_X; + outer_Y = &gBattle_BG2_Y; + } + else + { + outer_X = &gBattle_BG3_X; + outer_Y = &gBattle_BG3_Y; + } + + gTasks[taskId].data[0] = (gTasks[taskId].data[0] + 5) & 0xFF; + gTasks[taskId].data[1] = (gTasks[taskId].data[0] + 0x80) & 0xFF; + + *inner_X = Cos(gTasks[taskId].data[0], 4) + 8; + *inner_Y = Sin(gTasks[taskId].data[0], 4) + 16; + + *outer_X = Cos(gTasks[taskId].data[1], 4) + 8; + *outer_Y = Sin(gTasks[taskId].data[1], 4) + 16; + + if (!FuncIsActiveTask(sub_813FDEC)) + { + DestroyTask(taskId); + + *inner_X = 0; + *inner_Y = 0; + + *outer_X = 256; + *outer_Y = 0; + } +} + +static void InitMovingBgValues(u16 *movingBgs) +{ + s32 i, j; + + for (i = 0; i < 50; i++) + { + for (j = 0; j < 16; j++) + { + movingBgs[i * 16 + j] = gUnknown_085B5884[gUnknown_085B58D9[i * 16 + j]]; + } + } +} + +static void InitMovingBackgroundTask(bool8 isLink) +{ + u8 innerBgId, outerBgId; + + sEvoMovingBgPtr = AllocZeroed(0x640); + InitMovingBgValues(sEvoMovingBgPtr); + + if (!isLink) + innerBgId = 1, outerBgId = 2; + else + innerBgId = 1, outerBgId = 3; + + LoadPalette(gUnknown_085B51E4, 0xA0, 0x20); + + copy_decompressed_tile_data_to_vram_autofree(1, gUnknown_085B4134, FALSE, 0, 0); + CopyToBgTilemapBuffer(1, gUnknown_085B482C, 0, 0); + CopyToBgTilemapBuffer(outerBgId, gUnknown_085B4D10, 0, 0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(outerBgId); + + if (!isLink) + { + SetGpuReg(REG_OFFSET_BLDCNT, 0x442); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x808); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG2_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + + SetBgAttribute(innerBgId, BG_CTRL_ATTR_MOSAIC, 2); + SetBgAttribute(outerBgId, BG_CTRL_ATTR_MOSAIC, 2); + + ShowBg(1); + ShowBg(2); + } + else + { + SetGpuReg(REG_OFFSET_BLDCNT, 0x842); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x808); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG1_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + } + + CreateTask(sub_813FDEC, 5); + sub_813FEA4(isLink); +} + +static void sub_8140100(void) // unused +{ + u8 taskId = FindTaskIdByFunc(sub_813FDEC); + + if (taskId != 0xFF) + gTasks[taskId].data[6] = 1; + + FillPalette(0, 0xA0, 0x20); +} + +static void sub_8140134(void) +{ + u8 taskId; + + if ((taskId = FindTaskIdByFunc(sub_813FDEC)) != 0xFF) + DestroyTask(taskId); + if ((taskId = FindTaskIdByFunc(sub_813FEE8)) != 0xFF) + DestroyTask(taskId); + + FillPalette(0, 0xA0, 0x20); + sub_8140174(); +} + +static void sub_8140174(void) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0); + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + SetBgAttribute(1, BG_CTRL_ATTR_MOSAIC, sub_80391E0(1, 5)); + SetBgAttribute(2, BG_CTRL_ATTR_MOSAIC, sub_80391E0(2, 5)); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP); + Free(sEvoMovingBgPtr); +} + +static void EvoScene_DoMonAnimation(u8 monSpriteId, u16 speciesId) +{ + DoMonFrontSpriteAnimation(&gSprites[monSpriteId], speciesId, FALSE, 0); +} + +static bool32 EvoScene_IsMonAnimFinished(u8 monSpriteId) +{ + if (gSprites[monSpriteId].callback == SpriteCallbackDummy) + return TRUE; + + return FALSE; +} diff --git a/sym_common.txt b/sym_common.txt index 85b508403..9369020c8 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -370,7 +370,7 @@ gUnknown_030061C4: @ 30061C4 gUnknown_030061D0: @ 30061D0 .space 0x18 -gUnknown_030061E8: @ 30061E8 +gCB2_AfterEvolution: @ 30061E8 .space 0x4 gUnknown_030061EC: @ 30061EC diff --git a/sym_ewram.txt b/sym_ewram.txt index 32189b126..776245161 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1280,11 +1280,7 @@ gUnknown_0203AB78: @ 203AB78 gUnknown_0203AB7C: @ 203AB7C .space 0x4 -gEvoStructPtr: @ 203AB80 - .space 0x4 - -gUnknown_0203AB84: @ 203AB84 - .space 0x4 + .include "src/evolution_scene.o" gUnknown_0203AB88: @ 203AB88 .space 0x4