From ba176dfe0729e8c8c46a8f79c2f1b6e732ee13c8 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 1 Jan 2018 17:41:34 +0100 Subject: [PATCH 1/7] start working on battle transition --- asm/battle_transition.s | 455 ++++++++++-------------------------- asm/overworld.s | 18 +- asm/unk_transition.s | 308 ++++++++++++++++++++++-- asm/unk_transition_2.s | 268 --------------------- data/battle_transition.s | 257 -------------------- include/battle_transition.h | 2 + include/overworld.h | 2 + include/unk_transition.h | 13 ++ ld_script.txt | 3 +- src/battle_transition.c | 287 +++++++++++++++++++++++ sym_bss.txt | 11 +- sym_ewram.txt | 5 +- 12 files changed, 730 insertions(+), 899 deletions(-) delete mode 100755 asm/unk_transition_2.s create mode 100644 include/unk_transition.h create mode 100644 src/battle_transition.c diff --git a/asm/battle_transition.s b/asm/battle_transition.s index d7f6b9e03..45c62656a 100644 --- a/asm/battle_transition.s +++ b/asm/battle_transition.s @@ -4,210 +4,9 @@ .syntax unified .text - - thumb_func_start CB2_TestBattleTransition -CB2_TestBattleTransition: @ 8145E84 - push {r4,lr} - ldr r4, =sTestingTransitionState - ldrb r0, [r4] - cmp r0, 0 - beq _08145E98 - cmp r0, 0x1 - beq _08145EAC - b _08145EC0 - .pool -_08145E98: - ldr r0, =sTestingTransitionId - ldrb r0, [r0] - bl LaunchBattleTransitionTask - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08145EC0 - .pool -_08145EAC: - bl IsBattleTransitionDone - lsls r0, 24 - cmp r0, 0 - beq _08145EC0 - movs r0, 0 - strb r0, [r4] - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 -_08145EC0: - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end CB2_TestBattleTransition - thumb_func_start TestBattleTransition -TestBattleTransition: @ 8145EDC - push {lr} - ldr r1, =sTestingTransitionId - strb r0, [r1] - ldr r0, =CB2_TestBattleTransition - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end TestBattleTransition - - thumb_func_start BattleTransition_StartOnField -BattleTransition_StartOnField: @ 8145EF4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gMain - ldr r1, =sub_8085E50 - str r1, [r2, 0x4] - bl LaunchBattleTransitionTask - pop {r0} - bx r0 - .pool - thumb_func_end BattleTransition_StartOnField - - thumb_func_start BattleTransition_Start -BattleTransition_Start: @ 8145F10 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl LaunchBattleTransitionTask - pop {r0} - bx r0 - thumb_func_end BattleTransition_Start - - thumb_func_start IsBattleTransitionDone -IsBattleTransitionDone: @ 8145F20 - push {r4,lr} - ldr r0, =Task_BattleTransitionMain - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r0, r1 - movs r1, 0x26 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08145F4C - movs r0, 0 - b _08145F60 - .pool -_08145F4C: - adds r0, r2, 0 - bl DestroyTask - ldr r4, =sTransitionStructPtr - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - movs r0, 0x1 -_08145F60: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end IsBattleTransitionDone - - thumb_func_start LaunchBattleTransitionTask -LaunchBattleTransitionTask: @ 8145F6C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =Task_BattleTransitionMain - movs r1, 0x2 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xA] - ldr r4, =sTransitionStructPtr - movs r0, 0x3C - bl AllocZeroed - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end LaunchBattleTransitionTask - - thumb_func_start Task_BattleTransitionMain -Task_BattleTransitionMain: @ 8145FA8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sMainTransitionPhases - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08145FBA: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08145FBA - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Task_BattleTransitionMain - - thumb_func_start sub_8145FE0 -sub_8145FE0: @ 8145FE0 - push {r4,lr} - adds r4, r0, 0 - bl sub_80AC3D0 - ldr r0, =gPlttBufferFaded - ldr r1, =gPlttBufferUnfaded - ldr r2, =0x04000100 - bl CpuSet - ldr r1, =sPhase1_Tasks - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bne _0814601C - movs r0, 0x2 - strh r0, [r4, 0x8] - movs r0, 0x1 - b _0814602A - .pool -_0814601C: - movs r1, 0x4 - bl CreateTask - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 -_0814602A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8145FE0 - - thumb_func_start sub_8146030 -sub_8146030: @ 8146030 + thumb_func_start Transition_WaitForPhase1 +Transition_WaitForPhase1: @ 8146030 push {r4,lr} adds r4, r0, 0 ldr r1, =sPhase1_Tasks @@ -233,10 +32,10 @@ _0814605C: pop {r4} pop {r1} bx r1 - thumb_func_end sub_8146030 + thumb_func_end Transition_WaitForPhase1 - thumb_func_start sub_8146064 -sub_8146064: @ 8146064 + thumb_func_start Transition_Phase2 +Transition_Phase2: @ 8146064 push {r4,lr} adds r4, r0, 0 ldr r1, =sPhase2_Tasks @@ -255,10 +54,10 @@ sub_8146064: @ 8146064 pop {r1} bx r1 .pool - thumb_func_end sub_8146064 + thumb_func_end Transition_Phase2 - thumb_func_start sub_814608C -sub_814608C: @ 814608C + thumb_func_start Transition_WaitForPhase2 +Transition_WaitForPhase2: @ 814608C push {r4,lr} adds r4, r0, 0 movs r0, 0 @@ -282,10 +81,10 @@ _081460B0: pop {r1} bx r1 .pool - thumb_func_end sub_814608C + thumb_func_end Transition_WaitForPhase2 - thumb_func_start sub_81460BC -sub_81460BC: @ 81460BC + thumb_func_start Phase1Task_TransitionAll +Phase1Task_TransitionAll: @ 81460BC push {r4,lr} sub sp, 0x4 lsls r0, 24 @@ -324,10 +123,10 @@ _08146104: pop {r4} pop {r0} bx r0 - thumb_func_end sub_81460BC + thumb_func_end Phase1Task_TransitionAll - thumb_func_start sub_814610C -sub_814610C: @ 814610C + thumb_func_start Phase2Task_Transition_Blur +Phase2Task_Transition_Blur: @ 814610C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -352,7 +151,7 @@ _0814611E: pop {r0} bx r0 .pool - thumb_func_end sub_814610C + thumb_func_end Phase2Task_Transition_Blur thumb_func_start sub_8146144 sub_8146144: @ 8146144 @@ -441,7 +240,7 @@ sub_81461D8: @ 81461D8 ands r0, r1 cmp r0, 0 bne _081461F4 - ldr r0, =sub_814610C + ldr r0, =Phase2Task_Transition_Blur bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -453,8 +252,8 @@ _081461F4: .pool thumb_func_end sub_81461D8 - thumb_func_start sub_8146204 -sub_8146204: @ 8146204 + thumb_func_start Phase2Task_Transition_Swirl +Phase2Task_Transition_Swirl: @ 8146204 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -479,7 +278,7 @@ _08146216: pop {r0} bx r0 .pool - thumb_func_end sub_8146204 + thumb_func_end Phase2Task_Transition_Swirl thumb_func_start sub_814623C sub_814623C: @ 814623C @@ -559,7 +358,7 @@ sub_81462A8: @ 81462A8 ands r0, r1 cmp r0, 0 bne _081462FA - ldr r0, =sub_8146204 + ldr r0, =Phase2Task_Transition_Swirl bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -624,8 +423,8 @@ sub_8146358: @ 8146358 .pool thumb_func_end sub_8146358 - thumb_func_start sub_8146384 -sub_8146384: @ 8146384 + thumb_func_start Phase2Task_Transition_Shuffle +Phase2Task_Transition_Shuffle: @ 8146384 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -650,7 +449,7 @@ _08146396: pop {r0} bx r0 .pool - thumb_func_end sub_8146384 + thumb_func_end Phase2Task_Transition_Shuffle thumb_func_start sub_81463BC sub_81463BC: @ 81463BC @@ -742,7 +541,7 @@ _08146448: ands r0, r1 cmp r0, 0 bne _0814648E - ldr r0, =sub_8146384 + ldr r0, =Phase2Task_Transition_Shuffle bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -806,8 +605,8 @@ sub_81464E8: @ 81464E8 .pool thumb_func_end sub_81464E8 - thumb_func_start sub_8146514 -sub_8146514: @ 8146514 + thumb_func_start Phase2Task_Transition_BigPokeball +Phase2Task_Transition_BigPokeball: @ 8146514 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -832,10 +631,10 @@ _08146526: pop {r0} bx r0 .pool - thumb_func_end sub_8146514 + thumb_func_end Phase2Task_Transition_BigPokeball - thumb_func_start sub_814654C -sub_814654C: @ 814654C + thumb_func_start Phase2Task_Transition_Aqua +Phase2Task_Transition_Aqua: @ 814654C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -860,10 +659,10 @@ _0814655E: pop {r0} bx r0 .pool - thumb_func_end sub_814654C + thumb_func_end Phase2Task_Transition_Aqua - thumb_func_start sub_8146584 -sub_8146584: @ 8146584 + thumb_func_start Phase2Task_Transition_Magma +Phase2Task_Transition_Magma: @ 8146584 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -888,10 +687,10 @@ _08146596: pop {r0} bx r0 .pool - thumb_func_end sub_8146584 + thumb_func_end Phase2Task_Transition_Magma - thumb_func_start sub_81465BC -sub_81465BC: @ 81465BC + thumb_func_start Phase2Task_Transition_Regice +Phase2Task_Transition_Regice: @ 81465BC push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -916,10 +715,10 @@ _081465CE: pop {r0} bx r0 .pool - thumb_func_end sub_81465BC + thumb_func_end Phase2Task_Transition_Regice - thumb_func_start sub_81465F4 -sub_81465F4: @ 81465F4 + thumb_func_start Phase2Task_Transition_Registeel +Phase2Task_Transition_Registeel: @ 81465F4 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -944,10 +743,10 @@ _08146606: pop {r0} bx r0 .pool - thumb_func_end sub_81465F4 + thumb_func_end Phase2Task_Transition_Registeel - thumb_func_start sub_814662C -sub_814662C: @ 814662C + thumb_func_start Phase2Task_Transition_Regirock +Phase2Task_Transition_Regirock: @ 814662C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -972,10 +771,10 @@ _0814663E: pop {r0} bx r0 .pool - thumb_func_end sub_814662C + thumb_func_end Phase2Task_Transition_Regirock - thumb_func_start sub_8146664 -sub_8146664: @ 8146664 + thumb_func_start Phase2Task_Transition_Kyogre +Phase2Task_Transition_Kyogre: @ 8146664 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -1000,7 +799,7 @@ _08146676: pop {r0} bx r0 .pool - thumb_func_end sub_8146664 + thumb_func_end Phase2Task_Transition_Kyogre thumb_func_start sub_814669C sub_814669C: @ 814669C @@ -2069,8 +1868,8 @@ sub_8146F68: @ 8146F68 .pool thumb_func_end sub_8146F68 - thumb_func_start sub_8146F94 -sub_8146F94: @ 8146F94 + thumb_func_start Phase2Task_Transition_PokeballsTrail +Phase2Task_Transition_PokeballsTrail: @ 8146F94 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -2095,7 +1894,7 @@ _08146FA6: pop {r0} bx r0 .pool - thumb_func_end sub_8146F94 + thumb_func_end Phase2Task_Transition_PokeballsTrail thumb_func_start sub_8146FCC sub_8146FCC: @ 8146FCC @@ -2205,7 +2004,7 @@ sub_81470A4: @ 81470A4 cmp r0, 0 bne _081470C4 bl sub_8149F84 - ldr r0, =sub_8146F94 + ldr r0, =Phase2Task_Transition_PokeballsTrail bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -2365,8 +2164,8 @@ _081471F2: .pool thumb_func_end sub_814713C - thumb_func_start sub_8147204 -sub_8147204: @ 8147204 + thumb_func_start Phase2Task_Transition_Clockwise_BlackFade +Phase2Task_Transition_Clockwise_BlackFade: @ 8147204 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -2391,7 +2190,7 @@ _08147216: pop {r0} bx r0 .pool - thumb_func_end sub_8147204 + thumb_func_end Phase2Task_Transition_Clockwise_BlackFade thumb_func_start sub_814723C sub_814723C: @ 814723C @@ -2923,7 +2722,7 @@ sub_8147648: @ 8147648 strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] bl sub_8149F84 - ldr r0, =sub_8147204 + ldr r0, =Phase2Task_Transition_Clockwise_BlackFade bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -2992,8 +2791,8 @@ _081476C0: .pool thumb_func_end sub_8147688 - thumb_func_start sub_8147718 -sub_8147718: @ 8147718 + thumb_func_start Phase2Task_Transition_Ripple +Phase2Task_Transition_Ripple: @ 8147718 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -3018,7 +2817,7 @@ _0814772A: pop {r0} bx r0 .pool - thumb_func_end sub_8147718 + thumb_func_end Phase2Task_Transition_Ripple thumb_func_start sub_8147750 sub_8147750: @ 8147750 @@ -3141,7 +2940,7 @@ _08147838: ands r0, r1 cmp r0, 0 bne _0814785A - ldr r0, =sub_8147718 + ldr r0, =Phase2Task_Transition_Ripple bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -3209,8 +3008,8 @@ sub_81478C0: @ 81478C0 .pool thumb_func_end sub_81478C0 - thumb_func_start sub_81478EC -sub_81478EC: @ 81478EC + thumb_func_start Phase2Task_Transition_Wave +Phase2Task_Transition_Wave: @ 81478EC push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -3235,7 +3034,7 @@ _081478FE: pop {r0} bx r0 .pool - thumb_func_end sub_81478EC + thumb_func_end Phase2Task_Transition_Wave thumb_func_start sub_8147924 sub_8147924: @ 8147924 @@ -3373,7 +3172,7 @@ sub_8147A18: @ 8147A18 strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] bl sub_8149F84 - ldr r0, =sub_81478EC + ldr r0, =Phase2Task_Transition_Wave bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -3437,8 +3236,8 @@ _08147A90: .pool thumb_func_end sub_8147A58 - thumb_func_start sub_8147AE4 -sub_8147AE4: @ 8147AE4 + thumb_func_start Phase2Task_Transition_Sydney +Phase2Task_Transition_Sydney: @ 8147AE4 push {lr} lsls r0, 24 lsrs r0, 24 @@ -3453,10 +3252,10 @@ sub_8147AE4: @ 8147AE4 pop {r0} bx r0 .pool - thumb_func_end sub_8147AE4 + thumb_func_end Phase2Task_Transition_Sydney - thumb_func_start sub_8147B04 -sub_8147B04: @ 8147B04 + thumb_func_start Phase2Task_Transition_Phoebe +Phase2Task_Transition_Phoebe: @ 8147B04 push {lr} lsls r0, 24 lsrs r0, 24 @@ -3471,10 +3270,10 @@ sub_8147B04: @ 8147B04 pop {r0} bx r0 .pool - thumb_func_end sub_8147B04 + thumb_func_end Phase2Task_Transition_Phoebe - thumb_func_start sub_8147B24 -sub_8147B24: @ 8147B24 + thumb_func_start Phase2Task_Transition_Glacia +Phase2Task_Transition_Glacia: @ 8147B24 push {lr} lsls r0, 24 lsrs r0, 24 @@ -3489,10 +3288,10 @@ sub_8147B24: @ 8147B24 pop {r0} bx r0 .pool - thumb_func_end sub_8147B24 + thumb_func_end Phase2Task_Transition_Glacia - thumb_func_start sub_8147B44 -sub_8147B44: @ 8147B44 + thumb_func_start Phase2Task_Transition_Drake +Phase2Task_Transition_Drake: @ 8147B44 push {lr} lsls r0, 24 lsrs r0, 24 @@ -3507,10 +3306,10 @@ sub_8147B44: @ 8147B44 pop {r0} bx r0 .pool - thumb_func_end sub_8147B44 + thumb_func_end Phase2Task_Transition_Drake - thumb_func_start sub_8147B64 -sub_8147B64: @ 8147B64 + thumb_func_start Phase2Task_Transition_Wallace +Phase2Task_Transition_Wallace: @ 8147B64 push {lr} lsls r0, 24 lsrs r0, 24 @@ -3525,7 +3324,7 @@ sub_8147B64: @ 8147B64 pop {r0} bx r0 .pool - thumb_func_end sub_8147B64 + thumb_func_end Phase2Task_Transition_Wallace thumb_func_start sub_8147B84 sub_8147B84: @ 8147B84 @@ -4664,8 +4463,8 @@ sub_81484B8: @ 81484B8 .pool thumb_func_end sub_81484B8 - thumb_func_start sub_81484D0 -sub_81484D0: @ 81484D0 + thumb_func_start Phase2Task_Transition_Slice +Phase2Task_Transition_Slice: @ 81484D0 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -4690,7 +4489,7 @@ _081484E2: pop {r0} bx r0 .pool - thumb_func_end sub_81484D0 + thumb_func_end Phase2Task_Transition_Slice thumb_func_start sub_8148508 sub_8148508: @ 8148508 @@ -4873,7 +4672,7 @@ sub_814865C: @ 814865C strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] bl sub_8149F84 - ldr r0, =sub_81484D0 + ldr r0, =Phase2Task_Transition_Slice bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -4963,8 +4762,8 @@ _0814874E: .pool thumb_func_end sub_8148728 - thumb_func_start sub_8148760 -sub_8148760: @ 8148760 + thumb_func_start Phase2Task_Transition_25 +Phase2Task_Transition_25: @ 8148760 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -4989,7 +4788,7 @@ _08148772: pop {r0} bx r0 .pool - thumb_func_end sub_8148760 + thumb_func_end Phase2Task_Transition_25 thumb_func_start sub_8148798 sub_8148798: @ 8148798 @@ -5442,7 +5241,7 @@ sub_8148B14: @ 8148B14 strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] bl sub_8149F84 - ldr r0, =sub_8148760 + ldr r0, =Phase2Task_Transition_25 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -5453,8 +5252,8 @@ sub_8148B14: @ 8148B14 .pool thumb_func_end sub_8148B14 - thumb_func_start sub_8148B54 -sub_8148B54: @ 8148B54 + thumb_func_start Phase2Task_Transition_26 +Phase2Task_Transition_26: @ 8148B54 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -5479,10 +5278,10 @@ _08148B66: pop {r0} bx r0 .pool - thumb_func_end sub_8148B54 + thumb_func_end Phase2Task_Transition_26 - thumb_func_start sub_8148B8C -sub_8148B8C: @ 8148B8C + thumb_func_start Phase2Task_Transition_27 +Phase2Task_Transition_27: @ 8148B8C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -5507,7 +5306,7 @@ _08148B9E: pop {r0} bx r0 .pool - thumb_func_end sub_8148B8C + thumb_func_end Phase2Task_Transition_27 thumb_func_start sub_8148BC4 sub_8148BC4: @ 8148BC4 @@ -5819,8 +5618,8 @@ _08148E3C: .pool thumb_func_end sub_8148D6C - thumb_func_start sub_8148E54 -sub_8148E54: @ 8148E54 + thumb_func_start Phase2Task_Transition_28 +Phase2Task_Transition_28: @ 8148E54 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -5845,7 +5644,7 @@ _08148E66: pop {r0} bx r0 .pool - thumb_func_end sub_8148E54 + thumb_func_end Phase2Task_Transition_28 thumb_func_start sub_8148E8C sub_8148E8C: @ 8148E8C @@ -6187,8 +5986,8 @@ _08149138: bx r1 thumb_func_end sub_8149048 - thumb_func_start sub_8149140 -sub_8149140: @ 8149140 + thumb_func_start Phase2Task_Transition_Groudon +Phase2Task_Transition_Groudon: @ 8149140 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -6213,7 +6012,7 @@ _08149152: pop {r0} bx r0 .pool - thumb_func_end sub_8149140 + thumb_func_end Phase2Task_Transition_Groudon thumb_func_start sub_8149178 sub_8149178: @ 8149178 @@ -6341,8 +6140,8 @@ _0814926E: .pool thumb_func_end sub_8149224 - thumb_func_start sub_814927C -sub_814927C: @ 814927C + thumb_func_start Phase2Task_Transition_Rayquaza +Phase2Task_Transition_Rayquaza: @ 814927C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -6367,7 +6166,7 @@ _0814928E: pop {r0} bx r0 .pool - thumb_func_end sub_814927C + thumb_func_end Phase2Task_Transition_Rayquaza thumb_func_start sub_81492B4 sub_81492B4: @ 81492B4 @@ -6695,8 +6494,8 @@ _08149554: .pool thumb_func_end sub_8149508 - thumb_func_start sub_8149578 -sub_8149578: @ 8149578 + thumb_func_start Phase2Task_Transition_WhiteFade +Phase2Task_Transition_WhiteFade: @ 8149578 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -6721,7 +6520,7 @@ _0814958A: pop {r0} bx r0 .pool - thumb_func_end sub_8149578 + thumb_func_end Phase2Task_Transition_WhiteFade thumb_func_start sub_81495B0 sub_81495B0: @ 81495B0 @@ -6916,7 +6715,7 @@ sub_8149740: @ 8149740 cmp r0, 0x10 bls _08149766 bl sub_8149F84 - ldr r0, =sub_8149578 + ldr r0, =Phase2Task_Transition_WhiteFade bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -7158,8 +6957,8 @@ _0814994C: .pool thumb_func_end sub_8149864 - thumb_func_start sub_814995C -sub_814995C: @ 814995C + thumb_func_start Phase2Task_Transition_GridSquares +Phase2Task_Transition_GridSquares: @ 814995C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -7184,7 +6983,7 @@ _0814996E: pop {r0} bx r0 .pool - thumb_func_end sub_814995C + thumb_func_end Phase2Task_Transition_GridSquares thumb_func_start sub_8149994 sub_8149994: @ 8149994 @@ -7277,7 +7076,7 @@ sub_8149A40: @ 8149A40 cmp r1, 0 bne _08149A60 bl sub_8149F84 - ldr r0, =sub_814995C + ldr r0, =Phase2Task_Transition_GridSquares bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -7289,8 +7088,8 @@ _08149A60: .pool thumb_func_end sub_8149A40 - thumb_func_start sub_8149A6C -sub_8149A6C: @ 8149A6C + thumb_func_start Phase2Task_Transition_Shards +Phase2Task_Transition_Shards: @ 8149A6C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -7315,7 +7114,7 @@ _08149A7E: pop {r0} bx r0 .pool - thumb_func_end sub_8149A6C + thumb_func_end Phase2Task_Transition_Shards thumb_func_start sub_8149AA4 sub_8149AA4: @ 8149AA4 @@ -7559,7 +7358,7 @@ sub_8149C60: @ 8149C60 strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] bl sub_8149F84 - ldr r0, =sub_8149A6C + ldr r0, =Phase2Task_Transition_Shards bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -8511,8 +8310,8 @@ sub_814A374: @ 814A374 .pool thumb_func_end sub_814A374 - thumb_func_start sub_814A3BC -sub_814A3BC: @ 814A3BC + thumb_func_start Phase2Task_Transition_29 +Phase2Task_Transition_29: @ 814A3BC push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8537,10 +8336,10 @@ _0814A3CE: pop {r0} bx r0 .pool - thumb_func_end sub_814A3BC + thumb_func_end Phase2Task_Transition_29 - thumb_func_start sub_814A3F4 -sub_814A3F4: @ 814A3F4 + thumb_func_start Phase2Task_Transition_30 +Phase2Task_Transition_30: @ 814A3F4 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8565,7 +8364,7 @@ _0814A406: pop {r0} bx r0 .pool - thumb_func_end sub_814A3F4 + thumb_func_end Phase2Task_Transition_30 thumb_func_start sub_814A42C sub_814A42C: @ 814A42C @@ -8815,7 +8614,7 @@ _0814A632: ands r0, r1 cmp r0, 0 bne _0814A654 - ldr r0, =sub_814A3F4 + ldr r0, =Phase2Task_Transition_30 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -8888,8 +8687,8 @@ sub_814A6CC: @ 814A6CC .pool thumb_func_end sub_814A6CC - thumb_func_start sub_814A6F0 -sub_814A6F0: @ 814A6F0 + thumb_func_start Phase2Task_Transition_31 +Phase2Task_Transition_31: @ 814A6F0 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8914,10 +8713,10 @@ _0814A702: pop {r0} bx r0 .pool - thumb_func_end sub_814A6F0 + thumb_func_end Phase2Task_Transition_31 - thumb_func_start sub_814A728 -sub_814A728: @ 814A728 + thumb_func_start Phase2Task_Transition_33 +Phase2Task_Transition_33: @ 814A728 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8942,10 +8741,10 @@ _0814A73A: pop {r0} bx r0 .pool - thumb_func_end sub_814A728 + thumb_func_end Phase2Task_Transition_33 - thumb_func_start sub_814A760 -sub_814A760: @ 814A760 + thumb_func_start Phase2Task_Transition_32 +Phase2Task_Transition_32: @ 814A760 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8970,7 +8769,7 @@ _0814A772: pop {r0} bx r0 .pool - thumb_func_end sub_814A760 + thumb_func_end Phase2Task_Transition_32 thumb_func_start sub_814A798 sub_814A798: @ 814A798 diff --git a/asm/overworld.s b/asm/overworld.s index 5de62b896..92a63932e 100644 --- a/asm/overworld.s +++ b/asm/overworld.s @@ -3055,9 +3055,9 @@ _08085E18: .pool thumb_func_end c1_overworld - thumb_func_start c2_overworld_basic -@ void c2_overworld_basic() -c2_overworld_basic: @ 8085E24 + thumb_func_start OverworldBasic +@ void OverworldBasic() +OverworldBasic: @ 8085E24 push {lr} bl ScriptContext2_RunScript bl RunTasks @@ -3070,15 +3070,15 @@ c2_overworld_basic: @ 8085E24 bl do_scheduled_bg_tilemap_copies_to_vram pop {r0} bx r0 - thumb_func_end c2_overworld_basic + thumb_func_end OverworldBasic - thumb_func_start sub_8085E50 -sub_8085E50: @ 8085E50 + thumb_func_start CB2_OverworldBasic +CB2_OverworldBasic: @ 8085E50 push {lr} - bl c2_overworld_basic + bl OverworldBasic pop {r0} bx r0 - thumb_func_end sub_8085E50 + thumb_func_end CB2_OverworldBasic thumb_func_start c2_overworld c2_overworld: @ 8085E5C @@ -3092,7 +3092,7 @@ c2_overworld: @ 8085E5C movs r0, 0 bl SetVBlankCallback _08085E70: - bl c2_overworld_basic + bl OverworldBasic cmp r4, 0 beq _08085E7C bl SetFieldVBlankCallback diff --git a/asm/unk_transition.s b/asm/unk_transition.s index 385a8771e..564d2fbad 100755 --- a/asm/unk_transition.s +++ b/asm/unk_transition.s @@ -24,8 +24,8 @@ _081DABD2: bx r1 thumb_func_end sub_81DABBC - thumb_func_start sub_81DABDC -sub_81DABDC: @ 81DABDC + thumb_func_start Phase2Task_Transition_34 +Phase2Task_Transition_34: @ 81DABDC push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -50,7 +50,7 @@ _081DABEE: pop {r0} bx r0 .pool - thumb_func_end sub_81DABDC + thumb_func_end Phase2Task_Transition_34 thumb_func_start sub_81DAC14 sub_81DAC14: @ 81DAC14 @@ -119,7 +119,7 @@ sub_81DAC80: @ 81DAC80 bne _081DACA4 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =sub_81DABDC + ldr r0, =Phase2Task_Transition_34 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -131,8 +131,8 @@ _081DACA4: .pool thumb_func_end sub_81DAC80 - thumb_func_start sub_81DACB4 -sub_81DACB4: @ 81DACB4 + thumb_func_start Phase2Task_Transition_35 +Phase2Task_Transition_35: @ 81DACB4 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -157,7 +157,7 @@ _081DACC6: pop {r0} bx r0 .pool - thumb_func_end sub_81DACB4 + thumb_func_end Phase2Task_Transition_35 thumb_func_start sub_81DACEC sub_81DACEC: @ 81DACEC @@ -226,7 +226,7 @@ sub_81DAD58: @ 81DAD58 bne _081DAD7C adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =sub_81DACB4 + ldr r0, =Phase2Task_Transition_35 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -238,8 +238,8 @@ _081DAD7C: .pool thumb_func_end sub_81DAD58 - thumb_func_start sub_81DAD8C -sub_81DAD8C: @ 81DAD8C + thumb_func_start Phase2Task_Transition_36 +Phase2Task_Transition_36: @ 81DAD8C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -264,7 +264,7 @@ _081DAD9E: pop {r0} bx r0 .pool - thumb_func_end sub_81DAD8C + thumb_func_end Phase2Task_Transition_36 thumb_func_start sub_81DADC4 sub_81DADC4: @ 81DADC4 @@ -342,7 +342,7 @@ sub_81DAE44: @ 81DAE44 bne _081DAE68 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =sub_81DAD8C + ldr r0, =Phase2Task_Transition_36 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -354,8 +354,8 @@ _081DAE68: .pool thumb_func_end sub_81DAE44 - thumb_func_start sub_81DAE78 -sub_81DAE78: @ 81DAE78 + thumb_func_start Phase2Task_Transition_37 +Phase2Task_Transition_37: @ 81DAE78 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -380,7 +380,7 @@ _081DAE8A: pop {r0} bx r0 .pool - thumb_func_end sub_81DAE78 + thumb_func_end Phase2Task_Transition_37 thumb_func_start sub_81DAEB0 sub_81DAEB0: @ 81DAEB0 @@ -460,7 +460,7 @@ sub_81DAF34: @ 81DAF34 bne _081DAF58 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =sub_81DAE78 + ldr r0, =Phase2Task_Transition_37 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -472,8 +472,8 @@ _081DAF58: .pool thumb_func_end sub_81DAF34 - thumb_func_start sub_81DAF68 -sub_81DAF68: @ 81DAF68 + thumb_func_start Phase2Task_Transition_38 +Phase2Task_Transition_38: @ 81DAF68 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -498,7 +498,7 @@ _081DAF7A: pop {r0} bx r0 .pool - thumb_func_end sub_81DAF68 + thumb_func_end Phase2Task_Transition_38 thumb_func_start sub_81DAFA0 sub_81DAFA0: @ 81DAFA0 @@ -585,7 +585,7 @@ sub_81DB02C: @ 81DB02C bne _081DB050 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =sub_81DAF68 + ldr r0, =Phase2Task_Transition_38 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -597,8 +597,8 @@ _081DB050: .pool thumb_func_end sub_81DB02C - thumb_func_start sub_81DB060 -sub_81DB060: @ 81DB060 + thumb_func_start Phase2Task_Transition_39 +Phase2Task_Transition_39: @ 81DB060 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -623,7 +623,7 @@ _081DB072: pop {r0} bx r0 .pool - thumb_func_end sub_81DB060 + thumb_func_end Phase2Task_Transition_39 thumb_func_start sub_81DB098 sub_81DB098: @ 81DB098 @@ -710,7 +710,7 @@ sub_81DB124: @ 81DB124 bne _081DB148 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =sub_81DB060 + ldr r0, =Phase2Task_Transition_39 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -722,4 +722,264 @@ _081DB148: .pool thumb_func_end sub_81DB124 + thumb_func_start Phase2Task_Transition_40 +Phase2Task_Transition_40: @ 81DB158 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r5, =gUnknown_0862B7E8 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r4, r1, r2 +_081DB16A: + movs r1, 0x8 + ldrsh r0, [r4, r1] + lsls r0, 2 + adds r0, r5 + ldr r1, [r0] + adds r0, r4, 0 + bl _call_via_r1 + lsls r0, 24 + cmp r0, 0 + bne _081DB16A + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end Phase2Task_Transition_40 + + thumb_func_start sub_81DB190 +sub_81DB190: @ 81DB190 + push {r4,lr} + sub sp, 0x10 + adds r4, r0, 0 + movs r0, 0xA + ldrsh r1, [r4, r0] + cmp r1, 0 + bne _081DB1BE + movs r0, 0x80 + str r0, [sp] + str r1, [sp, 0x4] + subs r0, 0x84 + str r0, [sp, 0x8] + str r1, [sp, 0xC] + movs r0, 0x78 + movs r1, 0x2D + movs r2, 0xC + movs r3, 0x4 + bl sub_81DA8BC + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x10] + b _081DB212 +_081DB1BE: + cmp r1, 0x10 + bne _081DB1E6 + movs r0, 0x80 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + subs r0, 0x4 + str r0, [sp, 0x8] + movs r0, 0x1 + str r0, [sp, 0xC] + movs r0, 0x59 + movs r1, 0x61 + movs r2, 0xFC + movs r3, 0x4 + bl sub_81DA8BC + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x12] + b _081DB212 +_081DB1E6: + cmp r1, 0x20 + bne _081DB212 + movs r0, 0x80 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + subs r0, 0x4 + str r0, [sp, 0x8] + movs r0, 0x2 + str r0, [sp, 0xC] + movs r0, 0x97 + movs r1, 0x61 + movs r2, 0x84 + movs r3, 0x4 + bl sub_81DA8BC + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x14] + ldrh r0, [r4, 0x8] + adds r0, 0x1 + strh r0, [r4, 0x8] +_081DB212: + ldrh r0, [r4, 0xA] + adds r0, 0x1 + strh r0, [r4, 0xA] + movs r0, 0 + add sp, 0x10 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81DB190 + + thumb_func_start sub_81DB224 +sub_81DB224: @ 81DB224 + push {lr} + adds r2, r0, 0 + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _081DB248 + adds r0, r2, 0 + bl sub_81DAA20 + ldr r0, =Phase2Task_Transition_40 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r0, 24 + bl DestroyTask +_081DB248: + movs r0, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_81DB224 + + thumb_func_start Phase2Task_Transition_41 +Phase2Task_Transition_41: @ 81DB258 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r5, =gUnknown_0862B7FC + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r4, r1, r2 +_081DB26A: + movs r1, 0x8 + ldrsh r0, [r4, r1] + lsls r0, 2 + adds r0, r5 + ldr r1, [r0] + adds r0, r4, 0 + bl _call_via_r1 + lsls r0, 24 + cmp r0, 0 + bne _081DB26A + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end Phase2Task_Transition_41 + + thumb_func_start sub_81DB290 +sub_81DB290: @ 81DB290 + push {r4,lr} + sub sp, 0x10 + adds r4, r0, 0 + movs r0, 0xA + ldrsh r1, [r4, r0] + cmp r1, 0 + bne _081DB2C2 + movs r2, 0x8E + lsls r2, 1 + movs r0, 0x83 + str r0, [sp] + movs r0, 0x23 + str r0, [sp, 0x4] + subs r0, 0x26 + str r0, [sp, 0x8] + str r1, [sp, 0xC] + movs r0, 0x78 + movs r1, 0x50 + movs r3, 0x8 + bl sub_81DA8BC + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x10] + b _081DB316 +_081DB2C2: + cmp r1, 0x10 + bne _081DB2EA + movs r0, 0x83 + str r0, [sp] + movs r0, 0x23 + str r0, [sp, 0x4] + subs r0, 0x26 + str r0, [sp, 0x8] + movs r0, 0x1 + str r0, [sp, 0xC] + movs r0, 0x78 + movs r1, 0x50 + movs r2, 0x2C + movs r3, 0x8 + bl sub_81DA8BC + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x12] + b _081DB316 +_081DB2EA: + cmp r1, 0x20 + bne _081DB316 + movs r0, 0x83 + str r0, [sp] + movs r0, 0x23 + str r0, [sp, 0x4] + subs r0, 0x26 + str r0, [sp, 0x8] + movs r0, 0x2 + str r0, [sp, 0xC] + movs r0, 0x79 + movs r1, 0x50 + movs r2, 0xA4 + movs r3, 0x8 + bl sub_81DA8BC + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x14] + ldrh r0, [r4, 0x8] + adds r0, 0x1 + strh r0, [r4, 0x8] +_081DB316: + ldrh r0, [r4, 0xA] + adds r0, 0x1 + strh r0, [r4, 0xA] + movs r0, 0 + add sp, 0x10 + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81DB290 + + thumb_func_start sub_81DB328 +sub_81DB328: @ 81DB328 + push {lr} + adds r2, r0, 0 + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _081DB34C + adds r0, r2, 0 + bl sub_81DAA20 + ldr r0, =Phase2Task_Transition_41 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r0, 24 + bl DestroyTask +_081DB34C: + movs r0, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sub_81DB328 + .align 2, 0 @ Don't pad with nop. diff --git a/asm/unk_transition_2.s b/asm/unk_transition_2.s deleted file mode 100755 index a2ec93e5d..000000000 --- a/asm/unk_transition_2.s +++ /dev/null @@ -1,268 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81DB158 -sub_81DB158: @ 81DB158 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0862B7E8 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_081DB16A: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _081DB16A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81DB158 - - thumb_func_start sub_81DB190 -sub_81DB190: @ 81DB190 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - movs r0, 0xA - ldrsh r1, [r4, r0] - cmp r1, 0 - bne _081DB1BE - movs r0, 0x80 - str r0, [sp] - str r1, [sp, 0x4] - subs r0, 0x84 - str r0, [sp, 0x8] - str r1, [sp, 0xC] - movs r0, 0x78 - movs r1, 0x2D - movs r2, 0xC - movs r3, 0x4 - bl sub_81DA8BC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x10] - b _081DB212 -_081DB1BE: - cmp r1, 0x10 - bne _081DB1E6 - movs r0, 0x80 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - subs r0, 0x4 - str r0, [sp, 0x8] - movs r0, 0x1 - str r0, [sp, 0xC] - movs r0, 0x59 - movs r1, 0x61 - movs r2, 0xFC - movs r3, 0x4 - bl sub_81DA8BC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x12] - b _081DB212 -_081DB1E6: - cmp r1, 0x20 - bne _081DB212 - movs r0, 0x80 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - subs r0, 0x4 - str r0, [sp, 0x8] - movs r0, 0x2 - str r0, [sp, 0xC] - movs r0, 0x97 - movs r1, 0x61 - movs r2, 0x84 - movs r3, 0x4 - bl sub_81DA8BC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x14] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_081DB212: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - movs r0, 0 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81DB190 - - thumb_func_start sub_81DB224 -sub_81DB224: @ 81DB224 - push {lr} - adds r2, r0, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081DB248 - adds r0, r2, 0 - bl sub_81DAA20 - ldr r0, =sub_81DB158 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_081DB248: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81DB224 - - thumb_func_start sub_81DB258 -sub_81DB258: @ 81DB258 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0862B7FC - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_081DB26A: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _081DB26A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81DB258 - - thumb_func_start sub_81DB290 -sub_81DB290: @ 81DB290 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - movs r0, 0xA - ldrsh r1, [r4, r0] - cmp r1, 0 - bne _081DB2C2 - movs r2, 0x8E - lsls r2, 1 - movs r0, 0x83 - str r0, [sp] - movs r0, 0x23 - str r0, [sp, 0x4] - subs r0, 0x26 - str r0, [sp, 0x8] - str r1, [sp, 0xC] - movs r0, 0x78 - movs r1, 0x50 - movs r3, 0x8 - bl sub_81DA8BC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x10] - b _081DB316 -_081DB2C2: - cmp r1, 0x10 - bne _081DB2EA - movs r0, 0x83 - str r0, [sp] - movs r0, 0x23 - str r0, [sp, 0x4] - subs r0, 0x26 - str r0, [sp, 0x8] - movs r0, 0x1 - str r0, [sp, 0xC] - movs r0, 0x78 - movs r1, 0x50 - movs r2, 0x2C - movs r3, 0x8 - bl sub_81DA8BC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x12] - b _081DB316 -_081DB2EA: - cmp r1, 0x20 - bne _081DB316 - movs r0, 0x83 - str r0, [sp] - movs r0, 0x23 - str r0, [sp, 0x4] - subs r0, 0x26 - str r0, [sp, 0x8] - movs r0, 0x2 - str r0, [sp, 0xC] - movs r0, 0x79 - movs r1, 0x50 - movs r2, 0xA4 - movs r3, 0x8 - bl sub_81DA8BC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x14] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_081DB316: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - movs r0, 0 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81DB290 - - thumb_func_start sub_81DB328 -sub_81DB328: @ 81DB328 - push {lr} - adds r2, r0, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081DB34C - adds r0, r2, 0 - bl sub_81DAA20 - ldr r0, =sub_81DB258 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_081DB34C: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81DB328 - - .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_transition.s b/data/battle_transition.s index bd0386e2b..901eeb69d 100644 --- a/data/battle_transition.s +++ b/data/battle_transition.s @@ -4,263 +4,6 @@ .section .rodata - .align 2 -sBigPokeball_Tileset:: @ 85B9330 - .incbin "graphics/battle_transitions/big_pokeball.4bpp" - - .align 2 -sPokeballTrail_Tileset:: @ 85B98B0 - .incbin "graphics/battle_transitions/pokeball_trail.4bpp" - - .align 2 -sSpriteImage_85B98F0:: @ 85B98F0 - .incbin "graphics/battle_transitions/pokeball.4bpp" - - .align 2 -sUnknown_085B9AF0:: @ 85B9AF0 - .incbin "graphics/battle_transitions/elite_four_bg.4bpp" - - .align 2 -sSpriteImage_85B9CD0:: @ 85B9CD0 - .incbin "graphics/battle_transitions/unused_brendan.4bpp" - - .align 2 -sSpriteImage_85BA4D0:: @ 85BA4D0 - .incbin "graphics/battle_transitions/unused_lass.4bpp" - - .align 2 -sShrinkingBoxTileset:: @ 85BACD0 - .incbin "graphics/battle_transitions/shrinking_box.4bpp" - - .align 2 -sEvilTeam_Palette:: @ 85BAEB0 - .incbin "graphics/battle_transitions/evil_team.gbapal" - - .align 2 -sTeamAqua_Tileset:: @ 85BAED0 - .incbin "graphics/battle_transitions/team_aqua.4bpp.lz" - - .align 2 -sTeamAqua_Tilemap:: @ 85BB248 - .incbin "graphics/battle_transitions/team_aqua.bin.lz" - - .align 2 -sTeamMagma_Tileset:: @ 85BB4A4 - .incbin "graphics/battle_transitions/team_magma.4bpp.lz" - - .align 2 -sTeamMagma_Tilemap:: @ 85BB930 - .incbin "graphics/battle_transitions/team_magma.bin.lz" - - .align 2 -gUnknown_085BBC14:: @ 85BBC14 - .incbin "graphics/battle_transitions/85BBC14.4bpp" - - .align 2 -gUnknown_085BC2B4:: @ 85BC2B4 - .incbin "graphics/battle_transitions/85BC2B4.gbapal" - - .align 2 -gUnknown_085BC2D4:: @ 85BC2D4 - .incbin "graphics/battle_transitions/85BC2D4.gbapal" - - .align 2 -gUnknown_085BC2F4:: @ 85BC2F4 - .incbin "graphics/battle_transitions/85BC2F4.gbapal" - - .align 2 -gUnknown_085BC314:: @ 85BC314 - .incbin "graphics/battle_transitions/85BC314.bin" - - .align 2 -gUnknown_085BCB14:: @ 85BCB14 - .incbin "graphics/battle_transitions/85BCB14.bin" - - .align 2 -gUnknown_085BD314:: @ 85BD314 - .incbin "graphics/battle_transitions/85BD314.bin" - - .align 2 -gUnknown_085BDB14:: @ 85BDB14 - .incbin "graphics/battle_transitions/85BDB14.gbapal" - - .align 2 -gUnknown_085BDB34:: @ 85BDB34 - .incbin "graphics/battle_transitions/kyogre.4bpp.lz" - - .align 2 -gUnknown_085BE1E8:: @ 85BE1E8 - .incbin "graphics/battle_transitions/kyogre.bin.lz" - - .align 2 -gUnknown_085BE51C:: @ 85BE51C - .incbin "graphics/battle_transitions/groudon.4bpp.lz" - - .align 2 -gUnknown_085BEA88:: @ 85BEA88 - .incbin "graphics/battle_transitions/groudon.bin.lz" - - .align 2 -gUnknown_085BEDA0:: @ 85BEDA0 - .incbin "graphics/battle_transitions/kyogre_pt1.gbapal" - - .align 2 -gUnknown_085BEEE0:: @ 85BEEE0 - .incbin "graphics/battle_transitions/kyogre_pt2.gbapal" - - .align 2 -gUnknown_085BF0A0:: @ 85BF0A0 - .incbin "graphics/battle_transitions/groudon_pt1.gbapal" - - .align 2 -gUnknown_085BF2A0:: @ 85BF2A0 - .incbin "graphics/battle_transitions/groudon_pt2.gbapal" - - .align 2 -gUnknown_085BF4A0:: @ 85BF4A0 - .incbin "graphics/battle_transitions/rayquaza.gbapal" - - .align 2 -gUnknown_085BF6A0:: @ 85BF6A0 - .incbin "graphics/battle_transitions/rayquaza.4bpp" - - .align 2 -gUnknown_085C6BE0:: @ 85C6BE0 - .incbin "graphics/battle_transitions/rayquaza.bin" - - .align 2 -gUnknown_085C7BE0:: @ 85C7BE0 - .incbin "graphics/battle_transitions/frontier_brain.gbapal" - - .align 2 -gUnknown_085C7C00:: @ 85C7C00 - .incbin "graphics/battle_transitions/frontier_brain.4bpp.lz" - - .align 2 -gUnknown_085C828C:: @ 85C828C - .incbin "graphics/battle_transitions/frontier_brain.bin.lz" - - .align 2 -gUnknown_085C8578:: @ 85C8578 - .incbin "graphics/battle_transitions/frontier_squares_blanktiles.gbapal" - - .align 2 -gUnknown_085C8598:: @ 85C8598 - .incbin "graphics/battle_transitions/frontier_square_1.4bpp.lz" - - .align 2 -gUnknown_085C86F4:: @ 85C86F4 - .incbin "graphics/battle_transitions/frontier_square_2.4bpp.lz" - - .align 2 -gUnknown_085C87F4:: @ 85C87F4 - .incbin "graphics/battle_transitions/frontier_square_3.4bpp.lz" - - .align 2 -gUnknown_085C88A4:: @ 85C88A4 - .incbin "graphics/battle_transitions/frontier_square_4.4bpp.lz" - - .align 2 -gUnknown_085C8928:: @ 85C8928 - .incbin "graphics/battle_transitions/frontier_squares.bin" - - .align 2 -sPhase1_Tasks:: @ 85C8948 - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - .4byte sub_81460BC - - .align 2 -sPhase2_Tasks:: @ 85C89F0 - .4byte sub_814610C - .4byte sub_8146204 - .4byte sub_8146384 - .4byte sub_8146514 - .4byte sub_8146F94 - .4byte sub_8147204 - .4byte sub_8147718 - .4byte sub_81478EC - .4byte sub_81484D0 - .4byte sub_8149578 - .4byte sub_814995C - .4byte sub_8149A6C - .4byte sub_8147AE4 - .4byte sub_8147B04 - .4byte sub_8147B24 - .4byte sub_8147B44 - .4byte sub_8147B64 - .4byte sub_814654C - .4byte sub_8146584 - .4byte sub_81465BC - .4byte sub_81465F4 - .4byte sub_814662C - .4byte sub_8146664 - .4byte sub_8149140 - .4byte sub_814927C - .4byte sub_8148760 - .4byte sub_8148B54 - .4byte sub_8148B8C - .4byte sub_8148E54 - .4byte sub_814A3BC - .4byte sub_814A3F4 - .4byte sub_814A6F0 - .4byte sub_814A760 - .4byte sub_814A728 - .4byte sub_81DABDC - .4byte sub_81DACB4 - .4byte sub_81DAD8C - .4byte sub_81DAE78 - .4byte sub_81DAF68 - .4byte sub_81DB060 - .4byte sub_81DB158 - .4byte sub_81DB258 - - .align 2 -sMainTransitionPhases:: @ 85C8A98 - .4byte sub_8145FE0 - .4byte sub_8146030 - .4byte sub_8146064 - .4byte sub_814608C - .align 2 sPhase2_Transition_Blur_Funcs:: @ 85C8AA8 .4byte sub_8146144 diff --git a/include/battle_transition.h b/include/battle_transition.h index 84b5e37ec..108b6232b 100644 --- a/include/battle_transition.h +++ b/include/battle_transition.h @@ -1,6 +1,7 @@ #ifndef GUARD_BATTLE_TRANSITION_H #define GUARD_BATTLE_TRANSITION_H +void TestBattleTransition(u8 transitionId); void sub_8149DFC(u8 a1); void BattleTransition_StartOnField(u8 transitionID); void BattleTransition_Start(u8 transitionID); @@ -52,5 +53,6 @@ bool8 IsBattleTransitionDone(void); #define B_TRANSITION_39 39 #define B_TRANSITION_40 40 #define B_TRANSITION_41 41 +#define B_TRANSITION_COUNT 42 #endif // GUARD_BATTLE_TRANSITION_H diff --git a/include/overworld.h b/include/overworld.h index a5fba0c10..9f0f80a23 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -71,4 +71,6 @@ void mapldr_default(void); void IncrementGameStat(u8); u32 GetGameStat(u8); +void CB2_OverworldBasic(void); + #endif //GUARD_ROM4_H diff --git a/include/unk_transition.h b/include/unk_transition.h new file mode 100644 index 000000000..ef7b33ed7 --- /dev/null +++ b/include/unk_transition.h @@ -0,0 +1,13 @@ +#ifndef GUARD_UNK_TRANSITION_H +#define GUARD_UNK_TRANSITION_H + +void Phase2Task_Transition_34(u8 taskId); +void Phase2Task_Transition_35(u8 taskId); +void Phase2Task_Transition_36(u8 taskId); +void Phase2Task_Transition_37(u8 taskId); +void Phase2Task_Transition_38(u8 taskId); +void Phase2Task_Transition_39(u8 taskId); +void Phase2Task_Transition_40(u8 taskId); +void Phase2Task_Transition_41(u8 taskId); + +#endif // GUARD_UNK_TRANSITION_H diff --git a/ld_script.txt b/ld_script.txt index af40a1de4..7aeee8c8d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -196,6 +196,7 @@ SECTIONS { src/coins.o(.text); src/landmark.o(.text); asm/fldeff_strength.o(.text); + src/battle_transition.o(.text); asm/battle_transition.o(.text); src/battle_controller_link_partner.o(.text); src/battle_message.o(.text); @@ -274,7 +275,6 @@ SECTIONS { asm/trainer_rematch.o(.text); asm/unk_sprite_file.o(.text); asm/unk_transition.o(.text); - asm/unk_transition_2.o(.text); src/international_string_util.o(.text); asm/international_string_util.o(.text); } =0 @@ -447,6 +447,7 @@ SECTIONS { data/roulette.o(.rodata); data/pokedex_cry_screen.o(.rodata); src/landmark.o(.rodata); + src/battle_transition.o(.rodata); data/battle_transition.o(.rodata); src/battle_controller_link_partner.o(.rodata); src/battle_message.o(.rodata); diff --git a/src/battle_transition.c b/src/battle_transition.c new file mode 100644 index 000000000..386b0dd79 --- /dev/null +++ b/src/battle_transition.c @@ -0,0 +1,287 @@ +#include "global.h" +#include "battle_transition.h" +#include "unk_transition.h" +#include "main.h" +#include "overworld.h" +#include "task.h" +#include "palette.h" +#include "trig.h" +#include "field_effect.h" +#include "random.h" +#include "sprite.h" +#include "sound.h" +#include "constants/songs.h" +#include "constants/trainers.h" +#include "field_camera.h" +#include "unknown_task.h" +#include "malloc.h" + +struct TransitionData +{ + vs8 VBlank_DMA; + u16 WININ; + u16 WINOUT; + u16 field_6; + u16 WIN0V; + u16 field_A; + u16 field_C; + u16 BLDCNT; + u16 BLDALPHA; + u16 BLDY; + s16 field_14; + s16 field_16; + s16 field_18; + s16 field_1A; + s16 field_1C; + s16 field_1E; // unused + s16 field_20; + s16 field_22; // unused + s16 data[11]; +}; + +typedef bool8 (*TransitionState)(struct Task *task); +typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); + +extern void c2_exit_to_overworld_2_switch(void); +extern void sub_80AC3D0(void); + +// this file's functions +void LaunchBattleTransitionTask(u8 transitionId); +void Task_BattleTransitionMain(u8 taskId); +void Phase1Task_TransitionAll(u8 taskId); +void Phase2Task_Transition_Blur(u8 taskId); +void Phase2Task_Transition_Swirl(u8 taskId); +void Phase2Task_Transition_Shuffle(u8 taskId); +void Phase2Task_Transition_BigPokeball(u8 taskId); +void Phase2Task_Transition_PokeballsTrail(u8 taskId); +void Phase2Task_Transition_Clockwise_BlackFade(u8 taskId); +void Phase2Task_Transition_Ripple(u8 taskId); +void Phase2Task_Transition_Wave(u8 taskId); +void Phase2Task_Transition_Slice(u8 taskId); +void Phase2Task_Transition_WhiteFade(u8 taskId); +void Phase2Task_Transition_GridSquares(u8 taskId); +void Phase2Task_Transition_Shards(u8 taskId); +void Phase2Task_Transition_Sydney(u8 taskId); +void Phase2Task_Transition_Phoebe(u8 taskId); +void Phase2Task_Transition_Glacia(u8 taskId); +void Phase2Task_Transition_Drake(u8 taskId); +void Phase2Task_Transition_Wallace(u8 taskId); +void Phase2Task_Transition_Aqua(u8 taskId); +void Phase2Task_Transition_Magma(u8 taskId); +void Phase2Task_Transition_Regice(u8 taskId); +void Phase2Task_Transition_Registeel(u8 taskId); +void Phase2Task_Transition_Regirock(u8 taskId); +void Phase2Task_Transition_Kyogre(u8 taskId); +void Phase2Task_Transition_Groudon(u8 taskId); +void Phase2Task_Transition_Rayquaza(u8 taskId); +void Phase2Task_Transition_25(u8 taskId); +void Phase2Task_Transition_26(u8 taskId); +void Phase2Task_Transition_27(u8 taskId); +void Phase2Task_Transition_28(u8 taskId); +void Phase2Task_Transition_29(u8 taskId); +void Phase2Task_Transition_30(u8 taskId); +void Phase2Task_Transition_31(u8 taskId); +void Phase2Task_Transition_32(u8 taskId); +void Phase2Task_Transition_33(u8 taskId); +bool8 Transition_Phase1(struct Task *task); +bool8 Transition_WaitForPhase1(struct Task *task); +bool8 Transition_Phase2(struct Task *task); +bool8 Transition_WaitForPhase2(struct Task *task); + +// iwram bss vars +IWRAM_DATA u16 gUnknown_03001208; +IWRAM_DATA static u8 sTestingTransitionId; +IWRAM_DATA static u8 sTestingTransitionState; + +// ewram vars +EWRAM_DATA struct TransitionData *sTransitionStructPtr = NULL; + +// const rom data +const u32 sBigPokeball_Tileset[] = INCBIN_U32("graphics/battle_transitions/big_pokeball.4bpp"); +const u32 sPokeballTrail_Tileset[] = INCBIN_U32("graphics/battle_transitions/pokeball_trail.4bpp"); +const u32 sSpriteImage_85B98F0[] = INCBIN_U32("graphics/battle_transitions/pokeball.4bpp"); +const u32 sUnknown_085B9AF0[] = INCBIN_U32("graphics/battle_transitions/elite_four_bg.4bpp"); +const u32 sSpriteImage_85B9CD0[] = INCBIN_U32("graphics/battle_transitions/unused_brendan.4bpp"); +const u32 sSpriteImage_85BA4D0[] = INCBIN_U32("graphics/battle_transitions/unused_lass.4bpp"); +const u32 sShrinkingBoxTileset[] = INCBIN_U32("graphics/battle_transitions/shrinking_box.4bpp"); +const u32 sEvilTeam_Palette[] = INCBIN_U32("graphics/battle_transitions/evil_team.gbapal"); +const u32 sTeamAqua_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_aqua.4bpp.lz"); +const u32 sTeamAqua_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_aqua.bin.lz"); +const u32 sTeamMagma_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_magma.4bpp.lz"); +const u32 sTeamMagma_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_magma.bin.lz"); +const u32 gUnknown_085BBC14[] = INCBIN_U32("graphics/battle_transitions/85BBC14.4bpp"); +const u32 gUnknown_085BC2B4[] = INCBIN_U32("graphics/battle_transitions/85BC2B4.gbapal"); +const u32 gUnknown_085BC2D4[] = INCBIN_U32("graphics/battle_transitions/85BC2D4.gbapal"); +const u32 gUnknown_085BC2F4[] = INCBIN_U32("graphics/battle_transitions/85BC2F4.gbapal"); +const u32 gUnknown_085BC314[] = INCBIN_U32("graphics/battle_transitions/85BC314.bin"); +const u32 gUnknown_085BCB14[] = INCBIN_U32("graphics/battle_transitions/85BCB14.bin"); +const u32 gUnknown_085BD314[] = INCBIN_U32("graphics/battle_transitions/85BD314.bin"); +const u32 gUnknown_085BDB14[] = INCBIN_U32("graphics/battle_transitions/85BDB14.gbapal"); +const u32 gUnknown_085BDB34[] = INCBIN_U32("graphics/battle_transitions/kyogre.4bpp.lz"); +const u32 gUnknown_085BE1E8[] = INCBIN_U32("graphics/battle_transitions/kyogre.bin.lz"); +const u32 gUnknown_085BE51C[] = INCBIN_U32("graphics/battle_transitions/groudon.4bpp.lz"); +const u32 gUnknown_085BEA88[] = INCBIN_U32("graphics/battle_transitions/groudon.bin.lz"); +const u32 gUnknown_085BEDA0[] = INCBIN_U32("graphics/battle_transitions/kyogre_pt1.gbapal"); +const u32 gUnknown_085BEEE0[] = INCBIN_U32("graphics/battle_transitions/kyogre_pt2.gbapal"); +const u32 gUnknown_085BF0A0[] = INCBIN_U32("graphics/battle_transitions/groudon_pt1.gbapal"); +const u32 gUnknown_085BF2A0[] = INCBIN_U32("graphics/battle_transitions/groudon_pt2.gbapal"); +const u32 gUnknown_085BF4A0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.gbapal"); +const u32 gUnknown_085BF6A0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.4bpp"); +const u32 gUnknown_085C6BE0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.bin"); +const u32 gUnknown_085C7BE0[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.gbapal"); +const u32 gUnknown_085C7C00[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.4bpp.lz"); +const u32 gUnknown_085C828C[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.bin.lz"); +const u32 gUnknown_085C8578[] = INCBIN_U32("graphics/battle_transitions/frontier_squares_blanktiles.gbapal"); +const u32 gUnknown_085C8598[] = INCBIN_U32("graphics/battle_transitions/frontier_square_1.4bpp.lz"); +const u32 gUnknown_085C86F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_2.4bpp.lz"); +const u32 gUnknown_085C87F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_3.4bpp.lz"); +const u32 gUnknown_085C88A4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_4.4bpp.lz"); +const u32 gUnknown_085C8928[] = INCBIN_U32("graphics/battle_transitions/frontier_squares.bin"); + +const TaskFunc sPhase1_Tasks[B_TRANSITION_COUNT] = +{ + [0 ... B_TRANSITION_COUNT - 1] = &Phase1Task_TransitionAll +}; + +const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = +{ + Phase2Task_Transition_Blur, // 0 + Phase2Task_Transition_Swirl, // 1 + Phase2Task_Transition_Shuffle, // 2 + Phase2Task_Transition_BigPokeball, // 3 + Phase2Task_Transition_PokeballsTrail, // 4 + Phase2Task_Transition_Clockwise_BlackFade, // 5 + Phase2Task_Transition_Ripple, // 6 + Phase2Task_Transition_Wave, // 7 + Phase2Task_Transition_Slice, // 8 + Phase2Task_Transition_WhiteFade, // 9 + Phase2Task_Transition_GridSquares, // 10 + Phase2Task_Transition_Shards, // 11 + Phase2Task_Transition_Sydney, // 12 + Phase2Task_Transition_Phoebe, // 13 + Phase2Task_Transition_Glacia, // 14 + Phase2Task_Transition_Drake, // 15 + Phase2Task_Transition_Wallace, // 16 + Phase2Task_Transition_Aqua, // 17 + Phase2Task_Transition_Magma, // 18 + Phase2Task_Transition_Regice, // 19 + Phase2Task_Transition_Registeel, // 20 + Phase2Task_Transition_Regirock, // 21 + Phase2Task_Transition_Kyogre, // 22 + Phase2Task_Transition_Groudon, // 23 + Phase2Task_Transition_Rayquaza, // 24 + Phase2Task_Transition_25, // 25 + Phase2Task_Transition_26, // 26 + Phase2Task_Transition_27, // 27 + Phase2Task_Transition_28, // 28 + Phase2Task_Transition_29, // 29 + Phase2Task_Transition_30, // 30 + Phase2Task_Transition_31, // 31 + Phase2Task_Transition_32, // 32 + Phase2Task_Transition_33, // 33 + Phase2Task_Transition_34, // 34 + Phase2Task_Transition_35, // 35 + Phase2Task_Transition_36, // 36 + Phase2Task_Transition_37, // 37 + Phase2Task_Transition_38, // 38 + Phase2Task_Transition_39, // 39 + Phase2Task_Transition_40, // 40 + Phase2Task_Transition_41, // 41 +}; + +const TransitionState sMainTransitionPhases[] = +{ + &Transition_Phase1, + &Transition_WaitForPhase1, + &Transition_Phase2, + &Transition_WaitForPhase2 +}; + +// code +static void CB2_TestBattleTransition(void) +{ + switch (sTestingTransitionState) + { + case 0: + LaunchBattleTransitionTask(sTestingTransitionId); + sTestingTransitionState++; + break; + case 1: + if (IsBattleTransitionDone()) + { + sTestingTransitionState = 0; + SetMainCallback2(c2_exit_to_overworld_2_switch); + } + break; + } + + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void TestBattleTransition(u8 transitionId) +{ + sTestingTransitionId = transitionId; + SetMainCallback2(CB2_TestBattleTransition); +} + +void BattleTransition_StartOnField(u8 transitionId) +{ + gMain.callback2 = CB2_OverworldBasic; + LaunchBattleTransitionTask(transitionId); +} + +void BattleTransition_Start(u8 transitionId) +{ + LaunchBattleTransitionTask(transitionId); +} + +#define tState data[0] +#define tTransitionID data[1] +#define tTransitionDone data[15] + +bool8 IsBattleTransitionDone(void) +{ + u8 taskId = FindTaskIdByFunc(Task_BattleTransitionMain); + if (gTasks[taskId].tTransitionDone) + { + DestroyTask(taskId); + FREE_AND_SET_NULL(sTransitionStructPtr); + return TRUE; + } + else + { + return FALSE; + } +} + +void LaunchBattleTransitionTask(u8 transitionId) +{ + u8 taskId = CreateTask(Task_BattleTransitionMain, 2); + gTasks[taskId].tTransitionID = transitionId; + sTransitionStructPtr = AllocZeroed(sizeof(*sTransitionStructPtr)); +} + +void Task_BattleTransitionMain(u8 taskId) +{ + while (sMainTransitionPhases[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Transition_Phase1(struct Task *task) +{ + sub_80AC3D0(); + CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); + if (sPhase1_Tasks[task->tTransitionID] != NULL) + { + CreateTask(sPhase1_Tasks[task->tTransitionID], 4); + task->tState++; + return FALSE; + } + else + { + task->tState = 2; + return TRUE; + } +} diff --git a/sym_bss.txt b/sym_bss.txt index de452b2e7..0524f5545 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -73,14 +73,9 @@ gUnknown_03001202: @ 3001202 gUnknown_03001204: @ 3001204 .space 0x4 -gUnknown_03001208: @ 3001208 - .space 0x2 - -sTestingTransitionId: @ 300120A - .space 0x1 - -sTestingTransitionState: @ 300120B - .space 0x5 + .include "src/battle_transition.o" + + .align 4 gUnknown_03001210: @ 3001210 .space 0x30 diff --git a/sym_ewram.txt b/sym_ewram.txt index 4af63595e..d328d8864 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1193,10 +1193,7 @@ gUnknown_0203AB98: @ 203AB98 .space 0x4 .include "src/coins.o" - - .align 2 -sTransitionStructPtr: @ 203ABA0 - .space 0x4 + .include "src/battle_transition.o" gAbilitiesPerBank: @ 203ABA4 .space 0x4 From eb00e8ba4acab773b5bcebbc622563c60abb512d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Jan 2018 20:38:33 +0100 Subject: [PATCH 2/7] more work on battle transition --- asm/battle_transition.s | 4893 +---------------------------------- asm/field_effect.s | 6 +- asm/main_menu.s | 4 +- asm/unk_transition.s | 64 +- data/battle_transition.s | 197 +- data/field_effect_scripts.s | 2 +- include/battle_transition.h | 10 + include/field_effect.h | 1 + include/gba/io_reg.h | 61 +- include/unk_transition.h | 16 +- src/battle_transition.c | 2072 ++++++++++++++- 11 files changed, 2174 insertions(+), 5152 deletions(-) diff --git a/asm/battle_transition.s b/asm/battle_transition.s index 45c62656a..ef5c95332 100644 --- a/asm/battle_transition.s +++ b/asm/battle_transition.s @@ -5,4765 +5,8 @@ .text - thumb_func_start Transition_WaitForPhase1 -Transition_WaitForPhase1: @ 8146030 - push {r4,lr} - adds r4, r0, 0 - ldr r1, =sPhase1_Tasks - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08146054 - movs r0, 0 - b _0814605C - .pool -_08146054: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x1 -_0814605C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end Transition_WaitForPhase1 - - thumb_func_start Transition_Phase2 -Transition_Phase2: @ 8146064 - push {r4,lr} - adds r4, r0, 0 - ldr r1, =sPhase2_Tasks - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl CreateTask - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end Transition_Phase2 - - thumb_func_start Transition_WaitForPhase2 -Transition_WaitForPhase2: @ 814608C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - strh r0, [r4, 0x26] - ldr r1, =sPhase2_Tasks - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - bne _081460B0 - movs r0, 0x1 - strh r0, [r4, 0x26] -_081460B0: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end Transition_WaitForPhase2 - - thumb_func_start Phase1Task_TransitionAll -Phase1Task_TransitionAll: @ 81460BC - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r1, r0, r1 - ldrh r2, [r1, 0x8] - movs r3, 0x8 - ldrsh r0, [r1, r3] - cmp r0, 0 - bne _081460F4 - adds r0, r2, 0x1 - strh r0, [r1, 0x8] - movs r0, 0x2 - str r0, [sp] - movs r0, 0 - movs r1, 0 - movs r2, 0x3 - movs r3, 0x2 - bl sub_8149D78 - b _08146104 - .pool -_081460F4: - bl sub_8149DDC - lsls r0, 24 - cmp r0, 0 - beq _08146104 - adds r0, r4, 0 - bl DestroyTask -_08146104: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end Phase1Task_TransitionAll - - thumb_func_start Phase2Task_Transition_Blur -Phase2Task_Transition_Blur: @ 814610C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Transition_Blur_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814611E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814611E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Blur - - thumb_func_start sub_8146144 -sub_8146144: @ 8146144 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x4C - movs r1, 0 - bl SetGpuReg - movs r0, 0xA - movs r1, 0x40 - bl SetGpuRegBits - movs r0, 0xC - movs r1, 0x40 - bl SetGpuRegBits - movs r0, 0xE - movs r1, 0x40 - bl SetGpuRegBits - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8146144 - - thumb_func_start sub_8146178 -sub_8146178: @ 8146178 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldrh r0, [r4, 0xA] - movs r1, 0xA - ldrsh r2, [r4, r1] - cmp r2, 0 - beq _0814618E - subs r0, 0x1 - strh r0, [r4, 0xA] - b _081461CE -_0814618E: - movs r0, 0x4 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _081461B0 - movs r1, 0x1 - negs r1, r1 - str r2, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_081461B0: - ldrh r1, [r4, 0xC] - movs r0, 0xF - ands r0, r1 - lsls r1, r0, 4 - orrs r1, r0 - movs r0, 0x4C - bl SetGpuReg - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0xE - ble _081461CE - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_081461CE: - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8146178 - - thumb_func_start sub_81461D8 -sub_81461D8: @ 81461D8 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081461F4 - ldr r0, =Phase2Task_Transition_Blur - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_081461F4: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81461D8 - - thumb_func_start Phase2Task_Transition_Swirl -Phase2Task_Transition_Swirl: @ 8146204 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Transition_Swirl_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08146216: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08146216 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Swirl - - thumb_func_start sub_814623C -sub_814623C: @ 814623C - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - movs r0, 0x1 - negs r0, r0 - movs r4, 0 - str r4, [sp] - movs r1, 0x4 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_020393A8 - ldr r1, =sTransitionStructPtr - ldr r1, [r1] - movs r2, 0x14 - ldrsh r1, [r1, r2] - str r4, [sp] - movs r2, 0xA0 - str r2, [sp, 0x4] - movs r2, 0 - movs r3, 0x2 - bl sub_8149F98 - ldr r0, =sub_8146320 - bl SetVBlankCallback - ldr r0, =sub_8146358 - bl SetHBlankCallback - movs r0, 0x3 - bl EnableInterrupts - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814623C - - thumb_func_start sub_81462A8 -sub_81462A8: @ 81462A8 - push {r4,r5,lr} - sub sp, 0x8 - ldr r4, =sTransitionStructPtr - ldr r2, [r4] - ldrb r1, [r2] - movs r1, 0 - strb r1, [r2] - ldrh r1, [r0, 0xA] - adds r1, 0x4 - strh r1, [r0, 0xA] - ldrh r1, [r0, 0xC] - adds r1, 0x8 - strh r1, [r0, 0xC] - ldr r3, =gUnknown_02038C28 - ldr r1, [r4] - movs r2, 0x14 - ldrsh r1, [r1, r2] - movs r5, 0xA - ldrsh r2, [r0, r5] - movs r5, 0xC - ldrsh r0, [r0, r5] - str r0, [sp] - movs r0, 0xA0 - str r0, [sp, 0x4] - adds r0, r3, 0 - movs r3, 0x2 - bl sub_8149F98 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081462FA - ldr r0, =Phase2Task_Transition_Swirl - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_081462FA: - ldr r0, [r4] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81462A8 - - thumb_func_start sub_8146320 -sub_8146320: @ 8146320 - push {lr} - bl sub_8149F2C - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - beq _08146344 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_08146344: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8146320 - - thumb_func_start sub_8146358 -sub_8146358: @ 8146358 - ldr r1, =gUnknown_02038C28 - ldr r0, =0x04000006 - ldrh r0, [r0] - lsls r0, 1 - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x04000014 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_8146358 - - thumb_func_start Phase2Task_Transition_Shuffle -Phase2Task_Transition_Shuffle: @ 8146384 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Transition_Shuffle_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08146396: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08146396 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Shuffle - - thumb_func_start sub_81463BC -sub_81463BC: @ 81463BC - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r1, 0x4 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldr r0, =gUnknown_020393A8 - movs r2, 0x16 - ldrsh r1, [r1, r2] - movs r2, 0xA0 - lsls r2, 1 - bl memset - ldr r0, =sub_81464B0 - bl SetVBlankCallback - ldr r0, =sub_81464E8 - bl SetHBlankCallback - movs r0, 0x3 - bl EnableInterrupts - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81463BC - - thumb_func_start sub_8146420 -sub_8146420: @ 8146420 - push {r4-r7,lr} - ldr r1, =sTransitionStructPtr - ldr r2, [r1] - ldrb r1, [r2] - movs r1, 0 - strb r1, [r2] - ldrh r4, [r0, 0xA] - ldrh r2, [r0, 0xC] - lsls r3, r2, 16 - asrs r3, 24 - movs r5, 0x84 - lsls r5, 5 - adds r1, r4, r5 - strh r1, [r0, 0xA] - movs r1, 0xC0 - lsls r1, 1 - adds r2, r1 - strh r2, [r0, 0xC] - movs r5, 0 - lsls r7, r3, 16 -_08146448: - lsrs r0, r4, 8 - asrs r1, r7, 16 - bl Sin - ldr r1, =gUnknown_02038C28 - lsls r2, r5, 1 - adds r2, r1 - ldr r6, =sTransitionStructPtr - ldr r1, [r6] - ldrh r1, [r1, 0x16] - adds r0, r1 - strh r0, [r2] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x84 - lsls r1, 5 - adds r0, r4, r1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r5, 0x9F - bls _08146448 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0814648E - ldr r0, =Phase2Task_Transition_Shuffle - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0814648E: - ldr r0, [r6] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146420 - - thumb_func_start sub_81464B0 -sub_81464B0: @ 81464B0 - push {lr} - bl sub_8149F2C - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - beq _081464D4 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_081464D4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81464B0 - - thumb_func_start sub_81464E8 -sub_81464E8: @ 81464E8 - ldr r1, =gUnknown_02038C28 - ldr r0, =0x04000006 - ldrh r0, [r0] - lsls r0, 1 - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x04000016 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_81464E8 - - thumb_func_start Phase2Task_Transition_BigPokeball -Phase2Task_Transition_BigPokeball: @ 8146514 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8AFC - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08146526: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08146526 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_BigPokeball - - thumb_func_start Phase2Task_Transition_Aqua -Phase2Task_Transition_Aqua: @ 814654C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8AC4 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814655E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814655E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Aqua - - thumb_func_start Phase2Task_Transition_Magma -Phase2Task_Transition_Magma: @ 8146584 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8AE0 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08146596: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08146596 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Magma - - thumb_func_start Phase2Task_Transition_Regice -Phase2Task_Transition_Regice: @ 81465BC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8B14 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_081465CE: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _081465CE - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Regice - - thumb_func_start Phase2Task_Transition_Registeel -Phase2Task_Transition_Registeel: @ 81465F4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8B2C - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08146606: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08146606 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Registeel - - thumb_func_start Phase2Task_Transition_Regirock -Phase2Task_Transition_Regirock: @ 814662C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8B44 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814663E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814663E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Regirock - - thumb_func_start Phase2Task_Transition_Kyogre -Phase2Task_Transition_Kyogre: @ 8146664 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8B5C - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08146676: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08146676 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Kyogre - - thumb_func_start sub_814669C -sub_814669C: @ 814669C - push {r4,lr} - adds r4, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - movs r1, 0 - movs r0, 0x10 - strh r0, [r4, 0xA] - strh r1, [r4, 0xC] - strh r1, [r4, 0x10] - movs r0, 0x80 - lsls r0, 7 - strh r0, [r4, 0x12] - ldr r0, =sTransitionStructPtr - ldr r2, [r0] - movs r0, 0x3F - strh r0, [r2, 0x2] - strh r1, [r2, 0x4] - movs r0, 0xF0 - strh r0, [r2, 0x6] - movs r0, 0xA0 - strh r0, [r2, 0x8] - ldr r0, =0x00003f41 - strh r0, [r2, 0xE] - ldrh r0, [r4, 0xA] - lsls r0, 8 - ldrh r1, [r4, 0xC] - orrs r0, r1 - strh r0, [r2, 0x10] - ldr r0, =gUnknown_02038C28 - movs r2, 0xF0 - movs r1, 0x9F - ldr r3, =0x000008be - adds r0, r3 -_081466E2: - strh r2, [r0] - subs r0, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _081466E2 - ldr r0, =sub_8146F3C - bl SetVBlankCallback - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814669C - - thumb_func_start sub_814670C -sub_814670C: @ 814670C - push {r4,r5,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r5, 0 - movs r0, 0x3C - strh r0, [r4, 0x18] - adds r0, r4, 0 - bl sub_814669C - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r0, sp - strh r5, [r0] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - bl CpuSet - ldr r0, =sTeamAqua_Tileset - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =sEvilTeam_Palette - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814670C - - thumb_func_start sub_8146760 -sub_8146760: @ 8146760 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r5, 0 - movs r0, 0x3C - strh r0, [r4, 0x18] - adds r0, r4, 0 - bl sub_814669C - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r0, sp - strh r5, [r0] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - bl CpuSet - ldr r0, =sTeamMagma_Tileset - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =sEvilTeam_Palette - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146760 - - thumb_func_start sub_81467B4 -sub_81467B4: @ 81467B4 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r5, 0 - movs r0, 0x3C - strh r0, [r4, 0x18] - adds r0, r4, 0 - bl sub_814669C - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r0, sp - strh r5, [r0] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - bl CpuSet - ldr r0, =gUnknown_085BBC14 - ldr r1, [sp, 0x8] - movs r2, 0x80 - lsls r2, 5 - bl CpuSet - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81467B4 - - thumb_func_start sub_8146800 -sub_8146800: @ 8146800 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - bl sub_814669C - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - mov r0, sp - bl CpuSet - ldr r0, =sBigPokeball_Tileset - ldr r1, [sp, 0x8] - movs r2, 0xB0 - lsls r2, 2 - bl CpuSet - ldr r0, =gFieldEffectObjectPalette10 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146800 - - thumb_func_start sub_8146854 -sub_8146854: @ 8146854 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r7, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r5, =sBigPokeball_Tilemap - movs r1, 0 - ldr r0, [sp, 0x8] - mov r9, r0 - ldr r6, =gUnknown_02038C28 - mov r8, r6 - movs r0, 0xF0 - lsls r0, 8 - mov r12, r0 -_0814687A: - movs r0, 0 - lsls r3, r1, 16 - asrs r4, r3, 11 -_08146880: - lsls r2, r0, 16 - asrs r2, 16 - adds r1, r4, r2 - lsls r1, 1 - add r1, r9 - ldrh r0, [r5] - mov r6, r12 - orrs r0, r6 - strh r0, [r1] - adds r2, 0x1 - lsls r2, 16 - adds r5, 0x2 - lsrs r0, r2, 16 - asrs r2, 16 - cmp r2, 0x1D - ble _08146880 - movs r1, 0x80 - lsls r1, 9 - adds r0, r3, r1 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0814687A - movs r6, 0x10 - ldrsh r2, [r7, r6] - movs r1, 0x12 - ldrsh r0, [r7, r1] - str r0, [sp] - movs r0, 0xA0 - str r0, [sp, 0x4] - mov r0, r8 - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldrh r0, [r7, 0x8] - adds r0, 0x1 - strh r0, [r7, 0x8] - movs r0, 0x1 - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146854 - - thumb_func_start sub_81468E4 -sub_81468E4: @ 81468E4 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r0, =sTeamAqua_Tilemap - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =gUnknown_02038C28 - movs r1, 0x10 - ldrsh r2, [r4, r1] - movs r3, 0x12 - ldrsh r1, [r4, r3] - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81468E4 - - thumb_func_start sub_814692C -sub_814692C: @ 814692C - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r0, =sTeamMagma_Tilemap - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =gUnknown_02038C28 - movs r1, 0x10 - ldrsh r2, [r4, r1] - movs r3, 0x12 - ldrsh r1, [r4, r3] - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814692C - - thumb_func_start sub_8146974 -sub_8146974: @ 8146974 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r0, =gUnknown_085BC2B4 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_085BC314 - ldr r1, [sp, 0x8] - movs r2, 0xA0 - lsls r2, 2 - bl CpuSet - ldr r0, =gUnknown_02038C28 - movs r1, 0x10 - ldrsh r2, [r4, r1] - movs r3, 0x12 - ldrsh r1, [r4, r3] - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146974 - - thumb_func_start sub_81469CC -sub_81469CC: @ 81469CC - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r0, =gUnknown_085BC2D4 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_085BCB14 - ldr r1, [sp, 0x8] - movs r2, 0xA0 - lsls r2, 2 - bl CpuSet - ldr r0, =gUnknown_02038C28 - movs r1, 0x10 - ldrsh r2, [r4, r1] - movs r3, 0x12 - ldrsh r1, [r4, r3] - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81469CC - - thumb_func_start sub_8146A24 -sub_8146A24: @ 8146A24 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r0, =gUnknown_085BC2F4 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_085BD314 - ldr r1, [sp, 0x8] - movs r2, 0xA0 - lsls r2, 2 - bl CpuSet - ldr r0, =gUnknown_02038C28 - movs r1, 0x10 - ldrsh r2, [r4, r1] - movs r3, 0x12 - ldrsh r1, [r4, r3] - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146A24 - - thumb_func_start sub_8146A7C -sub_8146A7C: @ 8146A7C - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - mov r0, sp - bl CpuSet - ldr r0, =gUnknown_085BDB34 - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =gUnknown_085BE1E8 - ldr r1, [sp, 0x4] - bl LZ77UnCompVram - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146A7C - - thumb_func_start sub_8146AC8 -sub_8146AC8: @ 8146AC8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xA - ldrsh r5, [r4, r0] - adds r0, r5, 0 - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _08146B00 - adds r0, r5, 0 - movs r1, 0x1E - bl __modsi3 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 11 - ldr r1, =gUnknown_085BEDA0 - adds r0, r1 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette -_08146B00: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3A - ble _08146B18 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - strh r0, [r4, 0xA] -_08146B18: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146AC8 - - thumb_func_start sub_8146B24 -sub_8146B24: @ 8146B24 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xA - ldrsh r5, [r4, r0] - adds r0, r5, 0 - movs r1, 0x5 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _08146B52 - adds r0, r5, 0 - movs r1, 0x5 - bl __divsi3 - lsls r0, 16 - asrs r0, 11 - ldr r1, =gUnknown_085BEEE0 - adds r0, r1 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette -_08146B52: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x44 - ble _08146B6E - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - strh r0, [r4, 0xA] - movs r0, 0x1E - strh r0, [r4, 0x18] -_08146B6E: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146B24 - - thumb_func_start sub_8146B7C -sub_8146B7C: @ 8146B7C - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldr r0, =0xffff8000 - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146B7C - - thumb_func_start sub_8146BA8 -sub_8146BA8: @ 8146BA8 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08146BDE - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, [r4] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_08146BDE: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146BA8 - - thumb_func_start sub_8146BF8 -sub_8146BF8: @ 8146BF8 - push {r4,r5,lr} - sub sp, 0x8 - adds r3, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldrh r1, [r3, 0xE] - movs r4, 0xE - ldrsh r0, [r3, r4] - adds r4, r2, 0 - cmp r0, 0 - beq _08146C1E - subs r0, r1, 0x1 - strh r0, [r3, 0xE] - lsls r0, 16 - cmp r0, 0 - bne _08146C28 -_08146C1E: - ldrh r0, [r3, 0xC] - adds r0, 0x1 - strh r0, [r3, 0xC] - movs r0, 0x2 - strh r0, [r3, 0xE] -_08146C28: - ldr r2, [r4] - ldrh r0, [r3, 0xA] - lsls r0, 8 - ldrh r1, [r3, 0xC] - orrs r0, r1 - strh r0, [r2, 0x10] - movs r5, 0xC - ldrsh r0, [r3, r5] - cmp r0, 0xF - ble _08146C42 - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] -_08146C42: - ldrh r0, [r3, 0x10] - adds r0, 0x8 - strh r0, [r3, 0x10] - ldr r0, =0xffffff00 - adds r1, r0, 0 - ldrh r5, [r3, 0x12] - adds r1, r5 - strh r1, [r3, 0x12] - ldr r0, =gUnknown_02038C28 - movs r5, 0x10 - ldrsh r2, [r3, r5] - lsls r1, 16 - asrs r1, 24 - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146BF8 - - thumb_func_start sub_8146C8C -sub_8146C8C: @ 8146C8C - push {r4,r5,lr} - sub sp, 0x8 - adds r3, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldrh r1, [r3, 0xE] - movs r4, 0xE - ldrsh r0, [r3, r4] - adds r4, r2, 0 - cmp r0, 0 - beq _08146CB2 - subs r0, r1, 0x1 - strh r0, [r3, 0xE] - lsls r0, 16 - cmp r0, 0 - bne _08146CBC -_08146CB2: - ldrh r0, [r3, 0xA] - subs r0, 0x1 - strh r0, [r3, 0xA] - movs r0, 0x2 - strh r0, [r3, 0xE] -_08146CBC: - ldr r2, [r4] - ldrh r0, [r3, 0xA] - lsls r0, 8 - ldrh r1, [r3, 0xC] - orrs r0, r1 - strh r0, [r2, 0x10] - movs r5, 0xA - ldrsh r0, [r3, r5] - cmp r0, 0 - bne _08146CD6 - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] -_08146CD6: - ldrh r0, [r3, 0x10] - adds r0, 0x8 - strh r0, [r3, 0x10] - ldr r0, =0xffffff00 - adds r1, r0, 0 - ldrh r5, [r3, 0x12] - adds r1, r5 - strh r1, [r3, 0x12] - ldr r0, =gUnknown_02038C28 - movs r5, 0x10 - ldrsh r2, [r3, r5] - lsls r1, 16 - asrs r1, 24 - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146C8C - - thumb_func_start sub_8146D20 -sub_8146D20: @ 8146D20 - push {r4-r7,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r7, =sTransitionStructPtr - ldr r0, [r7] - ldrb r1, [r0] - movs r6, 0 - strb r6, [r0] - ldrh r0, [r4, 0x10] - adds r0, 0x8 - strh r0, [r4, 0x10] - ldr r0, =0xffffff00 - adds r1, r0, 0 - ldrh r3, [r4, 0x12] - adds r1, r3 - strh r1, [r4, 0x12] - ldr r0, =gUnknown_02038C28 - movs r3, 0x10 - ldrsh r2, [r4, r3] - lsls r1, 16 - asrs r1, 24 - str r1, [sp] - movs r5, 0xA0 - str r5, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - bgt _08146D70 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - strh r5, [r4, 0xA] - movs r0, 0x80 - lsls r0, 1 - strh r0, [r4, 0xC] - strh r6, [r4, 0xE] -_08146D70: - ldr r0, [r7] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - add sp, 0x8 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146D20 - - thumb_func_start sub_8146D90 -sub_8146D90: @ 8146D90 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x18] - subs r0, 0x1 - strh r0, [r1, 0x18] - lsls r0, 16 - cmp r0, 0 - bne _08146DA6 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_08146DA6: - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_8146D90 - - thumb_func_start sub_8146DAC -sub_8146DAC: @ 8146DAC - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldr r0, =0x0000ffff - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146DAC - - thumb_func_start sub_8146DD8 -sub_8146DD8: @ 8146DD8 - push {lr} - adds r2, r0, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08146DEE - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] -_08146DEE: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146DD8 - - thumb_func_start sub_8146DF8 -sub_8146DF8: @ 8146DF8 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - ldrb r1, [r0] - movs r3, 0 - strb r3, [r0] - ldrh r2, [r4, 0xC] - movs r0, 0xC - ldrsh r1, [r4, r0] - ldr r0, =0x000003ff - cmp r1, r0 - bgt _08146E18 - adds r0, r2, 0 - adds r0, 0x80 - strh r0, [r4, 0xC] -_08146E18: - ldrh r1, [r4, 0xA] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _08146E34 - ldrh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 24 - subs r0, r1, r0 - strh r0, [r4, 0xA] - lsls r0, 16 - cmp r0, 0 - bge _08146E34 - strh r3, [r4, 0xA] -_08146E34: - ldr r0, =gUnknown_02038C28 - movs r1, 0xA - ldrsh r3, [r4, r1] - movs r1, 0x78 - movs r2, 0x50 - bl sub_814A014 - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08146E90 - movs r0, 0 - bl SetVBlankCallback - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, [r4] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - b _08146EB0 - .pool -_08146E90: - ldrh r1, [r4, 0xE] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08146EA4 - adds r0, r1, 0x1 - strh r0, [r4, 0xE] - ldr r0, =sub_8146F68 - bl SetVBlankCallback -_08146EA4: - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] -_08146EB0: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146DF8 - - thumb_func_start sub_8146EC0 -sub_8146EC0: @ 8146EC0 - push {lr} - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F2C - ldr r2, =sTransitionStructPtr - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0 - beq _08146EF8 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r3, 0xF0 - lsls r3, 3 - adds r0, r3 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_08146EF8: - ldr r1, =0x04000048 - ldr r2, [r2] - ldrh r0, [r2, 0x2] - strh r0, [r1] - adds r1, 0x2 - ldrh r0, [r2, 0x4] - strh r0, [r1] - subs r1, 0x6 - ldrh r0, [r2, 0x8] - strh r0, [r1] - adds r1, 0xC - ldrh r0, [r2, 0xE] - strh r0, [r1] - adds r1, 0x2 - ldrh r0, [r2, 0x10] - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8146EC0 - - thumb_func_start sub_8146F3C -sub_8146F3C: @ 8146F3C - push {lr} - bl sub_8146EC0 - ldr r1, =0x040000b0 - ldr r0, =gUnknown_020393A8 - str r0, [r1] - ldr r0, =0x04000010 - str r0, [r1, 0x4] - ldr r0, =0xa2400001 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8146F3C - - thumb_func_start sub_8146F68 -sub_8146F68: @ 8146F68 - push {lr} - bl sub_8146EC0 - ldr r1, =0x040000b0 - ldr r0, =gUnknown_020393A8 - str r0, [r1] - ldr r0, =0x04000040 - str r0, [r1, 0x4] - ldr r0, =0xa2400001 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8146F68 - - thumb_func_start Phase2Task_Transition_PokeballsTrail -Phase2Task_Transition_PokeballsTrail: @ 8146F94 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Transition_PokeballsTrail_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08146FA6: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08146FA6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_PokeballsTrail - - thumb_func_start sub_8146FCC -sub_8146FCC: @ 8146FCC - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - ldr r0, =sPokeballTrail_Tileset - ldr r1, [sp, 0x8] - movs r2, 0x20 - bl CpuSet - movs r0, 0 - str r0, [sp] - ldr r1, [sp, 0x4] - ldr r2, =0x05000200 - mov r0, sp - bl CpuSet - ldr r0, =gFieldEffectObjectPalette10 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8146FCC - - thumb_func_start sub_8147018 -sub_8147018: @ 8147018 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - adds r7, r0, 0 - ldr r1, =sUnknown_085C8B88 - mov r0, sp - movs r2, 0x4 - bl memcpy - add r4, sp, 0x4 - ldr r1, =sUnknown_085C8B8C - adds r0, r4, 0 - movs r2, 0xA - bl memcpy - bl Random - movs r5, 0x1 - ands r5, r0 - movs r1, 0 - mov r8, r4 - ldr r6, =gFieldEffectArguments -_08147046: - lsls r5, 16 - asrs r5, 16 - lsls r0, r5, 1 - add r0, sp - movs r2, 0 - ldrsh r0, [r0, r2] - str r0, [r6] - lsls r4, r1, 16 - asrs r4, 16 - lsls r0, r4, 5 - adds r0, 0x10 - str r0, [r6, 0x4] - str r5, [r6, 0x8] - lsls r0, r4, 1 - add r0, r8 - movs r1, 0 - ldrsh r0, [r0, r1] - str r0, [r6, 0xC] - movs r0, 0x2D - bl FieldEffectStart - adds r4, 0x1 - lsls r4, 16 - movs r0, 0x1 - eors r5, r0 - lsls r5, 16 - lsrs r5, 16 - lsrs r1, r4, 16 - asrs r4, 16 - cmp r4, 0x4 - ble _08147046 - ldrh r0, [r7, 0x8] - adds r0, 0x1 - strh r0, [r7, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147018 - - thumb_func_start sub_81470A4 -sub_81470A4: @ 81470A4 - push {lr} - movs r0, 0x2D - bl FieldEffectActiveListContains - lsls r0, 24 - cmp r0, 0 - bne _081470C4 - bl sub_8149F84 - ldr r0, =Phase2Task_Transition_PokeballsTrail - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_081470C4: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81470A4 - - thumb_func_start sub_81470D0 -sub_81470D0: @ 81470D0 - push {r4,r5,lr} - ldr r0, =gUnknown_085C8E68 - ldr r5, =gFieldEffectArguments - movs r2, 0 - ldrsh r1, [r5, r2] - movs r3, 0x4 - ldrsh r2, [r5, r3] - movs r3, 0 - bl CreateSpriteAtEnd - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r4, r1 - ldrb r1, [r4, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x5] - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r4, 0x1] - ldr r0, [r5, 0x8] - strh r0, [r4, 0x2E] - ldr r0, [r5, 0xC] - strh r0, [r4, 0x30] - ldr r0, =0x0000ffff - strh r0, [r4, 0x32] - adds r0, r4, 0 - bl InitSpriteAffineAnim - ldrb r1, [r5, 0x8] - adds r0, r4, 0 - bl StartSpriteAffineAnim - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81470D0 - - thumb_func_start sub_814713C -sub_814713C: @ 814713C - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldr r1, =sUnknown_085C8B96 - mov r0, sp - movs r2, 0x4 - bl memcpy - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _08147160 - subs r0, r1, 0x1 - strh r0, [r4, 0x30] - b _081471F2 - .pool -_08147160: - ldrh r0, [r4, 0x20] - lsls r1, r0, 16 - lsrs r0, r1, 16 - cmp r0, 0xF0 - bhi _081471CE - asrs r0, r1, 19 - lsls r0, 16 - ldrh r1, [r4, 0x22] - lsls r1, 16 - asrs r1, 19 - lsls r1, 16 - lsrs r1, 16 - lsrs r2, r0, 16 - asrs r5, r0, 16 - movs r3, 0x32 - ldrsh r0, [r4, r3] - cmp r5, r0 - beq _081471CE - strh r2, [r4, 0x32] - ldr r0, =0x04000008 - ldrh r2, [r0] - lsrs r2, 8 - movs r0, 0x1F - ands r2, r0 - lsls r2, 11 - movs r0, 0xC0 - lsls r0, 19 - adds r2, r0 - lsls r1, 16 - asrs r1, 16 - subs r0, r1, 0x2 - lsls r0, 5 - adds r0, r5 - lsls r0, 1 - adds r0, r2 - ldr r6, =0x0000f001 - adds r3, r6, 0 - strh r3, [r0] - subs r0, r1, 0x1 - lsls r0, 5 - adds r0, r5 - lsls r0, 1 - adds r0, r2 - strh r3, [r0] - lsls r0, r1, 5 - adds r0, r5 - lsls r0, 1 - adds r0, r2 - strh r3, [r0] - adds r1, 0x1 - lsls r1, 5 - adds r1, r5 - lsls r1, 1 - adds r1, r2 - strh r3, [r1] -_081471CE: - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - adds r0, 0xF - lsls r0, 16 - movs r1, 0x87 - lsls r1, 17 - cmp r0, r1 - bls _081471F2 - adds r0, r4, 0 - movs r1, 0x2D - bl FieldEffectStop -_081471F2: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814713C - - thumb_func_start Phase2Task_Transition_Clockwise_BlackFade -Phase2Task_Transition_Clockwise_BlackFade: @ 8147204 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Transition_Clockwise_BlackFade_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08147216: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08147216 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Clockwise_BlackFade - - thumb_func_start sub_814723C -sub_814723C: @ 814723C - push {r4,lr} - adds r4, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x2] - movs r0, 0x3F - strh r0, [r1, 0x4] - ldr r0, =0x0000f0f1 - strh r0, [r1, 0x6] - movs r0, 0xA0 - strh r0, [r1, 0x8] - movs r1, 0 - ldr r3, =gUnknown_020393A8 - ldr r2, =0x0000f3f4 -_08147262: - lsls r0, r1, 1 - adds r0, r3 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x9F - bls _08147262 - ldr r0, =sub_8147688 - bl SetVBlankCallback - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r0, 0x78 - strh r0, [r1, 0x2C] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814723C - - thumb_func_start sub_81472A4 -sub_81472A4: @ 81472A4 - push {r4-r7,lr} - sub sp, 0xC - adds r6, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r1, [r2] - adds r0, r1, 0 - adds r0, 0x24 - movs r2, 0x2C - ldrsh r3, [r1, r2] - movs r1, 0x1 - negs r1, r1 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x78 - movs r2, 0x50 - bl sub_814A1AC - ldr r5, =gUnknown_02038C28 -_081472D4: - ldr r4, =sTransitionStructPtr - ldr r0, [r4] - movs r7, 0x2A - ldrsh r3, [r0, r7] - lsls r3, 1 - adds r3, r5 - ldrh r1, [r0, 0x28] - adds r1, 0x1 - movs r7, 0xF0 - lsls r7, 7 - adds r2, r7, 0 - orrs r1, r2 - strh r1, [r3] - adds r0, 0x24 - movs r1, 0x1 - movs r2, 0x1 - bl sub_814A228 - lsls r0, 24 - cmp r0, 0 - beq _081472D4 - ldr r1, [r4] - ldrh r0, [r1, 0x2C] - adds r0, 0x10 - strh r0, [r1, 0x2C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xEF - ble _08147318 - movs r0, 0 - strh r0, [r1, 0x2E] - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] -_08147318: - ldr r0, [r4] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - add sp, 0xC - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81472A4 - - thumb_func_start sub_8147334 -sub_8147334: @ 8147334 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - mov r8, r0 - add r1, sp, 0xC - movs r0, 0 - strb r0, [r1] - ldr r4, =sTransitionStructPtr - ldr r1, [r4] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x24 - movs r2, 0x2E - ldrsh r1, [r1, r2] - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0xF0 - bl sub_814A1AC - mov r9, r4 - mov r7, r9 - add r5, sp, 0xC -_08147372: - movs r1, 0x78 - ldr r3, [r7] - ldrh r0, [r3, 0x28] - adds r0, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - movs r2, 0x2E - ldrsh r0, [r3, r2] - cmp r0, 0x4F - ble _0814738A - ldrh r1, [r3, 0x28] - movs r4, 0xF0 -_0814738A: - ldr r6, =gUnknown_02038C28 - movs r0, 0x2A - ldrsh r2, [r3, r0] - lsls r2, 1 - adds r2, r6 - lsls r1, 16 - asrs r1, 8 - lsls r0, r4, 16 - asrs r4, r0, 16 - orrs r4, r1 - strh r4, [r2] - ldrb r0, [r5] - cmp r0, 0 - bne _081473C0 - adds r0, r3, 0 - adds r0, 0x24 - movs r1, 0x1 - movs r2, 0x1 - bl sub_814A228 - strb r0, [r5] - b _08147372 - .pool -_081473C0: - ldr r1, [r7] - ldrh r0, [r1, 0x2E] - adds r0, 0x8 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0x9F - ble _081473DE - movs r0, 0xF0 - strh r0, [r1, 0x2C] - mov r1, r8 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _08147406 -_081473DE: - movs r3, 0x2A - ldrsh r0, [r1, r3] - cmp r0, r2 - bge _08147406 - adds r3, r4, 0 - ldr r5, =sTransitionStructPtr -_081473EA: - ldr r2, [r5] - ldrh r0, [r2, 0x2A] - adds r0, 0x1 - strh r0, [r2, 0x2A] - lsls r0, 16 - asrs r0, 15 - adds r0, r6 - strh r3, [r0] - movs r4, 0x2A - ldrsh r1, [r2, r4] - movs r4, 0x2E - ldrsh r0, [r2, r4] - cmp r1, r0 - blt _081473EA -_08147406: - mov r1, r9 - ldr r0, [r1] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147334 - - thumb_func_start sub_8147428 -sub_8147428: @ 8147428 - push {r4-r6,lr} - sub sp, 0xC - adds r6, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r1, [r2] - adds r0, r1, 0 - adds r0, 0x24 - movs r2, 0x2C - ldrsh r3, [r1, r2] - movs r1, 0xA0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x78 - movs r2, 0x50 - bl sub_814A1AC - ldr r5, =gUnknown_02038C28 -_08147456: - ldr r4, =sTransitionStructPtr - ldr r0, [r4] - movs r1, 0x2A - ldrsh r3, [r0, r1] - lsls r3, 1 - adds r3, r5 - ldrh r1, [r0, 0x28] - lsls r1, 8 - movs r2, 0xF0 - orrs r1, r2 - strh r1, [r3] - adds r0, 0x24 - movs r1, 0x1 - movs r2, 0x1 - bl sub_814A228 - lsls r0, 24 - cmp r0, 0 - beq _08147456 - ldr r1, [r4] - ldrh r0, [r1, 0x2C] - subs r0, 0x10 - strh r0, [r1, 0x2C] - lsls r0, 16 - cmp r0, 0 - bgt _08147494 - movs r0, 0xA0 - strh r0, [r1, 0x2E] - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] -_08147494: - ldr r0, [r4] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147428 - - thumb_func_start sub_81474B0 -sub_81474B0: @ 81474B0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - mov r9, r0 - add r1, sp, 0xC - movs r0, 0 - strb r0, [r1] - ldr r4, =sTransitionStructPtr - ldr r1, [r4] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x24 - movs r2, 0x2E - ldrsh r1, [r1, r2] - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl sub_814A1AC - ldr r7, =gUnknown_02038C28 - mov r10, r7 - ldr r0, =sTransitionStructPtr - mov r8, r0 - add r6, sp, 0xC -_081474F4: - mov r1, r8 - ldr r4, [r1] - movs r2, 0x2A - ldrsh r0, [r4, r2] - lsls r0, 1 - mov r7, r10 - adds r5, r0, r7 - ldrb r1, [r5] - ldrh r2, [r4, 0x28] - adds r3, r2, 0 - movs r7, 0x2E - ldrsh r0, [r4, r7] - cmp r0, 0x50 - bgt _08147514 - movs r2, 0x78 - adds r1, r3, 0 -_08147514: - lsls r0, r2, 16 - asrs r0, 8 - lsls r1, 16 - asrs r1, 16 - orrs r1, r0 - movs r7, 0 - strh r1, [r5] - ldrb r0, [r6] - cmp r0, 0 - bne _08147540 - adds r0, r4, 0 - adds r0, 0x24 - movs r1, 0x1 - movs r2, 0x1 - bl sub_814A228 - strb r0, [r6] - b _081474F4 - .pool -_08147540: - mov r0, r8 - ldr r2, [r0] - ldrh r0, [r2, 0x2E] - subs r0, 0x8 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r3, r0, 16 - cmp r3, 0 - bgt _0814755E - strh r7, [r2, 0x2C] - mov r1, r9 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _08147588 -_0814755E: - movs r4, 0x2A - ldrsh r0, [r2, r4] - cmp r0, r3 - ble _08147588 - ldr r6, =gUnknown_02038C28 - adds r3, r1, 0 - ldr r5, =sTransitionStructPtr -_0814756C: - ldr r2, [r5] - ldrh r0, [r2, 0x2A] - subs r0, 0x1 - strh r0, [r2, 0x2A] - lsls r0, 16 - asrs r0, 15 - adds r0, r6 - strh r3, [r0] - movs r7, 0x2A - ldrsh r1, [r2, r7] - movs r4, 0x2E - ldrsh r0, [r2, r4] - cmp r1, r0 - bgt _0814756C -_08147588: - ldr r7, =sTransitionStructPtr - ldr r0, [r7] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81474B0 - - thumb_func_start sub_81475B0 -sub_81475B0: @ 81475B0 - push {r4-r7,lr} - sub sp, 0xC - adds r7, r0, 0 - ldr r1, =sTransitionStructPtr - ldr r0, [r1] - ldrb r2, [r0] - movs r2, 0 - strb r2, [r0] - ldr r1, [r1] - adds r0, r1, 0 - adds r0, 0x24 - movs r4, 0x2C - ldrsh r3, [r1, r4] - str r2, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x78 - movs r2, 0x50 - bl sub_814A1AC - ldr r6, =gUnknown_02038C28 -_081475DC: - movs r2, 0x78 - ldr r5, =sTransitionStructPtr - ldr r3, [r5] - ldrh r4, [r3, 0x28] - movs r1, 0x28 - ldrsh r0, [r3, r1] - cmp r0, 0x77 - ble _081475F0 - movs r2, 0 - movs r4, 0xF0 -_081475F0: - movs r0, 0x2A - ldrsh r1, [r3, r0] - lsls r1, 1 - adds r1, r6 - lsls r2, 8 - lsls r0, r4, 16 - asrs r0, 16 - orrs r0, r2 - strh r0, [r1] - adds r0, r3, 0 - adds r0, 0x24 - movs r1, 0x1 - movs r2, 0x1 - bl sub_814A228 - lsls r0, 24 - cmp r0, 0 - beq _081475DC - ldr r0, [r5] - ldrh r1, [r0, 0x2C] - adds r1, 0x10 - strh r1, [r0, 0x2C] - movs r1, 0x28 - ldrsh r0, [r0, r1] - cmp r0, 0x78 - ble _0814762A - ldrh r0, [r7, 0x8] - adds r0, 0x1 - strh r0, [r7, 0x8] -_0814762A: - ldr r0, [r5] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - add sp, 0xC - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81475B0 - - thumb_func_start sub_8147648 -sub_8147648: @ 8147648 - push {lr} - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, =Phase2Task_Transition_Clockwise_BlackFade - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147648 - - thumb_func_start sub_8147688 -sub_8147688: @ 8147688 - push {r4,lr} - ldr r4, =0x040000b0 - ldrh r1, [r4, 0xA] - ldr r0, =0x0000c5ff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0xA] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xA] - bl sub_8149F2C - ldr r3, =sTransitionStructPtr - ldr r0, [r3] - ldrb r0, [r0] - cmp r0, 0 - beq _081476C0 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_081476C0: - ldr r2, =0x04000048 - ldr r1, [r3] - ldrh r0, [r1, 0x2] - strh r0, [r2] - adds r2, 0x2 - ldrh r0, [r1, 0x4] - strh r0, [r2] - subs r2, 0x6 - ldrh r0, [r1, 0x8] - strh r0, [r2] - subs r2, 0x4 - ldr r0, =gUnknown_02038C28 - movs r1, 0xF0 - lsls r1, 3 - adds r0, r1 - ldrh r1, [r0] - strh r1, [r2] - str r0, [r4] - str r2, [r4, 0x4] - ldr r0, =0xa2400001 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8147688 - - thumb_func_start Phase2Task_Transition_Ripple -Phase2Task_Transition_Ripple: @ 8147718 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Transition_Ripple_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814772A: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814772A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Ripple - - thumb_func_start sub_8147750 -sub_8147750: @ 8147750 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - movs r2, 0 - ldr r4, =gUnknown_020393A8 - ldr r3, =sTransitionStructPtr -_08147762: - lsls r1, r2, 1 - adds r1, r4 - ldr r0, [r3] - ldrh r0, [r0, 0x16] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x9F - bls _08147762 - ldr r0, =sub_8147888 - bl SetVBlankCallback - ldr r0, =sub_81478C0 - bl SetHBlankCallback - movs r0, 0x2 - bl EnableInterrupts - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0x1 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147750 - - thumb_func_start sub_81477A8 -sub_81477A8: @ 81477A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r6, r0, 0 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldrh r2, [r6, 0xC] - lsls r1, r2, 16 - asrs r0, r1, 24 - lsls r0, 16 - lsrs r3, r0, 16 - ldrh r4, [r6, 0xA] - movs r0, 0xC0 - lsls r0, 1 - mov r8, r0 - movs r5, 0x80 - lsls r5, 3 - adds r0, r4, r5 - strh r0, [r6, 0xA] - ldr r0, =0x1fff0000 - cmp r1, r0 - bgt _081477E4 - movs r1, 0xC0 - lsls r1, 1 - adds r0, r2, r1 - strh r0, [r6, 0xC] -_081477E4: - movs r5, 0 - lsls r7, r3, 16 -_081477E8: - lsrs r0, r4, 8 - asrs r1, r7, 16 - bl Sin - ldr r1, =gUnknown_02038C28 - lsls r2, r5, 1 - adds r2, r1 - ldr r1, =sTransitionStructPtr - ldr r1, [r1] - ldrh r1, [r1, 0x16] - adds r0, r1 - strh r0, [r2] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - mov r1, r8 - adds r0, r4, r1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r5, 0x9F - bls _081477E8 - ldrh r0, [r6, 0xE] - adds r0, 0x1 - strh r0, [r6, 0xE] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x51 - bne _08147838 - ldrh r0, [r6, 0x10] - adds r0, 0x1 - strh r0, [r6, 0x10] - movs r0, 0x1 - negs r0, r0 - movs r1, 0x2 - negs r1, r1 - movs r2, 0 - str r2, [sp] - movs r3, 0x10 - bl BeginNormalPaletteFade -_08147838: - movs r5, 0x10 - ldrsh r0, [r6, r5] - cmp r0, 0 - beq _0814785A - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0814785A - ldr r0, =Phase2Task_Transition_Ripple - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0814785A: - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81477A8 - - thumb_func_start sub_8147888 -sub_8147888: @ 8147888 - push {lr} - bl sub_8149F2C - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0 - beq _081478AC - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_081478AC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8147888 - - thumb_func_start sub_81478C0 -sub_81478C0: @ 81478C0 - ldr r1, =gUnknown_02038C28 - ldr r0, =0x04000006 - ldrh r0, [r0] - lsls r0, 1 - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x04000016 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_81478C0 - - thumb_func_start Phase2Task_Transition_Wave -Phase2Task_Transition_Wave: @ 81478EC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Transition_Wave_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_081478FE: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _081478FE - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Wave - - thumb_func_start sub_8147924 -sub_8147924: @ 8147924 - push {r4,lr} - adds r4, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r2, 0 - movs r0, 0x3F - strh r0, [r1, 0x2] - strh r2, [r1, 0x4] - movs r0, 0xF0 - strh r0, [r1, 0x6] - movs r0, 0xA0 - strh r0, [r1, 0x8] - movs r1, 0 - ldr r3, =gUnknown_020393A8 - movs r2, 0xF2 -_0814794A: - lsls r0, r1, 1 - adds r0, r3 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x9F - bls _0814794A - ldr r0, =sub_8147A58 - bl SetVBlankCallback - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147924 - - thumb_func_start sub_814797C -sub_814797C: @ 814797C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r7, =gUnknown_02038C28 - ldrh r0, [r4, 0xC] - ldrb r5, [r4, 0xC] - adds r0, 0x10 - strh r0, [r4, 0xC] - ldrh r0, [r4, 0xA] - adds r0, 0x8 - strh r0, [r4, 0xA] - movs r6, 0 - movs r0, 0x1 - mov r8, r0 -_081479A4: - adds r0, r5, 0 - movs r1, 0x28 - bl Sin - ldrh r1, [r4, 0xA] - adds r0, r1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r0, 0 - bge _081479BA - movs r1, 0 -_081479BA: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0xF0 - ble _081479C4 - movs r1, 0xF0 -_081479C4: - lsls r0, r1, 16 - asrs r0, 16 - lsls r1, r0, 8 - movs r2, 0xF1 - orrs r1, r2 - strh r1, [r7] - cmp r0, 0xEF - bgt _081479D8 - movs r0, 0 - mov r8, r0 -_081479D8: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r5, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - adds r7, 0x2 - cmp r6, 0x9F - bls _081479A4 - mov r1, r8 - cmp r1, 0 - beq _081479F6 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_081479F6: - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814797C - - thumb_func_start sub_8147A18 -sub_8147A18: @ 8147A18 - push {lr} - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, =Phase2Task_Transition_Wave - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147A18 - - thumb_func_start sub_8147A58 -sub_8147A58: @ 8147A58 - push {r4,lr} - ldr r4, =0x040000b0 - ldrh r1, [r4, 0xA] - ldr r0, =0x0000c5ff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0xA] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xA] - bl sub_8149F2C - ldr r3, =sTransitionStructPtr - ldr r0, [r3] - ldrb r0, [r0] - cmp r0, 0 - beq _08147A90 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_08147A90: - ldr r2, =0x04000048 - ldr r1, [r3] - ldrh r0, [r1, 0x2] - strh r0, [r2] - adds r2, 0x2 - ldrh r0, [r1, 0x4] - strh r0, [r2] - subs r2, 0x6 - ldrh r0, [r1, 0x8] - strh r0, [r2] - ldr r0, =gUnknown_020393A8 - str r0, [r4] - ldr r0, =0x04000040 - str r0, [r4, 0x4] - ldr r0, =0xa2400001 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8147A58 - - thumb_func_start Phase2Task_Transition_Sydney -Phase2Task_Transition_Sydney: @ 8147AE4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0 - strh r2, [r1, 0x26] - bl sub_8147B84 - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Sydney - - thumb_func_start Phase2Task_Transition_Phoebe -Phase2Task_Transition_Phoebe: @ 8147B04 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0x1 - strh r2, [r1, 0x26] - bl sub_8147B84 - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Phoebe - - thumb_func_start Phase2Task_Transition_Glacia -Phase2Task_Transition_Glacia: @ 8147B24 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0x2 - strh r2, [r1, 0x26] - bl sub_8147B84 - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Glacia - - thumb_func_start Phase2Task_Transition_Drake -Phase2Task_Transition_Drake: @ 8147B44 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0x3 - strh r2, [r1, 0x26] - bl sub_8147B84 - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Drake - - thumb_func_start Phase2Task_Transition_Wallace -Phase2Task_Transition_Wallace: @ 8147B64 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0x4 - strh r2, [r1, 0x26] - bl sub_8147B84 - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Wallace - - thumb_func_start sub_8147B84 -sub_8147B84: @ 8147B84 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Mugshot_Transition_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08147B96: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08147B96 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8147B84 - - thumb_func_start sub_8147BBC -sub_8147BBC: @ 8147BBC - push {r4,lr} - adds r4, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - adds r0, r4, 0 - bl sub_8148218 - movs r0, 0 - strh r0, [r4, 0xA] - movs r0, 0x1 - strh r0, [r4, 0xC] - movs r0, 0xEF - strh r0, [r4, 0xE] - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r0, 0x3F - strh r0, [r1, 0x2] - movs r0, 0x3E - strh r0, [r1, 0x4] - movs r0, 0xA0 - strh r0, [r1, 0x8] - movs r1, 0 - ldr r3, =gUnknown_020393A8 - ldr r2, =0x0000f0f1 -_08147BF0: - lsls r0, r1, 1 - adds r0, r3 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x9F - bls _08147BF0 - ldr r0, =sub_81480CC - bl SetVBlankCallback - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147BBC - - thumb_func_start sub_8147C24 -sub_8147C24: @ 8147C24 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - mov r8, r0 - ldr r6, =sMugshotsTilemap - add r1, sp, 0x4 - mov r0, sp - bl sub_8149F58 - ldr r0, =sUnknown_085B9AF0 - ldr r1, [sp, 0x4] - movs r2, 0xF0 - bl CpuSet - ldr r1, =sOpponentMugshotsPals - mov r2, r8 - movs r3, 0x26 - ldrsh r0, [r2, r3] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =sPlayerMugshotsPals - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0xFA - movs r2, 0xC - bl LoadPalette - movs r1, 0 - ldr r5, [sp] - movs r0, 0xF0 - lsls r0, 8 - adds r7, r0, 0 -_08147C78: - movs r0, 0 - lsls r3, r1, 16 - asrs r4, r3, 11 -_08147C7E: - lsls r2, r0, 16 - asrs r2, 16 - adds r1, r4, r2 - lsls r1, 1 - adds r1, r5 - ldrh r0, [r6] - orrs r0, r7 - strh r0, [r1] - adds r2, 0x1 - lsls r2, 16 - adds r6, 0x2 - lsrs r0, r2, 16 - asrs r2, 16 - cmp r2, 0x1F - ble _08147C7E - movs r1, 0x80 - lsls r1, 9 - adds r0, r3, r1 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _08147C78 - movs r0, 0x2 - bl EnableInterrupts - ldr r0, =sub_81481E0 - bl SetHBlankCallback - mov r2, r8 - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - movs r0, 0 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147C24 - - thumb_func_start sub_8147CE4 -sub_8147CE4: @ 8147CE4 - push {r4-r7,lr} - adds r4, r0, 0 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r7, =gUnknown_02038C28 - ldrh r0, [r4, 0xA] - ldrb r5, [r4, 0xA] - adds r0, 0x10 - strh r0, [r4, 0xA] - movs r6, 0 -_08147CFE: - adds r0, r5, 0 - movs r1, 0x10 - bl Sin - ldrh r1, [r4, 0xC] - adds r0, r1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r0, 0 - bge _08147D14 - movs r2, 0x1 -_08147D14: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0xF0 - ble _08147D1E - movs r2, 0xF0 -_08147D1E: - strh r2, [r7] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r7, 0x2 - adds r0, r5, 0 - adds r0, 0x10 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r6, 0x4F - bls _08147CFE - cmp r6, 0x9F - bhi _08147D76 -_08147D38: - adds r0, r5, 0 - movs r1, 0x10 - bl Sin - ldrh r1, [r4, 0xE] - subs r1, r0 - lsls r1, 16 - lsrs r2, r1, 16 - cmp r1, 0 - bge _08147D4E - movs r2, 0 -_08147D4E: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0xEF - ble _08147D58 - movs r2, 0xEF -_08147D58: - lsls r0, r2, 16 - asrs r0, 8 - movs r1, 0xF0 - orrs r0, r1 - strh r0, [r7] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r7, 0x2 - adds r0, r5, 0 - adds r0, 0x10 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r6, 0x9F - bls _08147D38 -_08147D76: - ldrh r1, [r4, 0xC] - adds r1, 0x8 - strh r1, [r4, 0xC] - ldrh r0, [r4, 0xE] - subs r0, 0x8 - strh r0, [r4, 0xE] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0xF0 - ble _08147D8E - movs r0, 0xF0 - strh r0, [r4, 0xC] -_08147D8E: - movs r1, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0 - bge _08147D9A - movs r0, 0 - strh r0, [r4, 0xE] -_08147D9A: - ldr r0, [r4, 0xC] - cmp r0, 0xF0 - bne _08147DA6 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_08147DA6: - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrh r0, [r1, 0x18] - subs r0, 0x8 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x1A] - adds r0, 0x8 - strh r0, [r1, 0x1A] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147CE4 - - thumb_func_start sub_8147DD0 -sub_8147DD0: @ 8147DD0 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r1, =gUnknown_02038C28 - adds r5, r2, 0 - movs r2, 0xF0 -_08147DE4: - strh r2, [r1] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - adds r1, 0x2 - cmp r0, 0x9F - bls _08147DE4 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x8] - strh r1, [r4, 0xA] - strh r1, [r4, 0xC] - strh r1, [r4, 0xE] - ldr r1, [r5] - ldrh r0, [r1, 0x18] - subs r0, 0x8 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x1A] - adds r0, 0x8 - strh r0, [r1, 0x1A] - movs r1, 0x22 - ldrsh r0, [r4, r1] - movs r1, 0 - bl sub_8148484 - movs r1, 0x24 - ldrsh r0, [r4, r1] - movs r1, 0x1 - bl sub_8148484 - movs r1, 0x22 - ldrsh r0, [r4, r1] - bl sub_814849C - movs r0, 0x68 - bl PlaySE - ldr r1, [r5] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147DD0 - - thumb_func_start sub_8147E4C -sub_8147E4C: @ 8147E4C - push {r4,lr} - adds r4, r0, 0 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrh r0, [r1, 0x18] - subs r0, 0x8 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x1A] - adds r0, 0x8 - strh r0, [r1, 0x1A] - movs r1, 0x22 - ldrsh r0, [r4, r1] - bl sub_81484B8 - lsls r0, 16 - cmp r0, 0 - beq _08147E7C - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r1, 0x24 - ldrsh r0, [r4, r1] - bl sub_814849C -_08147E7C: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147E4C - - thumb_func_start sub_8147E88 -sub_8147E88: @ 8147E88 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - ldr r7, =sTransitionStructPtr - ldr r1, [r7] - ldrh r0, [r1, 0x18] - subs r0, 0x8 - movs r2, 0 - mov r8, r2 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x1A] - adds r0, 0x8 - strh r0, [r1, 0x1A] - movs r1, 0x24 - ldrsh r0, [r6, r1] - bl sub_81484B8 - lsls r0, 16 - cmp r0, 0 - beq _08147F1C - ldr r1, [r7] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - movs r0, 0 - bl SetVBlankCallback - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - ldr r4, =gUnknown_02038C28 - movs r5, 0xA0 - lsls r5, 1 - adds r0, r4, 0 - movs r1, 0 - adds r2, r5, 0 - bl memset - movs r2, 0xF0 - lsls r2, 3 - adds r4, r2 - adds r0, r4, 0 - movs r1, 0 - adds r2, r5, 0 - bl memset - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - mov r0, r8 - strh r0, [r6, 0xE] - strh r0, [r6, 0x10] - ldr r1, [r7] - movs r0, 0xBF - strh r0, [r1, 0xE] - ldr r0, =sub_8148160 - bl SetVBlankCallback -_08147F1C: - movs r0, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147E88 - - thumb_func_start sub_8147F40 -sub_8147F40: @ 8147F40 - push {r4-r7,lr} - adds r4, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - movs r6, 0x1 - ldr r1, [r2] - ldrh r0, [r1, 0x18] - subs r0, 0x8 - strh r0, [r1, 0x18] - ldrh r0, [r1, 0x1A] - adds r0, 0x8 - strh r0, [r1, 0x1A] - ldrh r1, [r4, 0x10] - movs r3, 0x10 - ldrsh r0, [r4, r3] - mov r12, r2 - cmp r0, 0x4F - bgt _08147F6E - adds r0, r1, 0x2 - strh r0, [r4, 0x10] -_08147F6E: - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r0, 0x50 - ble _08147F7A - movs r0, 0x50 - strh r0, [r4, 0x10] -_08147F7A: - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - movs r1, 0x1 - ands r0, r1 - ldrh r3, [r4, 0x10] - cmp r0, 0 - beq _08147FDC - movs r2, 0 - lsls r0, r3, 16 - movs r6, 0 - cmp r0, 0 - blt _08147FDC - movs r7, 0x50 - ldr r5, =gUnknown_02038C28 -_08147F98: - lsls r0, r2, 16 - asrs r3, r0, 16 - subs r1, r7, r3 - adds r0, r3, 0 - adds r0, 0x50 - lsls r0, 16 - lsrs r2, r0, 16 - lsls r1, 16 - asrs r1, 15 - adds r1, r5 - ldrh r0, [r1] - cmp r0, 0xF - bhi _08147FB8 - movs r6, 0x1 - adds r0, 0x1 - strh r0, [r1] -_08147FB8: - lsls r0, r2, 16 - asrs r0, 15 - adds r1, r0, r5 - ldrh r0, [r1] - cmp r0, 0xF - bhi _08147FCA - movs r6, 0x1 - adds r0, 0x1 - strh r0, [r1] -_08147FCA: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - asrs r0, 16 - movs r3, 0x10 - ldrsh r1, [r4, r3] - ldrh r3, [r4, 0x10] - cmp r0, r1 - ble _08147F98 -_08147FDC: - cmp r3, 0x50 - bne _08147FEA - cmp r6, 0 - bne _08147FEA - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_08147FEA: - mov r1, r12 - ldr r0, [r1] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8147F40 - - thumb_func_start sub_8148008 -sub_8148008: @ 8148008 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r5, =sTransitionStructPtr - ldr r0, [r5] - ldrb r1, [r0] - movs r6, 0 - strb r6, [r0] - movs r0, 0x1 - negs r0, r0 - ldr r2, =0x00007fff - movs r1, 0x10 - bl BlendPalettes - ldr r1, [r5] - movs r0, 0xFF - strh r0, [r1, 0xE] - strh r6, [r4, 0xE] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148008 - - thumb_func_start sub_8148040 -sub_8148040: @ 8148040 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =sTransitionStructPtr - ldr r1, [r5] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - ldr r0, =gUnknown_02038C28 - movs r2, 0xE - ldrsh r1, [r4, r2] - movs r2, 0xA0 - lsls r2, 1 - bl memset - movs r1, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0xF - ble _08148070 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_08148070: - ldr r0, [r5] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148040 - - thumb_func_start sub_814808C -sub_814808C: @ 814808C - push {r4,lr} - adds r4, r0, 0 - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, [r4] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814808C - - thumb_func_start sub_81480CC -sub_81480CC: @ 81480CC - push {r4,lr} - ldr r4, =0x040000b0 - ldrh r1, [r4, 0xA] - ldr r0, =0x0000c5ff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0xA] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xA] - bl sub_8149F2C - ldr r3, =sTransitionStructPtr - ldr r0, [r3] - ldrb r0, [r0] - cmp r0, 0 - beq _08148104 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_08148104: - ldr r2, =0x04000012 - ldr r1, [r3] - ldrh r0, [r1, 0x1C] - strh r0, [r2] - adds r2, 0x36 - ldrh r0, [r1, 0x2] - strh r0, [r2] - adds r2, 0x2 - ldrh r0, [r1, 0x4] - strh r0, [r2] - subs r2, 0x6 - ldrh r0, [r1, 0x8] - strh r0, [r2] - ldr r0, =gUnknown_020393A8 - str r0, [r4] - ldr r0, =0x04000040 - str r0, [r4, 0x4] - ldr r0, =0xa2400001 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81480CC - - thumb_func_start sub_8148160 -sub_8148160: @ 8148160 - push {r4,lr} - ldr r4, =0x040000b0 - ldrh r1, [r4, 0xA] - ldr r0, =0x0000c5ff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0xA] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xA] - bl sub_8149F2C - ldr r2, =sTransitionStructPtr - ldr r0, [r2] - ldrb r0, [r0] - cmp r0, 0 - beq _08148198 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r3, 0xF0 - lsls r3, 3 - adds r0, r3 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_08148198: - ldr r1, =0x04000050 - ldr r0, [r2] - ldrh r0, [r0, 0xE] - strh r0, [r1] - ldr r0, =gUnknown_020393A8 - str r0, [r4] - ldr r0, =0x04000054 - str r0, [r4, 0x4] - ldr r0, =0xa2400001 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8148160 - - thumb_func_start sub_81481E0 -sub_81481E0: @ 81481E0 - push {lr} - ldr r0, =0x04000006 - ldrh r0, [r0] - cmp r0, 0x4F - bhi _08148200 - ldr r1, =0x04000010 - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - ldrh r0, [r0, 0x18] - b _08148208 - .pool -_08148200: - ldr r1, =0x04000010 - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - ldrh r0, [r0, 0x1A] -_08148208: - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81481E0 - - thumb_func_start sub_8148218 -sub_8148218: @ 8148218 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x4 - adds r4, r0, 0 - ldr r0, =sMugshotsTrainerPicIDsTable - movs r2, 0x26 - ldrsh r1, [r4, r2] - mov r8, r1 - add r0, r8 - ldrb r0, [r0] - ldr r2, =sMugshotsOpponentCoords - lsls r1, 2 - mov r8, r1 - adds r1, r2 - ldrh r1, [r1] - subs r1, 0x20 - lsls r1, 16 - asrs r1, 16 - adds r2, 0x2 - add r2, r8 - ldrh r2, [r2] - adds r2, 0x2A - lsls r2, 16 - asrs r2, 16 - ldr r5, =0x0201c000 - str r5, [sp] - movs r3, 0 - bl sub_80B5E6C - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x22] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - bl PlayerGenderToFrontTrainerPicId - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x88 - lsls r1, 1 - str r5, [sp] - movs r2, 0x6A - movs r3, 0 - bl sub_80B5E6C - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x24] - movs r3, 0x22 - ldrsh r0, [r4, r3] - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - ldr r1, =gSprites - adds r5, r1 - movs r2, 0x24 - ldrsh r0, [r4, r2] - lsls r6, r0, 4 - adds r6, r0 - lsls r6, 2 - adds r6, r1 - ldr r0, =sub_8148380 - str r0, [r5, 0x1C] - str r0, [r6, 0x1C] - ldrb r0, [r5, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r5, 0x1] - ldrb r0, [r6, 0x1] - orrs r0, r1 - strb r0, [r6, 0x1] - bl AllocOamMatrix - lsls r0, 24 - lsrs r0, 24 - movs r3, 0x1F - mov r9, r3 - mov r4, r9 - ands r0, r4 - lsls r0, 1 - ldrb r2, [r5, 0x3] - movs r4, 0x3F - negs r4, r4 - adds r1, r4, 0 - ands r1, r2 - orrs r1, r0 - strb r1, [r5, 0x3] - bl AllocOamMatrix - lsls r0, 24 - lsrs r0, 24 - mov r1, r9 - ands r0, r1 - lsls r0, 1 - ldrb r1, [r6, 0x3] - ands r4, r1 - orrs r4, r0 - strb r4, [r6, 0x3] - ldrb r2, [r5, 0x1] - movs r1, 0x3F - adds r0, r1, 0 - ands r0, r2 - movs r2, 0x40 - orrs r0, r2 - strb r0, [r5, 0x1] - ldrb r0, [r6, 0x1] - ands r1, r0 - orrs r1, r2 - strb r1, [r6, 0x1] - ldrb r0, [r5, 0x3] - movs r1, 0xC0 - orrs r0, r1 - strb r0, [r5, 0x3] - ldrb r0, [r6, 0x3] - orrs r0, r1 - strb r0, [r6, 0x3] - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x3 - bl CalcCenterToCornerVec - adds r0, r6, 0 - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x3 - bl CalcCenterToCornerVec - ldrb r0, [r5, 0x3] - lsls r0, 26 - lsrs r0, 27 - ldr r2, =sMugshotsOpponentRotationScales - mov r3, r8 - adds r1, r3, r2 - movs r4, 0 - ldrsh r1, [r1, r4] - adds r2, 0x2 - add r8, r2 - mov r3, r8 - movs r4, 0 - ldrsh r2, [r3, r4] - movs r3, 0 - bl SetOamMatrixRotationScaling - ldrb r0, [r6, 0x3] - lsls r0, 26 - lsrs r0, 27 - ldr r1, =0xfffffe00 - movs r2, 0x80 - lsls r2, 2 - movs r3, 0 - bl SetOamMatrixRotationScaling - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8148218 - - thumb_func_start sub_8148380 -sub_8148380: @ 8148380 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r5, =sUnknown_085C8C24 -_08148386: - movs r1, 0x2E - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08148386 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8148380 - - thumb_func_start sub_81483A8 -sub_81483A8: @ 81483A8 - movs r0, 0 - bx lr - thumb_func_end sub_81483A8 - - thumb_func_start sub_81483AC -sub_81483AC: @ 81483AC - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldr r1, =sUnknown_085C8C40 - mov r0, sp - movs r2, 0x4 - bl memcpy - add r4, sp, 0x4 - ldr r1, =sUnknown_085C8C44 - adds r0, r4, 0 - movs r2, 0x4 - bl memcpy - ldrh r0, [r5, 0x2E] - adds r0, 0x1 - strh r0, [r5, 0x2E] - movs r1, 0x3C - ldrsh r0, [r5, r1] - lsls r0, 1 - add r0, sp - ldrh r0, [r0] - strh r0, [r5, 0x30] - movs r1, 0x3C - ldrsh r0, [r5, r1] - lsls r0, 1 - adds r4, r0 - ldrh r0, [r4] - strh r0, [r5, 0x32] - movs r0, 0x1 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81483AC - - thumb_func_start sub_81483F8 -sub_81483F8: @ 81483F8 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x30] - ldrh r3, [r1, 0x20] - adds r2, r0, r3 - strh r2, [r1, 0x20] - movs r3, 0x3C - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _08148416 - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x84 - bgt _08148424 - b _0814841E -_08148416: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x67 - ble _08148424 -_0814841E: - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - strh r0, [r1, 0x2E] -_08148424: - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_81483F8 - - thumb_func_start sub_814842C -sub_814842C: @ 814842C - push {lr} - adds r2, r0, 0 - ldrh r3, [r2, 0x32] - ldrh r0, [r2, 0x30] - adds r1, r3, r0 - strh r1, [r2, 0x30] - ldrh r0, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - lsls r1, 16 - cmp r1, 0 - bne _08148452 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - negs r0, r3 - strh r0, [r2, 0x32] - movs r0, 0x1 - strh r0, [r2, 0x3A] -_08148452: - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_814842C - - thumb_func_start sub_8148458 -sub_8148458: @ 8148458 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x32] - ldrh r1, [r2, 0x30] - adds r0, r1 - strh r0, [r2, 0x30] - ldrh r1, [r2, 0x20] - adds r1, r0 - strh r1, [r2, 0x20] - adds r1, 0x1F - lsls r1, 16 - movs r0, 0x97 - lsls r0, 17 - cmp r1, r0 - bls _0814847C - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] -_0814847C: - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_8148458 - - thumb_func_start sub_8148484 -sub_8148484: @ 8148484 - ldr r3, =gSprites - lsls r0, 16 - asrs r0, 16 - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - strh r1, [r2, 0x3C] - bx lr - .pool - thumb_func_end sub_8148484 - - thumb_func_start sub_814849C -sub_814849C: @ 814849C - ldr r2, =gSprites - lsls r0, 16 - asrs r0, 16 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - strh r0, [r1, 0x2E] - bx lr - .pool - thumb_func_end sub_814849C - - thumb_func_start sub_81484B8 -sub_81484B8: @ 81484B8 - ldr r2, =gSprites - lsls r0, 16 - asrs r0, 16 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - movs r2, 0x3A - ldrsh r0, [r1, r2] - bx lr - .pool - thumb_func_end sub_81484B8 - - thumb_func_start Phase2Task_Transition_Slice -Phase2Task_Transition_Slice: @ 81484D0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8C48 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_081484E2: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _081484E2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Transition_Slice - - thumb_func_start sub_8148508 -sub_8148508: @ 8148508 - push {r4-r6,lr} - adds r5, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - movs r4, 0 - movs r3, 0 - movs r0, 0x80 - lsls r0, 1 - strh r0, [r5, 0xC] - movs r0, 0x1 - strh r0, [r5, 0xE] - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - movs r0, 0x3F - strh r0, [r1, 0x2] - strh r3, [r1, 0x4] - movs r0, 0xA0 - strh r0, [r1, 0x8] - ldrb r0, [r1] - strb r4, [r1] - ldr r4, =gUnknown_020393A8 - adds r6, r2, 0 - movs r2, 0xF0 -_0814853A: - lsls r1, r3, 1 - adds r1, r4 - ldr r0, [r6] - ldrh r0, [r0, 0x14] - strh r0, [r1] - adds r0, r3, 0 - adds r0, 0xA0 - lsls r0, 1 - adds r0, r4 - strh r2, [r0] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x9F - bls _0814853A - movs r0, 0x2 - bl EnableInterrupts - movs r0, 0x4 - movs r1, 0x10 - bl SetGpuRegBits - ldr r0, =sub_814869C - bl SetVBlankCallback - ldr r0, =sub_8148728 - bl SetHBlankCallback - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0x1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148508 - - thumb_func_start sub_8148590 -sub_8148590: @ 8148590 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r3, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldrh r0, [r3, 0xC] - lsls r0, 16 - asrs r0, 24 - ldrh r1, [r3, 0xA] - adds r0, r1 - strh r0, [r3, 0xA] - lsls r0, 16 - asrs r0, 16 - mov r8, r2 - cmp r0, 0xF0 - ble _081485BC - movs r0, 0xF0 - strh r0, [r3, 0xA] -_081485BC: - ldrh r4, [r3, 0xC] - movs r0, 0xC - ldrsh r1, [r3, r0] - ldr r0, =0x00000fff - ldrh r2, [r3, 0xE] - cmp r1, r0 - bgt _081485CE - adds r0, r4, r2 - strh r0, [r3, 0xC] -_081485CE: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x7F - bgt _081485DA - lsls r0, r2, 1 - strh r0, [r3, 0xE] -_081485DA: - movs r5, 0 - ldr r7, =gUnknown_02038C28 - movs r1, 0xA0 - lsls r1, 1 - adds r1, r7 - mov r12, r1 - mov r6, r8 -_081485E8: - lsls r0, r5, 1 - adds r2, r0, r7 - mov r1, r12 - adds r4, r0, r1 - movs r0, 0x1 - ands r0, r5 - cmp r0, 0 - beq _08148618 - ldr r1, [r6] - ldrh r0, [r3, 0xA] - ldrh r1, [r1, 0x14] - adds r0, r1 - strh r0, [r2] - ldrh r1, [r3, 0xA] - movs r0, 0xF0 - subs r0, r1 - b _0814862A - .pool -_08148618: - ldr r0, [r6] - ldrh r0, [r0, 0x14] - ldrh r1, [r3, 0xA] - subs r0, r1 - strh r0, [r2] - ldrh r0, [r3, 0xA] - lsls r0, 8 - movs r1, 0xF1 - orrs r0, r1 -_0814862A: - strh r0, [r4] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x9F - bls _081485E8 - movs r1, 0xA - ldrsh r0, [r3, r1] - cmp r0, 0xEF - ble _08148644 - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] -_08148644: - mov r1, r8 - ldr r0, [r1] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8148590 - - thumb_func_start sub_814865C -sub_814865C: @ 814865C - push {lr} - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, =Phase2Task_Transition_Slice - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_814865C - - thumb_func_start sub_814869C -sub_814869C: @ 814869C - push {r4,lr} - ldr r4, =0x040000b0 - ldrh r1, [r4, 0xA] - ldr r0, =0x0000c5ff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0xA] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xA] - bl sub_8149F2C - ldr r2, =0x04000048 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrh r0, [r1, 0x2] - strh r0, [r2] - adds r2, 0x2 - ldrh r0, [r1, 0x4] - strh r0, [r2] - subs r2, 0x6 - ldrh r0, [r1, 0x8] - strh r0, [r2] - ldrb r0, [r1] - cmp r0, 0 - beq _081486E6 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x80000140 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_081486E6: - ldr r0, =gUnknown_020394E8 - str r0, [r4] - ldr r0, =0x04000040 - str r0, [r4, 0x4] - ldr r0, =0xa2400001 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814869C - - thumb_func_start sub_8148728 -sub_8148728: @ 8148728 - push {lr} - ldr r2, =0x04000006 - ldrh r0, [r2] - cmp r0, 0x9F - bhi _0814874E - ldr r1, =gUnknown_02038C28 - ldrh r0, [r2] - lsls r0, 1 - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x04000014 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] - adds r0, 0x4 - strh r1, [r0] -_0814874E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8148728 - - thumb_func_start Phase2Task_Transition_25 -Phase2Task_Transition_25: @ 8148760 + thumb_func_start Phase2Task_25 +Phase2Task_25: @ 8148760 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -4788,7 +31,7 @@ _08148772: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_25 + thumb_func_end Phase2Task_25 thumb_func_start sub_8148798 sub_8148798: @ 8148798 @@ -4868,9 +111,9 @@ _081487CC: strh r0, [r6, 0x14] movs r0, 0x2 bl EnableInterrupts - ldr r0, =sub_814869C + ldr r0, =VBlankCB_Phase2_Slice bl SetVBlankCallback - ldr r0, =sub_8148728 + ldr r0, =HBlankCB_Phase2_Slice bl SetHBlankCallback ldrh r0, [r6, 0x8] adds r0, 0x1 @@ -5241,7 +484,7 @@ sub_8148B14: @ 8148B14 strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] bl sub_8149F84 - ldr r0, =Phase2Task_Transition_25 + ldr r0, =Phase2Task_25 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -5252,8 +495,8 @@ sub_8148B14: @ 8148B14 .pool thumb_func_end sub_8148B14 - thumb_func_start Phase2Task_Transition_26 -Phase2Task_Transition_26: @ 8148B54 + thumb_func_start Phase2Task_26 +Phase2Task_26: @ 8148B54 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -5278,10 +521,10 @@ _08148B66: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_26 + thumb_func_end Phase2Task_26 - thumb_func_start Phase2Task_Transition_27 -Phase2Task_Transition_27: @ 8148B8C + thumb_func_start Phase2Task_27 +Phase2Task_27: @ 8148B8C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -5306,7 +549,7 @@ _08148B9E: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_27 + thumb_func_end Phase2Task_27 thumb_func_start sub_8148BC4 sub_8148BC4: @ 8148BC4 @@ -5336,7 +579,7 @@ _08148BEE: cmp r1, 0 bge _08148BEE movs r4, 0 - ldr r0, =sub_8146F68 + ldr r0, =VBlankCB1_Phase2_BigPokeball bl SetVBlankCallback ldrh r0, [r5, 0x8] adds r0, 0x1 @@ -5618,8 +861,8 @@ _08148E3C: .pool thumb_func_end sub_8148D6C - thumb_func_start Phase2Task_Transition_28 -Phase2Task_Transition_28: @ 8148E54 + thumb_func_start Phase2Task_28 +Phase2Task_28: @ 8148E54 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -5644,7 +887,7 @@ _08148E66: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_28 + thumb_func_end Phase2Task_28 thumb_func_start sub_8148E8C sub_8148E8C: @ 8148E8C @@ -5986,12 +1229,12 @@ _08149138: bx r1 thumb_func_end sub_8149048 - thumb_func_start Phase2Task_Transition_Groudon -Phase2Task_Transition_Groudon: @ 8149140 + thumb_func_start Phase2Task_Groudon +Phase2Task_Groudon: @ 8149140 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 - ldr r5, =gUnknown_085C8D40 + ldr r5, =sPhase2_Groudon_Funcs ldr r2, =gTasks lsls r1, r0, 2 adds r1, r0 @@ -6012,7 +1255,7 @@ _08149152: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_Groudon + thumb_func_end Phase2Task_Groudon thumb_func_start sub_8149178 sub_8149178: @ 8149178 @@ -6140,12 +1383,12 @@ _0814926E: .pool thumb_func_end sub_8149224 - thumb_func_start Phase2Task_Transition_Rayquaza -Phase2Task_Transition_Rayquaza: @ 814927C + thumb_func_start Phase2Task_Rayquaza +Phase2Task_Rayquaza: @ 814927C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 - ldr r5, =gUnknown_085C8D60 + ldr r5, =sPhase2_Rayquaza_Funcs ldr r2, =gTasks lsls r1, r0, 2 adds r1, r0 @@ -6166,7 +1409,7 @@ _0814928E: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_Rayquaza + thumb_func_end Phase2Task_Rayquaza thumb_func_start sub_81492B4 sub_81492B4: @ 81492B4 @@ -6419,7 +1662,7 @@ _0814949A: movs r0, 0xA0 strh r0, [r1, 0x8] movs r1, 0 - ldr r5, =sub_8146F68 + ldr r5, =VBlankCB1_Phase2_BigPokeball ldr r3, =gUnknown_020393A8 movs r2, 0 _081494C4: @@ -6464,7 +1707,7 @@ sub_8149508: @ 8149508 ands r0, r2 strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] - bl sub_8149F2C + bl VBlankCB_BattleTransition ldr r0, =sTransitionStructPtr ldr r0, [r0] movs r1, 0x20 @@ -6494,8 +1737,8 @@ _08149554: .pool thumb_func_end sub_8149508 - thumb_func_start Phase2Task_Transition_WhiteFade -Phase2Task_Transition_WhiteFade: @ 8149578 + thumb_func_start Phase2Task_WhiteFade +Phase2Task_WhiteFade: @ 8149578 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -6520,7 +1763,7 @@ _0814958A: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_WhiteFade + thumb_func_end Phase2Task_WhiteFade thumb_func_start sub_81495B0 sub_81495B0: @ 81495B0 @@ -6715,7 +1958,7 @@ sub_8149740: @ 8149740 cmp r0, 0x10 bls _08149766 bl sub_8149F84 - ldr r0, =Phase2Task_Transition_WhiteFade + ldr r0, =Phase2Task_WhiteFade bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -6740,7 +1983,7 @@ sub_8149774: @ 8149774 ands r0, r1 strh r0, [r4, 0xA] ldrh r0, [r4, 0xA] - bl sub_8149F2C + bl VBlankCB_BattleTransition ldr r2, =0x04000050 ldr r0, =sTransitionStructPtr ldr r1, [r0] @@ -6785,7 +2028,7 @@ _081497C4: thumb_func_start sub_8149804 sub_8149804: @ 8149804 push {lr} - bl sub_8149F2C + bl VBlankCB_BattleTransition ldr r1, =0x04000054 ldr r0, =sTransitionStructPtr ldr r2, [r0] @@ -6957,8 +2200,8 @@ _0814994C: .pool thumb_func_end sub_8149864 - thumb_func_start Phase2Task_Transition_GridSquares -Phase2Task_Transition_GridSquares: @ 814995C + thumb_func_start Phase2Task_GridSquares +Phase2Task_GridSquares: @ 814995C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -6983,7 +2226,7 @@ _0814996E: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_GridSquares + thumb_func_end Phase2Task_GridSquares thumb_func_start sub_8149994 sub_8149994: @ 8149994 @@ -7076,7 +2319,7 @@ sub_8149A40: @ 8149A40 cmp r1, 0 bne _08149A60 bl sub_8149F84 - ldr r0, =Phase2Task_Transition_GridSquares + ldr r0, =Phase2Task_GridSquares bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -7088,12 +2331,12 @@ _08149A60: .pool thumb_func_end sub_8149A40 - thumb_func_start Phase2Task_Transition_Shards -Phase2Task_Transition_Shards: @ 8149A6C + thumb_func_start Phase2Task_Shards +Phase2Task_Shards: @ 8149A6C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 - ldr r5, =sPhase2_Transition_Shards_Funcs + ldr r5, =sPhase2_Shards_Funcs ldr r2, =gTasks lsls r1, r0, 2 adds r1, r0 @@ -7114,7 +2357,7 @@ _08149A7E: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_Shards + thumb_func_end Phase2Task_Shards thumb_func_start sub_8149AA4 sub_8149AA4: @ 8149AA4 @@ -7358,7 +2601,7 @@ sub_8149C60: @ 8149C60 strh r0, [r1, 0xA] ldrh r0, [r1, 0xA] bl sub_8149F84 - ldr r0, =Phase2Task_Transition_Shards + ldr r0, =Phase2Task_Shards bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -7418,7 +2661,7 @@ sub_8149CE8: @ 8149CE8 ands r0, r1 strh r0, [r4, 0xA] ldrh r0, [r4, 0xA] - bl sub_8149F2C + bl VBlankCB_BattleTransition ldr r3, =sTransitionStructPtr ldr r0, [r3] ldrb r0, [r0] @@ -7463,8 +2706,8 @@ _08149D20: .pool thumb_func_end sub_8149CE8 - thumb_func_start sub_8149D78 -sub_8149D78: @ 8149D78 + thumb_func_start CreatePhase1Task +CreatePhase1Task: @ 8149D78 push {r4-r6,lr} mov r6, r8 push {r6} @@ -7511,10 +2754,10 @@ sub_8149D78: @ 8149D78 pop {r0} bx r0 .pool - thumb_func_end sub_8149D78 + thumb_func_end CreatePhase1Task - thumb_func_start sub_8149DDC -sub_8149DDC: @ 8149DDC + thumb_func_start IsPhase1Done +IsPhase1Done: @ 8149DDC push {lr} ldr r0, =sub_8149DFC bl FindTaskIdByFunc @@ -7530,7 +2773,7 @@ _08149DF4: _08149DF6: pop {r1} bx r1 - thumb_func_end sub_8149DDC + thumb_func_end IsPhase1Done thumb_func_start sub_8149DFC sub_8149DFC: @ 8149DFC @@ -7691,15 +2934,15 @@ sub_8149F08: @ 8149F08 .pool thumb_func_end sub_8149F08 - thumb_func_start sub_8149F2C -sub_8149F2C: @ 8149F2C + thumb_func_start VBlankCB_BattleTransition +VBlankCB_BattleTransition: @ 8149F2C push {lr} bl LoadOam bl ProcessSpriteCopyRequests bl TransferPlttBuffer pop {r0} bx r0 - thumb_func_end sub_8149F2C + thumb_func_end VBlankCB_BattleTransition thumb_func_start sub_8149F40 sub_8149F40: @ 8149F40 @@ -8310,8 +3553,8 @@ sub_814A374: @ 814A374 .pool thumb_func_end sub_814A374 - thumb_func_start Phase2Task_Transition_29 -Phase2Task_Transition_29: @ 814A3BC + thumb_func_start Phase2Task_29 +Phase2Task_29: @ 814A3BC push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8336,10 +3579,10 @@ _0814A3CE: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_29 + thumb_func_end Phase2Task_29 - thumb_func_start Phase2Task_Transition_30 -Phase2Task_Transition_30: @ 814A3F4 + thumb_func_start Phase2Task_30 +Phase2Task_30: @ 814A3F4 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8364,7 +3607,7 @@ _0814A406: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_30 + thumb_func_end Phase2Task_30 thumb_func_start sub_814A42C sub_814A42C: @ 814A42C @@ -8614,7 +3857,7 @@ _0814A632: ands r0, r1 cmp r0, 0 bne _0814A654 - ldr r0, =Phase2Task_Transition_30 + ldr r0, =Phase2Task_30 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -8642,7 +3885,7 @@ _0814A654: thumb_func_start sub_814A684 sub_814A684: @ 814A684 push {lr} - bl sub_8149F2C + bl VBlankCB_BattleTransition ldr r2, =0x04000050 ldr r0, =sTransitionStructPtr ldr r1, [r0] @@ -8687,8 +3930,8 @@ sub_814A6CC: @ 814A6CC .pool thumb_func_end sub_814A6CC - thumb_func_start Phase2Task_Transition_31 -Phase2Task_Transition_31: @ 814A6F0 + thumb_func_start Phase2Task_31 +Phase2Task_31: @ 814A6F0 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8713,10 +3956,10 @@ _0814A702: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_31 + thumb_func_end Phase2Task_31 - thumb_func_start Phase2Task_Transition_33 -Phase2Task_Transition_33: @ 814A728 + thumb_func_start Phase2Task_33 +Phase2Task_33: @ 814A728 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8741,10 +3984,10 @@ _0814A73A: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_33 + thumb_func_end Phase2Task_33 - thumb_func_start Phase2Task_Transition_32 -Phase2Task_Transition_32: @ 814A760 + thumb_func_start Phase2Task_32 +Phase2Task_32: @ 814A760 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -8769,7 +4012,7 @@ _0814A772: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_32 + thumb_func_end Phase2Task_32 thumb_func_start sub_814A798 sub_814A798: @ 814A798 diff --git a/asm/field_effect.s b/asm/field_effect.s index b6b4803d8..770f1932c 100644 --- a/asm/field_effect.s +++ b/asm/field_effect.s @@ -498,8 +498,8 @@ _080B5E68: bx r1 thumb_func_end FieldEffectActiveListContains - thumb_func_start sub_80B5E6C -sub_80B5E6C: @ 80B5E6C + thumb_func_start CreateTrainerSprite +CreateTrainerSprite: @ 80B5E6C push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -566,7 +566,7 @@ sub_80B5E6C: @ 80B5E6C pop {r1} bx r1 .pool - thumb_func_end sub_80B5E6C + thumb_func_end CreateTrainerSprite thumb_func_start sub_80B5F0C sub_80B5F0C: @ 80B5F0C diff --git a/asm/main_menu.s b/asm/main_menu.s index 52afc783e..5b50c42de 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -3948,7 +3948,7 @@ AddBirchSpeechObjects: @ 803192C movs r1, 0x78 movs r2, 0x3C movs r3, 0 - bl sub_80B5E6C + bl CreateTrainerSprite lsls r0, 24 lsrs r0, 24 lsls r2, r0, 4 @@ -3981,7 +3981,7 @@ AddBirchSpeechObjects: @ 803192C movs r1, 0x78 movs r2, 0x3C movs r3, 0 - bl sub_80B5E6C + bl CreateTrainerSprite lsls r0, 24 lsrs r0, 24 lsls r2, r0, 4 diff --git a/asm/unk_transition.s b/asm/unk_transition.s index 564d2fbad..4b96ccaf7 100755 --- a/asm/unk_transition.s +++ b/asm/unk_transition.s @@ -24,8 +24,8 @@ _081DABD2: bx r1 thumb_func_end sub_81DABBC - thumb_func_start Phase2Task_Transition_34 -Phase2Task_Transition_34: @ 81DABDC + thumb_func_start Phase2Task_34 +Phase2Task_34: @ 81DABDC push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -50,7 +50,7 @@ _081DABEE: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_34 + thumb_func_end Phase2Task_34 thumb_func_start sub_81DAC14 sub_81DAC14: @ 81DAC14 @@ -119,7 +119,7 @@ sub_81DAC80: @ 81DAC80 bne _081DACA4 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_34 + ldr r0, =Phase2Task_34 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -131,8 +131,8 @@ _081DACA4: .pool thumb_func_end sub_81DAC80 - thumb_func_start Phase2Task_Transition_35 -Phase2Task_Transition_35: @ 81DACB4 + thumb_func_start Phase2Task_35 +Phase2Task_35: @ 81DACB4 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -157,7 +157,7 @@ _081DACC6: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_35 + thumb_func_end Phase2Task_35 thumb_func_start sub_81DACEC sub_81DACEC: @ 81DACEC @@ -226,7 +226,7 @@ sub_81DAD58: @ 81DAD58 bne _081DAD7C adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_35 + ldr r0, =Phase2Task_35 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -238,8 +238,8 @@ _081DAD7C: .pool thumb_func_end sub_81DAD58 - thumb_func_start Phase2Task_Transition_36 -Phase2Task_Transition_36: @ 81DAD8C + thumb_func_start Phase2Task_36 +Phase2Task_36: @ 81DAD8C push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -264,7 +264,7 @@ _081DAD9E: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_36 + thumb_func_end Phase2Task_36 thumb_func_start sub_81DADC4 sub_81DADC4: @ 81DADC4 @@ -342,7 +342,7 @@ sub_81DAE44: @ 81DAE44 bne _081DAE68 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_36 + ldr r0, =Phase2Task_36 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -354,8 +354,8 @@ _081DAE68: .pool thumb_func_end sub_81DAE44 - thumb_func_start Phase2Task_Transition_37 -Phase2Task_Transition_37: @ 81DAE78 + thumb_func_start Phase2Task_37 +Phase2Task_37: @ 81DAE78 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -380,7 +380,7 @@ _081DAE8A: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_37 + thumb_func_end Phase2Task_37 thumb_func_start sub_81DAEB0 sub_81DAEB0: @ 81DAEB0 @@ -460,7 +460,7 @@ sub_81DAF34: @ 81DAF34 bne _081DAF58 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_37 + ldr r0, =Phase2Task_37 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -472,8 +472,8 @@ _081DAF58: .pool thumb_func_end sub_81DAF34 - thumb_func_start Phase2Task_Transition_38 -Phase2Task_Transition_38: @ 81DAF68 + thumb_func_start Phase2Task_38 +Phase2Task_38: @ 81DAF68 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -498,7 +498,7 @@ _081DAF7A: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_38 + thumb_func_end Phase2Task_38 thumb_func_start sub_81DAFA0 sub_81DAFA0: @ 81DAFA0 @@ -585,7 +585,7 @@ sub_81DB02C: @ 81DB02C bne _081DB050 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_38 + ldr r0, =Phase2Task_38 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -597,8 +597,8 @@ _081DB050: .pool thumb_func_end sub_81DB02C - thumb_func_start Phase2Task_Transition_39 -Phase2Task_Transition_39: @ 81DB060 + thumb_func_start Phase2Task_39 +Phase2Task_39: @ 81DB060 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -623,7 +623,7 @@ _081DB072: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_39 + thumb_func_end Phase2Task_39 thumb_func_start sub_81DB098 sub_81DB098: @ 81DB098 @@ -710,7 +710,7 @@ sub_81DB124: @ 81DB124 bne _081DB148 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_39 + ldr r0, =Phase2Task_39 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -722,8 +722,8 @@ _081DB148: .pool thumb_func_end sub_81DB124 - thumb_func_start Phase2Task_Transition_40 -Phase2Task_Transition_40: @ 81DB158 + thumb_func_start Phase2Task_40 +Phase2Task_40: @ 81DB158 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -748,7 +748,7 @@ _081DB16A: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_40 + thumb_func_end Phase2Task_40 thumb_func_start sub_81DB190 sub_81DB190: @ 81DB190 @@ -839,7 +839,7 @@ sub_81DB224: @ 81DB224 bne _081DB248 adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_40 + ldr r0, =Phase2Task_40 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 @@ -851,8 +851,8 @@ _081DB248: .pool thumb_func_end sub_81DB224 - thumb_func_start Phase2Task_Transition_41 -Phase2Task_Transition_41: @ 81DB258 + thumb_func_start Phase2Task_41 +Phase2Task_41: @ 81DB258 push {r4,r5,lr} lsls r0, 24 lsrs r0, 24 @@ -877,7 +877,7 @@ _081DB26A: pop {r0} bx r0 .pool - thumb_func_end Phase2Task_Transition_41 + thumb_func_end Phase2Task_41 thumb_func_start sub_81DB290 sub_81DB290: @ 81DB290 @@ -970,7 +970,7 @@ sub_81DB328: @ 81DB328 bne _081DB34C adds r0, r2, 0 bl sub_81DAA20 - ldr r0, =Phase2Task_Transition_41 + ldr r0, =Phase2Task_41 bl FindTaskIdByFunc lsls r0, 24 lsrs r0, 24 diff --git a/data/battle_transition.s b/data/battle_transition.s index 901eeb69d..98b022432 100644 --- a/data/battle_transition.s +++ b/data/battle_transition.s @@ -4,175 +4,6 @@ .section .rodata - .align 2 -sPhase2_Transition_Blur_Funcs:: @ 85C8AA8 - .4byte sub_8146144 - .4byte sub_8146178 - .4byte sub_81461D8 - - .align 2 -sPhase2_Transition_Swirl_Funcs:: @ 85C8AB4 - .4byte sub_814623C - .4byte sub_81462A8 - - .align 2 -sPhase2_Transition_Shuffle_Funcs:: @ 85C8ABC - .4byte sub_81463BC - .4byte sub_8146420 - - .align 2 -gUnknown_085C8AC4:: @ 85C8AC4 - .4byte sub_814670C - .4byte sub_81468E4 - .4byte sub_8146BF8 - .4byte sub_8146C8C - .4byte sub_8146D20 - .4byte sub_8146D90 - .4byte sub_8146DF8 - - .align 2 -gUnknown_085C8AE0:: @ 85C8AE0 - .4byte sub_8146760 - .4byte sub_814692C - .4byte sub_8146BF8 - .4byte sub_8146C8C - .4byte sub_8146D20 - .4byte sub_8146D90 - .4byte sub_8146DF8 - - .align 2 -gUnknown_085C8AFC:: @ 85C8AFC - .4byte sub_8146800 - .4byte sub_8146854 - .4byte sub_8146BF8 - .4byte sub_8146C8C - .4byte sub_8146D20 - .4byte sub_8146DF8 - - .align 2 -gUnknown_085C8B14:: @ 85C8B14 - .4byte sub_81467B4 - .4byte sub_8146974 - .4byte sub_8146BF8 - .4byte sub_8146C8C - .4byte sub_8146D20 - .4byte sub_8146DF8 - - .align 2 -gUnknown_085C8B2C:: @ 85C8B2C - .4byte sub_81467B4 - .4byte sub_81469CC - .4byte sub_8146BF8 - .4byte sub_8146C8C - .4byte sub_8146D20 - .4byte sub_8146DF8 - - .align 2 -gUnknown_085C8B44:: @ 85C8B44 - .4byte sub_81467B4 - .4byte sub_8146A24 - .4byte sub_8146BF8 - .4byte sub_8146C8C - .4byte sub_8146D20 - .4byte sub_8146DF8 - - .align 2 -gUnknown_085C8B5C:: @ 85C8B5C - .4byte sub_8146DAC - .4byte sub_8146DD8 - .4byte sub_8146A7C - .4byte sub_8146AC8 - .4byte sub_8146B24 - .4byte sub_8146D90 - .4byte sub_8146B7C - .4byte sub_8146BA8 - - .align 2 -sPhase2_Transition_PokeballsTrail_Funcs:: @ 85C8B7C - .4byte sub_8146FCC - .4byte sub_8147018 - .4byte sub_81470A4 - - .align 1 -sUnknown_085C8B88:: @ 85C8B88 - .2byte 0xfff0, 0x0100 - - .align 1 -sUnknown_085C8B8C:: @ 85C8B8C - .2byte 0x0000, 0x0020, 0x0040, 0x0012, 0x0030 - - .align 1 -sUnknown_085C8B96:: @ 85C8B96 - .2byte 0x0008, 0xfff8, 0x0000 - - .align 2 -sPhase2_Transition_Clockwise_BlackFade_Funcs:: @ 85C8B9C - .4byte sub_814723C - .4byte sub_81472A4 - .4byte sub_8147334 - .4byte sub_8147428 - .4byte sub_81474B0 - .4byte sub_81475B0 - .4byte sub_8147648 - - .align 2 -sPhase2_Transition_Ripple_Funcs:: @ 85C8BB8 - .4byte sub_8147750 - .4byte sub_81477A8 - - .align 2 -sPhase2_Transition_Wave_Funcs:: @ 85C8BC0 - .4byte sub_8147924 - .4byte sub_814797C - .4byte sub_8147A18 - - .align 2 -sPhase2_Mugshot_Transition_Funcs:: @ 85C8BCC - .4byte sub_8147BBC - .4byte sub_8147C24 - .4byte sub_8147CE4 - .4byte sub_8147DD0 - .4byte sub_8147E4C - .4byte sub_8147E88 - .4byte sub_8147F40 - .4byte sub_8148008 - .4byte sub_8148040 - .4byte sub_814808C - -sMugshotsTrainerPicIDsTable:: @ 85C8BF4 - .byte 0x24, 0x25, 0x26, 0x27, 0x36, 0x00 - - .align 1 -sMugshotsOpponentRotationScales:: @ 85C8BFA - .2byte 0x0200, 0x0200, 0x0200, 0x0200, 0x01b0, 0x01b0, 0x01a0, 0x01a0, 0x0188, 0x0188 - - .align 1 -sMugshotsOpponentCoords:: @ 85C8C0E - .2byte 0x0000, 0x0000, 0x0000, 0x0000, 0xfffc, 0x0004, 0x0000, 0x0005, 0xfff8, 0x0007, 0x0000 - - .align 2 -sUnknown_085C8C24:: @ 85C8C24 - .4byte sub_81483A8 - .4byte sub_81483AC - .4byte sub_81483F8 - .4byte sub_814842C - .4byte sub_81483A8 - .4byte sub_8148458 - .4byte sub_81483A8 - - .align 1 -sUnknown_085C8C40:: @ 85C8C40 - .2byte 0x000c, 0xfff4 - - .align 1 -sUnknown_085C8C44:: @ 85C8C44 - .2byte 0xffff, 0x0001 - - .align 2 -gUnknown_085C8C48:: @ 85C8C48 - .4byte sub_8148508 - .4byte sub_8148590 - .4byte sub_814865C .align 2 gUnknown_085C8C54:: @ 85C8C54 @@ -286,20 +117,20 @@ gUnknown_085C8D38:: @ 85C8D38 .4byte gUnknown_085C8D18 .align 2 -gUnknown_085C8D40:: @ 85C8D40 - .4byte sub_8146DAC - .4byte sub_8146DD8 +sPhase2_Groudon_Funcs:: @ 85C8D40 + .4byte Phase2_WeatherTrio_Func1 + .4byte Phase2_WaitPaletteFade .4byte sub_8149178 .4byte sub_81491C8 .4byte sub_8149224 - .4byte sub_8146D90 - .4byte sub_8146B7C - .4byte sub_8146BA8 + .4byte Phase2_FramesCountdown + .4byte Phase2_WeatherDuo_Func6 + .4byte Phase2_WeatherDuo_Func7 .align 2 -gUnknown_085C8D60:: @ 85C8D60 - .4byte sub_8146DAC - .4byte sub_8146DD8 +sPhase2_Rayquaza_Funcs:: @ 85C8D60 + .4byte Phase2_WeatherTrio_Func1 + .4byte Phase2_WaitPaletteFade .4byte sub_81492B4 .4byte sub_8149358 .4byte sub_8149388 @@ -329,7 +160,7 @@ sUnknown_085C8DB0:: @ 85C8DB0 .4byte sub_8149A40 .align 2 -sPhase2_Transition_Shards_Funcs:: @ 85C8DBC +sPhase2_Shards_Funcs:: @ 85C8DBC .4byte sub_8149AA4 .4byte sub_8149B08 .4byte sub_8149B84 @@ -481,10 +312,10 @@ sMugshotsTilemap:: @ 85C94D0 gUnknown_085C99D0:: @ 85C99D0 .4byte sub_814A324 .4byte sub_814A374 - .4byte sub_8146BF8 - .4byte sub_8146C8C - .4byte sub_8146D20 - .4byte sub_8146DF8 + .4byte Phase2_BigPokeball_Func3 + .4byte Phase2_BigPokeball_Func4 + .4byte Phase2_BigPokeball_Func5 + .4byte Phase2_BigPokeball_Func6 .align 2 gUnknown_085C99E8:: @ 85C99E8 diff --git a/data/field_effect_scripts.s b/data/field_effect_scripts.s index 9457094f9..1a877daa9 100644 --- a/data/field_effect_scripts.s +++ b/data/field_effect_scripts.s @@ -256,7 +256,7 @@ gFieldEffectScript_Unknown44:: @ 82DBC45 gFieldEffectScript_Unknown45:: @ 82DBC4B field_eff_loadpal gFieldEffectObjectPaletteInfo10 - field_eff_callnative sub_81470D0 + field_eff_callnative FldEff_Pokeball field_eff_end gFieldEffectScript_HeartIcon:: @ 82DBC56 diff --git a/include/battle_transition.h b/include/battle_transition.h index 108b6232b..2ad27dc29 100644 --- a/include/battle_transition.h +++ b/include/battle_transition.h @@ -7,6 +7,16 @@ void BattleTransition_StartOnField(u8 transitionID); void BattleTransition_Start(u8 transitionID); bool8 IsBattleTransitionDone(void); +enum // TRANSITION_MUGSHOT +{ + MUGSHOT_SYDNEY, + MUGSHOT_PHOEBE, + MUGSHOT_GLACIA, + MUGSHOT_DRAKE, + MUGSHOT_CHAMPION, + MUGSHOTS_COUNT +}; + // credits for the names go to Dyskinesia and Tetrable // names are naturally subject to change diff --git a/include/field_effect.h b/include/field_effect.h index 772b20d37..2d1d3b3b0 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -75,5 +75,6 @@ u32 FieldEffectStart(u8); bool8 FieldEffectActiveListContains(u8 id); void sub_80B69DC(void); void FieldEffectStop(struct Sprite *sprite, u8 id); +u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer); #endif //GUARD_FIELD_EFFECTS_H diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index f86f2434c..6dbe5e8ed 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -137,8 +137,6 @@ #define REG_OFFSET_DMA3CNT_H 0xde #define REG_OFFSET_TMCNT 0x100 -#define REG_OFFSET_TMCNT_L 0x100 -#define REG_OFFSET_TMCNT_H 0x102 #define REG_OFFSET_TM0CNT 0x100 #define REG_OFFSET_TM0CNT_L 0x100 #define REG_OFFSET_TM0CNT_H 0x102 @@ -300,8 +298,6 @@ #define REG_ADDR_DMA3CNT_H (REG_BASE + REG_OFFSET_DMA3CNT_H) #define REG_ADDR_TMCNT (REG_BASE + REG_OFFSET_TMCNT) -#define REG_ADDR_TMCNT_L (REG_BASE + REG_OFFSET_TMCNT_L) -#define REG_ADDR_TMCNT_H (REG_BASE + REG_OFFSET_TMCNT_H) #define REG_ADDR_TM0CNT (REG_BASE + REG_OFFSET_TM0CNT) #define REG_ADDR_TM0CNT_L (REG_BASE + REG_OFFSET_TM0CNT_L) #define REG_ADDR_TM0CNT_H (REG_BASE + REG_OFFSET_TM0CNT_H) @@ -462,8 +458,6 @@ #define REG_DMA3CNT_H (*(vu16 *)REG_ADDR_DMA3CNT_H) #define REG_TMCNT(n) (*(vu16 *)(REG_ADDR_TMCNT + ((n) * 4))) -#define REG_TMCNT_L(n) (*(vu16 *)(REG_ADDR_TMCNT_L + ((n) * 4))) -#define REG_TMCNT_H(n) (*(vu16 *)(REG_ADDR_TMCNT_H + ((n) * 4))) #define REG_TM0CNT (*(vu32 *)REG_ADDR_TM0CNT) #define REG_TM0CNT_L (*(vu16 *)REG_ADDR_TM0CNT_L) #define REG_TM0CNT_H (*(vu16 *)REG_ADDR_TM0CNT_H) @@ -501,12 +495,12 @@ // I/O register fields // DISPCNT -#define DISPCNT_MODE_0 0x0000 -#define DISPCNT_MODE_1 0x0001 -#define DISPCNT_MODE_2 0x0002 -#define DISPCNT_MODE_3 0x0003 -#define DISPCNT_MODE_4 0x0004 -#define DISPCNT_MODE_5 0x0005 +#define DISPCNT_MODE_0 0x0000 // BG0: text, BG1: text, BG2: text, BG3: text +#define DISPCNT_MODE_1 0x0001 // BG0: text, BG1: text, BG2: affine, BG3: off +#define DISPCNT_MODE_2 0x0002 // BG0: off, BG1: off, BG2: affine, BG3: affine +#define DISPCNT_MODE_3 0x0003 // Bitmap mode, 240x160, BGR555 color +#define DISPCNT_MODE_4 0x0004 // Bitmap mode, 240x160, 256 color palette +#define DISPCNT_MODE_5 0x0005 // Bitmap mode, 160x128, BGR555 color #define DISPCNT_OBJ_1D_MAP 0x0040 #define DISPCNT_FORCED_BLANK 0x0080 #define DISPCNT_BG0_ON 0x0100 @@ -527,7 +521,46 @@ #define DISPSTAT_HBLANK_INTR 0x0010 // H-Blank interrupt enabled #define DISPSTAT_VCOUNT_INTR 0x0020 // V-Count interrupt enabled +// BGCNT +#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs. +#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data. +#define BGCNT_MOSAIC 0x0040 +#define BGCNT_16COLOR 0x0000 // 4 bits per pixel +#define BGCNT_256COLOR 0x0080 // 8 bits per pixel +#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map. +#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default. +#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels. +#define BGCNT_TXT512x256 0x4000 +#define BGCNT_TXT256x512 0x8000 +#define BGCNT_TXT512x512 0xC000 +#define BGCNT_AFF128x128 0x0000 // Internal screen size size of affine mode BG in pixels. +#define BGCNT_AFF256x256 0x4000 +#define BGCNT_AFF512x512 0x8000 +#define BGCNT_AFF1024x1024 0xC000 + // BLDCNT +// Bits 0-5 select layers for the 1st target +#define BLDCNT_TGT1_BG0 (1 << 0) +#define BLDCNT_TGT1_BG1 (1 << 1) +#define BLDCNT_TGT1_BG2 (1 << 2) +#define BLDCNT_TGT1_BG3 (1 << 3) +#define BLDCNT_TGT1_OBJ (1 << 4) +#define BLDCNT_TGT1_BD (1 << 5) +// Bits 6-7 select the special effect +#define BLDCNT_EFFECT_NONE (0 << 6) // no special effect +#define BLDCNT_EFFECT_BLEND (1 << 6) // 1st+2nd targets mixed (controlled by BLDALPHA) +#define BLDCNT_EFFECT_LIGHTEN (2 << 6) // 1st target becomes whiter (controlled by BLDY) +#define BLDCNT_EFFECT_DARKEN (3 << 6) // 1st target becomes blacker (controlled by BLDY) +// Bits 8-13 select layers for the 2nd target +#define BLDCNT_TGT2_BG0 (1 << 8) +#define BLDCNT_TGT2_BG1 (1 << 9) +#define BLDCNT_TGT2_BG2 (1 << 10) +#define BLDCNT_TGT2_BG3 (1 << 11) +#define BLDCNT_TGT2_OBJ (1 << 12) +#define BLDCNT_TGT2_BD (1 << 13) + +// BLDALPHA +#define BLDALPHA_BLEND(target1, target2) (((target2) << 8) | (target1)) // SOUNDCNT_H #define SOUND_CGB_MIX_QUARTER 0x0000 @@ -627,8 +660,8 @@ #define KEY_INTR_ENABLE 0x0400 #define KEY_OR_INTR 0x0000 #define KEY_AND_INTR 0x8000 - -#define DPAD_ANY ((DPAD_RIGHT | DPAD_LEFT | DPAD_UP | DPAD_DOWN)) +#define DPAD_ANY 0x00F0 +#define JOY_EXCL_DPAD 0x030F // interrupt flags #define INTR_FLAG_VBLANK (1 << 0) diff --git a/include/unk_transition.h b/include/unk_transition.h index ef7b33ed7..a9caac419 100644 --- a/include/unk_transition.h +++ b/include/unk_transition.h @@ -1,13 +1,13 @@ #ifndef GUARD_UNK_TRANSITION_H #define GUARD_UNK_TRANSITION_H -void Phase2Task_Transition_34(u8 taskId); -void Phase2Task_Transition_35(u8 taskId); -void Phase2Task_Transition_36(u8 taskId); -void Phase2Task_Transition_37(u8 taskId); -void Phase2Task_Transition_38(u8 taskId); -void Phase2Task_Transition_39(u8 taskId); -void Phase2Task_Transition_40(u8 taskId); -void Phase2Task_Transition_41(u8 taskId); +void Phase2Task_34(u8 taskId); +void Phase2Task_35(u8 taskId); +void Phase2Task_36(u8 taskId); +void Phase2Task_37(u8 taskId); +void Phase2Task_38(u8 taskId); +void Phase2Task_39(u8 taskId); +void Phase2Task_40(u8 taskId); +void Phase2Task_41(u8 taskId); #endif // GUARD_UNK_TRANSITION_H diff --git a/src/battle_transition.c b/src/battle_transition.c index 386b0dd79..e60a2d91f 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -15,6 +15,8 @@ #include "field_camera.h" #include "unknown_task.h" #include "malloc.h" +#include "gpu_regs.h" +#include "decompress.h" struct TransitionData { @@ -39,54 +41,169 @@ struct TransitionData s16 data[11]; }; -typedef bool8 (*TransitionState)(struct Task *task); +typedef bool8 (*TransitionStateFunc)(struct Task *task); typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); +extern u16 gUnknown_020393A8[]; +extern u16 gUnknown_02038C28[][0x3C0]; + extern void c2_exit_to_overworld_2_switch(void); extern void sub_80AC3D0(void); +extern void dp12_8087EA4(void); // this file's functions void LaunchBattleTransitionTask(u8 transitionId); void Task_BattleTransitionMain(u8 taskId); void Phase1Task_TransitionAll(u8 taskId); -void Phase2Task_Transition_Blur(u8 taskId); -void Phase2Task_Transition_Swirl(u8 taskId); -void Phase2Task_Transition_Shuffle(u8 taskId); -void Phase2Task_Transition_BigPokeball(u8 taskId); -void Phase2Task_Transition_PokeballsTrail(u8 taskId); -void Phase2Task_Transition_Clockwise_BlackFade(u8 taskId); -void Phase2Task_Transition_Ripple(u8 taskId); -void Phase2Task_Transition_Wave(u8 taskId); -void Phase2Task_Transition_Slice(u8 taskId); -void Phase2Task_Transition_WhiteFade(u8 taskId); -void Phase2Task_Transition_GridSquares(u8 taskId); -void Phase2Task_Transition_Shards(u8 taskId); -void Phase2Task_Transition_Sydney(u8 taskId); -void Phase2Task_Transition_Phoebe(u8 taskId); -void Phase2Task_Transition_Glacia(u8 taskId); -void Phase2Task_Transition_Drake(u8 taskId); -void Phase2Task_Transition_Wallace(u8 taskId); -void Phase2Task_Transition_Aqua(u8 taskId); -void Phase2Task_Transition_Magma(u8 taskId); -void Phase2Task_Transition_Regice(u8 taskId); -void Phase2Task_Transition_Registeel(u8 taskId); -void Phase2Task_Transition_Regirock(u8 taskId); -void Phase2Task_Transition_Kyogre(u8 taskId); -void Phase2Task_Transition_Groudon(u8 taskId); -void Phase2Task_Transition_Rayquaza(u8 taskId); -void Phase2Task_Transition_25(u8 taskId); -void Phase2Task_Transition_26(u8 taskId); -void Phase2Task_Transition_27(u8 taskId); -void Phase2Task_Transition_28(u8 taskId); -void Phase2Task_Transition_29(u8 taskId); -void Phase2Task_Transition_30(u8 taskId); -void Phase2Task_Transition_31(u8 taskId); -void Phase2Task_Transition_32(u8 taskId); -void Phase2Task_Transition_33(u8 taskId); +void Phase2Task_Blur(u8 taskId); +void Phase2Task_Swirl(u8 taskId); +void Phase2Task_Shuffle(u8 taskId); +void Phase2Task_BigPokeball(u8 taskId); +void Phase2Task_PokeballsTrail(u8 taskId); +void Phase2Task_Clockwise_BlackFade(u8 taskId); +void Phase2Task_Ripple(u8 taskId); +void Phase2Task_Wave(u8 taskId); +void Phase2Task_Slice(u8 taskId); +void Phase2Task_WhiteFade(u8 taskId); +void Phase2Task_GridSquares(u8 taskId); +void Phase2Task_Shards(u8 taskId); +void Phase2Task_Sydney(u8 taskId); +void Phase2Task_Phoebe(u8 taskId); +void Phase2Task_Glacia(u8 taskId); +void Phase2Task_Drake(u8 taskId); +void Phase2Task_Champion(u8 taskId); +void Phase2Task_Aqua(u8 taskId); +void Phase2Task_Magma(u8 taskId); +void Phase2Task_Regice(u8 taskId); +void Phase2Task_Registeel(u8 taskId); +void Phase2Task_Regirock(u8 taskId); +void Phase2Task_Kyogre(u8 taskId); +void Phase2Task_Groudon(u8 taskId); +void Phase2Task_Rayquaza(u8 taskId); +void Phase2Task_25(u8 taskId); +void Phase2Task_26(u8 taskId); +void Phase2Task_27(u8 taskId); +void Phase2Task_28(u8 taskId); +void Phase2Task_29(u8 taskId); +void Phase2Task_30(u8 taskId); +void Phase2Task_31(u8 taskId); +void Phase2Task_32(u8 taskId); +void Phase2Task_33(u8 taskId); +void VBlankCB_BattleTransition(void); +void VBlankCB_Phase2_Swirl(void); +void HBlankCB_Phase2_Swirl(void); +void VBlankCB_Phase2_Shuffle(void); +void HBlankCB_Phase2_Shuffle(void); +void VBlankCB0_Phase2_BigPokeball(void); +void VBlankCB1_Phase2_BigPokeball(void); +void VBlankCB_Phase2_Clockwise_BlackFade(void); +void VBlankCB_Phase2_Ripple(void); +void HBlankCB_Phase2_Ripple(void); +void VBlankCB_Phase2_Wave(void); +void VBlankCB_Phase2_Slice(void); +void HBlankCB_Phase2_Slice(void); +void VBlankCB0_Phase2_WhiteFade(void); +void VBlankCB1_Phase2_WhiteFade(void); +void HBlankCB_Phase2_WhiteFade(void); +void VBlankCB_Phase2_Shards(void); +bool8 Phase2_Blur_Func1(struct Task *task); +bool8 Phase2_Blur_Func2(struct Task *task); +bool8 Phase2_Blur_Func3(struct Task *task); +bool8 Phase2_Swirl_Func1(struct Task *task); +bool8 Phase2_Swirl_Func2(struct Task *task); +bool8 Phase2_Shuffle_Func1(struct Task *task); +bool8 Phase2_Shuffle_Func2(struct Task *task); +bool8 Phase2_Aqua_Func1(struct Task *task); +bool8 Phase2_Aqua_Func2(struct Task *task); +bool8 Phase2_Magma_Func1(struct Task *task); +bool8 Phase2_Magma_Func2(struct Task *task); +bool8 Phase2_FramesCountdown(struct Task *task); +bool8 Phase2_Regi_Func1(struct Task *task); +bool8 Phase2_Regice_Func2(struct Task *task); +bool8 Phase2_Registeel_Func2(struct Task *task); +bool8 Phase2_Regirock_Func2(struct Task *task); +bool8 Phase2_WeatherTrio_Func1(struct Task *task); +bool8 Phase2_WaitPaletteFade(struct Task *task); +bool8 Phase2_Kyogre_Func3(struct Task *task); +bool8 Phase2_Kyogre_Func4(struct Task *task); +bool8 Phase2_Kyogre_Func5(struct Task *task); +bool8 Phase2_WeatherDuo_Func6(struct Task *task); +bool8 Phase2_WeatherDuo_Func7(struct Task *task); +bool8 Phase2_BigPokeball_Func1(struct Task *task); +bool8 Phase2_BigPokeball_Func2(struct Task *task); +bool8 Phase2_BigPokeball_Func3(struct Task *task); +bool8 Phase2_BigPokeball_Func4(struct Task *task); +bool8 Phase2_BigPokeball_Func5(struct Task *task); +bool8 Phase2_BigPokeball_Func6(struct Task *task); +bool8 Phase2_PokeballsTrail_Func1(struct Task *task); +bool8 Phase2_PokeballsTrail_Func2(struct Task *task); +bool8 Phase2_PokeballsTrail_Func3(struct Task *task); +bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task); +bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task); +bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task); +bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task); +bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task); +bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task); +bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task); +bool8 Phase2_Ripple_Func1(struct Task *task); +bool8 Phase2_Ripple_Func2(struct Task *task); +bool8 Phase2_Wave_Func1(struct Task *task); +bool8 Phase2_Wave_Func2(struct Task *task); +bool8 Phase2_Wave_Func3(struct Task *task); +bool8 Phase2_Slice_Func1(struct Task *task); +bool8 Phase2_Slice_Func2(struct Task *task); +bool8 Phase2_Slice_Func3(struct Task *task); +bool8 Phase2_WhiteFade_Func1(struct Task *task); +bool8 Phase2_WhiteFade_Func2(struct Task *task); +bool8 Phase2_WhiteFade_Func3(struct Task *task); +bool8 Phase2_WhiteFade_Func4(struct Task *task); +bool8 Phase2_WhiteFade_Func5(struct Task *task); +bool8 Phase2_GridSquares_Func1(struct Task *task); +bool8 Phase2_GridSquares_Func2(struct Task *task); +bool8 Phase2_GridSquares_Func3(struct Task *task); +bool8 Phase2_Shards_Func1(struct Task *task); +bool8 Phase2_Shards_Func2(struct Task *task); +bool8 Phase2_Shards_Func3(struct Task *task); +bool8 Phase2_Shards_Func4(struct Task *task); +bool8 Phase2_Shards_Func5(struct Task *task); +bool8 Phase2_Mugshot_Func1(struct Task *task); +bool8 Phase2_Mugshot_Func2(struct Task *task); +bool8 Phase2_Mugshot_Func3(struct Task *task); +bool8 Phase2_Mugshot_Func4(struct Task *task); +bool8 Phase2_Mugshot_Func5(struct Task *task); +bool8 Phase2_Mugshot_Func6(struct Task *task); +bool8 Phase2_Mugshot_Func7(struct Task *task); +bool8 Phase2_Mugshot_Func8(struct Task *task); +bool8 Phase2_Mugshot_Func9(struct Task *task); +bool8 Phase2_Mugshot_Func10(struct Task *task); +void Phase2Task_MugShotTransition(u8 taskId); +void Mugshots_CreateOpponentPlayerSprites(struct Task *task); +void VBlankCB0_Phase2_Mugshots(void); +void VBlankCB1_Phase2_Mugshots(void); +void HBlankCB_Phase2_Mugshots(void); bool8 Transition_Phase1(struct Task *task); bool8 Transition_WaitForPhase1(struct Task *task); bool8 Transition_Phase2(struct Task *task); bool8 Transition_WaitForPhase2(struct Task *task); +void sub_8149F08(void); +void sub_8149F84(void); +void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4); +void sub_814A014(u16 *a0, s16 a1, s16 a2, s16 a3); +void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize); +void sub_8149F58(u16 **a0, u16 **a1); +void sub_814A1AC(s16 *a0, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6); +bool8 sub_814A228(s16 *a0, bool8 a1, bool8 a2); +void sub_8148484(s16 spriteId, s16 value); +void sub_814849C(s16 spriteId); +s16 sub_81484B8(s16 spriteId); +bool8 IsPhase1Done(void); +void sub_814713C(struct Sprite *sprite); +void sub_8148380(struct Sprite *sprite); +bool8 sub_81483A8(struct Sprite *sprite); +bool8 sub_81483AC(struct Sprite *sprite); +bool8 sub_81483F8(struct Sprite *sprite); +bool8 sub_814842C(struct Sprite *sprite); +bool8 sub_8148458(struct Sprite *sprite); // iwram bss vars IWRAM_DATA u16 gUnknown_03001208; @@ -116,16 +233,16 @@ const u32 gUnknown_085BC2F4[] = INCBIN_U32("graphics/battle_transitions/85BC2F4. const u32 gUnknown_085BC314[] = INCBIN_U32("graphics/battle_transitions/85BC314.bin"); const u32 gUnknown_085BCB14[] = INCBIN_U32("graphics/battle_transitions/85BCB14.bin"); const u32 gUnknown_085BD314[] = INCBIN_U32("graphics/battle_transitions/85BD314.bin"); -const u32 gUnknown_085BDB14[] = INCBIN_U32("graphics/battle_transitions/85BDB14.gbapal"); +const u16 gUnknown_085BDB14[] = INCBIN_U16("graphics/battle_transitions/85BDB14.gbapal"); const u32 gUnknown_085BDB34[] = INCBIN_U32("graphics/battle_transitions/kyogre.4bpp.lz"); const u32 gUnknown_085BE1E8[] = INCBIN_U32("graphics/battle_transitions/kyogre.bin.lz"); const u32 gUnknown_085BE51C[] = INCBIN_U32("graphics/battle_transitions/groudon.4bpp.lz"); const u32 gUnknown_085BEA88[] = INCBIN_U32("graphics/battle_transitions/groudon.bin.lz"); -const u32 gUnknown_085BEDA0[] = INCBIN_U32("graphics/battle_transitions/kyogre_pt1.gbapal"); -const u32 gUnknown_085BEEE0[] = INCBIN_U32("graphics/battle_transitions/kyogre_pt2.gbapal"); -const u32 gUnknown_085BF0A0[] = INCBIN_U32("graphics/battle_transitions/groudon_pt1.gbapal"); -const u32 gUnknown_085BF2A0[] = INCBIN_U32("graphics/battle_transitions/groudon_pt2.gbapal"); -const u32 gUnknown_085BF4A0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.gbapal"); +const u16 gUnknown_085BEDA0[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt1.gbapal"); +const u16 gUnknown_085BEEE0[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt2.gbapal"); +const u16 gUnknown_085BF0A0[] = INCBIN_U16("graphics/battle_transitions/groudon_pt1.gbapal"); +const u16 gUnknown_085BF2A0[] = INCBIN_U16("graphics/battle_transitions/groudon_pt2.gbapal"); +const u16 gUnknown_085BF4A0[] = INCBIN_U16("graphics/battle_transitions/rayquaza.gbapal"); const u32 gUnknown_085BF6A0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.4bpp"); const u32 gUnknown_085C6BE0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.bin"); const u32 gUnknown_085C7BE0[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.gbapal"); @@ -145,51 +262,51 @@ const TaskFunc sPhase1_Tasks[B_TRANSITION_COUNT] = const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = { - Phase2Task_Transition_Blur, // 0 - Phase2Task_Transition_Swirl, // 1 - Phase2Task_Transition_Shuffle, // 2 - Phase2Task_Transition_BigPokeball, // 3 - Phase2Task_Transition_PokeballsTrail, // 4 - Phase2Task_Transition_Clockwise_BlackFade, // 5 - Phase2Task_Transition_Ripple, // 6 - Phase2Task_Transition_Wave, // 7 - Phase2Task_Transition_Slice, // 8 - Phase2Task_Transition_WhiteFade, // 9 - Phase2Task_Transition_GridSquares, // 10 - Phase2Task_Transition_Shards, // 11 - Phase2Task_Transition_Sydney, // 12 - Phase2Task_Transition_Phoebe, // 13 - Phase2Task_Transition_Glacia, // 14 - Phase2Task_Transition_Drake, // 15 - Phase2Task_Transition_Wallace, // 16 - Phase2Task_Transition_Aqua, // 17 - Phase2Task_Transition_Magma, // 18 - Phase2Task_Transition_Regice, // 19 - Phase2Task_Transition_Registeel, // 20 - Phase2Task_Transition_Regirock, // 21 - Phase2Task_Transition_Kyogre, // 22 - Phase2Task_Transition_Groudon, // 23 - Phase2Task_Transition_Rayquaza, // 24 - Phase2Task_Transition_25, // 25 - Phase2Task_Transition_26, // 26 - Phase2Task_Transition_27, // 27 - Phase2Task_Transition_28, // 28 - Phase2Task_Transition_29, // 29 - Phase2Task_Transition_30, // 30 - Phase2Task_Transition_31, // 31 - Phase2Task_Transition_32, // 32 - Phase2Task_Transition_33, // 33 - Phase2Task_Transition_34, // 34 - Phase2Task_Transition_35, // 35 - Phase2Task_Transition_36, // 36 - Phase2Task_Transition_37, // 37 - Phase2Task_Transition_38, // 38 - Phase2Task_Transition_39, // 39 - Phase2Task_Transition_40, // 40 - Phase2Task_Transition_41, // 41 + Phase2Task_Blur, // 0 + Phase2Task_Swirl, // 1 + Phase2Task_Shuffle, // 2 + Phase2Task_BigPokeball, // 3 + Phase2Task_PokeballsTrail, // 4 + Phase2Task_Clockwise_BlackFade, // 5 + Phase2Task_Ripple, // 6 + Phase2Task_Wave, // 7 + Phase2Task_Slice, // 8 + Phase2Task_WhiteFade, // 9 + Phase2Task_GridSquares, // 10 + Phase2Task_Shards, // 11 + Phase2Task_Sydney, // 12 + Phase2Task_Phoebe, // 13 + Phase2Task_Glacia, // 14 + Phase2Task_Drake, // 15 + Phase2Task_Champion, // 16 + Phase2Task_Aqua, // 17 + Phase2Task_Magma, // 18 + Phase2Task_Regice, // 19 + Phase2Task_Registeel, // 20 + Phase2Task_Regirock, // 21 + Phase2Task_Kyogre, // 22 + Phase2Task_Groudon, // 23 + Phase2Task_Rayquaza, // 24 + Phase2Task_25, // 25 + Phase2Task_26, // 26 + Phase2Task_27, // 27 + Phase2Task_28, // 28 + Phase2Task_29, // 29 + Phase2Task_30, // 30 + Phase2Task_31, // 31 + Phase2Task_32, // 32 + Phase2Task_33, // 33 + Phase2Task_34, // 34 + Phase2Task_35, // 35 + Phase2Task_36, // 36 + Phase2Task_37, // 37 + Phase2Task_38, // 38 + Phase2Task_39, // 39 + Phase2Task_40, // 40 + Phase2Task_41, // 41 }; -const TransitionState sMainTransitionPhases[] = +const TransitionStateFunc sMainTransitionPhases[] = { &Transition_Phase1, &Transition_WaitForPhase1, @@ -197,6 +314,201 @@ const TransitionState sMainTransitionPhases[] = &Transition_WaitForPhase2 }; +const TransitionStateFunc sPhase2_Blur_Funcs[] = +{ + Phase2_Blur_Func1, + Phase2_Blur_Func2, + Phase2_Blur_Func3 +}; + +const TransitionStateFunc sPhase2_Swirl_Funcs[] = +{ + Phase2_Swirl_Func1, + Phase2_Swirl_Func2, +}; + +const TransitionStateFunc sPhase2_Shuffle_Funcs[] = +{ + Phase2_Shuffle_Func1, + Phase2_Shuffle_Func2, +}; + +const TransitionStateFunc sPhase2_Aqua_Funcs[] = +{ + Phase2_Aqua_Func1, + Phase2_Aqua_Func2, + Phase2_BigPokeball_Func3, + Phase2_BigPokeball_Func4, + Phase2_BigPokeball_Func5, + Phase2_FramesCountdown, + Phase2_BigPokeball_Func6 +}; + +const TransitionStateFunc sPhase2_Magma_Funcs[] = +{ + Phase2_Magma_Func1, + Phase2_Magma_Func2, + Phase2_BigPokeball_Func3, + Phase2_BigPokeball_Func4, + Phase2_BigPokeball_Func5, + Phase2_FramesCountdown, + Phase2_BigPokeball_Func6 +}; + +const TransitionStateFunc sPhase2_BigPokeball_Funcs[] = +{ + Phase2_BigPokeball_Func1, + Phase2_BigPokeball_Func2, + Phase2_BigPokeball_Func3, + Phase2_BigPokeball_Func4, + Phase2_BigPokeball_Func5, + Phase2_BigPokeball_Func6 +}; + +const TransitionStateFunc sPhase2_Regice_Funcs[] = +{ + Phase2_Regi_Func1, + Phase2_Regice_Func2, + Phase2_BigPokeball_Func3, + Phase2_BigPokeball_Func4, + Phase2_BigPokeball_Func5, + Phase2_BigPokeball_Func6 +}; + +const TransitionStateFunc sPhase2_Registeel_Funcs[] = +{ + Phase2_Regi_Func1, + Phase2_Registeel_Func2, + Phase2_BigPokeball_Func3, + Phase2_BigPokeball_Func4, + Phase2_BigPokeball_Func5, + Phase2_BigPokeball_Func6 +}; + +const TransitionStateFunc sPhase2_Regirock_Funcs[] = +{ + Phase2_Regi_Func1, + Phase2_Regirock_Func2, + Phase2_BigPokeball_Func3, + Phase2_BigPokeball_Func4, + Phase2_BigPokeball_Func5, + Phase2_BigPokeball_Func6 +}; + +const TransitionStateFunc sPhase2_Kyogre_Funcs[] = +{ + Phase2_WeatherTrio_Func1, + Phase2_WaitPaletteFade, + Phase2_Kyogre_Func3, + Phase2_Kyogre_Func4, + Phase2_Kyogre_Func5, + Phase2_FramesCountdown, + Phase2_WeatherDuo_Func6, + Phase2_WeatherDuo_Func7 +}; + +const TransitionStateFunc sPhase2_PokeballsTrail_Funcs[] = +{ + Phase2_PokeballsTrail_Func1, + Phase2_PokeballsTrail_Func2, + Phase2_PokeballsTrail_Func3 +}; + +const s16 sUnknown_085C8B88[2] = {-16, 256}; +const s16 sUnknown_085C8B8C[5] = {0, 32, 64, 18, 48}; +const s16 sUnknown_085C8B96[2] = {8, -8}; + +const TransitionStateFunc sPhase2_Clockwise_BlackFade_Funcs[] = +{ + Phase2_Clockwise_BlackFade_Func1, + Phase2_Clockwise_BlackFade_Func2, + Phase2_Clockwise_BlackFade_Func3, + Phase2_Clockwise_BlackFade_Func4, + Phase2_Clockwise_BlackFade_Func5, + Phase2_Clockwise_BlackFade_Func6, + Phase2_Clockwise_BlackFade_Func7 +}; + +const TransitionStateFunc sPhase2_Ripple_Funcs[] = +{ + Phase2_Ripple_Func1, + Phase2_Ripple_Func2 +}; + +const TransitionStateFunc sPhase2_Wave_Funcs[] = +{ + Phase2_Wave_Func1, + Phase2_Wave_Func2, + Phase2_Wave_Func3 +}; + +const TransitionStateFunc sPhase2_Mugshot_Funcs[] = +{ + Phase2_Mugshot_Func1, + Phase2_Mugshot_Func2, + Phase2_Mugshot_Func3, + Phase2_Mugshot_Func4, + Phase2_Mugshot_Func5, + Phase2_Mugshot_Func6, + Phase2_Mugshot_Func7, + Phase2_Mugshot_Func8, + Phase2_Mugshot_Func9, + Phase2_Mugshot_Func10 +}; + +const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] = +{ + TRAINER_PIC_ELITE_FOUR_SIDNEY, + TRAINER_PIC_ELITE_FOUR_PHOEBE, + TRAINER_PIC_ELITE_FOUR_GLACIA, + TRAINER_PIC_ELITE_FOUR_DRAKE, + TRAINER_PIC_CHAMPION_WALLACE +}; +const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] = +{ + {0x200, 0x200}, + {0x200, 0x200}, + {0x1B0, 0x1B0}, + {0x1A0, 0x1A0}, + {0x188, 0x188}, +}; +const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] = +{ + {0, 0}, + {0, 0}, + {-4, 4}, + {0, 5}, + {-8, 7}, +}; + +const TransitionSpriteCallback sUnknown_085C8C24[] = +{ + sub_81483A8, + sub_81483AC, + sub_81483F8, + sub_814842C, + sub_81483A8, + sub_8148458, + sub_81483A8 +}; + +const s16 sUnknown_085C8C40[2] = {12, -12}; +const s16 sUnknown_085C8C44[2] = {-1, 1}; + +const TransitionStateFunc sPhase2_Slice_Funcs[] = +{ + Phase2_Slice_Func1, + Phase2_Slice_Func2, + Phase2_Slice_Func3 +}; + +extern const u16 gFieldEffectObjectPalette10[]; +extern const u16 sBigPokeball_Tilemap[]; +extern const u16 sMugshotsTilemap[]; +extern const struct SpriteTemplate gUnknown_085C8E68; +extern const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT]; +extern const u16 *const sPlayerMugshotsPals[2]; + // code static void CB2_TestBattleTransition(void) { @@ -238,6 +550,7 @@ void BattleTransition_Start(u8 transitionId) LaunchBattleTransitionTask(transitionId); } +// main task that launches sub-tasks for phase1 and phase2 #define tState data[0] #define tTransitionID data[1] #define tTransitionDone data[15] @@ -285,3 +598,1594 @@ bool8 Transition_Phase1(struct Task *task) return TRUE; } } + +bool8 Transition_WaitForPhase1(struct Task *task) +{ + if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionID]) == 0xFF) + { + task->tState++; + return TRUE; + } + else + { + return FALSE; + } +} + +bool8 Transition_Phase2(struct Task *task) +{ + CreateTask(sPhase2_Tasks[task->tTransitionID], 0); + task->tState++; + return FALSE; +} + +bool8 Transition_WaitForPhase2(struct Task *task) +{ + task->tTransitionDone = FALSE; + if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionID]) == 0xFF) + task->tTransitionDone = TRUE; + return FALSE; +} + +#undef tState +#undef tTransitionID +#undef tTransitionDone + +// sub-task for phase1 +#define tState data[0] + +void Phase1Task_TransitionAll(u8 taskId) +{ + if (gTasks[taskId].tState == 0) + { + gTasks[taskId].tState++; + CreatePhase1Task(0, 0, 3, 2, 2); // creates a sub-task for this sub-task + } + else if (IsPhase1Done()) + { + DestroyTask(taskId); + } +} + +#undef tState + +// sub-task for phase2 +#define tState data[0] +#define tFrames data[8] +#define tOpponentSpriteId data[13] +#define tPlayerSpriteId data[14] +#define tMugshotId data[15] + +void Phase2Task_Blur(u8 taskId) +{ + while (sPhase2_Blur_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Blur_Func1(struct Task *task) +{ + SetGpuReg(REG_OFFSET_MOSAIC, 0); + SetGpuRegBits(REG_OFFSET_BG1CNT, BGCNT_MOSAIC); + SetGpuRegBits(REG_OFFSET_BG2CNT, BGCNT_MOSAIC); + SetGpuRegBits(REG_OFFSET_BG3CNT, BGCNT_MOSAIC); + task->tState++; + return TRUE; +} + +bool8 Phase2_Blur_Func2(struct Task *task) +{ + if (task->data[1] != 0) + { + task->data[1]--; + } + else + { + task->data[1] = 4; + if (++task->data[2] == 10) + BeginNormalPaletteFade(-1, -1, 0, 0x10, 0); + SetGpuReg(REG_OFFSET_MOSAIC, (task->data[2] & 15) * 17); + if (task->data[2] > 14) + task->tState++; + } + return FALSE; +} + +bool8 Phase2_Blur_Func3(struct Task *task) +{ + if (!gPaletteFade.active) + { + u8 taskId = FindTaskIdByFunc(Phase2Task_Blur); + DestroyTask(taskId); + } + return FALSE; +} + +void Phase2Task_Swirl(u8 taskId) +{ + while (sPhase2_Swirl_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Swirl_Func1(struct Task *task) +{ + sub_8149F08(); + dp12_8087EA4(); + BeginNormalPaletteFade(-1, 4, 0, 0x10, 0); + sub_8149F98(gUnknown_020393A8, sTransitionStructPtr->field_14, 0, 2, 0, 160); + + SetVBlankCallback(VBlankCB_Phase2_Swirl); + SetHBlankCallback(HBlankCB_Phase2_Swirl); + + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Swirl_Func2(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + task->data[1] += 4; + task->data[2] += 8; + + sub_8149F98(gUnknown_02038C28[0], sTransitionStructPtr->field_14, task->data[1], 2, task->data[2], 160); + + if (!gPaletteFade.active) + { + u8 taskId = FindTaskIdByFunc(Phase2Task_Swirl); + DestroyTask(taskId); + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +void VBlankCB_Phase2_Swirl(void) +{ + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); +} + +void HBlankCB_Phase2_Swirl(void) +{ + u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + REG_BG1HOFS = var; + REG_BG2HOFS = var; + REG_BG3HOFS = var; +} + +void Phase2Task_Shuffle(u8 taskId) +{ + while (sPhase2_Shuffle_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Shuffle_Func1(struct Task *task) +{ + sub_8149F08(); + dp12_8087EA4(); + + BeginNormalPaletteFade(-1, 4, 0, 0x10, 0); + memset(gUnknown_020393A8, sTransitionStructPtr->field_16, 0x140); + + SetVBlankCallback(VBlankCB_Phase2_Shuffle); + SetHBlankCallback(HBlankCB_Phase2_Shuffle); + + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Shuffle_Func2(struct Task *task) +{ + u8 i; + u16 r3, r4; + + sTransitionStructPtr->VBlank_DMA = 0; + r4 = task->data[1]; + r3 = task->data[2] >> 8; + task->data[1] += 4224; + task->data[2] += 384; + + for (i = 0; i < 160; i++, r4 += 4224) + { + u16 var = r4 / 256; + gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); + } + + if (!gPaletteFade.active) + DestroyTask(FindTaskIdByFunc(Phase2Task_Shuffle)); + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +void VBlankCB_Phase2_Shuffle(void) +{ + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); +} + +void HBlankCB_Phase2_Shuffle(void) +{ + u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + REG_BG1VOFS = var; + REG_BG2VOFS = var; + REG_BG3VOFS = var; +} + +void Phase2Task_BigPokeball(u8 taskId) +{ + while (sPhase2_BigPokeball_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_Aqua(u8 taskId) +{ + while (sPhase2_Aqua_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_Magma(u8 taskId) +{ + while (sPhase2_Magma_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_Regice(u8 taskId) +{ + while (sPhase2_Regice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_Registeel(u8 taskId) +{ + while (sPhase2_Registeel_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_Regirock(u8 taskId) +{ + while (sPhase2_Regirock_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_Kyogre(u8 taskId) +{ + while (sPhase2_Kyogre_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void sub_814669C(struct Task *task) +{ + s32 i; + + sub_8149F08(); + dp12_8087EA4(); + + task->data[1] = 16; + task->data[2] = 0; + task->data[4] = 0; + task->data[5] = 0x4000; + sTransitionStructPtr->WININ = 63; + sTransitionStructPtr->WINOUT = 0; + sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->BLDCNT = 0x3F41; + sTransitionStructPtr->BLDALPHA = (task->data[1] << 8) | (task->data[2]); + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[1][i] = 240; + } + + SetVBlankCallback(VBlankCB0_Phase2_BigPokeball); +} + +bool8 Phase2_Aqua_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + task->tFrames = 60; + sub_814669C(task); + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + LZ77UnCompVram(sTeamAqua_Tileset, dst2); + LoadPalette(sEvilTeam_Palette, 0xF0, 0x20); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Magma_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + task->tFrames = 60; + sub_814669C(task); + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + LZ77UnCompVram(sTeamMagma_Tileset, dst2); + LoadPalette(sEvilTeam_Palette, 0xF0, 0x20); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Regi_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + task->tFrames = 60; + sub_814669C(task); + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + CpuCopy16(gUnknown_085BBC14, dst2, 0x2000); + + task->tState++; + return FALSE; +} + +bool8 Phase2_BigPokeball_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_814669C(task); + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + CpuCopy16(sBigPokeball_Tileset, dst2, 0x580); + LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + + task->tState++; + return FALSE; +} + +bool8 Phase2_BigPokeball_Func2(struct Task *task) +{ + s16 i, j; + u16 *dst1, *dst2; + const u16 *BigPokeballMap; + + sub_8149F58(&dst1, &dst2); + BigPokeballMap = sBigPokeball_Tilemap; + for (i = 0; i < 20; i++) + { + for (j = 0; j < 30; j++, BigPokeballMap++) + { + dst1[i * 32 + j] = *BigPokeballMap | 0xF000; + } + } + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + + task->tState++; + return TRUE; +} + +bool8 Phase2_Aqua_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LZ77UnCompVram(sTeamAqua_Tilemap, dst1); + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Magma_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LZ77UnCompVram(sTeamMagma_Tilemap, dst1); + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Regice_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LoadPalette(gUnknown_085BC2B4, 0xF0, 0x20); + CpuCopy16(gUnknown_085BC314, dst1, 0x500); + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Registeel_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LoadPalette(gUnknown_085BC2D4, 0xF0, 0x20); + CpuCopy16(gUnknown_085BCB14, dst1, 0x500); + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Regirock_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LoadPalette(gUnknown_085BC2F4, 0xF0, 0x20); + CpuCopy16(gUnknown_085BD314, dst1, 0x500); + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Kyogre_Func3(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + LZ77UnCompVram(gUnknown_085BDB34, dst2); + LZ77UnCompVram(gUnknown_085BE1E8, dst1); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Kyogre_Func4(struct Task *task) +{ + if (task->data[1] % 3 == 0) + { + u16 var = task->data[1] % 30; + var /= 3; + LoadPalette(gUnknown_085BEDA0 + (var * 16), 0xF0, 0x20); + } + if (++task->data[1] > 58) + { + task->tState++; + task->data[1] = 0; + } + + return FALSE; +} + +bool8 Phase2_Kyogre_Func5(struct Task *task) +{ + if (task->data[1] % 5 == 0) + { + s16 var = task->data[1] / 5; + LoadPalette(gUnknown_085BEEE0 + (var * 16), 0xF0, 0x20); + } + if (++task->data[1] > 68) + { + task->tState++; + task->data[1] = 0; + task->tFrames = 30; + } + + return FALSE; +} + +bool8 Phase2_WeatherDuo_Func6(struct Task *task) +{ + BeginNormalPaletteFade(0xFFFF8000, 1, 0, 0x10, 0); + task->tState++; + return FALSE; +} + +bool8 Phase2_WeatherDuo_Func7(struct Task *task) +{ + if (!gPaletteFade.active) + { + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(task->func)); + } + return FALSE; +} + +bool8 Phase2_BigPokeball_Func3(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + if (task->data[3] == 0 || --task->data[3] == 0) + { + task->data[2]++; + task->data[3] = 2; + } + sTransitionStructPtr->BLDALPHA = (task->data[1] << 8) | task->data[2]; + if (task->data[2] > 15) + task->tState++; + task->data[4] += 8; + task->data[5] -= 256; + + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5] >> 8, 160); + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_BigPokeball_Func4(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + if (task->data[3] == 0 || --task->data[3] == 0) + { + task->data[1]--; + task->data[3] = 2; + } + sTransitionStructPtr->BLDALPHA = (task->data[1] << 8) | task->data[2]; + if (task->data[1] == 0) + task->tState++; + task->data[4] += 8; + task->data[5] -= 256; + + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5] >> 8, 160); + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_BigPokeball_Func5(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + task->data[4] += 8; + task->data[5] -= 256; + + sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5] >> 8, 160); + + if (task->data[5] <= 0) + { + task->tState++; + task->data[1] = 160; + task->data[2] = 256; + task->data[3] = 0; + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_FramesCountdown(struct Task *task) +{ + if (--task->tFrames == 0) + task->tState++; + return FALSE; +} + +bool8 Phase2_WeatherTrio_Func1(struct Task *task) +{ + BeginNormalPaletteFade(0x0000FFFF, 1, 0, 0x10, 0); + task->tState++; + return FALSE; +} + +bool8 Phase2_WaitPaletteFade(struct Task *task) +{ + if (!gPaletteFade.active) + task->tState++; + return FALSE; +} + +bool8 Phase2_BigPokeball_Func6(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + if (task->data[2] < 1024) + task->data[2] += 128; + if (task->data[1] != 0) + { + task->data[1] -= (task->data[2] >> 8); + if (task->data[1] < 0) + task->data[1] = 0; + } + sub_814A014(gUnknown_02038C28[0], 120, 80, task->data[1]); + if (task->data[1] == 0) + { + SetVBlankCallback(NULL); + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(task->func)); + } + else + { + if (task->data[3] == 0) + { + task->data[3]++; + SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); + } + + sTransitionStructPtr->VBlank_DMA++; + } + + return FALSE; +} + +void Transition_BigPokeball_Vblank(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0V = sTransitionStructPtr->WIN0V; + REG_BLDCNT = sTransitionStructPtr->BLDCNT; + REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; +} + +void VBlankCB0_Phase2_BigPokeball(void) +{ + Transition_BigPokeball_Vblank(); + DmaSet(0, gUnknown_020393A8, ®_BG0HOFS, 0xA2400001); +} + +void VBlankCB1_Phase2_BigPokeball(void) +{ + Transition_BigPokeball_Vblank(); + DmaSet(0, gUnknown_020393A8, ®_WIN0H, 0xA2400001); +} + +void Phase2Task_PokeballsTrail(u8 taskId) +{ + while (sPhase2_PokeballsTrail_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_PokeballsTrail_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + CpuSet(sPokeballTrail_Tileset, dst2, 0x20); + CpuFill32(0, dst1, 0x800); + LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + + task->tState++; + return FALSE; +} + +bool8 Phase2_PokeballsTrail_Func2(struct Task *task) +{ + s16 i; + s16 rand; + s16 arr0[ARRAY_COUNT(sUnknown_085C8B88)]; + s16 arr1[ARRAY_COUNT(sUnknown_085C8B8C)]; + + memcpy(arr0, sUnknown_085C8B88, sizeof(sUnknown_085C8B88)); + memcpy(arr1, sUnknown_085C8B8C, sizeof(sUnknown_085C8B8C)); + rand = Random() & 1; + for (i = 0; i <= 4; i++, rand ^= 1) + { + gFieldEffectArguments[0] = arr0[rand]; // x + gFieldEffectArguments[1] = (i * 32) + 16; // y + gFieldEffectArguments[2] = rand; + gFieldEffectArguments[3] = arr1[i]; + FieldEffectStart(FLDEFF_POKEBALL); + } + + task->tState++; + return FALSE; +} + +bool8 Phase2_PokeballsTrail_Func3(struct Task *task) +{ + if (!FieldEffectActiveListContains(FLDEFF_POKEBALL)) + { + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_PokeballsTrail)); + } + return FALSE; +} + +bool8 FldEff_Pokeball(void) +{ + u8 spriteId = CreateSpriteAtEnd(&gUnknown_085C8E68, gFieldEffectArguments[0], gFieldEffectArguments[1], 0); + gSprites[spriteId].oam.priority = 0; + gSprites[spriteId].oam.affineMode = 1; + gSprites[spriteId].data[0] = gFieldEffectArguments[2]; + gSprites[spriteId].data[1] = gFieldEffectArguments[3]; + gSprites[spriteId].data[2] = -1; + InitSpriteAffineAnim(&gSprites[spriteId]); + StartSpriteAffineAnim(&gSprites[spriteId], gFieldEffectArguments[2]); + return FALSE; +} + +#define SOME_VRAM_STORE(ptr, posY, posX, toStore) \ +{ \ + u32 index = (posY) * 32 + posX; \ + ptr[index] = toStore; \ +} + +void sub_814713C(struct Sprite *sprite) +{ + s16 arr0[ARRAY_COUNT(sUnknown_085C8B96)]; + + memcpy(arr0, sUnknown_085C8B96, sizeof(sUnknown_085C8B96)); + if (sprite->data[1] != 0) + { + sprite->data[1]--; + } + else + { + if (sprite->pos1.x >= 0 && sprite->pos1.x <= 240) + { + s16 posX = sprite->pos1.x >> 3; + s16 posY = sprite->pos1.y >> 3; + + if (posX != sprite->data[2]) + { + u32 var; + u16 *ptr; + + sprite->data[2] = posX; + var = (((REG_BG0CNT >> 8) & 0x1F) << 11); // r2 + ptr = (u16 *)(VRAM + var); + + SOME_VRAM_STORE(ptr, posY - 2, posX, 0xF001); + SOME_VRAM_STORE(ptr, posY - 1, posX, 0xF001); + SOME_VRAM_STORE(ptr, posY - 0, posX, 0xF001); + SOME_VRAM_STORE(ptr, posY + 1, posX, 0xF001); + } + } + sprite->pos1.x += arr0[sprite->data[0]]; + if (sprite->pos1.x < -15 || sprite->pos1.x > 255) + FieldEffectStop(sprite, FLDEFF_POKEBALL); + } +} + +void Phase2Task_Clockwise_BlackFade(u8 taskId) +{ + while (sPhase2_Clockwise_BlackFade_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) +{ + u16 i; + + sub_8149F08(); + dp12_8087EA4(); + + sTransitionStructPtr->WININ = 0; + sTransitionStructPtr->WINOUT = 63; + sTransitionStructPtr->field_6 = -3855; + sTransitionStructPtr->WIN0V = 160; + + for (i = 0; i < 160; i++) + { + gUnknown_020393A8[i] = 0xF3F4; + } + + SetVBlankCallback(VBlankCB_Phase2_Clockwise_BlackFade); + sTransitionStructPtr->data[4] = 120; + + task->tState++; + return TRUE; +} + +bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + + sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], -1, 1, 1); + do + { + gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] + 1) | 0x7800; + } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); + + sTransitionStructPtr->data[4] += 16; + if (sTransitionStructPtr->data[4] >= 240) + { + sTransitionStructPtr->data[5] = 0; + task->tState++; + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) +{ + s16 r1, r3; + vu8 var = 0; + + sTransitionStructPtr->VBlank_DMA = 0; + + sub_814A1AC(sTransitionStructPtr->data, 120, 80, 240, sTransitionStructPtr->data[5], 1, 1); + + while (1) + { + r1 = 120, r3 = sTransitionStructPtr->data[2] + 1; + if (sTransitionStructPtr->data[5] >= 80) + r1 = sTransitionStructPtr->data[2], r3 = 240; + gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); + if (var != 0) + break; + var = sub_814A228(sTransitionStructPtr->data, 1, 1); + } + + sTransitionStructPtr->data[5] += 8; + if (sTransitionStructPtr->data[5] >= 160) + { + sTransitionStructPtr->data[4] = 240; + task->tState++; + } + else + { + while (sTransitionStructPtr->data[3] < sTransitionStructPtr->data[5]) + { + gUnknown_02038C28[0][++sTransitionStructPtr->data[3]] = (r3) | (r1 << 8); + } + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + + sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 160, 1, 1); + do + { + gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (sTransitionStructPtr->data[2] << 8) | 0xF0; + } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); + + sTransitionStructPtr->data[4] -= 16; + if (sTransitionStructPtr->data[4] <= 0) + { + sTransitionStructPtr->data[5] = 160; + task->tState++; + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) +{ + s16 r1, r2, var4; + vu8 var = 0; + + sTransitionStructPtr->VBlank_DMA = 0; + + sub_814A1AC(sTransitionStructPtr->data, 120, 80, 0, sTransitionStructPtr->data[5], 1, 1); + + while (1) + { + r1 = (gUnknown_02038C28[0][sTransitionStructPtr->data[3]]) & 0xFF; + r2 = sTransitionStructPtr->data[2]; + if (sTransitionStructPtr->data[5] <= 80) + r2 = 120, r1 = sTransitionStructPtr->data[2]; + var4 = (r1) | (r2 << 8); + gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = var4; + if (var != 0) + break; + var = sub_814A228(sTransitionStructPtr->data, 1, 1); + } + + sTransitionStructPtr->data[5] -= 8; + if (sTransitionStructPtr->data[5] <= 0) + { + sTransitionStructPtr->data[4] = 0; + task->tState++; + } + else + { + while (sTransitionStructPtr->data[3] > sTransitionStructPtr->data[5]) + { + gUnknown_02038C28[0][--sTransitionStructPtr->data[3]] = (r1) | (r2 << 8); + } + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + + sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 0, 1, 1); + do + { + s16 r2, r3; + + r2 = 120, r3 = sTransitionStructPtr->data[2]; + if (sTransitionStructPtr->data[2] >= 120) + r2 = 0, r3 = 240; + gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r3) | (r2 << 8); + + } while (!sub_814A228(sTransitionStructPtr->data, 1, 1)); + + sTransitionStructPtr->data[4] += 16; + if (sTransitionStructPtr->data[2] > 120) + task->tState++; + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task) +{ + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_Clockwise_BlackFade)); + return FALSE; +} + +void VBlankCB_Phase2_Clockwise_BlackFade(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA != 0) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0V = sTransitionStructPtr->WIN0V; + REG_WIN0H = gUnknown_02038C28[1][0]; + DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); +} + +void Phase2Task_Ripple(u8 taskId) +{ + while (sPhase2_Ripple_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Ripple_Func1(struct Task *task) +{ + u8 i; + + sub_8149F08(); + dp12_8087EA4(); + + for (i = 0; i < 160; i++) + { + gUnknown_020393A8[i] = sTransitionStructPtr->field_16; + } + + SetVBlankCallback(VBlankCB_Phase2_Ripple); + SetHBlankCallback(HBlankCB_Phase2_Ripple); + + EnableInterrupts(INTR_FLAG_HBLANK); + + task->tState++; + return TRUE; +} + +bool8 Phase2_Ripple_Func2(struct Task *task) +{ + u8 i; + s16 r3; + u16 r4, r8; + + sTransitionStructPtr->VBlank_DMA = 0; + + r3 = task->data[2] >> 8; + r4 = task->data[1]; + r8 = 384; + task->data[1] += 0x400; + if (task->data[2] <= 0x1FFF) + task->data[2] += 0x180; + + for (i = 0; i < 160; i++, r4 += r8) + { + // todo: fix the asm + s16 var = r4 >> 8; + asm(""); + gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); + } + + if (++task->data[3] == 81) + { + task->data[4]++; + BeginNormalPaletteFade(-1, -2, 0, 0x10, 0); + } + + if (task->data[4] != 0 && !gPaletteFade.active) + DestroyTask(FindTaskIdByFunc(Phase2Task_Ripple)); + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +void VBlankCB_Phase2_Ripple(void) +{ + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); +} + +void HBlankCB_Phase2_Ripple(void) +{ + u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + REG_BG1VOFS = var; + REG_BG2VOFS = var; + REG_BG3VOFS = var; +} + +void Phase2Task_Wave(u8 taskId) +{ + while (sPhase2_Wave_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Wave_Func1(struct Task *task) +{ + u8 i; + + sub_8149F08(); + dp12_8087EA4(); + + sTransitionStructPtr->WININ = 63; + sTransitionStructPtr->WINOUT = 0; + sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0V = 160; + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[1][i] = 242; + } + + SetVBlankCallback(VBlankCB_Phase2_Wave); + + task->tState++; + return TRUE; +} + +bool8 Phase2_Wave_Func2(struct Task *task) +{ + u8 i, r5; + u16* toStore; + bool8 nextFunc; + + sTransitionStructPtr->VBlank_DMA = 0; + toStore = gUnknown_02038C28[0]; + r5 = task->data[2]; + task->data[2] += 16; + task->data[1] += 8; + + for (i = 0, nextFunc = TRUE; i < 160; i++, r5 += 4, toStore++) + { + s16 value = task->data[1] + Sin(r5, 40); + if (value < 0) + value = 0; + if (value > 240) + value = 240; + *toStore = (value << 8) | (0xF1); + if (value < 240) + nextFunc = FALSE; + } + if (nextFunc) + task->tState++; + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Wave_Func3(struct Task *task) +{ + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_Wave)); + return FALSE; +} + +void VBlankCB_Phase2_Wave(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA != 0) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0V = sTransitionStructPtr->WIN0V; + DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); +} + +void Phase2Task_Sydney(u8 taskId) +{ + gTasks[taskId].tMugshotId = MUGSHOT_SYDNEY; + Phase2Task_MugShotTransition(taskId); +} + +void Phase2Task_Phoebe(u8 taskId) +{ + gTasks[taskId].tMugshotId = MUGSHOT_PHOEBE; + Phase2Task_MugShotTransition(taskId); +} + +void Phase2Task_Glacia(u8 taskId) +{ + gTasks[taskId].tMugshotId = MUGSHOT_GLACIA; + Phase2Task_MugShotTransition(taskId); +} + +void Phase2Task_Drake(u8 taskId) +{ + gTasks[taskId].tMugshotId = MUGSHOT_DRAKE; + Phase2Task_MugShotTransition(taskId); +} + +void Phase2Task_Champion(u8 taskId) +{ + gTasks[taskId].tMugshotId = MUGSHOT_CHAMPION; + Phase2Task_MugShotTransition(taskId); +} + +void Phase2Task_MugShotTransition(u8 taskId) +{ + while (sPhase2_Mugshot_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Mugshot_Func1(struct Task *task) +{ + u8 i; + + sub_8149F08(); + dp12_8087EA4(); + Mugshots_CreateOpponentPlayerSprites(task); + + task->data[1] = 0; + task->data[2] = 1; + task->data[3] = 239; + sTransitionStructPtr->WININ = 63; + sTransitionStructPtr->WINOUT = 62; + sTransitionStructPtr->WIN0V = 160; + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[1][i] = 0xF0F1; + } + + SetVBlankCallback(VBlankCB0_Phase2_Mugshots); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Mugshot_Func2(struct Task *task) +{ + s16 i, j; + u16 *dst1, *dst2; + const u16 *MugshotsMap; + + MugshotsMap = sMugshotsTilemap; + sub_8149F58(&dst1, &dst2); + CpuSet(sUnknown_085B9AF0, dst2, 0xF0); + LoadPalette(sOpponentMugshotsPals[task->tMugshotId], 0xF0, 0x20); + LoadPalette(sPlayerMugshotsPals[gSaveBlock2Ptr->playerGender], 0xFA, 0xC); + + for (i = 0; i < 20; i++) + { + for (j = 0; j < 32; j++, MugshotsMap++) + { + dst1[i * 32 + j] = *MugshotsMap | 0xF000; + } + } + + EnableInterrupts(INTR_FLAG_HBLANK); + + SetHBlankCallback(HBlankCB_Phase2_Mugshots); + task->tState++; + return FALSE; +} + +bool8 Phase2_Mugshot_Func3(struct Task *task) +{ + u8 i, r5; + u16* toStore; + s16 value; + s32 mergedValue; + + sTransitionStructPtr->VBlank_DMA = 0; + + toStore = gUnknown_02038C28[0]; + r5 = task->data[1]; + task->data[1] += 0x10; + + for (i = 0; i < 80; i++, toStore++, r5 += 0x10) + { + value = task->data[2] + Sin(r5, 0x10); + if (value < 0) + value = 1; + if (value > 0xF0) + value = 0xF0; + *toStore = value; + } + for (; i < 160; i++, toStore++, r5 += 0x10) + { + value = task->data[3] - Sin(r5, 0x10); + if (value < 0) + value = 0; + if (value > 0xEF) + value = 0xEF; + *toStore = (value << 8) | (0xF0); + } + + task->data[2] += 8; + task->data[3] -= 8; + if (task->data[2] > 0xF0) + task->data[2] = 0xF0; + if (task->data[3] < 0) + task->data[3] = 0; + mergedValue = *(s32*)(&task->data[2]); + if (mergedValue == 0xF0) + task->tState++; + + sTransitionStructPtr->field_18 -= 8; + sTransitionStructPtr->field_1A += 8; + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Mugshot_Func4(struct Task *task) +{ + u8 i; + u16* toStore; + + sTransitionStructPtr->VBlank_DMA = 0; + + for (i = 0, toStore = gUnknown_02038C28[0]; i < 160; i++, toStore++) + { + *toStore = 0xF0; + } + + task->tState++; + task->data[1] = 0; + task->data[2] = 0; + task->data[3] = 0; + sTransitionStructPtr->field_18 -= 8; + sTransitionStructPtr->field_1A += 8; + + sub_8148484(task->tOpponentSpriteId, 0); + sub_8148484(task->tPlayerSpriteId, 1); + sub_814849C(task->tOpponentSpriteId); + + PlaySE(SE_BT_START); + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Mugshot_Func5(struct Task *task) +{ + sTransitionStructPtr->field_18 -= 8; + sTransitionStructPtr->field_1A += 8; + if (sub_81484B8(task->tOpponentSpriteId)) + { + task->tState++; + sub_814849C(task->tPlayerSpriteId); + } + return FALSE; +} + +bool8 Phase2_Mugshot_Func6(struct Task *task) +{ + sTransitionStructPtr->field_18 -= 8; + sTransitionStructPtr->field_1A += 8; + if (sub_81484B8(task->tPlayerSpriteId)) + { + sTransitionStructPtr->VBlank_DMA = 0; + SetVBlankCallback(NULL); + DmaStop(0); + memset(gUnknown_02038C28[0], 0, 0x140); + memset(gUnknown_02038C28[1], 0, 0x140); + SetGpuReg(REG_OFFSET_WIN0H, 0xF0); + SetGpuReg(REG_OFFSET_BLDY, 0); + task->tState++; + task->data[3] = 0; + task->data[4] = 0; + sTransitionStructPtr->BLDCNT = 0xBF; + SetVBlankCallback(VBlankCB1_Phase2_Mugshots); + } + return FALSE; +} + +bool8 Phase2_Mugshot_Func7(struct Task *task) +{ + bool32 r6; + + sTransitionStructPtr->VBlank_DMA = 0; + r6 = TRUE; + sTransitionStructPtr->field_18 -= 8; + sTransitionStructPtr->field_1A += 8; + + if (task->data[4] < 0x50) + task->data[4] += 2; + if (task->data[4] > 0x50) + task->data[4] = 0x50; + + if (++task->data[3] & 1) + { + s16 i; + for (i = 0, r6 = FALSE; i <= task->data[4]; i++) + { + s16 index1 = 0x50 - i; + s16 index2 = 0x50 + i; + if (gUnknown_02038C28[0][index1] <= 15) + { + r6 = TRUE; + gUnknown_02038C28[0][index1]++; + } + if (gUnknown_02038C28[0][index2] <= 15) + { + r6 = TRUE; + gUnknown_02038C28[0][index2]++; + } + } + } + + if (task->data[4] == 0x50 && !r6) + task->tState++; + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Mugshot_Func8(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + BlendPalettes(-1, 0x10, 0x7FFF); + sTransitionStructPtr->BLDCNT = 0xFF; + task->data[3] = 0; + + task->tState++; + return TRUE; +} + +bool8 Phase2_Mugshot_Func9(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + + task->data[3]++; + memset(gUnknown_02038C28[0], task->data[3], 0x140); + if (task->data[3] > 15) + task->tState++; + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Mugshot_Func10(struct Task *task) +{ + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(task->func)); + return FALSE; +} + +void VBlankCB0_Phase2_Mugshots(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA != 0) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + REG_BG0VOFS = sTransitionStructPtr->field_1C; + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0V = sTransitionStructPtr->WIN0V; + DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); +} + +void VBlankCB1_Phase2_Mugshots(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA != 0) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + REG_BLDCNT = sTransitionStructPtr->BLDCNT; + DmaSet(0, gUnknown_02038C28[1], ®_BLDY, 0xA2400001); +} + +void HBlankCB_Phase2_Mugshots(void) +{ + if (REG_VCOUNT < 80) + REG_BG0HOFS = sTransitionStructPtr->field_18; + else + REG_BG0HOFS = sTransitionStructPtr->field_1A; +} + +void Mugshots_CreateOpponentPlayerSprites(struct Task *task) +{ + struct Sprite *opponentSprite, *playerSprite; + + s16 mugshotId = task->tMugshotId; + task->tOpponentSpriteId = CreateTrainerSprite(sMugshotsTrainerPicIDsTable[mugshotId], + sMugshotsOpponentCoords[mugshotId][0] - 32, + sMugshotsOpponentCoords[mugshotId][1] + 42, + 0, gDecompressionBuffer); + task->tPlayerSpriteId = CreateTrainerSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), 272, 106, 0, gDecompressionBuffer); + + opponentSprite = &gSprites[task->tOpponentSpriteId]; + playerSprite = &gSprites[task->tPlayerSpriteId]; + + opponentSprite->callback = sub_8148380; + playerSprite->callback = sub_8148380; + + opponentSprite->oam.affineMode = 3; + playerSprite->oam.affineMode = 3; + + opponentSprite->oam.matrixNum = AllocOamMatrix(); + playerSprite->oam.matrixNum = AllocOamMatrix(); + + opponentSprite->oam.shape = 1; + playerSprite->oam.shape = 1; + + opponentSprite->oam.size = 3; + playerSprite->oam.size = 3; + + CalcCenterToCornerVec(opponentSprite, 1, 3, 3); + CalcCenterToCornerVec(playerSprite, 1, 3, 3); + + SetOamMatrixRotationScaling(opponentSprite->oam.matrixNum, sMugshotsOpponentRotationScales[mugshotId][0], sMugshotsOpponentRotationScales[mugshotId][1], 0); + SetOamMatrixRotationScaling(playerSprite->oam.matrixNum, -512, 512, 0); +} + +void sub_8148380(struct Sprite *sprite) +{ + while (sUnknown_085C8C24[sprite->data[0]](sprite)); +} + +bool8 sub_81483A8(struct Sprite *sprite) +{ + return FALSE; +} + +bool8 sub_81483AC(struct Sprite *sprite) +{ + s16 arr0[2]; + s16 arr1[2]; + + memcpy(arr0, sUnknown_085C8C40, sizeof(sUnknown_085C8C40)); + memcpy(arr1, sUnknown_085C8C44, sizeof(sUnknown_085C8C44)); + + sprite->data[0]++; + sprite->data[1] = arr0[sprite->data[7]]; + sprite->data[2] = arr1[sprite->data[7]]; + return TRUE; +} + +bool8 sub_81483F8(struct Sprite *sprite) +{ + sprite->pos1.x += sprite->data[1]; + if (sprite->data[7] && sprite->pos1.x < 133) + sprite->data[0]++; + else if (!sprite->data[7] && sprite->pos1.x > 103) + sprite->data[0]++; + return FALSE; +} + +bool8 sub_814842C(struct Sprite *sprite) +{ + sprite->data[1] += sprite->data[2]; + sprite->pos1.x += sprite->data[1]; + if (sprite->data[1] == 0) + { + sprite->data[0]++; + sprite->data[2] = -sprite->data[2]; + sprite->data[6] = 1; + } + return FALSE; +} + +bool8 sub_8148458(struct Sprite *sprite) +{ + sprite->data[1] += sprite->data[2]; + sprite->pos1.x += sprite->data[1]; + if (sprite->pos1.x < -31 || sprite->pos1.x > 271) + sprite->data[0]++; + return FALSE; +} + +void sub_8148484(s16 spriteId, s16 value) +{ + gSprites[spriteId].data[7] = value; +} + +void sub_814849C(s16 spriteId) +{ + gSprites[spriteId].data[0]++; +} + +s16 sub_81484B8(s16 spriteId) +{ + return gSprites[spriteId].data[6]; +} + +void Phase2Task_Slice(u8 taskId) +{ + while (sPhase2_Slice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Slice_Func1(struct Task *task) +{ + u16 i; + + sub_8149F08(); + dp12_8087EA4(); + + task->data[2] = 256; + task->data[3] = 1; + sTransitionStructPtr->WININ = 63; + sTransitionStructPtr->WINOUT = 0; + sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->VBlank_DMA = 0; + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[1][i] = sTransitionStructPtr->field_14; + gUnknown_02038C28[1][160 + i] = 0xF0; + } + + EnableInterrupts(INTR_FLAG_HBLANK); + SetGpuRegBits(REG_OFFSET_DISPSTAT, DISPSTAT_HBLANK_INTR); + + SetVBlankCallback(VBlankCB_Phase2_Slice); + SetHBlankCallback(HBlankCB_Phase2_Slice); + + task->tState++; + return TRUE; +} + +bool8 Phase2_Slice_Func2(struct Task *task) +{ + u16 i; + + sTransitionStructPtr->VBlank_DMA = 0; + + task->data[1] += (task->data[2] >> 8); + if (task->data[1] > 0xF0) + task->data[1] = 0xF0; + if (task->data[2] <= 0xFFF) + task->data[2] += task->data[3]; + if (task->data[3] < 128) + task->data[3] <<= 1; // multiplying by two + + for (i = 0; i < 160; i++) + { + u16* storeLoc1 = &gUnknown_02038C28[0][i]; + u16* storeLoc2 = &gUnknown_02038C28[0][i + 160]; + if (1 & i) + { + *storeLoc1 = sTransitionStructPtr->field_14 + task->data[1]; + *storeLoc2 = 0xF0 - task->data[1]; + } + else + { + *storeLoc1 = sTransitionStructPtr->field_14 - task->data[1]; + *storeLoc2 = (task->data[1] << 8) | (0xF1); + } + } + + if (task->data[1] > 0xEF) + task->tState++; + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Slice_Func3(struct Task *task) +{ + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_Slice)); + return FALSE; +} + +void VBlankCB_Phase2_Slice(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0V = sTransitionStructPtr->WIN0V; + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 640); + DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); +} + +void HBlankCB_Phase2_Slice(void) +{ + if (REG_VCOUNT < 160) + { + u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + REG_BG1HOFS = var; + REG_BG2HOFS = var; + REG_BG3HOFS = var; + } +} From 9106d8df1856c65b2bc85da6d61b6968669814ea Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 13 Jan 2018 21:03:07 +0100 Subject: [PATCH 3/7] up to groudon transition --- asm/battle_transition.s | 1377 +---------------------------------- data/battle_transition.s | 127 +--- include/battle_transition.h | 8 +- src/battle_transition.c | 679 ++++++++++++++++- sym_bss.txt | 5 - 5 files changed, 658 insertions(+), 1538 deletions(-) diff --git a/asm/battle_transition.s b/asm/battle_transition.s index ef5c95332..675f46bfd 100644 --- a/asm/battle_transition.s +++ b/asm/battle_transition.s @@ -5,1383 +5,8 @@ .text - thumb_func_start Phase2Task_25 -Phase2Task_25: @ 8148760 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8C54 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08148772: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08148772 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_25 + - thumb_func_start sub_8148798 -sub_8148798: @ 8148798 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r6, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r2, 0 - movs r0, 0x3F - strh r0, [r1, 0x2] - strh r2, [r1, 0x4] - movs r0, 0xA0 - strh r0, [r1, 0x8] - movs r4, 0 - ldr r5, =gUnknown_02038C28 - movs r0, 0xF0 - lsls r0, 3 - adds r0, r5 - mov r12, r0 - mov r8, r4 - movs r1, 0xF0 - mov r9, r1 -_081487CC: - lsls r2, r4, 1 - mov r7, r12 - adds r1, r2, r7 - ldr r0, =sTransitionStructPtr - ldr r3, [r0] - ldrh r0, [r3, 0x14] - strh r0, [r1] - adds r1, r4, 0 - adds r1, 0xA0 - lsls r1, 1 - adds r0, r1, r7 - mov r7, r9 - strh r7, [r0] - adds r2, r5 - ldrh r0, [r3, 0x14] - strh r0, [r2] - adds r1, r5 - mov r0, r9 - strh r0, [r1] - movs r1, 0xA0 - lsls r1, 1 - adds r0, r4, r1 - lsls r0, 1 - adds r0, r5 - mov r7, r8 - strh r7, [r0] - adds r1, 0xA0 - adds r0, r4, r1 - lsls r0, 1 - adds r0, r5 - subs r1, 0xE0 - strh r1, [r0] - movs r7, 0xA0 - lsls r7, 2 - adds r0, r4, r7 - lsls r0, 1 - adds r0, r5 - movs r1, 0x1 - strh r1, [r0] - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x9F - bls _081487CC - movs r0, 0 - strh r0, [r6, 0x10] - strh r0, [r6, 0x12] - movs r0, 0x7 - strh r0, [r6, 0x14] - movs r0, 0x2 - bl EnableInterrupts - ldr r0, =VBlankCB_Phase2_Slice - bl SetVBlankCallback - ldr r0, =HBlankCB_Phase2_Slice - bl SetHBlankCallback - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - movs r0, 0x1 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148798 - - thumb_func_start sub_8148864 -sub_8148864: @ 8148864 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - mov r9, r0 - ldr r1, =gUnknown_085C8C64 - mov r0, sp - movs r2, 0x2 - bl memcpy - add r4, sp, 0x4 - ldr r1, =gUnknown_085C8C66 - adds r0, r4, 0 - movs r2, 0x4 - bl memcpy - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - str r0, [sp, 0x8] - mov r10, r0 - mov r1, r9 - movs r3, 0x12 - ldrsh r0, [r1, r3] - ldr r1, [sp, 0x8] - cmp r1, r0 - ble _081488A4 - b _08148A68 -_081488A4: - movs r7, 0 - mov r2, r10 - negs r2, r2 - str r2, [sp, 0xC] - mov r3, r10 - adds r3, 0x1 - str r3, [sp, 0x10] -_081488B2: - movs r6, 0 - mov r0, sp - adds r0, r7 - mov r12, r0 -_081488BA: - lsls r0, r6, 1 - add r0, sp - adds r0, 0x4 - movs r1, 0 - ldrsh r0, [r0, r1] - ldr r2, [sp, 0xC] - muls r0, r2 - lsls r0, 1 - mov r3, r12 - ldrb r3, [r3] - adds r0, r3 - lsls r0, 16 - lsrs r5, r0, 16 - asrs r0, 16 - cmp r0, 0 - blt _08148966 - cmp r0, 0x4F - bne _081488E2 - cmp r7, 0x1 - beq _08148966 -_081488E2: - lsls r1, r0, 1 - ldr r0, =gUnknown_02038EA8 - adds r4, r1, r0 - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2 - adds r3, r1, r0 - ldr r0, =gUnknown_02039128 - adds r1, r0 - ldrh r2, [r4] - cmp r2, 0xEF - bls _08148920 - movs r1, 0xF0 - strh r1, [r4] - ldr r0, [sp, 0x8] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - b _08148940 - .pool -_08148920: - ldrh r0, [r3] - lsrs r0, 8 - adds r0, r2, r0 - strh r0, [r4] - ldrh r0, [r1] - cmp r0, 0x7F - bhi _08148932 - lsls r0, 1 - strh r0, [r1] -_08148932: - ldrh r2, [r3] - ldr r0, =0x00000fff - cmp r2, r0 - bhi _08148940 - ldrh r0, [r1] - adds r0, r2, r0 - strh r0, [r3] -_08148940: - lsls r0, r5, 16 - asrs r0, 15 - ldr r1, =gUnknown_02038C28 - adds r2, r0, r1 - ldr r1, =gUnknown_02038D68 - adds r3, r0, r1 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrh r0, [r4] - ldrh r1, [r1, 0x14] - adds r0, r1 - strh r0, [r2] - ldrh r0, [r4] - movs r1, 0xF0 - subs r0, r1, r0 - strh r0, [r3] - mov r2, r10 - cmp r2, 0 - beq _08148970 -_08148966: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x1 - bls _081488BA -_08148970: - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x1 - bls _081488B2 - movs r7, 0 - ldr r3, =gUnknown_02038EA8 - mov r8, r3 -_08148980: - movs r6, 0 - mov r0, sp - adds r0, r7 - mov r12, r0 - adds r1, r7, 0x1 - str r1, [sp, 0x14] -_0814898C: - mov r2, r12 - ldrb r1, [r2] - adds r1, 0x1 - lsls r0, r6, 1 - add r0, sp - adds r0, 0x4 - movs r3, 0 - ldrsh r0, [r0, r3] - ldr r2, [sp, 0xC] - muls r0, r2 - lsls r0, 1 - adds r1, r0 - lsls r1, 16 - lsrs r5, r1, 16 - asrs r1, 16 - cmp r1, 0xA0 - bgt _08148A40 - cmp r1, 0x50 - bne _081489B6 - cmp r7, 0x1 - beq _08148A40 -_081489B6: - lsls r1, 1 - mov r3, r8 - adds r4, r1, r3 - movs r0, 0xA0 - lsls r0, 1 - add r0, r8 - adds r3, r1, r0 - ldr r0, =gUnknown_02039128 - adds r1, r0 - ldrh r2, [r4] - cmp r2, 0xEF - bls _081489F8 - movs r1, 0xF0 - strh r1, [r4] - ldr r0, [sp, 0x8] - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - b _08148A18 - .pool -_081489F8: - ldrh r0, [r3] - lsrs r0, 8 - adds r0, r2, r0 - strh r0, [r4] - ldrh r0, [r1] - cmp r0, 0x7F - bhi _08148A0A - lsls r0, 1 - strh r0, [r1] -_08148A0A: - ldrh r2, [r3] - ldr r0, =0x00000fff - cmp r2, r0 - bhi _08148A18 - ldrh r0, [r1] - adds r0, r2, r0 - strh r0, [r3] -_08148A18: - lsls r0, r5, 16 - asrs r0, 15 - ldr r1, =gUnknown_02038C28 - adds r2, r0, r1 - ldr r1, =gUnknown_02038D68 - adds r3, r0, r1 - ldr r1, =sTransitionStructPtr - ldr r0, [r1] - ldrh r1, [r0, 0x14] - ldrh r0, [r4] - subs r1, r0 - strh r1, [r2] - ldrh r0, [r4] - lsls r0, 8 - movs r1, 0xF1 - orrs r0, r1 - strh r0, [r3] - mov r2, r10 - cmp r2, 0 - beq _08148A4A -_08148A40: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x1 - bls _0814898C -_08148A4A: - ldr r3, [sp, 0x14] - lsls r0, r3, 16 - lsrs r7, r0, 16 - cmp r7, 0x1 - bls _08148980 - ldr r1, [sp, 0x10] - lsls r0, r1, 16 - lsrs r0, 16 - mov r10, r0 - mov r2, r9 - movs r3, 0x12 - ldrsh r0, [r2, r3] - cmp r10, r0 - bgt _08148A68 - b _081488A4 -_08148A68: - mov r1, r9 - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] - lsls r0, 16 - cmp r0, 0 - bge _08148A7A - movs r0, 0 - strh r0, [r1, 0x10] -_08148A7A: - mov r2, r9 - movs r3, 0x10 - ldrsh r0, [r2, r3] - cmp r0, 0 - bgt _08148A98 - movs r1, 0x12 - ldrsh r0, [r2, r1] - adds r0, 0x1 - cmp r0, 0x14 - bgt _08148A98 - ldrh r0, [r2, 0x14] - strh r0, [r2, 0x10] - ldrh r0, [r2, 0x12] - adds r0, 0x1 - strh r0, [r2, 0x12] -_08148A98: - ldr r2, [sp, 0x8] - cmp r2, 0x9F - bls _08148AA6 - mov r3, r9 - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] -_08148AA6: - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148864 - - thumb_func_start sub_8148AD4 -sub_8148AD4: @ 8148AD4 - push {r4,r5,lr} - adds r3, r0, 0 - movs r2, 0x1 - ldr r5, =0x0000ff10 - movs r1, 0 - ldr r4, =gUnknown_020393A8 -_08148AE0: - lsls r0, r1, 1 - adds r0, r4 - ldrh r0, [r0] - cmp r0, 0xF0 - beq _08148AF0 - cmp r0, r5 - beq _08148AF0 - movs r2, 0 -_08148AF0: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x9F - bls _08148AE0 - cmp r2, 0x1 - bne _08148B04 - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] -_08148B04: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148AD4 - - thumb_func_start sub_8148B14 -sub_8148B14: @ 8148B14 - push {lr} - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, =Phase2Task_25 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148B14 - - thumb_func_start Phase2Task_26 -Phase2Task_26: @ 8148B54 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8C6C - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08148B66: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08148B66 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_26 - - thumb_func_start Phase2Task_27 -Phase2Task_27: @ 8148B8C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8C78 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08148B9E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08148B9E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_27 - - thumb_func_start sub_8148BC4 -sub_8148BC4: @ 8148BC4 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x2] - movs r0, 0x3F - strh r0, [r1, 0x4] - movs r0, 0xF0 - strh r0, [r1, 0x6] - movs r0, 0xA0 - strh r0, [r1, 0x8] - ldr r0, =gUnknown_02038C28 - movs r2, 0 - movs r1, 0x9F - ldr r3, =0x000008be - adds r0, r3 -_08148BEE: - strh r2, [r0] - subs r0, 0x2 - subs r1, 0x1 - cmp r1, 0 - bge _08148BEE - movs r4, 0 - ldr r0, =VBlankCB1_Phase2_BigPokeball - bl SetVBlankCallback - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0x1 - strh r0, [r5, 0xA] - adds r0, 0xFF - strh r0, [r5, 0xC] - strh r4, [r5, 0x16] - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148BC4 - - thumb_func_start sub_8148C28 -sub_8148C28: @ 8148C28 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x16 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _08148C6C - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - movs r0, 0 - bl SetVBlankCallback - ldr r0, [r4] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - b _08148CDE - .pool -_08148C6C: - ldr r5, =sTransitionStructPtr - ldr r1, [r5] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldrh r2, [r4, 0xC] - movs r0, 0xC - ldrsh r1, [r4, r0] - ldr r0, =0x000003ff - cmp r1, r0 - bgt _08148C88 - adds r0, r2, 0 - adds r0, 0x80 - strh r0, [r4, 0xC] -_08148C88: - ldrh r1, [r4, 0xA] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0x9F - bgt _08148C9C - ldrh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 24 - adds r0, r1, r0 - strh r0, [r4, 0xA] -_08148C9C: - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0xA0 - ble _08148CA8 - movs r0, 0xA0 - strh r0, [r4, 0xA] -_08148CA8: - ldr r0, =gUnknown_02038C28 - movs r2, 0xA - ldrsh r3, [r4, r2] - movs r1, 0x78 - movs r2, 0x50 - bl sub_814A014 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0xA0 - bne _08148CD4 - movs r0, 0x1 - strh r0, [r4, 0x16] - bl sub_8149F84 - b _08148CDE - .pool -_08148CD4: - ldr r0, [r5] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] -_08148CDE: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8148C28 - - thumb_func_start sub_8148CE8 -sub_8148CE8: @ 8148CE8 - push {r4-r6,lr} - adds r4, r0, 0 - ldr r6, =sTransitionStructPtr - ldr r0, [r6] - ldrb r1, [r0] - movs r5, 0 - strb r5, [r0] - ldrh r1, [r4, 0x16] - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08148D0A - adds r0, r1, 0x1 - strh r0, [r4, 0x16] - movs r0, 0x30 - strh r0, [r4, 0xA] - strh r5, [r4, 0x14] -_08148D0A: - ldr r1, =gUnknown_085C8C80 - movs r2, 0x14 - ldrsh r0, [r4, r2] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - ldrh r1, [r4, 0xA] - adds r0, r1 - strh r0, [r4, 0xA] - movs r2, 0x14 - ldrsh r1, [r4, r2] - adds r1, 0x1 - lsrs r0, r1, 31 - adds r0, r1, r0 - asrs r0, 1 - lsls r0, 1 - subs r1, r0 - strh r1, [r4, 0x14] - ldr r0, =gUnknown_02038C28 - movs r1, 0xA - ldrsh r3, [r4, r1] - movs r1, 0x78 - movs r2, 0x50 - bl sub_814A014 - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r0, 0x8 - bgt _08148D4C - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - strh r5, [r4, 0x16] -_08148D4C: - ldr r0, [r6] - ldrb r1, [r0] - adds r1, 0x1 - ldrb r2, [r0] - strb r1, [r0] - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148CE8 - - thumb_func_start sub_8148D6C -sub_8148D6C: @ 8148D6C - push {r4,lr} - adds r4, r0, 0 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldrh r1, [r4, 0x16] - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _08148D8E - adds r0, r1, 0x1 - strh r0, [r4, 0x16] - movs r0, 0x2 - strh r0, [r4, 0x12] - strh r0, [r4, 0x14] -_08148D8E: - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0xA0 - ble _08148D9A - movs r0, 0xA0 - strh r0, [r4, 0xA] -_08148D9A: - ldr r0, =gUnknown_02038C28 - movs r2, 0xA - ldrsh r3, [r4, r2] - movs r1, 0x78 - movs r2, 0x50 - bl sub_814A014 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0xA0 - bne _08148DD6 - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, [r4] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_08148DD6: - ldrh r2, [r4, 0x12] - ldrb r0, [r4, 0x12] - cmp r0, 0x80 - bgt _08148DFC - ldrh r1, [r4, 0x14] - adds r0, r2, 0 - adds r0, 0x8 - b _08148E08 - .pool -_08148DFC: - ldrh r0, [r4, 0x14] - subs r0, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - adds r0, r2, 0 - adds r0, 0x10 -_08148E08: - strh r0, [r4, 0x12] - movs r0, 0xFF - ands r2, r0 - lsls r1, 16 - asrs r1, 16 - adds r0, r2, 0 - bl Sin - ldrh r2, [r4, 0xA] - adds r0, r2 - strh r0, [r4, 0xA] - lsls r0, 16 - cmp r0, 0 - bgt _08148E28 - movs r0, 0x1 - strh r0, [r4, 0xA] -_08148E28: - ldrh r0, [r4, 0x12] - lsls r1, r0, 16 - asrs r0, r1, 16 - cmp r0, 0xFE - ble _08148E3C - asrs r0, r1, 24 - strh r0, [r4, 0x12] - ldrh r0, [r4, 0x14] - adds r0, 0x1 - strh r0, [r4, 0x14] -_08148E3C: - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148D6C - - thumb_func_start Phase2Task_28 -Phase2Task_28: @ 8148E54 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8C84 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08148E66: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08148E66 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_28 - - thumb_func_start sub_8148E8C -sub_8148E8C: @ 8148E8C - push {r4,r5,lr} - sub sp, 0xC - adds r5, r0, 0 - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - ldr r4, =sShrinkingBoxTileset - ldr r1, [sp, 0x8] - adds r0, r4, 0 - movs r2, 0x10 - bl CpuSet - movs r0, 0xE0 - lsls r0, 1 - adds r4, r0 - ldr r1, [sp, 0x8] - adds r1, 0x40 - adds r0, r4, 0 - movs r2, 0x10 - bl CpuSet - mov r1, sp - movs r2, 0xF0 - lsls r2, 8 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - mov r0, sp - bl CpuSet - ldr r0, =gFieldEffectObjectPalette10 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r1, 0 - movs r4, 0x1 - movs r0, 0x1 - strh r0, [r5, 0xE] - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - ldr r5, =gUnknown_03001210 - strb r1, [r5] - ldr r0, =0x0000ffff - strh r0, [r5, 0x2] - strb r4, [r5, 0x4] - movs r2, 0x9A - lsls r2, 1 - strh r2, [r5, 0x6] - strb r1, [r5, 0x8] - strb r1, [r5, 0xC] - movs r0, 0x1 - negs r0, r0 - strh r0, [r5, 0xE] - strb r4, [r5, 0x10] - strh r2, [r5, 0x12] - strb r1, [r5, 0x14] - strb r1, [r5, 0x18] - ldr r2, =0x0000fffd - strh r2, [r5, 0x1A] - strb r4, [r5, 0x1C] - ldr r3, =0x00000133 - strh r3, [r5, 0x1E] - adds r0, r5, 0 - adds r0, 0x20 - strb r1, [r0] - adds r0, 0x4 - strb r1, [r0] - strh r2, [r5, 0x26] - adds r0, 0x4 - strb r4, [r0] - strh r3, [r5, 0x2A] - adds r0, 0x4 - strb r1, [r0] - movs r0, 0 - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148E8C - - thumb_func_start sub_8148F4C -sub_8148F4C: @ 8148F4C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - mov r8, r0 - movs r7, 0x1 - add r1, sp, 0x4 - mov r0, sp - bl sub_8149F58 - movs r0, 0 -_08148F62: - movs r5, 0 - adds r6, r0, 0x1 -_08148F66: - ldr r1, =gUnknown_085C8D38 - lsrs r0, r5, 1 - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 2 - ldr r2, =gUnknown_03001210 - adds r4, r1, r2 - adds r1, r4, 0 - bl sub_8149048 - lsls r0, 16 - cmp r0, 0 - beq _08148FCA - movs r7, 0 - ldrh r2, [r4, 0x2] - movs r0, 0x1 - ands r0, r5 - cmp r0, 0x1 - bne _08148FA0 - ldr r0, =0x0000027d - adds r1, r0, 0 - lsls r0, r2, 16 - asrs r0, 16 - subs r1, r0 - lsls r1, 16 - lsrs r2, r1, 16 -_08148FA0: - lsls r0, r2, 16 - asrs r1, r0, 16 - adds r0, r1, 0 - cmp r1, 0 - bge _08148FAC - adds r0, 0x1F -_08148FAC: - asrs r2, r0, 5 - lsls r0, r2, 5 - subs r0, r1, r0 - lsls r0, 16 - lsrs r0, 16 - lsls r1, r2, 5 - lsls r0, 16 - asrs r0, 16 - adds r1, r0 - ldr r0, [sp] - lsls r1, 1 - adds r1, r0 - ldr r2, =0x0000f002 - adds r0, r2, 0 - strh r0, [r1] -_08148FCA: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x3 - bls _08148F66 - lsls r0, r6, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _08148F62 - cmp r7, 0x1 - bne _08148FE8 - mov r1, r8 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_08148FE8: - movs r0, 0 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8148F4C - - thumb_func_start sub_8149008 -sub_8149008: @ 8149008 - push {r4,lr} - adds r4, r0, 0 - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, [r4] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149008 - - thumb_func_start sub_8149048 -sub_8149048: @ 8149048 - push {r4,lr} - adds r2, r1, 0 - ldrb r1, [r2] - lsls r1, 2 - adds r1, r0 - ldr r3, [r1] - ldrb r0, [r2, 0x4] - lsls r0, 1 - adds r0, r3 - movs r4, 0 - ldrsh r1, [r0, r4] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081490CE - ldr r1, =gUnknown_03001208 - ldrh r0, [r3] - strh r0, [r1] - ldrh r0, [r3, 0x2] - strh r0, [r1] - ldrh r0, [r3, 0x4] - strh r0, [r1] - ldrh r0, [r3, 0x6] - strh r0, [r1] - movs r1, 0 - ldrsh r0, [r3, r1] - cmp r0, 0x2 - beq _081490A0 - cmp r0, 0x2 - bgt _08149090 - cmp r0, 0x1 - beq _0814909A - b _081490B2 - .pool -_08149090: - cmp r0, 0x3 - beq _081490A6 - cmp r0, 0x4 - beq _081490AC - b _081490B2 -_0814909A: - ldrh r0, [r2, 0x2] - adds r0, 0x1 - b _081490B0 -_081490A0: - ldrh r0, [r2, 0x2] - subs r0, 0x1 - b _081490B0 -_081490A6: - ldrh r0, [r2, 0x2] - subs r0, 0x20 - b _081490B0 -_081490AC: - ldrh r0, [r2, 0x2] - adds r0, 0x20 -_081490B0: - strh r0, [r2, 0x2] -_081490B2: - movs r4, 0x2 - ldrsh r1, [r2, r4] - ldr r0, =0x0000027f - cmp r1, r0 - bgt _081490CE - ldrb r0, [r2, 0x4] - lsls r0, 1 - adds r0, r3 - movs r4, 0 - ldrsh r1, [r0, r4] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _081490D8 -_081490CE: - movs r0, 0 - b _08149138 - .pool -_081490D8: - ldrb r0, [r2, 0x8] - cmp r0, 0 - bne _081490F4 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - bne _081490F4 - movs r0, 0x1 - strb r0, [r2, 0x8] - strb r0, [r2, 0x4] - ldrh r0, [r2, 0x6] - strh r0, [r2, 0x2] - movs r0, 0x4 - strb r0, [r2] -_081490F4: - ldrb r0, [r2, 0x4] - lsls r0, 1 - adds r0, r3 - movs r3, 0x2 - ldrsh r1, [r2, r3] - movs r4, 0 - ldrsh r0, [r0, r4] - cmp r1, r0 - bne _08149136 - ldrb r0, [r2] - adds r1, r0, 0x1 - strb r1, [r2] - ldrb r0, [r2, 0x8] - cmp r0, 0x1 - bne _08149124 - lsls r0, r1, 24 - lsrs r0, 24 - cmp r0, 0x7 - bls _08149136 - ldrb r0, [r2, 0x4] - adds r0, 0x1 - strb r0, [r2, 0x4] - movs r0, 0x4 - b _08149134 -_08149124: - lsls r0, r1, 24 - lsrs r0, 24 - cmp r0, 0x3 - bls _08149136 - ldrb r0, [r2, 0x4] - adds r0, 0x1 - strb r0, [r2, 0x4] - movs r0, 0 -_08149134: - strb r0, [r2] -_08149136: - movs r0, 0x1 -_08149138: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8149048 - - thumb_func_start Phase2Task_Groudon -Phase2Task_Groudon: @ 8149140 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Groudon_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08149152: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08149152 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Groudon - - thumb_func_start sub_8149178 -sub_8149178: @ 8149178 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - mov r0, sp - bl CpuSet - ldr r0, =gUnknown_085BE51C - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =gUnknown_085BEA88 - ldr r1, [sp, 0x4] - bl LZ77UnCompVram - ldrh r0, [r4, 0x8] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x8] - strh r1, [r4, 0xA] - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149178 - - thumb_func_start sub_81491C8 -sub_81491C8: @ 81491C8 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xA - ldrsh r5, [r4, r0] - adds r0, r5, 0 - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _08149200 - adds r0, r5, 0 - movs r1, 0x1E - bl __modsi3 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x3 - bl __divsi3 - lsls r0, 16 - lsrs r0, 11 - ldr r1, =gUnknown_085BF0A0 - adds r0, r1 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette -_08149200: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3A - ble _08149218 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - strh r0, [r4, 0xA] -_08149218: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81491C8 - - thumb_func_start sub_8149224 -sub_8149224: @ 8149224 - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xA - ldrsh r5, [r4, r0] - adds r0, r5, 0 - movs r1, 0x5 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _08149252 - adds r0, r5, 0 - movs r1, 0x5 - bl __divsi3 - lsls r0, 16 - asrs r0, 11 - ldr r1, =gUnknown_085BF2A0 - adds r0, r1 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette -_08149252: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x44 - ble _0814926E - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - strh r0, [r4, 0xA] - movs r0, 0x1E - strh r0, [r4, 0x18] -_0814926E: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149224 thumb_func_start Phase2Task_Rayquaza Phase2Task_Rayquaza: @ 814927C diff --git a/data/battle_transition.s b/data/battle_transition.s index 98b022432..68801b22e 100644 --- a/data/battle_transition.s +++ b/data/battle_transition.s @@ -4,129 +4,6 @@ .section .rodata - - .align 2 -gUnknown_085C8C54:: @ 85C8C54 - .4byte sub_8148798 - .4byte sub_8148864 - .4byte sub_8148AD4 - .4byte sub_8148B14 - - .align 1 -gUnknown_085C8C64:: @ 85C8C64 - .2byte 0x7727 - - .align 1 -gUnknown_085C8C66:: @ 85C8C66 - .2byte 0x0001, 0xffff, 0x0000 - - .align 2 -gUnknown_085C8C6C:: @ 85C8C6C - .4byte sub_8148BC4 - .4byte sub_8148CE8 - .4byte sub_8148C28 - - .align 2 -gUnknown_085C8C78:: @ 85C8C78 - .4byte sub_8148BC4 - .4byte sub_8148D6C - - .align 1 -gUnknown_085C8C80:: @ 85C8C80 - .2byte 0xfffa, 0x0004 - - .align 2 -gUnknown_085C8C84:: @ 85C8C84 - .4byte sub_8148E8C - .4byte sub_8148F4C - .4byte sub_8149008 - -gUnknown_085C8C90:: @ 85C8C90 - .2byte 0x0001, 0x001b, 0x0113, 0xffff - -gUnknown_085C8C98:: @ 85C8C98 - .2byte 0x0002, 0x01e6, 0xffff - -gUnknown_085C8C9E:: @ 85C8C9E - .2byte 0x0003, 0x0106, 0xffff - -gUnknown_085C8CA4:: @ 85C8CA4 - .2byte 0x0004, 0x01fb, 0xfffe - -gUnknown_085C8CAA:: @ 85C8CAA - .2byte 0x0001, 0x00d5, 0xffff - -gUnknown_085C8CB0:: @ 85C8CB0 - .2byte 0x0002, 0x0224, 0xfffe - -gUnknown_085C8CB6:: @ 85C8CB6 - .2byte 0x0003, 0x00c4, 0xffff - -gUnknown_085C8CBC:: @ 85C8CBC - .2byte 0x0004, 0x023d, 0x0135, 0xffff - -gUnknown_085C8CC4:: @ 85C8CC4 - .2byte 0x0001, 0x01da, 0xffff - -gUnknown_085C8CCA:: @ 85C8CCA - .2byte 0x0002, 0x0127, 0x0020, 0xffff - -gUnknown_085C8CD2:: @ 85C8CD2 - .2byte 0x0003, 0x003a, 0xffff - -gUnknown_085C8CD8:: @ 85C8CD8 - .2byte 0x0004, 0x01c7, 0xffff - -gUnknown_085C8CDE:: @ 85C8CDE - .2byte 0x0001, 0x021c, 0xffff - -gUnknown_085C8CE4:: @ 85C8CE4 - .2byte 0x0002, 0x00e5, 0xffff - -gUnknown_085C8CEA:: @ 85C8CEA - .2byte 0x0003, 0x00f4, 0x001c, 0xffff - -gUnknown_085C8CF2:: @ 85C8CF2 - .2byte 0x0004, 0x0205, 0xffff - - .align 2 -gUnknown_085C8CF8:: @ 85C8CF8 - .4byte gUnknown_085C8C90 - .4byte gUnknown_085C8CA4 - .4byte gUnknown_085C8C98 - .4byte gUnknown_085C8C9E - .4byte gUnknown_085C8CEA - .4byte gUnknown_085C8CE4 - .4byte gUnknown_085C8CF2 - .4byte gUnknown_085C8CDE - - .align 2 -gUnknown_085C8D18:: @ 85C8D18 - .4byte gUnknown_085C8CBC - .4byte gUnknown_085C8CB0 - .4byte gUnknown_085C8CB6 - .4byte gUnknown_085C8CAA - .4byte gUnknown_085C8CCA - .4byte gUnknown_085C8CD8 - .4byte gUnknown_085C8CC4 - .4byte gUnknown_085C8CD2 - - .align 2 -gUnknown_085C8D38:: @ 85C8D38 - .4byte gUnknown_085C8CF8 - .4byte gUnknown_085C8D18 - - .align 2 -sPhase2_Groudon_Funcs:: @ 85C8D40 - .4byte Phase2_WeatherTrio_Func1 - .4byte Phase2_WaitPaletteFade - .4byte sub_8149178 - .4byte sub_81491C8 - .4byte sub_8149224 - .4byte Phase2_FramesCountdown - .4byte Phase2_WeatherDuo_Func6 - .4byte Phase2_WeatherDuo_Func7 - .align 2 sPhase2_Rayquaza_Funcs:: @ 85C8D60 .4byte Phase2_WeatherTrio_Func1 @@ -138,8 +15,8 @@ sPhase2_Rayquaza_Funcs:: @ 85C8D60 .4byte sub_8149410 .4byte sub_814943C .4byte sub_814946C - .4byte sub_8148CE8 - .4byte sub_8148C28 + .4byte Phase2_Blackhole1_Func2 + .4byte Phase2_Blackhole1_Func3 .align 2 gUnknown_085C8D8C:: @ 85C8D8C diff --git a/include/battle_transition.h b/include/battle_transition.h index 2ad27dc29..bb8505edb 100644 --- a/include/battle_transition.h +++ b/include/battle_transition.h @@ -17,7 +17,7 @@ enum // TRANSITION_MUGSHOT MUGSHOTS_COUNT }; -// credits for the names go to Dyskinesia and Tetrable +// credits for the names go to Dyskinesia, Tetrable and Farore // names are naturally subject to change #define B_TRANSITION_BLUR 0 @@ -47,9 +47,9 @@ enum // TRANSITION_MUGSHOT #define B_TRANSITION_GROUDON 23 #define B_TRANSITION_RAYQUAZA 24 #define B_TRANSITION_25 25 -#define B_TRANSITION_26 26 -#define B_TRANSITION_27 27 -#define B_TRANSITION_28 28 +#define B_TRANSITION_BLACKHOLE1 26 +#define B_TRANSITION_BLACKHOLE2 27 +#define B_TRANSITION_RECTANGULAR_SPIRAL 28 #define B_TRANSITION_29 29 #define B_TRANSITION_30 30 #define B_TRANSITION_31 31 diff --git a/src/battle_transition.c b/src/battle_transition.c index e60a2d91f..04f48b126 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -41,6 +41,15 @@ struct TransitionData s16 data[11]; }; +struct StructRectangularSpiral +{ + u8 field_0; + s16 field_2; + u8 field_4; + s16 field_6; + u8 field_8; +}; + typedef bool8 (*TransitionStateFunc)(struct Task *task); typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); @@ -81,9 +90,9 @@ void Phase2Task_Kyogre(u8 taskId); void Phase2Task_Groudon(u8 taskId); void Phase2Task_Rayquaza(u8 taskId); void Phase2Task_25(u8 taskId); -void Phase2Task_26(u8 taskId); -void Phase2Task_27(u8 taskId); -void Phase2Task_28(u8 taskId); +void Phase2Task_Blackhole1(u8 taskId); +void Phase2Task_Blackhole2(u8 taskId); +void Phase2Task_RectangularSpiral(u8 taskId); void Phase2Task_29(u8 taskId); void Phase2Task_30(u8 taskId); void Phase2Task_31(u8 taskId); @@ -127,6 +136,9 @@ bool8 Phase2_WaitPaletteFade(struct Task *task); bool8 Phase2_Kyogre_Func3(struct Task *task); bool8 Phase2_Kyogre_Func4(struct Task *task); bool8 Phase2_Kyogre_Func5(struct Task *task); +bool8 Phase2_Groudon_Func3(struct Task *task); +bool8 Phase2_Groudon_Func4(struct Task *task); +bool8 Phase2_Groudon_Func5(struct Task *task); bool8 Phase2_WeatherDuo_Func6(struct Task *task); bool8 Phase2_WeatherDuo_Func7(struct Task *task); bool8 Phase2_BigPokeball_Func1(struct Task *task); @@ -166,6 +178,17 @@ bool8 Phase2_Shards_Func2(struct Task *task); bool8 Phase2_Shards_Func3(struct Task *task); bool8 Phase2_Shards_Func4(struct Task *task); bool8 Phase2_Shards_Func5(struct Task *task); +bool8 Phase2_25_Func1(struct Task *task); +bool8 Phase2_25_Func2(struct Task *task); +bool8 Phase2_25_Func3(struct Task *task); +bool8 Phase2_25_Func4(struct Task *task); +bool8 Phase2_Blackhole_Func1(struct Task *task); +bool8 Phase2_Blackhole1_Func2(struct Task *task); +bool8 Phase2_Blackhole1_Func3(struct Task *task); +bool8 Phase2_Blackhole2_Func2(struct Task *task); +bool8 Phase2_RectangularSpiral_Func1(struct Task *task); +bool8 Phase2_RectangularSpiral_Func2(struct Task *task); +bool8 Phase2_RectangularSpiral_Func3(struct Task *task); bool8 Phase2_Mugshot_Func1(struct Task *task); bool8 Phase2_Mugshot_Func2(struct Task *task); bool8 Phase2_Mugshot_Func3(struct Task *task); @@ -197,6 +220,7 @@ void sub_8148484(s16 spriteId, s16 value); void sub_814849C(s16 spriteId); s16 sub_81484B8(s16 spriteId); bool8 IsPhase1Done(void); +bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1); void sub_814713C(struct Sprite *sprite); void sub_8148380(struct Sprite *sprite); bool8 sub_81483A8(struct Sprite *sprite); @@ -206,9 +230,10 @@ bool8 sub_814842C(struct Sprite *sprite); bool8 sub_8148458(struct Sprite *sprite); // iwram bss vars -IWRAM_DATA u16 gUnknown_03001208; +IWRAM_DATA static s16 sUnusedRectangularSpiralVar; IWRAM_DATA static u8 sTestingTransitionId; IWRAM_DATA static u8 sTestingTransitionState; +IWRAM_DATA static struct StructRectangularSpiral sRectangularSpiralTransition[4]; // ewram vars EWRAM_DATA struct TransitionData *sTransitionStructPtr = NULL; @@ -288,9 +313,9 @@ const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = Phase2Task_Groudon, // 23 Phase2Task_Rayquaza, // 24 Phase2Task_25, // 25 - Phase2Task_26, // 26 - Phase2Task_27, // 27 - Phase2Task_28, // 28 + Phase2Task_Blackhole1, // 26 + Phase2Task_Blackhole2, // 27 + Phase2Task_RectangularSpiral, // 28 Phase2Task_29, // 29 Phase2Task_30, // 30 Phase2Task_31, // 31 @@ -502,6 +527,98 @@ const TransitionStateFunc sPhase2_Slice_Funcs[] = Phase2_Slice_Func3 }; +const TransitionStateFunc sPhase2_25_Funcs[] = +{ + Phase2_25_Func1, + Phase2_25_Func2, + Phase2_25_Func3, + Phase2_25_Func4 +}; + +const u8 gUnknown_085C8C64[] = {39, 119}; +const s16 gUnknown_085C8C66[] = {1, -1}; + +const TransitionStateFunc sPhase2_Blackhole1_Funcs[] = +{ + Phase2_Blackhole_Func1, + Phase2_Blackhole1_Func2, + Phase2_Blackhole1_Func3 +}; + +const TransitionStateFunc sPhase2_Blackhole2_Funcs[] = +{ + Phase2_Blackhole_Func1, + Phase2_Blackhole2_Func2 +}; + +const s16 gUnknown_085C8C80[] = {-6, 4}; + +const TransitionStateFunc sPhase2_RectangularSpiral_Funcs[] = +{ + Phase2_RectangularSpiral_Func1, + Phase2_RectangularSpiral_Func2, + Phase2_RectangularSpiral_Func3 +}; + +const s16 gUnknown_085C8C90[] = {1, 27, 275, -1}; +const s16 gUnknown_085C8C98[] = {2, 486, -1}; +const s16 gUnknown_085C8C9E[] = {3, 262, -1}; +const s16 gUnknown_085C8CA4[] = {4, 507, -2}; +const s16 gUnknown_085C8CAA[] = {1, 213, -1}; +const s16 gUnknown_085C8CB0[] = {2, 548, -2}; +const s16 gUnknown_085C8CB6[] = {3, 196, -1}; +const s16 gUnknown_085C8CBC[] = {4, 573, 309, -1}; +const s16 gUnknown_085C8CC4[] = {1, 474, -1}; +const s16 gUnknown_085C8CCA[] = {2, 295, 32, -1}; +const s16 gUnknown_085C8CD2[] = {3, 58, -1}; +const s16 gUnknown_085C8CD8[] = {4, 455, -1}; +const s16 gUnknown_085C8CDE[] = {1, 540, -1}; +const s16 gUnknown_085C8CE4[] = {2, 229, -1}; +const s16 gUnknown_085C8CEA[] = {3, 244, 28, -1}; +const s16 gUnknown_085C8CF2[] = {4, 517, -1}; + +const s16 *const gUnknown_085C8CF8[] = +{ + gUnknown_085C8C90, + gUnknown_085C8CA4, + gUnknown_085C8C98, + gUnknown_085C8C9E, + gUnknown_085C8CEA, + gUnknown_085C8CE4, + gUnknown_085C8CF2, + gUnknown_085C8CDE +}; + +const s16 *const gUnknown_085C8D18[] = +{ + gUnknown_085C8CBC, + gUnknown_085C8CB0, + gUnknown_085C8CB6, + gUnknown_085C8CAA, + gUnknown_085C8CCA, + gUnknown_085C8CD8, + gUnknown_085C8CC4, + gUnknown_085C8CD2 +}; + +const s16 *const *const gUnknown_085C8D38[] = +{ + gUnknown_085C8CF8, + gUnknown_085C8D18 +}; + +const TransitionStateFunc sPhase2_Groudon_Funcs[] = +{ + Phase2_WeatherTrio_Func1, + Phase2_WaitPaletteFade, + Phase2_Groudon_Func3, + Phase2_Groudon_Func4, + Phase2_Groudon_Func5, + Phase2_FramesCountdown, + Phase2_WeatherDuo_Func6, + Phase2_WeatherDuo_Func7 +}; + extern const u16 gFieldEffectObjectPalette10[]; extern const u16 sBigPokeball_Tilemap[]; extern const u16 sMugshotsTilemap[]; @@ -722,7 +839,7 @@ bool8 Phase2_Swirl_Func1(struct Task *task) bool8 Phase2_Swirl_Func2(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; task->data[1] += 4; task->data[2] += 8; @@ -780,7 +897,7 @@ bool8 Phase2_Shuffle_Func2(struct Task *task) u8 i; u16 r3, r4; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; r4 = task->data[1]; r3 = task->data[2] >> 8; task->data[1] += 4224; @@ -1084,7 +1201,7 @@ bool8 Phase2_WeatherDuo_Func7(struct Task *task) bool8 Phase2_BigPokeball_Func3(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; if (task->data[3] == 0 || --task->data[3] == 0) { task->data[2]++; @@ -1104,7 +1221,7 @@ bool8 Phase2_BigPokeball_Func3(struct Task *task) bool8 Phase2_BigPokeball_Func4(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; if (task->data[3] == 0 || --task->data[3] == 0) { task->data[1]--; @@ -1124,7 +1241,7 @@ bool8 Phase2_BigPokeball_Func4(struct Task *task) bool8 Phase2_BigPokeball_Func5(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; task->data[4] += 8; task->data[5] -= 256; @@ -1165,7 +1282,7 @@ bool8 Phase2_WaitPaletteFade(struct Task *task) bool8 Phase2_BigPokeball_Func6(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; if (task->data[2] < 1024) task->data[2] += 128; if (task->data[1] != 0) @@ -1359,7 +1476,7 @@ bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], -1, 1, 1); do @@ -1383,7 +1500,7 @@ bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) s16 r1, r3; vu8 var = 0; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; sub_814A1AC(sTransitionStructPtr->data, 120, 80, 240, sTransitionStructPtr->data[5], 1, 1); @@ -1418,7 +1535,7 @@ bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 160, 1, 1); do @@ -1442,7 +1559,7 @@ bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) s16 r1, r2, var4; vu8 var = 0; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; sub_814A1AC(sTransitionStructPtr->data, 120, 80, 0, sTransitionStructPtr->data[5], 1, 1); @@ -1479,7 +1596,7 @@ bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; sub_814A1AC(sTransitionStructPtr->data, 120, 80, sTransitionStructPtr->data[4], 0, 1, 1); do @@ -1554,7 +1671,7 @@ bool8 Phase2_Ripple_Func2(struct Task *task) s16 r3; u16 r4, r8; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; r3 = task->data[2] >> 8; r4 = task->data[1]; @@ -1633,7 +1750,7 @@ bool8 Phase2_Wave_Func2(struct Task *task) u16* toStore; bool8 nextFunc; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; toStore = gUnknown_02038C28[0]; r5 = task->data[2]; task->data[2] += 16; @@ -1772,7 +1889,7 @@ bool8 Phase2_Mugshot_Func3(struct Task *task) s16 value; s32 mergedValue; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; toStore = gUnknown_02038C28[0]; r5 = task->data[1]; @@ -1818,7 +1935,7 @@ bool8 Phase2_Mugshot_Func4(struct Task *task) u8 i; u16* toStore; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; for (i = 0, toStore = gUnknown_02038C28[0]; i < 160; i++, toStore++) { @@ -1860,7 +1977,7 @@ bool8 Phase2_Mugshot_Func6(struct Task *task) sTransitionStructPtr->field_1A += 8; if (sub_81484B8(task->tPlayerSpriteId)) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; SetVBlankCallback(NULL); DmaStop(0); memset(gUnknown_02038C28[0], 0, 0x140); @@ -1880,7 +1997,7 @@ bool8 Phase2_Mugshot_Func7(struct Task *task) { bool32 r6; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; r6 = TRUE; sTransitionStructPtr->field_18 -= 8; sTransitionStructPtr->field_1A += 8; @@ -1919,7 +2036,7 @@ bool8 Phase2_Mugshot_Func7(struct Task *task) bool8 Phase2_Mugshot_Func8(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; BlendPalettes(-1, 0x10, 0x7FFF); sTransitionStructPtr->BLDCNT = 0xFF; task->data[3] = 0; @@ -1930,7 +2047,7 @@ bool8 Phase2_Mugshot_Func8(struct Task *task) bool8 Phase2_Mugshot_Func9(struct Task *task) { - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; task->data[3]++; memset(gUnknown_02038C28[0], task->data[3], 0x140); @@ -2104,7 +2221,7 @@ bool8 Phase2_Slice_Func1(struct Task *task) sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; sTransitionStructPtr->WIN0V = 160; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; for (i = 0; i < 160; i++) { @@ -2126,7 +2243,7 @@ bool8 Phase2_Slice_Func2(struct Task *task) { u16 i; - sTransitionStructPtr->VBlank_DMA = 0; + sTransitionStructPtr->VBlank_DMA = FALSE; task->data[1] += (task->data[2] >> 8); if (task->data[1] > 0xF0) @@ -2189,3 +2306,509 @@ void HBlankCB_Phase2_Slice(void) REG_BG3HOFS = var; } } + +void Phase2Task_25(u8 taskId) +{ + while (sPhase2_25_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_25_Func1(struct Task *task) +{ + u16 i; + + sub_8149F08(); + dp12_8087EA4(); + + sTransitionStructPtr->WININ = 63; + sTransitionStructPtr->WINOUT = 0; + sTransitionStructPtr->WIN0V = 160; + + for (i = 0; i < 0xA0; i++) + { + gUnknown_02038C28[1][i] = sTransitionStructPtr->field_14; + gUnknown_02038C28[1][0xA0 + i] = 0xF0; + gUnknown_02038C28[0][i] = sTransitionStructPtr->field_14; + gUnknown_02038C28[0][0xA0 + i] = 0xF0; + gUnknown_02038C28[0][0x140 + i] = 0; + gUnknown_02038C28[0][0x1E0 + i] = 0x100; + gUnknown_02038C28[0][0x280 + i] = 1; + } + + task->data[4] = 0; + task->data[5] = 0; + task->data[6] = 7; + + EnableInterrupts(INTR_FLAG_HBLANK); + + SetVBlankCallback(VBlankCB_Phase2_Slice); + SetHBlankCallback(HBlankCB_Phase2_Slice); + + task->tState++; + return TRUE; +} + +bool8 Phase2_25_Func2(struct Task *task) +{ + u16 i, j, k; + u8 arr1[ARRAY_COUNT(gUnknown_085C8C64)]; + s16 arr2[ARRAY_COUNT(gUnknown_085C8C66)]; + u8 var; + u16 *ptr4, *ptr3, *ptr1, *ptr2; + s16 unkVar; + + memcpy(arr1, gUnknown_085C8C64, sizeof(arr1)); + memcpy(arr2, gUnknown_085C8C66, sizeof(arr2)); + + sTransitionStructPtr->VBlank_DMA = FALSE; + var = 0; + + for (i = 0; i <= task->data[5]; i++) + { + for (j = 0; j < 2; j++) + { + for (k = 0; k < 2; k++) + { + unkVar = (arr1[j]) + (arr2[k] * -(i) * 2); + if (unkVar >= 0 && (unkVar != 79 || j != 1)) + { + ptr4 = &gUnknown_02038C28[0][unkVar + 320]; + ptr3 = &gUnknown_02038C28[0][unkVar + 480]; + ptr1 = &gUnknown_02038C28[0][unkVar + 640]; + if (*ptr4 > 0xEF) + { + *ptr4 = 0xF0; + var++; + } + else + { + *ptr4 += (*ptr3 >> 8); + if (*ptr1 <= 0x7F) + *ptr1 *= 2; + if (*ptr3 <= 0xFFF) + *ptr3 += *ptr1; + } + ptr2 = &gUnknown_02038C28[0][unkVar]; + ptr3 = &gUnknown_02038C28[0][unkVar + 160]; + *ptr2 = sTransitionStructPtr->field_14 + *ptr4; + *ptr3 = 0xF0 - *ptr4; + + if (i == 0) + break; + } + } + } + + for (j = 0; j < 2; j++) + { + for (k = 0; k < 2; k++) + { + unkVar = (arr1[j] + 1) + (arr2[k] * -(i) * 2); + if (unkVar <= 160 && (unkVar != 80 || j != 1)) + { + ptr4 = &gUnknown_02038C28[0][unkVar + 320]; + ptr3 = &gUnknown_02038C28[0][unkVar + 480]; + ptr1 = &gUnknown_02038C28[0][unkVar + 640]; + if (*ptr4 > 0xEF) + { + *ptr4 = 0xF0; + var++; + } + else + { + *ptr4 += (*ptr3 >> 8); + if (*ptr1 <= 0x7F) + *ptr1 *= 2; + if (*ptr3 <= 0xFFF) + *ptr3 += *ptr1; + } + ptr2 = &gUnknown_02038C28[0][unkVar]; + ptr3 = &gUnknown_02038C28[0][unkVar + 160]; + *ptr2 = sTransitionStructPtr->field_14 - *ptr4; + *ptr3 = (*ptr4 << 8) | (0xF1); + + if (i == 0) + break; + } + } + } + } + + if (--task->data[4] < 0) + task->data[4] = 0; + if (task->data[4] <= 0 && task->data[5] + 1 <= 20) + task->data[4] = task->data[6], task->data[5]++; + if (var > 0x9F) + task->tState++; + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_25_Func3(struct Task *task) +{ + u16 i; + bool32 done = TRUE; + u16 checkVar2 = 0xFF10; + + for (i = 0; i < 0xA0; i++) + { + if (gUnknown_02038C28[1][i] != 0xF0 && gUnknown_02038C28[1][i] != checkVar2) + done = FALSE; // a break statement should be put here + } + + if (done == TRUE) + task->tState++; + + return FALSE; +} + +bool8 Phase2_25_Func4(struct Task *task) +{ + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_25)); + return FALSE; +} + +void Phase2Task_Blackhole1(u8 taskId) +{ + while (sPhase2_Blackhole1_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_Blackhole2(u8 taskId) +{ + while (sPhase2_Blackhole2_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Blackhole_Func1(struct Task *task) +{ + s32 i; + + sub_8149F08(); + dp12_8087EA4(); + + sTransitionStructPtr->WININ = 0; + sTransitionStructPtr->WINOUT = 63; + sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0V = 160; + + for (i = 0; i < 0xA0; i++) + { + gUnknown_02038C28[1][i] = 0; + } + + SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); + + task->tState++; + task->data[1] = 1; + task->data[2] = 0x100; + task->data[7] = 0; + + return FALSE; +} + +bool8 Phase2_Blackhole1_Func3(struct Task *task) +{ + if (task->data[7] == 1) + { + DmaStop(0); + SetVBlankCallback(NULL); + DestroyTask(FindTaskIdByFunc(task->func)); + } + else + { + sTransitionStructPtr->VBlank_DMA = FALSE; + if (task->data[2] < 0x400) + task->data[2] += 0x80; + if (task->data[1] < 0xA0) + task->data[1] += (task->data[2] >> 8); + if (task->data[1] > 0xA0) + task->data[1] = 0xA0; + sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->data[1]); + if (task->data[1] == 0xA0) + { + task->data[7] = 1; + sub_8149F84(); + } + else + { + sTransitionStructPtr->VBlank_DMA++; + } + } + + return FALSE; +} + +bool8 Phase2_Blackhole1_Func2(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = FALSE; + if (task->data[7] == 0) + { + task->data[7]++; + task->data[1] = 0x30; + task->data[6] = 0; + } + task->data[1] += gUnknown_085C8C80[task->data[6]]; + task->data[6] = (task->data[6] + 1) % 2; + sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->data[1]); + if (task->data[1] < 9) + { + task->tState++; + task->data[7] = 0; + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Blackhole2_Func2(struct Task *task) +{ + u16 index; // should be s16 I think + s16 amplitude; + + sTransitionStructPtr->VBlank_DMA = FALSE; + if (task->data[7] == 0) + { + task->data[7]++; + task->data[5] = 2; + task->data[6] = 2; + } + if (task->data[1] > 0xA0) + task->data[1] = 0xA0; + + sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->data[1]); + if (task->data[1] == 0xA0) + { + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(task->func)); + } + + index = task->data[5]; + if ((task->data[5] & 0xFF) <= 128) + { + amplitude = task->data[6]; + task->data[5] += 8; + } + else + { + amplitude = task->data[6] - 1; + task->data[5] += 16; + } + task->data[1] += Sin(index & 0xFF, amplitude); + + if (task->data[1] <= 0) + task->data[1] = 1; + if (task->data[5] > 0xFE) + task->data[5] >>= 8, task->data[6]++; + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +void Phase2Task_RectangularSpiral(u8 taskId) +{ + while (sPhase2_RectangularSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_RectangularSpiral_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + CpuCopy16(sShrinkingBoxTileset, dst2, 0x20); + CpuCopy16(sShrinkingBoxTileset + 0x70, dst2 + 0x20, 0x20); + CpuFill16(0xF000, dst1, 0x800); + LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + + task->data[3] = 1; + task->tState++; + + sRectangularSpiralTransition[0].field_0 = 0; + sRectangularSpiralTransition[0].field_2 = -1; + sRectangularSpiralTransition[0].field_4 = 1; + sRectangularSpiralTransition[0].field_6 = 308; + sRectangularSpiralTransition[0].field_8 = 0; + + sRectangularSpiralTransition[1].field_0 = 0; + sRectangularSpiralTransition[1].field_2 = -1; + sRectangularSpiralTransition[1].field_4 = 1; + sRectangularSpiralTransition[1].field_6 = 308; + sRectangularSpiralTransition[1].field_8 = 0; + + sRectangularSpiralTransition[2].field_0 = 0; + sRectangularSpiralTransition[2].field_2 = -3; + sRectangularSpiralTransition[2].field_4 = 1; + sRectangularSpiralTransition[2].field_6 = 307; + sRectangularSpiralTransition[2].field_8 = 0; + + sRectangularSpiralTransition[3].field_0 = 0; + sRectangularSpiralTransition[3].field_2 = -3; + sRectangularSpiralTransition[3].field_4 = 1; + sRectangularSpiralTransition[3].field_6 = 307; + sRectangularSpiralTransition[3].field_8 = 0; + + return FALSE; +} + +bool8 Phase2_RectangularSpiral_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + u8 i; + u16 j; + bool32 done = TRUE; + + sub_8149F58(&dst1, &dst2); + + for (i = 0; i < 2; i++) + { + for (j = 0; j < ARRAY_COUNT(sRectangularSpiralTransition); j++) + { + s16 var = 0, var2 = 0; + s32 var3 = 0; + + if (sub_8149048(gUnknown_085C8D38[j / 2], &sRectangularSpiralTransition[j])) + { + u32 one; + done = FALSE; + var = sRectangularSpiralTransition[j].field_2; + one = 1; + if ((j & 1) == one) + var = 0x27D - var; + + var2 = var % 32; + var3 = var / 32 * 32; + + dst1[var3 + var2] = 0xF002; + } + } + } + + if (done == TRUE) + task->tState++; + return FALSE; +} + +bool8 Phase2_RectangularSpiral_Func3(struct Task *task) +{ + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(task->func)); + return FALSE; +} + +bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1) +{ + const s16 *array = arg0[arg1->field_0]; + if (array[arg1->field_4] == -1) + return FALSE; + + // ?? + sUnusedRectangularSpiralVar = array[0]; + sUnusedRectangularSpiralVar = array[1]; + sUnusedRectangularSpiralVar = array[2]; + sUnusedRectangularSpiralVar = array[3]; + + switch (array[0]) + { + case 1: + arg1->field_2 += 0x1; + break; + case 2: + arg1->field_2 -= 0x1; + break; + case 3: + arg1->field_2 -= 0x20; + break; + case 4: + arg1->field_2 += 0x20; + break; + } + + if (arg1->field_2 > 0x27F || array[arg1->field_4] == -1) + return FALSE; + + if (arg1->field_8 == 0 && array[arg1->field_4] == -2) + { + arg1->field_8 = 1; + arg1->field_4 = 1; + arg1->field_2 = arg1->field_6; + arg1->field_0 = 4; + } + + if (arg1->field_2 == array[arg1->field_4]) + { + (arg1->field_0)++; + if (arg1->field_8 == 1) + { + if (arg1->field_0 > 7) + { + (arg1->field_4)++; + (arg1->field_0) = 4; + } + } + else + { + if (arg1->field_0 > 3) + { + (arg1->field_4)++; + (arg1->field_0) = 0; + } + } + } + + return TRUE; +} + +void Phase2Task_Groudon(u8 taskId) +{ + while (sPhase2_Groudon_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Groudon_Func3(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + LZ77UnCompVram(gUnknown_085BE51C, dst2); + LZ77UnCompVram(gUnknown_085BEA88, dst1); + + task->tState++; + task->data[1] = 0; + return FALSE; +} + +bool8 Phase2_Groudon_Func4(struct Task *task) +{ + if (task->data[1] % 3 == 0) + { + u16 var = (task->data[1] % 30) / 3; + LoadPalette(gUnknown_085BF0A0 + (var * 16), 0xF0, 0x20); + } + if (++task->data[1] > 58) + { + task->tState++; + task->data[1] = 0; + } + + return FALSE; +} + +bool8 Phase2_Groudon_Func5(struct Task *task) +{ + if (task->data[1] % 5 == 0) + { + s16 var = task->data[1] / 5; + LoadPalette(gUnknown_085BF2A0 + (var * 16), 0xF0, 0x20); + } + if (++task->data[1] > 68) + { + task->tState++; + task->data[1] = 0; + task->tFrames = 30; + } + + return FALSE; +} + diff --git a/sym_bss.txt b/sym_bss.txt index 0524f5545..e413e08f9 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -74,11 +74,6 @@ gUnknown_03001204: @ 3001204 .space 0x4 .include "src/battle_transition.o" - - .align 4 - -gUnknown_03001210: @ 3001210 - .space 0x30 gUnknown_03001240: @ 3001240 .space 0x30 From fdbe7fa7de9b2e1f8a22efca87201901fcea32b4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 14 Jan 2018 20:45:44 +0100 Subject: [PATCH 4/7] up to 30 battle transitions --- asm/battle_transition.s | 2712 +---------------------------------- data/battle_transition.s | 235 --- include/battle_transition.h | 3 +- include/field_camera.h | 1 + ld_script.txt | 1 - src/battle_transition.c | 1664 ++++++++++++++++++--- src/tileset_anims.c | 5 +- 7 files changed, 1485 insertions(+), 3136 deletions(-) delete mode 100644 data/battle_transition.s diff --git a/asm/battle_transition.s b/asm/battle_transition.s index 675f46bfd..eb87f0563 100644 --- a/asm/battle_transition.s +++ b/asm/battle_transition.s @@ -5,2642 +5,8 @@ .text - - - - thumb_func_start Phase2Task_Rayquaza -Phase2Task_Rayquaza: @ 814927C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Rayquaza_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814928E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814928E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Rayquaza - - thumb_func_start sub_81492B4 -sub_81492B4: @ 81492B4 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - ldr r1, =0x00009a08 - movs r0, 0x8 - bl SetGpuReg - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - mov r0, sp - bl CpuSet - ldr r0, =gUnknown_085BF6A0 - ldr r1, [sp, 0x8] - movs r2, 0x80 - lsls r2, 5 - bl CpuSet - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x20] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - ldr r0, =gUnknown_085BF4A0+0xA0 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r2, 0 - ldr r3, =gUnknown_02038C28 - movs r6, 0 - movs r0, 0xF0 - lsls r0, 3 - adds r5, r3, r0 - movs r4, 0x80 - lsls r4, 1 -_08149316: - lsls r1, r2, 1 - adds r0, r1, r3 - strh r6, [r0] - adds r1, r5 - strh r4, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x9F - bls _08149316 - ldr r0, =sub_8149508 - bl SetVBlankCallback - movs r0, 0 - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81492B4 - - thumb_func_start sub_8149358 -sub_8149358: @ 8149358 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - add r1, sp, 0x4 - mov r0, sp - bl sub_8149F58 - ldr r0, =gUnknown_085C6BE0 - ldr r1, [sp] - movs r2, 0x80 - lsls r2, 4 - bl CpuSet - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149358 - - thumb_func_start sub_8149388 -sub_8149388: @ 8149388 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0xA] - movs r1, 0x3 - ands r0, r1 - cmp r0, 0 - bne _081493B4 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0 - bge _081493A0 - adds r0, 0x3 -_081493A0: - lsls r0, 14 - lsrs r0, 16 - adds r0, 0x5 - lsls r0, 5 - ldr r1, =gUnknown_085BF4A0 - adds r0, r1 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette -_081493B4: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x28 - ble _081493CC - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - strh r0, [r4, 0xA] -_081493CC: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149388 - - thumb_func_start sub_81493D8 -sub_81493D8: @ 81493D8 - push {lr} - sub sp, 0x4 - adds r1, r0, 0 - ldrh r0, [r1, 0xA] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _08149402 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - strh r2, [r1, 0xA] - ldr r0, =0xffff8000 - str r2, [sp] - movs r1, 0x2 - movs r3, 0x10 - bl BeginNormalPaletteFade -_08149402: - movs r0, 0 - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81493D8 - - thumb_func_start sub_8149410 -sub_8149410: @ 8149410 - push {lr} - adds r2, r0, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0814942E - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r0, 0x1 - strh r0, [r1, 0x20] - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] -_0814942E: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149410 - - thumb_func_start sub_814943C -sub_814943C: @ 814943C - push {r4,lr} - adds r4, r0, 0 - ldr r0, =0x00007fff - movs r1, 0x8 - movs r2, 0 - bl BlendPalettes - ldr r0, =0xffff8000 - movs r1, 0 - movs r2, 0 - bl BlendPalettes - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814943C - - thumb_func_start sub_814946C -sub_814946C: @ 814946C - push {r4,r5,lr} - adds r4, r0, 0 - movs r0, 0xA - ldrsh r5, [r4, r0] - adds r0, r5, 0 - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _0814949A - adds r0, r5, 0 - movs r1, 0x3 - bl __divsi3 - lsls r0, 16 - lsrs r0, 11 - ldr r1, =gUnknown_085BF4A0 - adds r0, r1 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette -_0814949A: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x27 - ble _081494F0 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x2] - movs r0, 0x3F - strh r0, [r1, 0x4] - movs r0, 0xF0 - strh r0, [r1, 0x6] - movs r0, 0xA0 - strh r0, [r1, 0x8] - movs r1, 0 - ldr r5, =VBlankCB1_Phase2_BigPokeball - ldr r3, =gUnknown_020393A8 - movs r2, 0 -_081494C4: - lsls r0, r1, 1 - adds r0, r3 - strh r2, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x9F - bls _081494C4 - adds r0, r5, 0 - bl SetVBlankCallback - ldrh r0, [r4, 0x8] - adds r0, 0x1 - movs r2, 0 - strh r0, [r4, 0x8] - movs r1, 0x80 - lsls r1, 1 - strh r1, [r4, 0xC] - strh r2, [r4, 0x16] - movs r0, 0 - bl ClearGpuRegBits -_081494F0: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814946C - - thumb_func_start sub_8149508 -sub_8149508: @ 8149508 - push {lr} - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl VBlankCB_BattleTransition - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - movs r1, 0x20 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08149548 - ldr r2, =gUnknown_02038C28 - b _08149554 - .pool -_08149548: - ldr r2, =gUnknown_02038C28 - cmp r0, 0x1 - bne _08149554 - movs r0, 0xF0 - lsls r0, 3 - adds r2, r0 -_08149554: - ldr r1, =0x040000b0 - str r2, [r1] - ldr r0, =0x04000012 - str r0, [r1, 0x4] - ldr r0, =0xa2400001 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149508 - - thumb_func_start Phase2Task_WhiteFade -Phase2Task_WhiteFade: @ 8149578 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C8D8C - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814958A: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814958A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_WhiteFade - - thumb_func_start sub_81495B0 -sub_81495B0: @ 81495B0 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r2, 0 - movs r0, 0xBF - strh r0, [r1, 0xE] - strh r2, [r1, 0x12] - movs r0, 0x1E - strh r0, [r1, 0x2] - movs r0, 0x3F - strh r0, [r1, 0x4] - movs r0, 0xA0 - strh r0, [r1, 0x8] - movs r1, 0 - ldr r2, =gUnknown_020393A8 - movs r4, 0 - movs r3, 0xF0 -_081495DC: - lsls r0, r1, 1 - adds r0, r2 - strh r4, [r0] - adds r0, r1, 0 - adds r0, 0xA0 - lsls r0, 1 - adds r0, r2 - strh r3, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x9F - bls _081495DC - movs r0, 0x2 - bl EnableInterrupts - ldr r0, =sub_8149840 - bl SetHBlankCallback - ldr r0, =sub_8149774 - bl SetVBlankCallback - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81495B0 - - thumb_func_start sub_8149628 -sub_8149628: @ 8149628 - push {r4-r6,lr} - sub sp, 0x10 - adds r6, r0, 0 - ldr r1, =sUnknown_085C8DA0 - mov r0, sp - movs r2, 0x10 - bl memcpy - movs r5, 0 - movs r4, 0 -_0814963C: - ldr r0, =sub_8149864 - bl CreateInvisibleSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r2, r1, r0 - movs r0, 0xF0 - strh r0, [r2, 0x20] - strh r4, [r2, 0x22] - lsls r1, r5, 16 - asrs r1, 16 - lsls r0, r1, 1 - add r0, sp - ldrh r0, [r0] - strh r0, [r2, 0x38] - adds r1, 0x1 - lsls r1, 16 - lsls r0, r4, 16 - movs r3, 0xA0 - lsls r3, 13 - adds r0, r3 - lsrs r4, r0, 16 - lsrs r5, r1, 16 - asrs r1, 16 - cmp r1, 0x7 - ble _0814963C - ldrh r0, [r2, 0x3A] - adds r0, 0x1 - strh r0, [r2, 0x3A] - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149628 - - thumb_func_start sub_814969C -sub_814969C: @ 814969C - push {r4,lr} - adds r4, r0, 0 - ldr r2, =sTransitionStructPtr - ldr r1, [r2] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - ldr r0, [r2] - movs r1, 0x20 - ldrsh r0, [r0, r1] - cmp r0, 0x7 - ble _081496C6 - movs r0, 0x1 - negs r0, r0 - ldr r2, =0x00007fff - movs r1, 0x10 - bl BlendPalettes - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_081496C6: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814969C - - thumb_func_start sub_81496D8 -sub_81496D8: @ 81496D8 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =sTransitionStructPtr - ldr r0, [r4] - ldrb r1, [r0] - movs r5, 0 - strb r5, [r0] - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - ldr r1, [r4] - movs r0, 0xF0 - strh r0, [r1, 0x6] - strh r5, [r1, 0x12] - movs r0, 0xFF - strh r0, [r1, 0xE] - movs r0, 0x3F - strh r0, [r1, 0x2] - ldr r0, =sub_8149804 - bl SetVBlankCallback - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81496D8 - - thumb_func_start sub_8149740 -sub_8149740: @ 8149740 - push {lr} - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrh r0, [r1, 0x12] - adds r0, 0x1 - strh r0, [r1, 0x12] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x10 - bls _08149766 - bl sub_8149F84 - ldr r0, =Phase2Task_WhiteFade - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_08149766: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149740 - - thumb_func_start sub_8149774 -sub_8149774: @ 8149774 - push {r4,lr} - ldr r4, =0x040000b0 - ldrh r1, [r4, 0xA] - ldr r0, =0x0000c5ff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0xA] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xA] - bl VBlankCB_BattleTransition - ldr r2, =0x04000050 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrh r0, [r1, 0xE] - strh r0, [r2] - subs r2, 0x8 - ldrh r0, [r1, 0x2] - strh r0, [r2] - adds r2, 0x2 - ldrh r0, [r1, 0x4] - strh r0, [r2] - subs r2, 0x6 - ldrh r0, [r1, 0x8] - strh r0, [r2] - ldrb r0, [r1] - cmp r0, 0 - beq _081497C4 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x80000140 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_081497C4: - ldr r0, =gUnknown_020394E8 - str r0, [r4] - ldr r0, =0x04000040 - str r0, [r4, 0x4] - ldr r0, =0xa2400001 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149774 - - thumb_func_start sub_8149804 -sub_8149804: @ 8149804 - push {lr} - bl VBlankCB_BattleTransition - ldr r1, =0x04000054 - ldr r0, =sTransitionStructPtr - ldr r2, [r0] - ldrh r0, [r2, 0x12] - strh r0, [r1] - subs r1, 0x4 - ldrh r0, [r2, 0xE] - strh r0, [r1] - subs r1, 0x8 - ldrh r0, [r2, 0x2] - strh r0, [r1] - adds r1, 0x2 - ldrh r0, [r2, 0x4] - strh r0, [r1] - subs r1, 0xA - ldrh r0, [r2, 0x6] - strh r0, [r1] - adds r1, 0x4 - ldrh r0, [r2, 0x8] - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149804 - - thumb_func_start sub_8149840 -sub_8149840: @ 8149840 - ldr r2, =0x04000054 - ldr r1, =gUnknown_02038C28 - ldr r0, =0x04000006 - ldrh r0, [r0] - lsls r0, 1 - movs r3, 0xF0 - lsls r3, 3 - adds r1, r3 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - bx lr - .pool - thumb_func_end sub_8149840 - - thumb_func_start sub_8149864 -sub_8149864: @ 8149864 - push {r4-r6,lr} - adds r3, r0, 0 - ldrh r1, [r3, 0x38] - movs r2, 0x38 - ldrsh r0, [r3, r2] - cmp r0, 0 - beq _08149890 - subs r0, r1, 0x1 - strh r0, [r3, 0x38] - movs r1, 0x3A - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _0814994C - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - movs r0, 0x1 - strb r0, [r1] - b _0814994C - .pool -_08149890: - movs r2, 0x22 - ldrsh r1, [r3, r2] - lsls r1, 1 - ldr r0, =gUnknown_02038C28 - adds r6, r1, r0 - movs r2, 0xA0 - lsls r2, 1 - adds r0, r2 - adds r5, r1, r0 - movs r4, 0 -_081498A4: - lsls r1, r4, 1 - adds r2, r1, r6 - ldrh r0, [r3, 0x2E] - lsls r0, 16 - asrs r0, 24 - strh r0, [r2] - adds r1, r5 - ldrh r0, [r3, 0x20] - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x13 - bls _081498A4 - movs r1, 0x20 - ldrsh r0, [r3, r1] - ldrh r2, [r3, 0x20] - cmp r0, 0 - bne _081498DE - movs r0, 0x2E - ldrsh r1, [r3, r0] - movs r0, 0x80 - lsls r0, 5 - cmp r1, r0 - bne _081498DE - movs r0, 0x1 - strh r0, [r3, 0x30] -_081498DE: - adds r1, r2, 0 - subs r1, 0x10 - strh r1, [r3, 0x20] - ldrh r0, [r3, 0x2E] - adds r0, 0x80 - strh r0, [r3, 0x2E] - lsls r1, 16 - cmp r1, 0 - bge _081498F4 - movs r0, 0 - strh r0, [r3, 0x20] -_081498F4: - movs r1, 0x2E - ldrsh r0, [r3, r1] - movs r1, 0x80 - lsls r1, 5 - cmp r0, r1 - ble _08149902 - strh r1, [r3, 0x2E] -_08149902: - movs r2, 0x3A - ldrsh r0, [r3, r2] - cmp r0, 0 - beq _08149914 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - movs r0, 0x1 - strb r0, [r1] -_08149914: - movs r1, 0x30 - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _0814994C - movs r2, 0x3A - ldrsh r0, [r3, r2] - ldr r2, =sTransitionStructPtr - cmp r0, 0 - beq _0814993E - ldr r0, [r2] - movs r1, 0x20 - ldrsh r0, [r0, r1] - cmp r0, 0x6 - ble _0814994C - ldrh r0, [r3, 0x32] - adds r1, r0, 0x1 - strh r1, [r3, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _0814994C -_0814993E: - ldr r1, [r2] - ldrh r0, [r1, 0x20] - adds r0, 0x1 - strh r0, [r1, 0x20] - adds r0, r3, 0 - bl DestroySprite -_0814994C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149864 - - thumb_func_start Phase2Task_GridSquares -Phase2Task_GridSquares: @ 814995C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sUnknown_085C8DB0 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814996E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814996E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_GridSquares - - thumb_func_start sub_8149994 -sub_8149994: @ 8149994 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - ldr r0, =sShrinkingBoxTileset - ldr r1, [sp, 0x8] - movs r2, 0x10 - bl CpuSet - mov r1, sp - movs r2, 0xF0 - lsls r2, 8 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - mov r0, sp - bl CpuSet - ldr r0, =gFieldEffectObjectPalette10 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149994 - - thumb_func_start sub_81499E8 -sub_81499E8: @ 81499E8 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08149A2A - mov r0, sp - bl sub_8149F40 - movs r0, 0x3 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - movs r1, 0xC - ldrsh r0, [r4, r1] - lsls r0, 5 - ldr r1, =sShrinkingBoxTileset - adds r0, r1 - ldr r1, [sp] - movs r2, 0x10 - bl CpuSet - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0xD - ble _08149A2A - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x10 - strh r0, [r4, 0xA] -_08149A2A: - ldrh r0, [r4, 0xA] - subs r0, 0x1 - strh r0, [r4, 0xA] - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81499E8 - - thumb_func_start sub_8149A40 -sub_8149A40: @ 8149A40 - push {lr} - ldrh r1, [r0, 0xA] - subs r1, 0x1 - strh r1, [r0, 0xA] - lsls r1, 16 - cmp r1, 0 - bne _08149A60 - bl sub_8149F84 - ldr r0, =Phase2Task_GridSquares - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_08149A60: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149A40 - - thumb_func_start Phase2Task_Shards -Phase2Task_Shards: @ 8149A6C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase2_Shards_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08149A7E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08149A7E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_Shards - - thumb_func_start sub_8149AA4 -sub_8149AA4: @ 8149AA4 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - movs r2, 0 - movs r0, 0x3F - strh r0, [r1, 0x2] - strh r2, [r1, 0x4] - movs r0, 0xA0 - strh r0, [r1, 0x8] - movs r1, 0 - ldr r2, =gUnknown_02038C28 - movs r3, 0xF0 - adds r4, r2, 0 -_08149AC8: - lsls r0, r1, 1 - adds r0, r2 - strh r3, [r0] - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0x9F - bls _08149AC8 - movs r0, 0xF0 - lsls r0, 3 - adds r1, r4, r0 - adds r0, r4, 0 - movs r2, 0xA0 - bl CpuSet - ldr r0, =sub_8149CE8 - bl SetVBlankCallback - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0x1 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149AA4 - - thumb_func_start sub_8149B08 -sub_8149B08: @ 8149B08 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0xC - mov r8, r0 - ldr r0, =sTransitionStructPtr - ldr r0, [r0] - adds r0, 0x24 - ldr r6, =sUnknown_085C8DD0 - mov r2, r8 - movs r3, 0xA - ldrsh r1, [r2, r3] - lsls r4, r1, 2 - adds r4, r1 - lsls r4, 1 - adds r1, r4, r6 - movs r5, 0 - ldrsh r1, [r1, r5] - adds r2, r6, 0x2 - adds r2, r4, r2 - movs r3, 0 - ldrsh r2, [r2, r3] - adds r3, r6, 0x4 - adds r3, r4, r3 - movs r5, 0 - ldrsh r3, [r3, r5] - adds r5, r6, 0x6 - adds r4, r5 - movs r5, 0 - ldrsh r4, [r4, r5] - str r4, [sp] - movs r4, 0x1 - str r4, [sp, 0x4] - str r4, [sp, 0x8] - bl sub_814A1AC - mov r0, r8 - movs r2, 0xA - ldrsh r1, [r0, r2] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 1 - adds r6, 0x8 - adds r0, r6 - ldrh r0, [r0] - mov r3, r8 - strh r0, [r3, 0xC] - ldrh r0, [r3, 0x8] - adds r0, 0x1 - strh r0, [r3, 0x8] - movs r0, 0x1 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149B08 - - thumb_func_start sub_8149B84 -sub_8149B84: @ 8149B84 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r6, r0, 0 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - movs r0, 0 - strb r0, [r1] - mov r8, r0 - movs r7, 0 - ldr r0, =gUnknown_02038C28 - mov r9, r0 -_08149BA0: - ldr r1, =gUnknown_02038C28 - ldr r0, =sTransitionStructPtr - ldr r2, [r0] - movs r3, 0x2A - ldrsh r0, [r2, r3] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - lsrs r3, r0, 8 - movs r5, 0xFF - ands r5, r0 - movs r4, 0xC - ldrsh r0, [r6, r4] - cmp r0, 0 - bne _08149BDC - movs r1, 0x28 - ldrsh r0, [r2, r1] - cmp r3, r0 - bge _08149BC8 - ldrh r3, [r2, 0x28] -_08149BC8: - lsls r0, r3, 16 - lsls r1, r5, 16 - cmp r0, r1 - ble _08149BF4 - lsrs r3, r1, 16 - b _08149BF4 - .pool -_08149BDC: - lsls r0, r5, 16 - asrs r0, 16 - movs r4, 0x28 - ldrsh r1, [r2, r4] - cmp r0, r1 - ble _08149BEA - ldrh r5, [r2, 0x28] -_08149BEA: - lsls r0, r5, 16 - lsls r1, r3, 16 - cmp r0, r1 - bgt _08149BF4 - lsrs r5, r1, 16 -_08149BF4: - ldr r0, =sTransitionStructPtr - ldr r4, [r0] - movs r0, 0x2A - ldrsh r2, [r4, r0] - lsls r2, 1 - add r2, r9 - lsls r1, r3, 16 - asrs r1, 8 - lsls r0, r5, 16 - asrs r0, 16 - orrs r0, r1 - strh r0, [r2] - cmp r7, 0 - beq _08149C1C - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - b _08149C40 - .pool -_08149C1C: - adds r0, r4, 0 - adds r0, 0x24 - movs r1, 0x1 - movs r2, 0x1 - bl sub_814A228 - lsls r0, 24 - lsrs r7, r0, 24 - mov r1, r8 - lsls r0, r1, 16 - movs r3, 0x80 - lsls r3, 9 - adds r0, r3 - lsrs r4, r0, 16 - mov r8, r4 - asrs r0, 16 - cmp r0, 0xF - ble _08149BA0 -_08149C40: - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149B84 - - thumb_func_start sub_8149C60 -sub_8149C60: @ 8149C60 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0xA] - adds r0, 0x1 - strh r0, [r2, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - ble _08149CAC - ldr r1, =0x040000b0 - ldrh r2, [r1, 0xA] - ldr r0, =0x0000c5ff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r2, [r1, 0xA] - ldr r0, =0x00007fff - ands r0, r2 - strh r0, [r1, 0xA] - ldrh r0, [r1, 0xA] - bl sub_8149F84 - ldr r0, =Phase2Task_Shards - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - b _08149CC4 - .pool -_08149CAC: - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - ldr r1, =sUnknown_085C8E16 - movs r3, 0xA - ldrsh r0, [r2, r3] - subs r0, 0x1 - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2, 0xE] - movs r0, 0x1 -_08149CC4: - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149C60 - - thumb_func_start sub_8149CCC -sub_8149CCC: @ 8149CCC - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0xE] - subs r0, 0x1 - strh r0, [r1, 0xE] - lsls r0, 16 - cmp r0, 0 - beq _08149CE0 - movs r0, 0 - b _08149CE4 -_08149CE0: - movs r0, 0x1 - strh r0, [r1, 0x8] -_08149CE4: - pop {r1} - bx r1 - thumb_func_end sub_8149CCC - - thumb_func_start sub_8149CE8 -sub_8149CE8: @ 8149CE8 - push {r4,lr} - ldr r4, =0x040000b0 - ldrh r1, [r4, 0xA] - ldr r0, =0x0000c5ff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r1, [r4, 0xA] - ldr r0, =0x00007fff - ands r0, r1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0xA] - bl VBlankCB_BattleTransition - ldr r3, =sTransitionStructPtr - ldr r0, [r3] - ldrb r0, [r0] - cmp r0, 0 - beq _08149D20 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_08149D20: - ldr r2, =0x04000048 - ldr r1, [r3] - ldrh r0, [r1, 0x2] - strh r0, [r2] - adds r2, 0x2 - ldrh r0, [r1, 0x4] - strh r0, [r2] - subs r2, 0x6 - ldrh r0, [r1, 0x8] - strh r0, [r2] - subs r2, 0x4 - ldr r0, =gUnknown_02038C28 - movs r1, 0xF0 - lsls r1, 3 - adds r0, r1 - ldrh r1, [r0] - strh r1, [r2] - str r0, [r4] - str r2, [r4, 0x4] - ldr r0, =0xa2400001 - str r0, [r4, 0x8] - ldr r0, [r4, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149CE8 - - thumb_func_start CreatePhase1Task -CreatePhase1Task: @ 8149D78 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - mov r8, r0 - adds r4, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r3, [sp, 0x18] - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - lsls r3, 16 - lsrs r3, 16 - ldr r0, =sub_8149DFC - movs r1, 0x3 - str r3, [sp] - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - mov r0, r8 - strh r0, [r1, 0xA] - strh r4, [r1, 0xC] - strh r5, [r1, 0xE] - strh r6, [r1, 0x10] - ldr r3, [sp] - strh r3, [r1, 0x12] - strh r0, [r1, 0x14] - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end CreatePhase1Task - - thumb_func_start IsPhase1Done -IsPhase1Done: @ 8149DDC - push {lr} - ldr r0, =sub_8149DFC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _08149DF4 - movs r0, 0 - b _08149DF6 - .pool -_08149DF4: - movs r0, 0x1 -_08149DF6: - pop {r1} - bx r1 - thumb_func_end IsPhase1Done - - thumb_func_start sub_8149DFC -sub_8149DFC: @ 8149DFC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =sPhase1_TransitionAll_Funcs - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_08149E0E: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _08149E0E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149DFC - - thumb_func_start sub_8149E34 -sub_8149E34: @ 8149E34 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x14] - movs r2, 0x14 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _08149E4C - subs r0, r1, 0x1 - strh r0, [r4, 0x14] - lsls r0, 16 - cmp r0, 0 - bne _08149E70 -_08149E4C: - ldrh r0, [r4, 0xA] - strh r0, [r4, 0x14] - ldrh r0, [r4, 0x10] - ldrh r1, [r4, 0x16] - adds r0, r1 - strh r0, [r4, 0x16] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x10 - ble _08149E64 - movs r0, 0x10 - strh r0, [r4, 0x16] -_08149E64: - movs r0, 0x1 - negs r0, r0 - ldrb r1, [r4, 0x16] - ldr r2, =0x00002d6b - bl BlendPalettes -_08149E70: - movs r2, 0x16 - ldrsh r0, [r4, r2] - cmp r0, 0xF - ble _08149E82 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - ldrh r0, [r4, 0xC] - strh r0, [r4, 0x14] -_08149E82: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8149E34 - - thumb_func_start sub_8149E90 -sub_8149E90: @ 8149E90 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x14] - movs r2, 0x14 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _08149EA8 - subs r0, r1, 0x1 - strh r0, [r4, 0x14] - lsls r0, 16 - cmp r0, 0 - bne _08149ECA -_08149EA8: - ldrh r0, [r4, 0xC] - strh r0, [r4, 0x14] - ldrh r0, [r4, 0x16] - ldrh r1, [r4, 0x12] - subs r0, r1 - strh r0, [r4, 0x16] - lsls r0, 16 - cmp r0, 0 - bge _08149EBE - movs r0, 0 - strh r0, [r4, 0x16] -_08149EBE: - movs r0, 0x1 - negs r0, r0 - ldrb r1, [r4, 0x16] - ldr r2, =0x00002d6b - bl BlendPalettes -_08149ECA: - movs r0, 0x16 - ldrsh r1, [r4, r0] - cmp r1, 0 - bne _08149EFE - ldrh r0, [r4, 0xE] - subs r0, 0x1 - strh r0, [r4, 0xE] - lsls r0, 16 - cmp r0, 0 - bne _08149EF8 - ldr r0, =sub_8149DFC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - b _08149EFE - .pool -_08149EF8: - ldrh r0, [r4, 0xA] - strh r0, [r4, 0x14] - strh r1, [r4, 0x8] -_08149EFE: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8149E90 - - thumb_func_start sub_8149F08 -sub_8149F08: @ 8149F08 - push {r4,lr} - ldr r4, =sTransitionStructPtr - ldr r0, [r4] - movs r1, 0 - movs r2, 0x3C - bl memset - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x14 - adds r1, 0x16 - bl sub_8089C08 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149F08 - - thumb_func_start VBlankCB_BattleTransition -VBlankCB_BattleTransition: @ 8149F2C - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end VBlankCB_BattleTransition - - thumb_func_start sub_8149F40 -sub_8149F40: @ 8149F40 - ldr r1, =0x04000008 - ldrh r1, [r1] - lsrs r1, 2 - lsls r1, 30 - lsrs r1, 16 - movs r2, 0xC0 - lsls r2, 19 - adds r1, r2 - str r1, [r0] - bx lr - .pool - thumb_func_end sub_8149F40 - - thumb_func_start sub_8149F58 -sub_8149F58: @ 8149F58 - push {r4,lr} - ldr r3, =0x04000008 - ldrh r2, [r3] - lsrs r2, 8 - ldrh r3, [r3] - lsrs r3, 2 - lsls r2, 27 - lsrs r2, 16 - lsls r3, 30 - lsrs r3, 16 - movs r4, 0xC0 - lsls r4, 19 - adds r2, r4 - str r2, [r0] - adds r3, r4 - str r3, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149F58 - - thumb_func_start sub_8149F84 -sub_8149F84: @ 8149F84 - push {lr} - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - pop {r0} - bx r0 - thumb_func_end sub_8149F84 - - thumb_func_start sub_8149F98 -sub_8149F98: @ 8149F98 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r10, r0 - ldr r0, [sp, 0x20] - ldr r4, [sp, 0x24] - lsls r1, 16 - lsrs r7, r1, 16 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r1, r0, 16 - lsls r4, 16 - movs r6, 0 - lsrs r5, r4, 16 - cmp r4, 0 - ble _0814A000 - lsls r0, r7, 16 - asrs r0, 16 - mov r9, r0 - lsls r1, 16 - mov r8, r1 - lsls r0, r3, 16 - asrs r7, r0, 16 -_08149FD0: - lsls r4, r2, 16 - asrs r4, 16 - movs r0, 0xFF - ands r0, r4 - mov r2, r8 - asrs r1, r2, 16 - bl Sin - lsls r1, r6, 1 - add r1, r10 - add r0, r9 - strh r0, [r1] - lsls r1, r5, 16 - ldr r0, =0xffff0000 - adds r1, r0 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r4, r7 - lsls r4, 16 - lsrs r2, r4, 16 - lsrs r5, r1, 16 - cmp r1, 0 - bgt _08149FD0 -_0814A000: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8149F98 - - thumb_func_start sub_814A014 -sub_814A014: @ 814A014 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - mov r9, r0 - adds r5, r2, 0 - adds r4, r3, 0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - lsls r5, 16 - lsrs r5, 16 - lsls r4, 16 - lsrs r4, 16 - movs r2, 0xA0 - lsls r2, 1 - movs r1, 0xA - bl memset - movs r1, 0 - lsls r4, 16 - asrs r4, 16 - str r4, [sp, 0x4] - lsls r5, 16 - asrs r5, 16 - str r5, [sp, 0x8] -_0814A04C: - lsls r5, r1, 16 - asrs r0, r5, 16 - mov r10, r0 - ldr r1, [sp, 0x4] - bl Sin - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, r10 - ldr r1, [sp, 0x4] - bl Cos - ldr r2, [sp] - lsls r1, r2, 16 - asrs r1, 16 - lsls r4, 16 - asrs r4, 16 - subs r2, r1, r4 - lsls r2, 16 - adds r1, r4 - lsls r1, 16 - lsrs r6, r1, 16 - lsls r0, 16 - asrs r0, 16 - ldr r3, [sp, 0x8] - subs r1, r3, r0 - lsls r1, 16 - lsrs r7, r1, 16 - adds r0, r3, r0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsrs r1, r2, 16 - str r5, [sp, 0x10] - cmp r2, 0 - bge _0814A098 - movs r1, 0 -_0814A098: - lsls r0, r6, 16 - asrs r0, 16 - cmp r0, 0xF0 - ble _0814A0A2 - movs r6, 0xF0 -_0814A0A2: - lsls r0, r7, 16 - cmp r0, 0 - bge _0814A0AA - movs r7, 0 -_0814A0AA: - mov r2, r8 - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x9F - ble _0814A0B8 - movs r3, 0x9F - mov r8, r3 -_0814A0B8: - lsls r0, r1, 24 - lsrs r0, 16 - orrs r6, r0 - lsls r0, r7, 16 - asrs r0, 16 - str r0, [sp, 0xC] - lsls r0, 1 - add r0, r9 - strh r6, [r0] - mov r0, r8 - lsls r4, r0, 16 - asrs r0, r4, 15 - add r0, r9 - strh r6, [r0] - mov r0, r10 - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - ldr r1, [sp, 0x4] - bl Cos - lsls r0, 16 - asrs r0, 16 - ldr r2, [sp, 0x8] - subs r1, r2, r0 - lsls r1, 16 - adds r0, r2, r0 - lsls r0, 16 - lsrs r2, r0, 16 - lsrs r3, r1, 16 - cmp r1, 0 - bge _0814A0FA - movs r3, 0 -_0814A0FA: - lsls r0, r2, 16 - asrs r0, 16 - cmp r0, 0x9F - ble _0814A104 - movs r2, 0x9F -_0814A104: - lsls r0, r3, 16 - asrs r1, r0, 16 - adds r3, r0, 0 - lsls r5, r2, 16 - ldr r0, [sp, 0xC] - cmp r0, r1 - ble _0814A128 - adds r2, r1, 0 -_0814A114: - lsls r1, r7, 16 - ldr r0, =0xffff0000 - adds r1, r0 - asrs r0, r1, 15 - add r0, r9 - strh r6, [r0] - lsrs r7, r1, 16 - asrs r1, 16 - cmp r1, r2 - bgt _0814A114 -_0814A128: - lsls r1, r7, 16 - asrs r0, r3, 16 - cmp r1, r3 - bge _0814A146 - adds r2, r0, 0 -_0814A132: - movs r3, 0x80 - lsls r3, 9 - adds r0, r1, r3 - asrs r1, r0, 15 - add r1, r9 - strh r6, [r1] - adds r1, r0, 0 - asrs r0, r1, 16 - cmp r0, r2 - blt _0814A132 -_0814A146: - asrs r0, r5, 16 - cmp r4, r5 - ble _0814A164 - adds r1, r0, 0 -_0814A14E: - ldr r2, =0xffff0000 - adds r0, r4, r2 - lsrs r3, r0, 16 - mov r8, r3 - asrs r0, 15 - add r0, r9 - strh r6, [r0] - lsls r4, r3, 16 - asrs r0, r4, 16 - cmp r0, r1 - bgt _0814A14E -_0814A164: - mov r0, r8 - lsls r4, r0, 16 - asrs r0, r5, 16 - cmp r4, r5 - bge _0814A184 - adds r2, r0, 0 -_0814A170: - movs r1, 0x80 - lsls r1, 9 - adds r0, r4, r1 - asrs r1, r0, 15 - add r1, r9 - strh r6, [r1] - adds r4, r0, 0 - asrs r0, r4, 16 - cmp r0, r2 - blt _0814A170 -_0814A184: - ldr r2, [sp, 0x10] - movs r3, 0x80 - lsls r3, 9 - adds r0, r2, r3 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, 0x3F - bgt _0814A196 - b _0814A04C -_0814A196: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814A014 - - thumb_func_start sub_814A1AC -sub_814A1AC: @ 814A1AC - push {r4-r7,lr} - adds r6, r0, 0 - ldr r0, [sp, 0x14] - ldr r5, [sp, 0x18] - ldr r4, [sp, 0x1C] - lsls r1, 16 - lsrs r1, 16 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r0, 16 - adds r7, r0, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r4, 16 - lsrs r4, 16 - strh r1, [r6] - strh r2, [r6, 0x2] - strh r1, [r6, 0x4] - strh r2, [r6, 0x6] - strh r3, [r6, 0x8] - strh r7, [r6, 0xA] - strh r5, [r6, 0xC] - strh r4, [r6, 0xE] - lsls r3, 16 - asrs r3, 16 - lsls r1, 16 - asrs r1, 16 - subs r3, r1 - strh r3, [r6, 0x10] - lsls r0, r3, 16 - cmp r0, 0 - bge _0814A1FE - negs r0, r3 - strh r0, [r6, 0x10] - lsls r0, r5, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r6, 0xC] -_0814A1FE: - lsls r0, r7, 16 - asrs r0, 16 - lsls r1, r2, 16 - asrs r1, 16 - subs r1, r0, r1 - strh r1, [r6, 0x12] - lsls r0, r1, 16 - cmp r0, 0 - bge _0814A21C - negs r0, r1 - strh r0, [r6, 0x12] - lsls r0, r4, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r6, 0xE] -_0814A21C: - movs r0, 0 - strh r0, [r6, 0x14] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_814A1AC - - thumb_func_start sub_814A228 -sub_814A228: @ 814A228 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r3, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - lsls r2, 24 - lsrs r2, 24 - mov r10, r2 - ldrh r0, [r3, 0x10] - mov r8, r0 - movs r1, 0x10 - ldrsh r6, [r3, r1] - ldrh r2, [r3, 0x12] - mov r12, r2 - movs r4, 0x12 - ldrsh r5, [r3, r4] - cmp r6, r5 - ble _0814A278 - ldrh r0, [r3, 0xC] - ldrh r2, [r3, 0x4] - adds r1, r0, r2 - strh r1, [r3, 0x4] - ldrh r2, [r3, 0x14] - add r2, r12 - strh r2, [r3, 0x14] - lsls r1, r2, 16 - asrs r1, 16 - adds r4, r0, 0 - ldrh r7, [r3, 0xE] - cmp r1, r6 - ble _0814A29E - ldrh r1, [r3, 0x6] - adds r0, r7, r1 - strh r0, [r3, 0x6] - mov r1, r8 - b _0814A29A -_0814A278: - ldrh r0, [r3, 0xE] - ldrh r2, [r3, 0x6] - adds r1, r0, r2 - strh r1, [r3, 0x6] - ldrh r2, [r3, 0x14] - add r2, r8 - strh r2, [r3, 0x14] - lsls r1, r2, 16 - asrs r1, 16 - ldrh r4, [r3, 0xC] - adds r7, r0, 0 - cmp r1, r5 - ble _0814A29E - ldrh r1, [r3, 0x4] - adds r0, r4, r1 - strh r0, [r3, 0x4] - mov r1, r12 -_0814A29A: - subs r0, r2, r1 - strh r0, [r3, 0x14] -_0814A29E: - movs r5, 0 - lsls r0, r4, 16 - asrs r2, r0, 16 - cmp r2, 0 - ble _0814A2B6 - movs r4, 0x4 - ldrsh r1, [r3, r4] - movs r4, 0x8 - ldrsh r0, [r3, r4] - ldrh r4, [r3, 0x8] - cmp r1, r0 - bge _0814A2C8 -_0814A2B6: - cmp r2, 0 - bge _0814A2D6 - movs r0, 0x4 - ldrsh r1, [r3, r0] - movs r2, 0x8 - ldrsh r0, [r3, r2] - ldrh r4, [r3, 0x8] - cmp r1, r0 - bgt _0814A2D6 -_0814A2C8: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r9 - cmp r0, 0 - beq _0814A2D6 - strh r4, [r3, 0x4] -_0814A2D6: - lsls r0, r7, 16 - asrs r2, r0, 16 - cmp r2, 0 - ble _0814A2EC - movs r4, 0x6 - ldrsh r1, [r3, r4] - movs r4, 0xA - ldrsh r0, [r3, r4] - ldrh r4, [r3, 0xA] - cmp r1, r0 - bge _0814A2FE -_0814A2EC: - cmp r2, 0 - bge _0814A30C - movs r0, 0x6 - ldrsh r1, [r3, r0] - movs r2, 0xA - ldrsh r0, [r3, r2] - ldrh r4, [r3, 0xA] - cmp r1, r0 - bgt _0814A30C -_0814A2FE: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r10 - cmp r0, 0 - beq _0814A30C - strh r4, [r3, 0x6] -_0814A30C: - cmp r5, 0x2 - beq _0814A314 - movs r0, 0 - b _0814A316 -_0814A314: - movs r0, 0x1 -_0814A316: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_814A228 - - thumb_func_start sub_814A324 -sub_814A324: @ 814A324 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - bl sub_814669C - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - mov r0, sp - bl CpuSet - ldr r0, =gUnknown_085C7C00 - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =gUnknown_085C7BE0 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814A324 - - thumb_func_start sub_814A374 -sub_814A374: @ 814A374 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r0, =gUnknown_085C828C - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =gUnknown_02038C28 - movs r1, 0x10 - ldrsh r2, [r4, r1] - movs r3, 0x12 - ldrsh r1, [r4, r3] - str r1, [sp] - movs r1, 0xA0 - str r1, [sp, 0x4] - movs r1, 0 - movs r3, 0x84 - bl sub_8149F98 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x1 - add sp, 0x10 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814A374 - - thumb_func_start Phase2Task_29 -Phase2Task_29: @ 814A3BC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C99D0 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814A3CE: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814A3CE - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_29 - - thumb_func_start Phase2Task_30 -Phase2Task_30: @ 814A3F4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C99E8 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814A406: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814A406 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_30 - - thumb_func_start sub_814A42C -sub_814A42C: @ 814A42C - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - bl sub_8149F08 - bl dp12_8087EA4 - movs r1, 0xC0 - lsls r1, 7 - movs r0, 0 - bl ClearGpuRegBits - movs r5, 0 - movs r0, 0x80 - lsls r0, 6 - strh r0, [r4, 0xC] - ldr r0, =0x00007fff - strh r0, [r4, 0xA] - strh r5, [r4, 0x12] - movs r0, 0x10 - strh r0, [r4, 0x14] - movs r0, 0xA0 - lsls r0, 4 - strh r0, [r4, 0x16] - ldr r6, =sTransitionStructPtr - ldr r2, [r6] - ldr r3, =0x00003f41 - strh r3, [r2, 0xE] - ldrh r0, [r4, 0x14] - lsls r0, 8 - ldrh r1, [r4, 0x12] - orrs r0, r1 - strh r0, [r2, 0x10] - ldr r0, =0x04000050 - strh r3, [r0] - ldr r1, =0x04000052 - ldrh r0, [r2, 0x10] - strh r0, [r1] - add r0, sp, 0x4 - add r1, sp, 0x8 - bl sub_8149F58 - mov r0, sp - strh r5, [r0] - ldr r1, [sp, 0x4] - ldr r2, =0x01000400 - bl CpuSet - ldr r0, =gUnknown_085C7C00 - ldr r1, [sp, 0x8] - bl LZ77UnCompVram - ldr r0, =gUnknown_085C7BE0 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r0, [r6] - strh r5, [r0, 0x16] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - add sp, 0xC - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814A42C - - thumb_func_start sub_814A4D4 -sub_814A4D4: @ 814A4D4 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - add r1, sp, 0x4 - mov r0, sp - bl sub_8149F58 - ldr r0, =gUnknown_085C828C - ldr r1, [sp] - bl LZ77UnCompVram - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x1 - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814A4D4 - - thumb_func_start sub_814A500 -sub_814A500: @ 814A500 - push {r4-r6,lr} - adds r5, r0, 0 - movs r2, 0 - ldr r6, =sub_814A684 - ldr r4, =gUnknown_020393A8 - ldr r3, =sTransitionStructPtr -_0814A50C: - lsls r1, r2, 1 - adds r1, r4 - ldr r0, [r3] - ldrh r0, [r0, 0x16] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x9F - bls _0814A50C - adds r0, r6, 0 - bl SetVBlankCallback - ldr r0, =sub_814A6CC - bl SetHBlankCallback - movs r0, 0x2 - bl EnableInterrupts - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0x1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814A500 - - thumb_func_start sub_814A550 -sub_814A550: @ 814A550 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r0, 0 - ldr r1, =sTransitionStructPtr - ldr r0, [r1] - ldrb r2, [r0] - movs r3, 0 - strb r3, [r0] - ldrh r2, [r4, 0xC] - lsls r0, r2, 16 - asrs r0, 24 - lsls r0, 16 - lsrs r7, r0, 16 - ldrh r6, [r4, 0xA] - movs r0, 0xC0 - lsls r0, 1 - mov r8, r0 - ldrh r0, [r4, 0x16] - subs r0, r6, r0 - strh r0, [r4, 0xA] - movs r5, 0xE - ldrsh r0, [r4, r5] - adds r5, r1, 0 - cmp r0, 0x45 - ble _0814A5A2 - movs r1, 0xC - ldrsh r0, [r4, r1] - ldr r1, =0xfffffe80 - adds r0, r1 - cmp r0, 0 - blt _0814A5A0 - adds r0, r2, r1 - strh r0, [r4, 0xC] - b _0814A5A2 - .pool -_0814A5A0: - strh r3, [r4, 0xC] -_0814A5A2: - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r0, 0 - blt _0814A5E0 - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _0814A5E0 - ldrh r1, [r4, 0x12] - movs r2, 0x12 - ldrsh r0, [r4, r2] - cmp r0, 0xF - bgt _0814A5C6 - adds r0, r1, 0x1 - strh r0, [r4, 0x12] - b _0814A5D4 -_0814A5C6: - ldrh r1, [r4, 0x14] - movs r2, 0x14 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _0814A5D4 - subs r0, r1, 0x1 - strh r0, [r4, 0x14] -_0814A5D4: - ldr r0, [r5] - ldrh r1, [r4, 0x14] - lsls r1, 8 - ldrh r2, [r4, 0x12] - orrs r1, r2 - strh r1, [r0, 0x10] -_0814A5E0: - movs r5, 0 - lsls r7, 16 -_0814A5E4: - lsrs r0, r6, 8 - asrs r1, r7, 16 - bl Sin - ldr r1, =gUnknown_02038C28 - lsls r2, r5, 1 - adds r2, r1 - ldr r1, =sTransitionStructPtr - ldr r1, [r1] - ldrh r1, [r1, 0x16] - adds r0, r1 - strh r0, [r2] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - mov r1, r8 - adds r0, r6, r1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r5, 0x9F - bls _0814A5E4 - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x65 - bne _0814A632 - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0814A632: - movs r2, 0x10 - ldrsh r0, [r4, r2] - cmp r0, 0 - beq _0814A654 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0814A654 - ldr r0, =Phase2Task_30 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0814A654: - ldrh r0, [r4, 0x16] - subs r0, 0x11 - strh r0, [r4, 0x16] - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - ldrb r2, [r1] - strb r0, [r1] - movs r0, 0 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814A550 - - thumb_func_start sub_814A684 -sub_814A684: @ 814A684 - push {lr} - bl VBlankCB_BattleTransition - ldr r2, =0x04000050 - ldr r0, =sTransitionStructPtr - ldr r1, [r0] - ldrh r0, [r1, 0xE] - strh r0, [r2] - adds r2, 0x2 - ldrh r0, [r1, 0x10] - strh r0, [r2] - ldrb r0, [r1] - cmp r0, 0 - beq _0814A6B4 - ldr r1, =0x040000d4 - ldr r0, =gUnknown_02038C28 - str r0, [r1] - movs r2, 0xF0 - lsls r2, 3 - adds r0, r2 - str r0, [r1, 0x4] - ldr r0, =0x800000a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] -_0814A6B4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_814A684 - - thumb_func_start sub_814A6CC -sub_814A6CC: @ 814A6CC - ldr r1, =gUnknown_02038C28 - ldr r0, =0x04000006 - ldrh r0, [r0] - lsls r0, 1 - movs r2, 0xF0 - lsls r2, 3 - adds r1, r2 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x04000012 - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_814A6CC - - thumb_func_start Phase2Task_31 -Phase2Task_31: @ 814A6F0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C99F8 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814A702: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814A702 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_31 - - thumb_func_start Phase2Task_33 -Phase2Task_33: @ 814A728 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C9A08 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814A73A: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814A73A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_33 - - thumb_func_start Phase2Task_32 -Phase2Task_32: @ 814A760 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_085C9A1C - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0814A772: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0814A772 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Phase2Task_32 - - thumb_func_start sub_814A798 -sub_814A798: @ 814A798 + thumb_func_start Phase2_31_Func1 +Phase2_31_Func1: @ 814A798 push {r4-r6,lr} mov r6, r8 push {r6} @@ -2702,10 +68,10 @@ sub_814A798: @ 814A798 pop {r1} bx r1 .pool - thumb_func_end sub_814A798 + thumb_func_end Phase2_31_Func1 - thumb_func_start sub_814A828 -sub_814A828: @ 814A828 + thumb_func_start Phase2_31_Func2 +Phase2_31_Func2: @ 814A828 push {r4,r5,lr} sub sp, 0x24 adds r4, r0, 0 @@ -2760,10 +126,10 @@ _0814A88A: pop {r1} bx r1 .pool - thumb_func_end sub_814A828 + thumb_func_end Phase2_31_Func2 - thumb_func_start sub_814A898 -sub_814A898: @ 814A898 + thumb_func_start Phase2_31_Func3 +Phase2_31_Func3: @ 814A898 push {r4-r6,lr} sub sp, 0x10 adds r4, r0, 0 @@ -2858,10 +224,10 @@ _0814A956: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_814A898 + thumb_func_end Phase2_31_Func3 - thumb_func_start sub_814A960 -sub_814A960: @ 814A960 + thumb_func_start Phase2_33_Func1 +Phase2_33_Func1: @ 814A960 push {r4-r6,lr} mov r6, r8 push {r6} @@ -2931,10 +297,10 @@ sub_814A960: @ 814A960 pop {r1} bx r1 .pool - thumb_func_end sub_814A960 + thumb_func_end Phase2_33_Func1 - thumb_func_start sub_814AA04 -sub_814AA04: @ 814AA04 + thumb_func_start Phase2_33_Func2 +Phase2_33_Func2: @ 814AA04 push {r4-r6,lr} sub sp, 0x24 adds r6, r0, 0 @@ -2992,10 +358,10 @@ _0814AA70: pop {r1} bx r1 .pool - thumb_func_end sub_814AA04 + thumb_func_end Phase2_33_Func2 - thumb_func_start sub_814AA84 -sub_814AA84: @ 814AA84 + thumb_func_start Phase2_33_Func3 +Phase2_33_Func3: @ 814AA84 push {r4,lr} adds r4, r0, 0 movs r0, 0xE0 @@ -3018,10 +384,10 @@ sub_814AA84: @ 814AA84 pop {r1} bx r1 .pool - thumb_func_end sub_814AA84 + thumb_func_end Phase2_33_Func3 - thumb_func_start sub_814AAB8 -sub_814AAB8: @ 814AAB8 + thumb_func_start Phase2_33_Func4 +Phase2_33_Func4: @ 814AAB8 push {r4-r7,lr} mov r7, r8 push {r7} @@ -3130,10 +496,10 @@ _0814AB86: pop {r1} bx r1 .pool - thumb_func_end sub_814AAB8 + thumb_func_end Phase2_33_Func4 - thumb_func_start sub_814ABA0 -sub_814ABA0: @ 814ABA0 + thumb_func_start Phase2_31_33_Func5 +Phase2_31_33_Func5: @ 814ABA0 push {r4,lr} sub sp, 0x8 adds r4, r0, 0 @@ -3162,7 +528,7 @@ sub_814ABA0: @ 814ABA0 pop {r4} pop {r1} bx r1 - thumb_func_end sub_814ABA0 + thumb_func_end Phase2_31_33_Func5 thumb_func_start sub_814ABE4 sub_814ABE4: @ 814ABE4 @@ -3203,8 +569,8 @@ _0814AC24: .pool thumb_func_end sub_814ABE4 - thumb_func_start sub_814AC38 -sub_814AC38: @ 814AC38 + thumb_func_start Phase2_32_Func1 +Phase2_32_Func1: @ 814AC38 push {r4-r6,lr} sub sp, 0x10 adds r6, r0, 0 @@ -3318,10 +684,10 @@ _0814AD2E: pop {r1} bx r1 .pool - thumb_func_end sub_814AC38 + thumb_func_end Phase2_32_Func1 - thumb_func_start sub_814AD48 -sub_814AD48: @ 814AD48 + thumb_func_start Phase2_32_Func2 +Phase2_32_Func2: @ 814AD48 push {r4,lr} sub sp, 0x24 adds r4, r0, 0 @@ -3371,10 +737,10 @@ _0814ADA0: pop {r1} bx r1 .pool - thumb_func_end sub_814AD48 + thumb_func_end Phase2_32_Func2 - thumb_func_start sub_814ADB4 -sub_814ADB4: @ 814ADB4 + thumb_func_start Phase2_32_Func3 +Phase2_32_Func3: @ 814ADB4 push {r4,lr} adds r4, r0, 0 ldr r0, =0xffff7fff @@ -3391,10 +757,10 @@ sub_814ADB4: @ 814ADB4 pop {r1} bx r1 .pool - thumb_func_end sub_814ADB4 + thumb_func_end Phase2_32_Func3 - thumb_func_start sub_814ADD8 -sub_814ADD8: @ 814ADD8 + thumb_func_start Phase2_32_Func4 +Phase2_32_Func4: @ 814ADD8 push {r4,lr} sub sp, 0xC adds r4, r0, 0 @@ -3441,10 +807,10 @@ _0814AE2E: pop {r1} bx r1 .pool - thumb_func_end sub_814ADD8 + thumb_func_end Phase2_32_Func4 - thumb_func_start sub_814AE40 -sub_814AE40: @ 814AE40 + thumb_func_start Phase2_32_Func5 +Phase2_32_Func5: @ 814AE40 push {r4,r5,lr} sub sp, 0x8 adds r5, r0, 0 @@ -3488,6 +854,6 @@ sub_814AE40: @ 814AE40 pop {r1} bx r1 .pool - thumb_func_end sub_814AE40 + thumb_func_end Phase2_32_Func5 .align 2, 0 @ Don't pad with nop. diff --git a/data/battle_transition.s b/data/battle_transition.s deleted file mode 100644 index 68801b22e..000000000 --- a/data/battle_transition.s +++ /dev/null @@ -1,235 +0,0 @@ - - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -sPhase2_Rayquaza_Funcs:: @ 85C8D60 - .4byte Phase2_WeatherTrio_Func1 - .4byte Phase2_WaitPaletteFade - .4byte sub_81492B4 - .4byte sub_8149358 - .4byte sub_8149388 - .4byte sub_81493D8 - .4byte sub_8149410 - .4byte sub_814943C - .4byte sub_814946C - .4byte Phase2_Blackhole1_Func2 - .4byte Phase2_Blackhole1_Func3 - - .align 2 -gUnknown_085C8D8C:: @ 85C8D8C - .4byte sub_81495B0 - .4byte sub_8149628 - .4byte sub_814969C - .4byte sub_81496D8 - .4byte sub_8149740 - - .align 1 -sUnknown_085C8DA0:: @ 85C8DA0 - .2byte 0x0000, 0x0014, 0x000f, 0x0028, 0x000a, 0x0019, 0x0023, 0x0005 - - .align 2 -sUnknown_085C8DB0:: @ 85C8DB0 - .4byte sub_8149994 - .4byte sub_81499E8 - .4byte sub_8149A40 - - .align 2 -sPhase2_Shards_Funcs:: @ 85C8DBC - .4byte sub_8149AA4 - .4byte sub_8149B08 - .4byte sub_8149B84 - .4byte sub_8149C60 - .4byte sub_8149CCC - - .align 1 -sUnknown_085C8DD0:: @ 85C8DD0 - .2byte 0x0038, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0068, 0x00a0, 0x00f0, 0x0058, 0x0001, 0x00f0, 0x0048, 0x0038, 0x0000, 0x0001, 0x0000 - .2byte 0x0020, 0x0090, 0x00a0, 0x0000, 0x0090, 0x00a0, 0x00b8, 0x0000, 0x0001, 0x0038, 0x0000, 0x00a8, 0x00a0, 0x0000, 0x00a8, 0x00a0 - .2byte 0x0030, 0x0000, 0x0001 - - .align 1 -sUnknown_085C8E16:: @ 85C8E16 - .2byte 0x0008, 0x0004, 0x0002, 0x0001, 0x0001, 0x0001, 0x0000 - - .align 2 -sPhase1_TransitionAll_Funcs:: @ 85C8E24 - .4byte sub_8149E34 - .4byte sub_8149E90 - - .align 2 -sSpriteImageTable_85C8E2C:: @ 85C8E2C - obj_frame_tiles sSpriteImage_85B98F0, 0x0200 - - .align 2 -sSpriteAnim_85C8E34:: @ 85C8E34 - obj_image_anim_frame 0, 1 - obj_image_anim_end - - .align 2 -sSpriteAnimTable_85C8E3C:: @ 85C8E3C - .4byte sSpriteAnim_85C8E34 - - .align 2 -sSpriteAffineAnim_85C8E40:: @ 85C8E40 - obj_rot_scal_anim_frame 0, 0, -4, 1 - obj_rot_scal_anim_jump 0 - - .align 2 -sSpriteAffineAnim_85C8E50:: @ 85C8E50 - obj_rot_scal_anim_frame 0, 0, 4, 1 - obj_rot_scal_anim_jump 0 - - .align 2 -sSpriteAffineAnimTable_85C8E60:: @ 85C8E60 - .4byte sSpriteAffineAnim_85C8E40 - .4byte sSpriteAffineAnim_85C8E50 - - .align 2 -gUnknown_085C8E68:: @ 85C8E68 - spr_template 0xffff, 0x1009, gFieldObjectBaseOam_32x32, sSpriteAnimTable_85C8E3C, sSpriteImageTable_85C8E2C, sSpriteAffineAnimTable_85C8E60, sub_814713C - - .align 2 -gOamData_85C8E80:: @ 85C8E80 - .2byte 0x0000, 0xc000, 0x0000, 0x0000 - - .align 2 -sSpriteImageTable_85C8E88:: @ 85C8E88 - obj_frame_tiles sSpriteImage_85B9CD0, 0x0800 - - .align 2 -sSpriteImageTable_85C8E90:: @ 85C8E90 - obj_frame_tiles sSpriteImage_85BA4D0, 0x0800 - - .align 2 -sSpriteAnim_85C8E98:: @ 85C8E98 - obj_image_anim_frame 0, 1 - obj_image_anim_end - - .align 2 -sSpriteAnimTable_85C8EA0:: @ 85C8EA0 - .4byte sSpriteAnim_85C8E98 - - .align 2 -sSpriteTemplate_85C8EA4:: @ 85C8EA4 - spr_template 0xffff, 0x100a, gOamData_85C8E80, sSpriteAnimTable_85C8EA0, sSpriteImageTable_85C8E88, gDummySpriteAffineAnimTable, sub_8148380 - - .align 2 -sSpriteTemplate_85C8EBC:: @ 85C8EBC - spr_template 0xffff, 0x100a, gOamData_85C8E80, sSpriteAnimTable_85C8EA0, sSpriteImageTable_85C8E90, gDummySpriteAffineAnimTable, sub_8148380 - - .align 2 -gFieldEffectObjectPalette10:: @ 85C8ED4 - .incbin "graphics/map_objects/palettes/field_effect_object_palette_10.gbapal" - - .align 2 -gFieldEffectObjectPaletteInfo10:: @ 85C8EF4 - obj_pal gFieldEffectObjectPalette10, 0x1009 - - .align 2 -sMugshotPal_Sidney:: @ 85C8EFC - .incbin "graphics/battle_transitions/sidney_bg.gbapal" - - .align 2 -sMugshotPal_Phoebe:: @ 85C8F1C - .incbin "graphics/battle_transitions/phoebe_bg.gbapal" - - .align 2 -sMugshotPal_Glacia:: @ 85C8F3C - .incbin "graphics/battle_transitions/glacia_bg.gbapal" - - .align 2 -sMugshotPal_Drake:: @ 85C8F5C - .incbin "graphics/battle_transitions/drake_bg.gbapal" - - .align 2 -sMugshotPal_Wallace:: @ 85C8F7C - .incbin "graphics/battle_transitions/wallace_bg.gbapal" - - .align 2 -sMugshotPal_Brendan:: @ 85C8F9C - .incbin "graphics/battle_transitions/brendan_bg.gbapal" - - .align 2 -sMugshotPal_May:: @ 85C8EFC - .incbin "graphics/battle_transitions/may_bg.gbapal" - - .align 2 -sOpponentMugshotsPals:: @ 85C8FDC - .4byte sMugshotPal_Sidney - .4byte sMugshotPal_Phoebe - .4byte sMugshotPal_Glacia - .4byte sMugshotPal_Drake - .4byte sMugshotPal_Wallace - - .align 2 -sPlayerMugshotsPals:: @ 85C8FF0 - .4byte sMugshotPal_Brendan - .4byte sMugshotPal_May - - .align 2 -sUnusedTrainerPalette:: @ 85C8EF8 - .incbin "graphics/battle_transitions/unused_trainer.gbapal" - - .align 2 -sSpritePalette_UnusedTrainer:: @ 85C8EFC - obj_pal sUnusedTrainerPalette, 0x100A - - .align 2 -sBigPokeball_Tilemap:: @ 85C9020 - .incbin "graphics/battle_transitions/big_pokeball_map.bin" - - .align 2 -sMugshotsTilemap:: @ 85C94D0 - .incbin "graphics/battle_transitions/elite_four_bg_map.bin" - - .align 2 -gUnknown_085C99D0:: @ 85C99D0 - .4byte sub_814A324 - .4byte sub_814A374 - .4byte Phase2_BigPokeball_Func3 - .4byte Phase2_BigPokeball_Func4 - .4byte Phase2_BigPokeball_Func5 - .4byte Phase2_BigPokeball_Func6 - - .align 2 -gUnknown_085C99E8:: @ 85C99E8 - .4byte sub_814A42C - .4byte sub_814A4D4 - .4byte sub_814A500 - .4byte sub_814A550 - - .align 2 -gUnknown_085C99F8:: @ 85C99F8 - .4byte sub_814A798 - .4byte sub_814A828 - .4byte sub_814A898 - .4byte sub_814ABA0 - - .align 2 -gUnknown_085C9A08:: @ 85C9A08 - .4byte sub_814A960 - .4byte sub_814AA04 - .4byte sub_814AA84 - .4byte sub_814AAB8 - .4byte sub_814ABA0 - - .align 2 -gUnknown_085C9A1C:: @ 85C9A1C - .4byte sub_814AC38 - .4byte sub_814AD48 - .4byte sub_814ADB4 - .4byte sub_814ADD8 - .4byte sub_814AE40 - -gUnknown_085C9A30:: @ 85C9A30 - .byte 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x1b, 0x14, 0x0d, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0e, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x13, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f - .byte 0x10, 0x11, 0x12 - -gUnknown_085C9A53:: @ 85C9A53 - .byte 0x00, 0x10, 0x29, 0x16, 0x2c, 0x02, 0x2b, 0x15, 0x2e, 0x1b, 0x09, 0x30, 0x26, 0x05, 0x39, 0x3b, 0x0c, 0x3f, 0x23, 0x1c, 0x0a, 0x35, 0x07, 0x31, 0x27, 0x17, 0x37, 0x01, 0x3e, 0x11, 0x3d, 0x1e - .byte 0x06, 0x22, 0x0f, 0x33, 0x20, 0x3a, 0x0d, 0x2d, 0x25, 0x34, 0x0b, 0x18, 0x3c, 0x13, 0x38, 0x21, 0x1d, 0x32, 0x28, 0x36, 0x0e, 0x03, 0x2f, 0x14, 0x12, 0x19, 0x04, 0x24, 0x1a, 0x2a, 0x1f, 0x08 - .byte 0x00 - diff --git a/include/battle_transition.h b/include/battle_transition.h index bb8505edb..cd4cdd1b3 100644 --- a/include/battle_transition.h +++ b/include/battle_transition.h @@ -6,6 +6,7 @@ void sub_8149DFC(u8 a1); void BattleTransition_StartOnField(u8 transitionID); void BattleTransition_Start(u8 transitionID); bool8 IsBattleTransitionDone(void); +void Phase1_Task_RunFuncs(u8 taskId); enum // TRANSITION_MUGSHOT { @@ -46,7 +47,7 @@ enum // TRANSITION_MUGSHOT #define B_TRANSITION_KYOGRE 22 #define B_TRANSITION_GROUDON 23 #define B_TRANSITION_RAYQUAZA 24 -#define B_TRANSITION_25 25 +#define B_TRANSITION_SHRED_SPLIT 25 #define B_TRANSITION_BLACKHOLE1 26 #define B_TRANSITION_BLACKHOLE2 27 #define B_TRANSITION_RECTANGULAR_SPIRAL 28 diff --git a/include/field_camera.h b/include/field_camera.h index a8559e1c2..4686742d3 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -24,5 +24,6 @@ extern u16 gUnknown_03005DE8; void DrawWholeMapView(void); void CurrentMapDrawMetatileAt(int x, int y); +void sub_8089C08(s16 *a0, s16 *a1); #endif //GUARD_FIELD_CAMERA_H diff --git a/ld_script.txt b/ld_script.txt index 7aeee8c8d..c74413f19 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -448,7 +448,6 @@ SECTIONS { data/pokedex_cry_screen.o(.rodata); src/landmark.o(.rodata); src/battle_transition.o(.rodata); - data/battle_transition.o(.rodata); src/battle_controller_link_partner.o(.rodata); src/battle_message.o(.rodata); data/cable_car.o(.rodata); diff --git a/src/battle_transition.c b/src/battle_transition.c index 04f48b126..def302889 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -7,6 +7,7 @@ #include "palette.h" #include "trig.h" #include "field_effect.h" +#include "field_camera.h" #include "random.h" #include "sprite.h" #include "sound.h" @@ -56,6 +57,8 @@ typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); extern u16 gUnknown_020393A8[]; extern u16 gUnknown_02038C28[][0x3C0]; +extern const struct OamData gFieldObjectBaseOam_32x32; + extern void c2_exit_to_overworld_2_switch(void); extern void sub_80AC3D0(void); extern void dp12_8087EA4(void); @@ -89,7 +92,7 @@ void Phase2Task_Regirock(u8 taskId); void Phase2Task_Kyogre(u8 taskId); void Phase2Task_Groudon(u8 taskId); void Phase2Task_Rayquaza(u8 taskId); -void Phase2Task_25(u8 taskId); +void Phase2Task_ShredSplit(u8 taskId); void Phase2Task_Blackhole1(u8 taskId); void Phase2Task_Blackhole2(u8 taskId); void Phase2Task_RectangularSpiral(u8 taskId); @@ -108,6 +111,8 @@ void VBlankCB1_Phase2_BigPokeball(void); void VBlankCB_Phase2_Clockwise_BlackFade(void); void VBlankCB_Phase2_Ripple(void); void HBlankCB_Phase2_Ripple(void); +void VBlankCB_Phase2_30(void); +void HBlankCB_Phase2_30(void); void VBlankCB_Phase2_Wave(void); void VBlankCB_Phase2_Slice(void); void HBlankCB_Phase2_Slice(void); @@ -115,6 +120,7 @@ void VBlankCB0_Phase2_WhiteFade(void); void VBlankCB1_Phase2_WhiteFade(void); void HBlankCB_Phase2_WhiteFade(void); void VBlankCB_Phase2_Shards(void); +void VBlankCB_Phase2_Rayquaza(void); bool8 Phase2_Blur_Func1(struct Task *task); bool8 Phase2_Blur_Func2(struct Task *task); bool8 Phase2_Blur_Func3(struct Task *task); @@ -178,10 +184,10 @@ bool8 Phase2_Shards_Func2(struct Task *task); bool8 Phase2_Shards_Func3(struct Task *task); bool8 Phase2_Shards_Func4(struct Task *task); bool8 Phase2_Shards_Func5(struct Task *task); -bool8 Phase2_25_Func1(struct Task *task); -bool8 Phase2_25_Func2(struct Task *task); -bool8 Phase2_25_Func3(struct Task *task); -bool8 Phase2_25_Func4(struct Task *task); +bool8 Phase2_ShredSplit_Func1(struct Task *task); +bool8 Phase2_ShredSplit_Func2(struct Task *task); +bool8 Phase2_ShredSplit_Func3(struct Task *task); +bool8 Phase2_ShredSplit_Func4(struct Task *task); bool8 Phase2_Blackhole_Func1(struct Task *task); bool8 Phase2_Blackhole1_Func2(struct Task *task); bool8 Phase2_Blackhole1_Func3(struct Task *task); @@ -189,6 +195,32 @@ bool8 Phase2_Blackhole2_Func2(struct Task *task); bool8 Phase2_RectangularSpiral_Func1(struct Task *task); bool8 Phase2_RectangularSpiral_Func2(struct Task *task); bool8 Phase2_RectangularSpiral_Func3(struct Task *task); +bool8 Phase2_29_Func1(struct Task *task); +bool8 Phase2_29_Func2(struct Task *task); +bool8 Phase2_30_Func1(struct Task *task); +bool8 Phase2_30_Func2(struct Task *task); +bool8 Phase2_30_Func3(struct Task *task); +bool8 Phase2_30_Func4(struct Task *task); +bool8 Phase2_Rayquaza_Func3(struct Task *task); +bool8 Phase2_Rayquaza_Func4(struct Task *task); +bool8 Phase2_Rayquaza_Func5(struct Task *task); +bool8 Phase2_Rayquaza_Func6(struct Task *task); +bool8 Phase2_Rayquaza_Func7(struct Task *task); +bool8 Phase2_Rayquaza_Func8(struct Task *task); +bool8 Phase2_Rayquaza_Func9(struct Task *task); +bool8 Phase2_31_Func1(struct Task *task); +bool8 Phase2_31_Func2(struct Task *task); +bool8 Phase2_31_Func3(struct Task *task); +bool8 Phase2_31_33_Func5(struct Task *task); +bool8 Phase2_33_Func1(struct Task *task); +bool8 Phase2_33_Func2(struct Task *task); +bool8 Phase2_33_Func3(struct Task *task); +bool8 Phase2_33_Func4(struct Task *task); +bool8 Phase2_32_Func1(struct Task *task); +bool8 Phase2_32_Func2(struct Task *task); +bool8 Phase2_32_Func3(struct Task *task); +bool8 Phase2_32_Func4(struct Task *task); +bool8 Phase2_32_Func5(struct Task *task); bool8 Phase2_Mugshot_Func1(struct Task *task); bool8 Phase2_Mugshot_Func2(struct Task *task); bool8 Phase2_Mugshot_Func3(struct Task *task); @@ -214,15 +246,19 @@ void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4); void sub_814A014(u16 *a0, s16 a1, s16 a2, s16 a3); void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize); void sub_8149F58(u16 **a0, u16 **a1); +void sub_8149F40(u16 **a0); void sub_814A1AC(s16 *a0, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6); bool8 sub_814A228(s16 *a0, bool8 a1, bool8 a2); void sub_8148484(s16 spriteId, s16 value); void sub_814849C(s16 spriteId); s16 sub_81484B8(s16 spriteId); +bool8 Phase1_TransitionAll_Func1(struct Task *task); +bool8 Phase1_TransitionAll_Func2(struct Task *task); bool8 IsPhase1Done(void); bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1); void sub_814713C(struct Sprite *sprite); void sub_8148380(struct Sprite *sprite); +void sub_8149864(struct Sprite *sprite); bool8 sub_81483A8(struct Sprite *sprite); bool8 sub_81483AC(struct Sprite *sprite); bool8 sub_81483F8(struct Sprite *sprite); @@ -236,15 +272,15 @@ IWRAM_DATA static u8 sTestingTransitionState; IWRAM_DATA static struct StructRectangularSpiral sRectangularSpiralTransition[4]; // ewram vars -EWRAM_DATA struct TransitionData *sTransitionStructPtr = NULL; +EWRAM_DATA static struct TransitionData *sTransitionStructPtr = NULL; // const rom data const u32 sBigPokeball_Tileset[] = INCBIN_U32("graphics/battle_transitions/big_pokeball.4bpp"); const u32 sPokeballTrail_Tileset[] = INCBIN_U32("graphics/battle_transitions/pokeball_trail.4bpp"); -const u32 sSpriteImage_85B98F0[] = INCBIN_U32("graphics/battle_transitions/pokeball.4bpp"); +const u8 sSpriteImage_85B98F0[] = INCBIN_U8("graphics/battle_transitions/pokeball.4bpp"); const u32 sUnknown_085B9AF0[] = INCBIN_U32("graphics/battle_transitions/elite_four_bg.4bpp"); -const u32 sSpriteImage_85B9CD0[] = INCBIN_U32("graphics/battle_transitions/unused_brendan.4bpp"); -const u32 sSpriteImage_85BA4D0[] = INCBIN_U32("graphics/battle_transitions/unused_lass.4bpp"); +const u8 sSpriteImage_85B9CD0[] = INCBIN_U8("graphics/battle_transitions/unused_brendan.4bpp"); +const u8 sSpriteImage_85BA4D0[] = INCBIN_U8("graphics/battle_transitions/unused_lass.4bpp"); const u32 sShrinkingBoxTileset[] = INCBIN_U32("graphics/battle_transitions/shrinking_box.4bpp"); const u32 sEvilTeam_Palette[] = INCBIN_U32("graphics/battle_transitions/evil_team.gbapal"); const u32 sTeamAqua_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_aqua.4bpp.lz"); @@ -312,7 +348,7 @@ const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = Phase2Task_Kyogre, // 22 Phase2Task_Groudon, // 23 Phase2Task_Rayquaza, // 24 - Phase2Task_25, // 25 + Phase2Task_ShredSplit, // 25 Phase2Task_Blackhole1, // 26 Phase2Task_Blackhole2, // 27 Phase2Task_RectangularSpiral, // 28 @@ -527,12 +563,12 @@ const TransitionStateFunc sPhase2_Slice_Funcs[] = Phase2_Slice_Func3 }; -const TransitionStateFunc sPhase2_25_Funcs[] = +const TransitionStateFunc sPhase2_ShredSplit_Funcs[] = { - Phase2_25_Func1, - Phase2_25_Func2, - Phase2_25_Func3, - Phase2_25_Func4 + Phase2_ShredSplit_Func1, + Phase2_ShredSplit_Func2, + Phase2_ShredSplit_Func3, + Phase2_ShredSplit_Func4 }; const u8 gUnknown_085C8C64[] = {39, 119}; @@ -619,12 +655,257 @@ const TransitionStateFunc sPhase2_Groudon_Funcs[] = Phase2_WeatherDuo_Func7 }; -extern const u16 gFieldEffectObjectPalette10[]; -extern const u16 sBigPokeball_Tilemap[]; -extern const u16 sMugshotsTilemap[]; -extern const struct SpriteTemplate gUnknown_085C8E68; -extern const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT]; -extern const u16 *const sPlayerMugshotsPals[2]; +const TransitionStateFunc sPhase2_Rayquaza_Funcs[] = +{ + Phase2_WeatherTrio_Func1, + Phase2_WaitPaletteFade, + Phase2_Rayquaza_Func3, + Phase2_Rayquaza_Func4, + Phase2_Rayquaza_Func5, + Phase2_Rayquaza_Func6, + Phase2_Rayquaza_Func7, + Phase2_Rayquaza_Func8, + Phase2_Rayquaza_Func9, + Phase2_Blackhole1_Func2, + Phase2_Blackhole1_Func3 +}; + +const TransitionStateFunc sPhase2_WhiteFade_Funcs[] = +{ + Phase2_WhiteFade_Func1, + Phase2_WhiteFade_Func2, + Phase2_WhiteFade_Func3, + Phase2_WhiteFade_Func4, + Phase2_WhiteFade_Func5 +}; + +const s16 sUnknown_085C8DA0[] = {0, 20, 15, 40, 10, 25, 35, 5}; + +const TransitionStateFunc sPhase2_GridSquares_Funcs[] = +{ + Phase2_GridSquares_Func1, + Phase2_GridSquares_Func2, + Phase2_GridSquares_Func3 +}; + +const TransitionStateFunc sPhase2_Shards_Funcs[] = +{ + Phase2_Shards_Func1, + Phase2_Shards_Func2, + Phase2_Shards_Func3, + Phase2_Shards_Func4, + Phase2_Shards_Func5 +}; + +const s16 sUnknown_085C8DD0[][5] = +{ + {56, 0, 0, 160, 0}, + {104, 160, 240, 88, 1}, + {240, 72, 56, 0, 1}, + {0, 32, 144, 160, 0}, + {144, 160, 184, 0, 1}, + {56, 0, 168, 160, 0}, + {168, 160, 48, 0, 1}, +}; + +const s16 sUnknown_085C8E16[] = {8, 4, 2, 1, 1, 1, 0}; + +const TransitionStateFunc sPhase1_TransitionAll_Funcs[] = +{ + Phase1_TransitionAll_Func1, + Phase1_TransitionAll_Func2 +}; + +const struct SpriteFrameImage sSpriteImageTable_85C8E2C[] = +{ + sSpriteImage_85B98F0, 0x200 +}; + +const union AnimCmd sSpriteAnim_85C8E34[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END +}; + +const union AnimCmd *const sSpriteAnimTable_85C8E3C[] = +{ + sSpriteAnim_85C8E34 +}; + +const union AffineAnimCmd sSpriteAffineAnim_85C8E40[] = +{ + AFFINEANIMCMD_FRAME(0, 0, -4, 1), + AFFINEANIMCMD_JUMP(0) +}; + +const union AffineAnimCmd sSpriteAffineAnim_85C8E50[] = +{ + AFFINEANIMCMD_FRAME(0, 0, 4, 1), + AFFINEANIMCMD_JUMP(0) +}; + +const union AffineAnimCmd *const sSpriteAffineAnimTable_85C8E60[] = +{ + sSpriteAffineAnim_85C8E40, + sSpriteAffineAnim_85C8E50 +}; + +const struct SpriteTemplate gUnknown_085C8E68 = +{ + .tileTag = 0xFFFF, + .paletteTag = 4105, + .oam = &gFieldObjectBaseOam_32x32, + .anims = sSpriteAnimTable_85C8E3C, + .images = sSpriteImageTable_85C8E2C, + .affineAnims = sSpriteAffineAnimTable_85C8E60, + .callback = sub_814713C +}; + +const struct OamData gOamData_85C8E80 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct SpriteFrameImage sSpriteImageTable_85C8E88[] = +{ + sSpriteImage_85B9CD0, 0x800 +}; + +const struct SpriteFrameImage sSpriteImageTable_85C8E90[] = +{ + sSpriteImage_85BA4D0, 0x800 +}; + +const union AnimCmd sSpriteAnim_85C8E98[] = +{ + ANIMCMD_FRAME(0, 1), + ANIMCMD_END +}; + +const union AnimCmd *const sSpriteAnimTable_85C8EA0[] = +{ + sSpriteAnim_85C8E98 +}; + +const struct SpriteTemplate sSpriteTemplate_85C8EA4 = +{ + .tileTag = 0xFFFF, + .paletteTag = 4106, + .oam = &gOamData_85C8E80, + .anims = sSpriteAnimTable_85C8EA0, + .images = sSpriteImageTable_85C8E88, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8148380 +}; + +const struct SpriteTemplate sSpriteTemplate_85C8EBC = +{ + .tileTag = 0xFFFF, + .paletteTag = 4106, + .oam = &gOamData_85C8E80, + .anims = sSpriteAnimTable_85C8EA0, + .images = sSpriteImageTable_85C8E90, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8148380 +}; + +const u16 gFieldEffectObjectPalette10[] = INCBIN_U16("graphics/map_objects/palettes/field_effect_object_palette_10.gbapal"); + +const struct SpritePalette gFieldEffectObjectPaletteInfo10 = +{ + gFieldEffectObjectPalette10, 0x1009 +}; + +const u16 sMugshotPal_Sydney[] = INCBIN_U16("graphics/battle_transitions/sidney_bg.gbapal"); +const u16 sMugshotPal_Phoebe[] = INCBIN_U16("graphics/battle_transitions/phoebe_bg.gbapal"); +const u16 sMugshotPal_Glacia[] = INCBIN_U16("graphics/battle_transitions/glacia_bg.gbapal"); +const u16 sMugshotPal_Drake[] = INCBIN_U16("graphics/battle_transitions/drake_bg.gbapal"); +const u16 sMugshotPal_Champion[] = INCBIN_U16("graphics/battle_transitions/wallace_bg.gbapal"); +const u16 sMugshotPal_Brendan[] = INCBIN_U16("graphics/battle_transitions/brendan_bg.gbapal"); +const u16 sMugshotPal_May[] = INCBIN_U16("graphics/battle_transitions/may_bg.gbapal"); + +const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT] = +{ + sMugshotPal_Sydney, + sMugshotPal_Phoebe, + sMugshotPal_Glacia, + sMugshotPal_Drake, + sMugshotPal_Champion +}; + +const u16 *const sPlayerMugshotsPals[2] = +{ + sMugshotPal_Brendan, + sMugshotPal_May +}; + +const u16 sUnusedTrainerPalette[] = INCBIN_U16("graphics/battle_transitions/unused_trainer.gbapal"); +const struct SpritePalette sSpritePalette_UnusedTrainer = +{ + sUnusedTrainerPalette, 0x100A +}; + +const u16 sBigPokeball_Tilemap[] = INCBIN_U16("graphics/battle_transitions/big_pokeball_map.bin"); +const u16 sMugshotsTilemap[] = INCBIN_U16("graphics/battle_transitions/elite_four_bg_map.bin"); + +const TransitionStateFunc sPhase2_29_Funcs[] = +{ + Phase2_29_Func1, + Phase2_29_Func2, + Phase2_BigPokeball_Func3, + Phase2_BigPokeball_Func4, + Phase2_BigPokeball_Func5, + Phase2_BigPokeball_Func6 +}; + +const TransitionStateFunc sPhase2_30_Funcs[] = +{ + Phase2_30_Func1, + Phase2_30_Func2, + Phase2_30_Func3, + Phase2_30_Func4 +}; + +const TransitionStateFunc sPhase2_31_Funcs[] = +{ + Phase2_31_Func1, + Phase2_31_Func2, + Phase2_31_Func3, + Phase2_31_33_Func5 +}; + +const TransitionStateFunc sPhase2_33_Funcs[] = +{ + Phase2_33_Func1, + Phase2_33_Func2, + Phase2_33_Func3, + Phase2_33_Func4, + Phase2_31_33_Func5 +}; + +const TransitionStateFunc sPhase2_32_Funcs[] = +{ + Phase2_32_Func1, + Phase2_32_Func2, + Phase2_32_Func3, + Phase2_32_Func4, + Phase2_32_Func5 +}; + +const u8 gUnknown_085C9A30[] = {0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x1b, 0x14, 0x0d, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0e, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x13, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x10, 0x11, 0x12}; +const u8 gUnknown_085C9A53[] = {0x00, 0x10, 0x29, 0x16, 0x2c, 0x02, 0x2b, 0x15, 0x2e, 0x1b, 0x09, 0x30, 0x26, 0x05, 0x39, 0x3b, 0x0c, 0x3f, 0x23, 0x1c, 0x0a, 0x35, 0x07, 0x31, 0x27, 0x17, 0x37, 0x01, 0x3e, 0x11, 0x3d, 0x1e, 0x06, 0x22, 0x0f, 0x33, 0x20, 0x3a, 0x0d, 0x2d, 0x25, 0x34, 0x0b, 0x18, 0x3c, 0x13, 0x38, 0x21, 0x1d, 0x32, 0x28, 0x36, 0x0e, 0x03, 0x2f, 0x14, 0x12, 0x19, 0x04, 0x24, 0x1a, 0x2a, 0x1f, 0x08, 0x00}; // code static void CB2_TestBattleTransition(void) @@ -667,9 +948,11 @@ void BattleTransition_Start(u8 transitionId) LaunchBattleTransitionTask(transitionId); } -// main task that launches sub-tasks for phase1 and phase2 +// in all tasks data[0] is reserved for the state #define tState data[0] -#define tTransitionID data[1] + +// main task that launches sub-tasks for phase1 and phase2 +#define tTransitionId data[1] #define tTransitionDone data[15] bool8 IsBattleTransitionDone(void) @@ -690,7 +973,7 @@ bool8 IsBattleTransitionDone(void) void LaunchBattleTransitionTask(u8 transitionId) { u8 taskId = CreateTask(Task_BattleTransitionMain, 2); - gTasks[taskId].tTransitionID = transitionId; + gTasks[taskId].tTransitionId = transitionId; sTransitionStructPtr = AllocZeroed(sizeof(*sTransitionStructPtr)); } @@ -703,9 +986,9 @@ bool8 Transition_Phase1(struct Task *task) { sub_80AC3D0(); CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); - if (sPhase1_Tasks[task->tTransitionID] != NULL) + if (sPhase1_Tasks[task->tTransitionId] != NULL) { - CreateTask(sPhase1_Tasks[task->tTransitionID], 4); + CreateTask(sPhase1_Tasks[task->tTransitionId], 4); task->tState++; return FALSE; } @@ -718,7 +1001,7 @@ bool8 Transition_Phase1(struct Task *task) bool8 Transition_WaitForPhase1(struct Task *task) { - if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionID]) == 0xFF) + if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionId]) == 0xFF) { task->tState++; return TRUE; @@ -731,7 +1014,7 @@ bool8 Transition_WaitForPhase1(struct Task *task) bool8 Transition_Phase2(struct Task *task) { - CreateTask(sPhase2_Tasks[task->tTransitionID], 0); + CreateTask(sPhase2_Tasks[task->tTransitionId], 0); task->tState++; return FALSE; } @@ -739,18 +1022,14 @@ bool8 Transition_Phase2(struct Task *task) bool8 Transition_WaitForPhase2(struct Task *task) { task->tTransitionDone = FALSE; - if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionID]) == 0xFF) + if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionId]) == 0xFF) task->tTransitionDone = TRUE; return FALSE; } -#undef tState -#undef tTransitionID +#undef tTransitionId #undef tTransitionDone -// sub-task for phase1 -#define tState data[0] - void Phase1Task_TransitionAll(u8 taskId) { if (gTasks[taskId].tState == 0) @@ -764,10 +1043,14 @@ void Phase1Task_TransitionAll(u8 taskId) } } -#undef tState - // sub-task for phase2 -#define tState data[0] +#define tData1 data[1] +#define tData2 data[2] +#define tData3 data[3] +#define tData4 data[4] +#define tData5 data[5] +#define tData6 data[6] +#define tFuncState data[7] #define tFrames data[8] #define tOpponentSpriteId data[13] #define tPlayerSpriteId data[14] @@ -790,17 +1073,17 @@ bool8 Phase2_Blur_Func1(struct Task *task) bool8 Phase2_Blur_Func2(struct Task *task) { - if (task->data[1] != 0) + if (task->tData1 != 0) { - task->data[1]--; + task->tData1--; } else { - task->data[1] = 4; - if (++task->data[2] == 10) + task->tData1 = 4; + if (++task->tData2 == 10) BeginNormalPaletteFade(-1, -1, 0, 0x10, 0); - SetGpuReg(REG_OFFSET_MOSAIC, (task->data[2] & 15) * 17); - if (task->data[2] > 14) + SetGpuReg(REG_OFFSET_MOSAIC, (task->tData2 & 15) * 17); + if (task->tData2 > 14) task->tState++; } return FALSE; @@ -840,10 +1123,10 @@ bool8 Phase2_Swirl_Func1(struct Task *task) bool8 Phase2_Swirl_Func2(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - task->data[1] += 4; - task->data[2] += 8; + task->tData1 += 4; + task->tData2 += 8; - sub_8149F98(gUnknown_02038C28[0], sTransitionStructPtr->field_14, task->data[1], 2, task->data[2], 160); + sub_8149F98(gUnknown_02038C28[0], sTransitionStructPtr->field_14, task->tData1, 2, task->tData2, 160); if (!gPaletteFade.active) { @@ -898,10 +1181,10 @@ bool8 Phase2_Shuffle_Func2(struct Task *task) u16 r3, r4; sTransitionStructPtr->VBlank_DMA = FALSE; - r4 = task->data[1]; - r3 = task->data[2] >> 8; - task->data[1] += 4224; - task->data[2] += 384; + r4 = task->tData1; + r3 = task->tData2 >> 8; + task->tData1 += 4224; + task->tData2 += 384; for (i = 0; i < 160; i++, r4 += 4224) { @@ -973,16 +1256,16 @@ void sub_814669C(struct Task *task) sub_8149F08(); dp12_8087EA4(); - task->data[1] = 16; - task->data[2] = 0; - task->data[4] = 0; - task->data[5] = 0x4000; + task->tData1 = 16; + task->tData2 = 0; + task->tData4 = 0; + task->tData5 = 0x4000; sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; sTransitionStructPtr->field_6 = 240; sTransitionStructPtr->WIN0V = 160; sTransitionStructPtr->BLDCNT = 0x3F41; - sTransitionStructPtr->BLDALPHA = (task->data[1] << 8) | (task->data[2]); + sTransitionStructPtr->BLDALPHA = (task->tData1 << 8) | (task->tData2); for (i = 0; i < 160; i++) { @@ -1065,7 +1348,7 @@ bool8 Phase2_BigPokeball_Func2(struct Task *task) dst1[i * 32 + j] = *BigPokeballMap | 0xF000; } } - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return TRUE; @@ -1077,7 +1360,7 @@ bool8 Phase2_Aqua_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(sTeamAqua_Tilemap, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1089,7 +1372,7 @@ bool8 Phase2_Magma_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LZ77UnCompVram(sTeamMagma_Tilemap, dst1); - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1102,7 +1385,7 @@ bool8 Phase2_Regice_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2B4, 0xF0, 0x20); CpuCopy16(gUnknown_085BC314, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1115,7 +1398,7 @@ bool8 Phase2_Registeel_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2D4, 0xF0, 0x20); CpuCopy16(gUnknown_085BCB14, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1128,7 +1411,7 @@ bool8 Phase2_Regirock_Func2(struct Task *task) sub_8149F58(&dst1, &dst2); LoadPalette(gUnknown_085BC2F4, 0xF0, 0x20); CpuCopy16(gUnknown_085BD314, dst1, 0x500); - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5], 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5, 160); task->tState++; return FALSE; @@ -1149,16 +1432,16 @@ bool8 Phase2_Kyogre_Func3(struct Task *task) bool8 Phase2_Kyogre_Func4(struct Task *task) { - if (task->data[1] % 3 == 0) + if (task->tData1 % 3 == 0) { - u16 var = task->data[1] % 30; + u16 var = task->tData1 % 30; var /= 3; LoadPalette(gUnknown_085BEDA0 + (var * 16), 0xF0, 0x20); } - if (++task->data[1] > 58) + if (++task->tData1 > 58) { task->tState++; - task->data[1] = 0; + task->tData1 = 0; } return FALSE; @@ -1166,15 +1449,15 @@ bool8 Phase2_Kyogre_Func4(struct Task *task) bool8 Phase2_Kyogre_Func5(struct Task *task) { - if (task->data[1] % 5 == 0) + if (task->tData1 % 5 == 0) { - s16 var = task->data[1] / 5; + s16 var = task->tData1 / 5; LoadPalette(gUnknown_085BEEE0 + (var * 16), 0xF0, 0x20); } - if (++task->data[1] > 68) + if (++task->tData1 > 68) { task->tState++; - task->data[1] = 0; + task->tData1 = 0; task->tFrames = 30; } @@ -1202,18 +1485,18 @@ bool8 Phase2_WeatherDuo_Func7(struct Task *task) bool8 Phase2_BigPokeball_Func3(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->data[3] == 0 || --task->data[3] == 0) + if (task->tData3 == 0 || --task->tData3 == 0) { - task->data[2]++; - task->data[3] = 2; + task->tData2++; + task->tData3 = 2; } - sTransitionStructPtr->BLDALPHA = (task->data[1] << 8) | task->data[2]; - if (task->data[2] > 15) + sTransitionStructPtr->BLDALPHA = (task->tData1 << 8) | task->tData2; + if (task->tData2 > 15) task->tState++; - task->data[4] += 8; - task->data[5] -= 256; + task->tData4 += 8; + task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5] >> 8, 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); sTransitionStructPtr->VBlank_DMA++; return FALSE; @@ -1222,18 +1505,18 @@ bool8 Phase2_BigPokeball_Func3(struct Task *task) bool8 Phase2_BigPokeball_Func4(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->data[3] == 0 || --task->data[3] == 0) + if (task->tData3 == 0 || --task->tData3 == 0) { - task->data[1]--; - task->data[3] = 2; + task->tData1--; + task->tData3 = 2; } - sTransitionStructPtr->BLDALPHA = (task->data[1] << 8) | task->data[2]; - if (task->data[1] == 0) + sTransitionStructPtr->BLDALPHA = (task->tData1 << 8) | task->tData2; + if (task->tData1 == 0) task->tState++; - task->data[4] += 8; - task->data[5] -= 256; + task->tData4 += 8; + task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5] >> 8, 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); sTransitionStructPtr->VBlank_DMA++; return FALSE; @@ -1242,17 +1525,17 @@ bool8 Phase2_BigPokeball_Func4(struct Task *task) bool8 Phase2_BigPokeball_Func5(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - task->data[4] += 8; - task->data[5] -= 256; + task->tData4 += 8; + task->tData5 -= 256; - sub_8149F98(gUnknown_02038C28[0], 0, task->data[4], 132, task->data[5] >> 8, 160); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 132, task->tData5 >> 8, 160); - if (task->data[5] <= 0) + if (task->tData5 <= 0) { task->tState++; - task->data[1] = 160; - task->data[2] = 256; - task->data[3] = 0; + task->tData1 = 160; + task->tData2 = 256; + task->tData3 = 0; } sTransitionStructPtr->VBlank_DMA++; @@ -1283,16 +1566,16 @@ bool8 Phase2_WaitPaletteFade(struct Task *task) bool8 Phase2_BigPokeball_Func6(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->data[2] < 1024) - task->data[2] += 128; - if (task->data[1] != 0) + if (task->tData2 < 1024) + task->tData2 += 128; + if (task->tData1 != 0) { - task->data[1] -= (task->data[2] >> 8); - if (task->data[1] < 0) - task->data[1] = 0; + task->tData1 -= (task->tData2 >> 8); + if (task->tData1 < 0) + task->tData1 = 0; } - sub_814A014(gUnknown_02038C28[0], 120, 80, task->data[1]); - if (task->data[1] == 0) + sub_814A014(gUnknown_02038C28[0], 120, 80, task->tData1); + if (task->tData1 == 0) { SetVBlankCallback(NULL); DmaStop(0); @@ -1301,9 +1584,9 @@ bool8 Phase2_BigPokeball_Func6(struct Task *task) } else { - if (task->data[3] == 0) + if (task->tData3 == 0) { - task->data[3]++; + task->tData3++; SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); } @@ -1673,12 +1956,12 @@ bool8 Phase2_Ripple_Func2(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; - r3 = task->data[2] >> 8; - r4 = task->data[1]; + r3 = task->tData2 >> 8; + r4 = task->tData1; r8 = 384; - task->data[1] += 0x400; - if (task->data[2] <= 0x1FFF) - task->data[2] += 0x180; + task->tData1 += 0x400; + if (task->tData2 <= 0x1FFF) + task->tData2 += 0x180; for (i = 0; i < 160; i++, r4 += r8) { @@ -1688,13 +1971,13 @@ bool8 Phase2_Ripple_Func2(struct Task *task) gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); } - if (++task->data[3] == 81) + if (++task->tData3 == 81) { - task->data[4]++; + task->tData4++; BeginNormalPaletteFade(-1, -2, 0, 0x10, 0); } - if (task->data[4] != 0 && !gPaletteFade.active) + if (task->tData4 != 0 && !gPaletteFade.active) DestroyTask(FindTaskIdByFunc(Phase2Task_Ripple)); sTransitionStructPtr->VBlank_DMA++; @@ -1752,13 +2035,13 @@ bool8 Phase2_Wave_Func2(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; toStore = gUnknown_02038C28[0]; - r5 = task->data[2]; - task->data[2] += 16; - task->data[1] += 8; + r5 = task->tData2; + task->tData2 += 16; + task->tData1 += 8; for (i = 0, nextFunc = TRUE; i < 160; i++, r5 += 4, toStore++) { - s16 value = task->data[1] + Sin(r5, 40); + s16 value = task->tData1 + Sin(r5, 40); if (value < 0) value = 0; if (value > 240) @@ -1837,9 +2120,9 @@ bool8 Phase2_Mugshot_Func1(struct Task *task) dp12_8087EA4(); Mugshots_CreateOpponentPlayerSprites(task); - task->data[1] = 0; - task->data[2] = 1; - task->data[3] = 239; + task->tData1 = 0; + task->tData2 = 1; + task->tData3 = 239; sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 62; sTransitionStructPtr->WIN0V = 160; @@ -1892,12 +2175,12 @@ bool8 Phase2_Mugshot_Func3(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; toStore = gUnknown_02038C28[0]; - r5 = task->data[1]; - task->data[1] += 0x10; + r5 = task->tData1; + task->tData1 += 0x10; for (i = 0; i < 80; i++, toStore++, r5 += 0x10) { - value = task->data[2] + Sin(r5, 0x10); + value = task->tData2 + Sin(r5, 0x10); if (value < 0) value = 1; if (value > 0xF0) @@ -1906,7 +2189,7 @@ bool8 Phase2_Mugshot_Func3(struct Task *task) } for (; i < 160; i++, toStore++, r5 += 0x10) { - value = task->data[3] - Sin(r5, 0x10); + value = task->tData3 - Sin(r5, 0x10); if (value < 0) value = 0; if (value > 0xEF) @@ -1914,13 +2197,13 @@ bool8 Phase2_Mugshot_Func3(struct Task *task) *toStore = (value << 8) | (0xF0); } - task->data[2] += 8; - task->data[3] -= 8; - if (task->data[2] > 0xF0) - task->data[2] = 0xF0; - if (task->data[3] < 0) - task->data[3] = 0; - mergedValue = *(s32*)(&task->data[2]); + task->tData2 += 8; + task->tData3 -= 8; + if (task->tData2 > 0xF0) + task->tData2 = 0xF0; + if (task->tData3 < 0) + task->tData3 = 0; + mergedValue = *(s32*)(&task->tData2); if (mergedValue == 0xF0) task->tState++; @@ -1943,9 +2226,9 @@ bool8 Phase2_Mugshot_Func4(struct Task *task) } task->tState++; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = 0; + task->tData1 = 0; + task->tData2 = 0; + task->tData3 = 0; sTransitionStructPtr->field_18 -= 8; sTransitionStructPtr->field_1A += 8; @@ -1985,8 +2268,8 @@ bool8 Phase2_Mugshot_Func6(struct Task *task) SetGpuReg(REG_OFFSET_WIN0H, 0xF0); SetGpuReg(REG_OFFSET_BLDY, 0); task->tState++; - task->data[3] = 0; - task->data[4] = 0; + task->tData3 = 0; + task->tData4 = 0; sTransitionStructPtr->BLDCNT = 0xBF; SetVBlankCallback(VBlankCB1_Phase2_Mugshots); } @@ -2002,15 +2285,15 @@ bool8 Phase2_Mugshot_Func7(struct Task *task) sTransitionStructPtr->field_18 -= 8; sTransitionStructPtr->field_1A += 8; - if (task->data[4] < 0x50) - task->data[4] += 2; - if (task->data[4] > 0x50) - task->data[4] = 0x50; + if (task->tData4 < 0x50) + task->tData4 += 2; + if (task->tData4 > 0x50) + task->tData4 = 0x50; - if (++task->data[3] & 1) + if (++task->tData3 & 1) { s16 i; - for (i = 0, r6 = FALSE; i <= task->data[4]; i++) + for (i = 0, r6 = FALSE; i <= task->tData4; i++) { s16 index1 = 0x50 - i; s16 index2 = 0x50 + i; @@ -2027,7 +2310,7 @@ bool8 Phase2_Mugshot_Func7(struct Task *task) } } - if (task->data[4] == 0x50 && !r6) + if (task->tData4 == 0x50 && !r6) task->tState++; sTransitionStructPtr->VBlank_DMA++; @@ -2039,7 +2322,7 @@ bool8 Phase2_Mugshot_Func8(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; BlendPalettes(-1, 0x10, 0x7FFF); sTransitionStructPtr->BLDCNT = 0xFF; - task->data[3] = 0; + task->tData3 = 0; task->tState++; return TRUE; @@ -2049,9 +2332,9 @@ bool8 Phase2_Mugshot_Func9(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - task->data[3]++; - memset(gUnknown_02038C28[0], task->data[3], 0x140); - if (task->data[3] > 15) + task->tData3++; + memset(gUnknown_02038C28[0], task->tData3, 0x140); + if (task->tData3 > 15) task->tState++; sTransitionStructPtr->VBlank_DMA++; @@ -2216,8 +2499,8 @@ bool8 Phase2_Slice_Func1(struct Task *task) sub_8149F08(); dp12_8087EA4(); - task->data[2] = 256; - task->data[3] = 1; + task->tData2 = 256; + task->tData3 = 1; sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; sTransitionStructPtr->WIN0V = 160; @@ -2245,13 +2528,13 @@ bool8 Phase2_Slice_Func2(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; - task->data[1] += (task->data[2] >> 8); - if (task->data[1] > 0xF0) - task->data[1] = 0xF0; - if (task->data[2] <= 0xFFF) - task->data[2] += task->data[3]; - if (task->data[3] < 128) - task->data[3] <<= 1; // multiplying by two + task->tData1 += (task->tData2 >> 8); + if (task->tData1 > 0xF0) + task->tData1 = 0xF0; + if (task->tData2 <= 0xFFF) + task->tData2 += task->tData3; + if (task->tData3 < 128) + task->tData3 <<= 1; // multiplying by two for (i = 0; i < 160; i++) { @@ -2259,17 +2542,17 @@ bool8 Phase2_Slice_Func2(struct Task *task) u16* storeLoc2 = &gUnknown_02038C28[0][i + 160]; if (1 & i) { - *storeLoc1 = sTransitionStructPtr->field_14 + task->data[1]; - *storeLoc2 = 0xF0 - task->data[1]; + *storeLoc1 = sTransitionStructPtr->field_14 + task->tData1; + *storeLoc2 = 0xF0 - task->tData1; } else { - *storeLoc1 = sTransitionStructPtr->field_14 - task->data[1]; - *storeLoc2 = (task->data[1] << 8) | (0xF1); + *storeLoc1 = sTransitionStructPtr->field_14 - task->tData1; + *storeLoc2 = (task->tData1 << 8) | (0xF1); } } - if (task->data[1] > 0xEF) + if (task->tData1 > 0xEF) task->tState++; sTransitionStructPtr->VBlank_DMA++; @@ -2307,12 +2590,12 @@ void HBlankCB_Phase2_Slice(void) } } -void Phase2Task_25(u8 taskId) +void Phase2Task_ShredSplit(u8 taskId) { - while (sPhase2_25_Funcs[gTasks[taskId].tState](&gTasks[taskId])); + while (sPhase2_ShredSplit_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_25_Func1(struct Task *task) +bool8 Phase2_ShredSplit_Func1(struct Task *task) { u16 i; @@ -2334,9 +2617,9 @@ bool8 Phase2_25_Func1(struct Task *task) gUnknown_02038C28[0][0x280 + i] = 1; } - task->data[4] = 0; - task->data[5] = 0; - task->data[6] = 7; + task->tData4 = 0; + task->tData5 = 0; + task->tData6 = 7; EnableInterrupts(INTR_FLAG_HBLANK); @@ -2347,7 +2630,7 @@ bool8 Phase2_25_Func1(struct Task *task) return TRUE; } -bool8 Phase2_25_Func2(struct Task *task) +bool8 Phase2_ShredSplit_Func2(struct Task *task) { u16 i, j, k; u8 arr1[ARRAY_COUNT(gUnknown_085C8C64)]; @@ -2362,7 +2645,7 @@ bool8 Phase2_25_Func2(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; var = 0; - for (i = 0; i <= task->data[5]; i++) + for (i = 0; i <= task->tData5; i++) { for (j = 0; j < 2; j++) { @@ -2433,10 +2716,10 @@ bool8 Phase2_25_Func2(struct Task *task) } } - if (--task->data[4] < 0) - task->data[4] = 0; - if (task->data[4] <= 0 && task->data[5] + 1 <= 20) - task->data[4] = task->data[6], task->data[5]++; + if (--task->tData4 < 0) + task->tData4 = 0; + if (task->tData4 <= 0 && task->tData5 + 1 <= 20) + task->tData4 = task->tData6, task->tData5++; if (var > 0x9F) task->tState++; @@ -2444,7 +2727,7 @@ bool8 Phase2_25_Func2(struct Task *task) return FALSE; } -bool8 Phase2_25_Func3(struct Task *task) +bool8 Phase2_ShredSplit_Func3(struct Task *task) { u16 i; bool32 done = TRUE; @@ -2462,11 +2745,11 @@ bool8 Phase2_25_Func3(struct Task *task) return FALSE; } -bool8 Phase2_25_Func4(struct Task *task) +bool8 Phase2_ShredSplit_Func4(struct Task *task) { DmaStop(0); sub_8149F84(); - DestroyTask(FindTaskIdByFunc(Phase2Task_25)); + DestroyTask(FindTaskIdByFunc(Phase2Task_ShredSplit)); return FALSE; } @@ -2500,16 +2783,16 @@ bool8 Phase2_Blackhole_Func1(struct Task *task) SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); task->tState++; - task->data[1] = 1; - task->data[2] = 0x100; - task->data[7] = 0; + task->tData1 = 1; + task->tData2 = 0x100; + task->tFuncState = 0; return FALSE; } bool8 Phase2_Blackhole1_Func3(struct Task *task) { - if (task->data[7] == 1) + if (task->tFuncState == 1) { DmaStop(0); SetVBlankCallback(NULL); @@ -2518,16 +2801,16 @@ bool8 Phase2_Blackhole1_Func3(struct Task *task) else { sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->data[2] < 0x400) - task->data[2] += 0x80; - if (task->data[1] < 0xA0) - task->data[1] += (task->data[2] >> 8); - if (task->data[1] > 0xA0) - task->data[1] = 0xA0; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->data[1]); - if (task->data[1] == 0xA0) + if (task->tData2 < 0x400) + task->tData2 += 0x80; + if (task->tData1 < 0xA0) + task->tData1 += (task->tData2 >> 8); + if (task->tData1 > 0xA0) + task->tData1 = 0xA0; + sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + if (task->tData1 == 0xA0) { - task->data[7] = 1; + task->tFuncState = 1; sub_8149F84(); } else @@ -2542,19 +2825,19 @@ bool8 Phase2_Blackhole1_Func3(struct Task *task) bool8 Phase2_Blackhole1_Func2(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->data[7] == 0) + if (task->tFuncState == 0) { - task->data[7]++; - task->data[1] = 0x30; - task->data[6] = 0; + task->tFuncState++; + task->tData1 = 0x30; + task->tData6 = 0; } - task->data[1] += gUnknown_085C8C80[task->data[6]]; - task->data[6] = (task->data[6] + 1) % 2; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->data[1]); - if (task->data[1] < 9) + task->tData1 += gUnknown_085C8C80[task->tData6]; + task->tData6 = (task->tData6 + 1) % 2; + sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + if (task->tData1 < 9) { task->tState++; - task->data[7] = 0; + task->tFuncState = 0; } sTransitionStructPtr->VBlank_DMA++; @@ -2567,40 +2850,40 @@ bool8 Phase2_Blackhole2_Func2(struct Task *task) s16 amplitude; sTransitionStructPtr->VBlank_DMA = FALSE; - if (task->data[7] == 0) + if (task->tFuncState == 0) { - task->data[7]++; - task->data[5] = 2; - task->data[6] = 2; + task->tFuncState++; + task->tData5 = 2; + task->tData6 = 2; } - if (task->data[1] > 0xA0) - task->data[1] = 0xA0; + if (task->tData1 > 0xA0) + task->tData1 = 0xA0; - sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->data[1]); - if (task->data[1] == 0xA0) + sub_814A014(gUnknown_02038C28[0], 0x78, 0x50, task->tData1); + if (task->tData1 == 0xA0) { DmaStop(0); sub_8149F84(); DestroyTask(FindTaskIdByFunc(task->func)); } - index = task->data[5]; - if ((task->data[5] & 0xFF) <= 128) + index = task->tData5; + if ((task->tData5 & 0xFF) <= 128) { - amplitude = task->data[6]; - task->data[5] += 8; + amplitude = task->tData6; + task->tData5 += 8; } else { - amplitude = task->data[6] - 1; - task->data[5] += 16; + amplitude = task->tData6 - 1; + task->tData5 += 16; } - task->data[1] += Sin(index & 0xFF, amplitude); + task->tData1 += Sin(index & 0xFF, amplitude); - if (task->data[1] <= 0) - task->data[1] = 1; - if (task->data[5] > 0xFE) - task->data[5] >>= 8, task->data[6]++; + if (task->tData1 <= 0) + task->tData1 = 1; + if (task->tData5 > 0xFE) + task->tData5 >>= 8, task->tData6++; sTransitionStructPtr->VBlank_DMA++; return FALSE; @@ -2621,7 +2904,7 @@ bool8 Phase2_RectangularSpiral_Func1(struct Task *task) CpuFill16(0xF000, dst1, 0x800); LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); - task->data[3] = 1; + task->tData3 = 1; task->tState++; sRectangularSpiralTransition[0].field_0 = 0; @@ -2775,21 +3058,21 @@ bool8 Phase2_Groudon_Func3(struct Task *task) LZ77UnCompVram(gUnknown_085BEA88, dst1); task->tState++; - task->data[1] = 0; + task->tData1 = 0; return FALSE; } bool8 Phase2_Groudon_Func4(struct Task *task) { - if (task->data[1] % 3 == 0) + if (task->tData1 % 3 == 0) { - u16 var = (task->data[1] % 30) / 3; + u16 var = (task->tData1 % 30) / 3; LoadPalette(gUnknown_085BF0A0 + (var * 16), 0xF0, 0x20); } - if (++task->data[1] > 58) + if (++task->tData1 > 58) { task->tState++; - task->data[1] = 0; + task->tData1 = 0; } return FALSE; @@ -2797,18 +3080,951 @@ bool8 Phase2_Groudon_Func4(struct Task *task) bool8 Phase2_Groudon_Func5(struct Task *task) { - if (task->data[1] % 5 == 0) + if (task->tData1 % 5 == 0) { - s16 var = task->data[1] / 5; + s16 var = task->tData1 / 5; LoadPalette(gUnknown_085BF2A0 + (var * 16), 0xF0, 0x20); } - if (++task->data[1] > 68) + if (++task->tData1 > 68) { task->tState++; - task->data[1] = 0; + task->tData1 = 0; task->tFrames = 30; } return FALSE; } +void Phase2Task_Rayquaza(u8 taskId) +{ + while (sPhase2_Rayquaza_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Rayquaza_Func3(struct Task *task) +{ + u16 *dst1, *dst2; + u16 i; + + sub_8149F08(); + dp12_8087EA4(); + + SetGpuReg(REG_OFFSET_BG0CNT, 0x9A08); + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + CpuCopy16(gUnknown_085BF6A0, dst2, 0x2000); + + sTransitionStructPtr->field_20 = 0; + task->tState++; + LoadPalette(gUnknown_085BF4A0 + 0x50, 0xF0, 0x20); + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[0][i] = 0; + gUnknown_02038C28[1][i] = 0x100; + } + + SetVBlankCallback(VBlankCB_Phase2_Rayquaza); + return FALSE; +} + +bool8 Phase2_Rayquaza_Func4(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + CpuCopy16(gUnknown_085C6BE0, dst1, 0x1000); + task->tState++; + return FALSE; +} + +bool8 Phase2_Rayquaza_Func5(struct Task *task) +{ + if ((task->tData1 % 4) == 0) + { + u16 value = task->tData1 / 4; + const u16 *palPtr = &gUnknown_085BF4A0[(value + 5) * 16]; + LoadPalette(palPtr, 0xF0, 0x20); + } + if (++task->tData1 > 40) + { + task->tState++; + task->tData1 = 0; + } + + return FALSE; +} + +bool8 Phase2_Rayquaza_Func6(struct Task *task) +{ + if (++task->tData1 > 20) + { + task->tState++; + task->tData1 = 0; + BeginNormalPaletteFade(0xFFFF8000, 2, 0, 0x10, 0); + } + + return FALSE; +} + +bool8 Phase2_Rayquaza_Func7(struct Task *task) +{ + if (!gPaletteFade.active) + { + sTransitionStructPtr->field_20 = 1; + task->tState++; + } + + return FALSE; +} + +bool8 Phase2_Rayquaza_Func8(struct Task *task) +{ + BlendPalettes(0x00007FFF, 8, 0); + BlendPalettes(0xFFFF8000, 0, 0); + + task->tState++; + return FALSE; +} + +bool8 Phase2_Rayquaza_Func9(struct Task *task) +{ + if ((task->tData1 % 3) == 0) + { + u16 value = task->tData1 / 3; + const u16 *palPtr = &gUnknown_085BF4A0[(value + 0) * 16]; + LoadPalette(palPtr, 0xF0, 0x20); + } + if (++task->tData1 >= 40) + { + u16 i; + + sTransitionStructPtr->WININ = 0; + sTransitionStructPtr->WINOUT = 63; + sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0V = 160; + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[1][i] = 0; + } + + SetVBlankCallback(VBlankCB1_Phase2_BigPokeball); + task->tState++; + task->tData2 = 0x100; + task->tFuncState = 0; + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON); + } + + return FALSE; +} + +void VBlankCB_Phase2_Rayquaza(void) +{ + void *dmaSrc; + + DmaStop(0); + VBlankCB_BattleTransition(); + + if (sTransitionStructPtr->field_20 == 0) + dmaSrc = gUnknown_02038C28[0]; + else if (sTransitionStructPtr->field_20 == 1) + dmaSrc = gUnknown_02038C28[1]; + else + dmaSrc = gUnknown_02038C28[0]; + + DmaSet(0, dmaSrc, ®_BG0VOFS, 0xA2400001); +} + +void Phase2Task_WhiteFade(u8 taskId) +{ + while (sPhase2_WhiteFade_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_WhiteFade_Func1(struct Task *task) +{ + u16 i; + + sub_8149F08(); + dp12_8087EA4(); + + sTransitionStructPtr->BLDCNT = 0xBF; + sTransitionStructPtr->BLDY = 0; + sTransitionStructPtr->WININ = 0x1E; + sTransitionStructPtr->WINOUT = 0x3F; + sTransitionStructPtr->WIN0V = 0xA0; + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[1][i] = 0; + gUnknown_02038C28[1][i + 160] = 0xF0; + } + + EnableInterrupts(INTR_FLAG_HBLANK); + SetHBlankCallback(HBlankCB_Phase2_WhiteFade); + SetVBlankCallback(VBlankCB0_Phase2_WhiteFade); + + task->tState++; + return FALSE; +} + +bool8 Phase2_WhiteFade_Func2(struct Task *task) +{ + s16 i, posY; + s16 arr1[ARRAY_COUNT(sUnknown_085C8DA0)]; + struct Sprite *sprite; + + memcpy(arr1, sUnknown_085C8DA0, sizeof(sUnknown_085C8DA0)); + for (i = 0, posY = 0; i < 8; i++, posY += 0x14) + { + sprite = &gSprites[CreateInvisibleSprite(sub_8149864)]; + sprite->pos1.x = 0xF0; + sprite->pos1.y = posY; + sprite->data[5] = arr1[i]; + } + sprite->data[6]++; + + task->tState++; + return FALSE; +} + +bool8 Phase2_WhiteFade_Func3(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + if (sTransitionStructPtr->field_20 > 7) + { + BlendPalettes(-1, 0x10, 0x7FFF); + task->tState++; + } + return FALSE; +} + +bool8 Phase2_WhiteFade_Func4(struct Task *task) +{ + sTransitionStructPtr->VBlank_DMA = 0; + + DmaStop(0); + SetVBlankCallback(0); + SetHBlankCallback(0); + + sTransitionStructPtr->field_6 = 0xF0; + sTransitionStructPtr->BLDY = 0; + sTransitionStructPtr->BLDCNT = 0xFF; + sTransitionStructPtr->WININ = 0x3F; + + SetVBlankCallback(VBlankCB1_Phase2_WhiteFade); + + task->tState++; + return FALSE; +} + +bool8 Phase2_WhiteFade_Func5(struct Task *task) +{ + if (++sTransitionStructPtr->BLDY > 16) + { + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_WhiteFade)); + } + return FALSE; +} + +void VBlankCB0_Phase2_WhiteFade(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + REG_BLDCNT = sTransitionStructPtr->BLDCNT; + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0V = sTransitionStructPtr->WIN0V; + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 640); + DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); +} + +void VBlankCB1_Phase2_WhiteFade(void) +{ + VBlankCB_BattleTransition(); + REG_BLDY = sTransitionStructPtr->BLDY; + REG_BLDCNT = sTransitionStructPtr->BLDCNT; + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0H = sTransitionStructPtr->field_6; + REG_WIN0V = sTransitionStructPtr->WIN0V; +} + +void HBlankCB_Phase2_WhiteFade(void) +{ + REG_BLDY = gUnknown_02038C28[1][REG_VCOUNT]; +} + +void sub_8149864(struct Sprite *sprite) +{ + if (sprite->data[5]) + { + sprite->data[5]--; + if (sprite->data[6]) + sTransitionStructPtr->VBlank_DMA = 1; + } + else + { + u16 i; + u16* ptr1 = &gUnknown_02038C28[0][sprite->pos1.y]; + u16* ptr2 = &gUnknown_02038C28[0][sprite->pos1.y + 160]; + for (i = 0; i < 20; i++) + { + ptr1[i] = sprite->data[0] >> 8; + ptr2[i] = (u8)(sprite->pos1.x); + } + if (sprite->pos1.x == 0 && sprite->data[0] == 0x1000) + sprite->data[1] = 1; + + sprite->pos1.x -= 16; + sprite->data[0] += 0x80; + + if (sprite->pos1.x < 0) + sprite->pos1.x = 0; + if (sprite->data[0] > 0x1000) + sprite->data[0] = 0x1000; + + if (sprite->data[6]) + sTransitionStructPtr->VBlank_DMA = 1; + + if (sprite->data[1]) + { + if (sprite->data[6] == 0 || (sTransitionStructPtr->field_20 > 6 && sprite->data[2]++ > 7)) + { + sTransitionStructPtr->field_20++; + DestroySprite(sprite); + } + } + } +} + +void Phase2Task_GridSquares(u8 taskId) +{ + while (sPhase2_GridSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_GridSquares_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + CpuSet(sShrinkingBoxTileset, dst2, 0x10); + CpuFill16(0xF000, dst1, 0x800); + LoadPalette(gFieldEffectObjectPalette10, 0xF0, 0x20); + + task->tState++; + return FALSE; +} + +bool8 Phase2_GridSquares_Func2(struct Task *task) +{ + u16* dst1; + + if (task->tData1 == 0) + { + sub_8149F40(&dst1); + task->tData1 = 3; + task->tData2++; + CpuSet(sShrinkingBoxTileset + (task->tData2 * 8), dst1, 0x10); + if (task->tData2 > 0xD) + { + task->tState++; + task->tData1 = 16; + } + } + + task->tData1--; + return FALSE; +} + +bool8 Phase2_GridSquares_Func3(struct Task *task) +{ + if (--task->tData1 == 0) + { + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_GridSquares)); + } + return FALSE; +} + +void Phase2Task_Shards(u8 taskId) +{ + while (sPhase2_Shards_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_Shards_Func1(struct Task *task) +{ + u16 i; + + sub_8149F08(); + dp12_8087EA4(); + + sTransitionStructPtr->WININ = 0x3F; + sTransitionStructPtr->WINOUT = 0; + sTransitionStructPtr->WIN0V = 0xA0; + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[0][i] = 0xF0; + } + + CpuSet(gUnknown_02038C28[0], gUnknown_02038C28[1], 0xA0); + SetVBlankCallback(VBlankCB_Phase2_Shards); + + task->tState++; + return TRUE; +} + +bool8 Phase2_Shards_Func2(struct Task *task) +{ + sub_814A1AC(sTransitionStructPtr->data, + sUnknown_085C8DD0[task->tData1][0], + sUnknown_085C8DD0[task->tData1][1], + sUnknown_085C8DD0[task->tData1][2], + sUnknown_085C8DD0[task->tData1][3], + 1, 1); + task->tData2 = sUnknown_085C8DD0[task->tData1][4]; + task->tState++; + return TRUE; +} + +bool8 Phase2_Shards_Func3(struct Task *task) +{ + s16 i; + bool8 nextFunc; + + sTransitionStructPtr->VBlank_DMA = 0; + + for (i = 0, nextFunc = FALSE; i < 16; i++) + { + s16 r3 = gUnknown_02038C28[0][sTransitionStructPtr->data[3]] >> 8; + s16 r4 = gUnknown_02038C28[0][sTransitionStructPtr->data[3]] & 0xFF; + if (task->tData2 == 0) + { + if (r3 < sTransitionStructPtr->data[2]) + r3 = sTransitionStructPtr->data[2]; + if (r3 > r4) + r3 = r4; + } + else + { + if (r4 > sTransitionStructPtr->data[2]) + r4 = sTransitionStructPtr->data[2]; + if (r4 <= r3) + r4 = r3; + } + gUnknown_02038C28[0][sTransitionStructPtr->data[3]] = (r4) | (r3 << 8); + if (nextFunc) + { + task->tState++; + break; + } + else + nextFunc = sub_814A228(sTransitionStructPtr->data, 1, 1); + } + + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +bool8 Phase2_Shards_Func4(struct Task *task) +{ + if (++task->tData1 < 7) + { + task->tState++; + task->tData3 = sUnknown_085C8E16[task->tData1 - 1]; + return TRUE; + } + else + { + DmaStop(0); + sub_8149F84(); + DestroyTask(FindTaskIdByFunc(Phase2Task_Shards)); + return FALSE; + } +} + +bool8 Phase2_Shards_Func5(struct Task *task) +{ + if (--task->tData3 == 0) + { + task->tState = 1; + return TRUE; + } + else + return FALSE; +} + +void VBlankCB_Phase2_Shards(void) +{ + DmaStop(0); + VBlankCB_BattleTransition(); + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); + REG_WININ = sTransitionStructPtr->WININ; + REG_WINOUT = sTransitionStructPtr->WINOUT; + REG_WIN0V = sTransitionStructPtr->WIN0V; + REG_WIN0H = gUnknown_02038C28[1][0]; + DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); +} + +// sub-task for phase2 +#undef tData1 +#undef tData2 +#undef tData3 +#undef tData4 +#undef tData5 +#undef tData6 +#undef tFuncState +#undef tFrames +#undef tOpponentSpriteId +#undef tPlayerSpriteId +#undef tMugshotId + +// sub-task for sub-task phase +#define tData1 data[1] +#define tData2 data[2] +#define tData3 data[3] +#define tData4 data[4] +#define tData5 data[5] +#define tData6 data[6] +#define tData7 data[7] + +void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4) +{ + u8 taskId = CreateTask(Phase1_Task_RunFuncs, 3); + gTasks[taskId].tData1 = a0; + gTasks[taskId].tData2 = a1; + gTasks[taskId].tData3 = a2; + gTasks[taskId].tData4 = a3; + gTasks[taskId].tData5 = a4; + gTasks[taskId].tData6 = a0; +} + +bool8 IsPhase1Done(void) +{ + if (FindTaskIdByFunc(Phase1_Task_RunFuncs) == 0xFF) + return TRUE; + else + return FALSE; +} + +void Phase1_Task_RunFuncs(u8 taskId) +{ + while (sPhase1_TransitionAll_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase1_TransitionAll_Func1(struct Task *task) +{ + if (task->tData6 == 0 || --task->tData6 == 0) + { + task->tData6 = task->tData1; + task->tData7 += task->tData4; + if (task->tData7 > 16) + task->tData7 = 16; + BlendPalettes(-1, task->tData7, 0x2D6B); + } + if (task->tData7 > 15) + { + task->tState++; + task->tData6 = task->tData2; + } + return FALSE; +} + +bool8 Phase1_TransitionAll_Func2(struct Task *task) +{ + if (task->tData6 == 0 || --task->tData6 == 0) + { + task->tData6 = task->tData2; + task->tData7 -= task->tData5; + if (task->tData7 < 0) + task->tData7 = 0; + BlendPalettes(-1, task->tData7, 0x2D6B); + } + if (task->tData7 == 0) + { + if (--task->tData3 == 0) + DestroyTask(FindTaskIdByFunc(Phase1_Task_RunFuncs)); + else + { + task->tData6 = task->tData1; + task->tState = 0; + } + } + return FALSE; +} + +#undef tData1 +#undef tData2 +#undef tData3 +#undef tData4 +#undef tData5 +#undef tData6 +#undef tData7 + +void sub_8149F08(void) +{ + memset(sTransitionStructPtr, 0, sizeof(*sTransitionStructPtr)); + sub_8089C08(&sTransitionStructPtr->field_14, &sTransitionStructPtr->field_16); +} + +void VBlankCB_BattleTransition(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_8149F40(u16 **a0) +{ + u16 reg, *vram; + + reg = REG_BG0CNT >> 2; + reg <<= 0xE; + vram = (u16*)(VRAM + reg); + + *a0 = vram; +} + +void sub_8149F58(u16 **a0, u16 **a1) +{ + u16 reg0, reg1, *vram0, *vram1; + + reg0 = REG_BG0CNT >> 8; + reg1 = REG_BG0CNT >> 2; + + reg0 <<= 0xB; + reg1 <<= 0xE; + + vram0 = (u16*)(VRAM + reg0); + *a0 = vram0; + + vram1 = (u16*)(VRAM + reg1); + *a1 = vram1; +} + +void sub_8149F84(void) +{ + BlendPalettes(-1, 0x10, 0); +} + +void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize) +{ + u8 i; + for (i = 0; arrSize > 0; arrSize--, i++, index += indexIncrementer) + { + array[i] = sinAdd + Sin(0xFF & index, amplitude); + } +} + +void sub_814A014(u16 *array, s16 a1, s16 a2, s16 a3) +{ + s16 i; + + memset(array, 0xA, 160 * sizeof(s16)); + for (i = 0; i < 64; i++) + { + s16 sinResult, cosResult; + s16 toStoreOrr, r2, r3, toStore, r7, r8; + + sinResult = Sin(i, a3); + cosResult = Cos(i, a3); + + toStoreOrr = a1 - sinResult; + toStore = a1 + sinResult; + r7 = a2 - cosResult; + r8 = a2 + cosResult; + + if (toStoreOrr < 0) + toStoreOrr = 0; + if (toStore > 0xF0) + toStore = 0xF0; + if (r7 < 0) + r7 = 0; + if (r8 > 0x9F) + r8 = 0x9F; + + toStore |= (toStoreOrr << 8); + array[r7] = toStore; + array[r8] = toStore; + + cosResult = Cos(i + 1, a3); + r3 = a2 - cosResult; + r2 = a2 + cosResult; + + if (r3 < 0) + r3 = 0; + if (r2 > 0x9F) + r2 = 0x9F; + + while (r7 > r3) + array[--r7] = toStore; + while (r7 < r3) + array[++r7] = toStore; + + while (r8 > r2) + array[--r8] = toStore; + while (r8 < r2) + array[++r8] = toStore; + } +} + +void sub_814A1AC(s16 *data, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) +{ + data[0] = a1; + data[1] = a2; + data[2] = a1; + data[3] = a2; + data[4] = a3; + data[5] = a4; + data[6] = a5; + data[7] = a6; + data[8] = a3 - a1; + if (data[8] < 0) + { + data[8] = -data[8]; + data[6] = -a5; + } + data[9] = a4 - a2; + if (data[9] < 0) + { + data[9] = -data[9]; + data[7] = -a6; + } + data[10] = 0; +} + +bool8 sub_814A228(s16 *data, bool8 a1, bool8 a2) +{ + u8 var; + if (data[8] > data[9]) + { + data[2] += data[6]; + data[10] += data[9]; + if (data[10] > data[8]) + { + data[3] += data[7]; + data[10] -= data[8]; + } + } + else + { + data[3] += data[7]; + data[10] += data[8]; + if (data[10] > data[9]) + { + data[2] += data[6]; + data[10] -= data[9]; + } + } + var = 0; + if ((data[6] > 0 && data[2] >= data[4]) || (data[6] < 0 && data[2] <= data[4])) + { + var++; + if (a1) + data[2] = data[4]; + } + if ((data[7] > 0 && data[3] >= data[5]) || (data[7] < 0 && data[3] <= data[5])) + { + var++; + if (a2) + data[3] = data[5]; + } + + if (var == 2) + return TRUE; + else + return FALSE; +} + +// sub-task for phase2 of a couple of new transitions +#define tData1 data[1] +#define tData2 data[2] +#define tData3 data[3] +#define tData4 data[4] +#define tData5 data[5] +#define tData6 data[6] +#define tData7 data[7] + +bool8 Phase2_29_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_814669C(task); + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + LZ77UnCompVram(gUnknown_085C7C00, dst2); + LoadPalette(gUnknown_085C7BE0, 0xF0, 0x20); + + task->tState++; + return FALSE; +} + +bool8 Phase2_29_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LZ77UnCompVram(gUnknown_085C828C, dst1); + sub_8149F98(gUnknown_02038C28[0], 0, task->tData4, 0x84, task->tData5, 160); + + task->tState++; + return TRUE; +} + +void Phase2Task_29(u8 taskId) +{ + while (sPhase2_29_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_30(u8 taskId) +{ + while (sPhase2_30_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +bool8 Phase2_30_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F08(); + dp12_8087EA4(); + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); + task->data[2] = 0x2000; + task->data[1] = 0x7FFF; + task->data[5] = 0; + task->data[6] = 16; + task->data[7] = 2560; + sTransitionStructPtr->BLDCNT = 0x3F41; + sTransitionStructPtr->BLDALPHA = (task->tData6 << 8) | (task->tData5); + REG_BLDCNT = sTransitionStructPtr->BLDCNT; + REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; + sub_8149F58(&dst1, &dst2); + CpuFill16(0, dst1, 0x800); + LZ77UnCompVram(gUnknown_085C7C00, dst2); + LoadPalette(gUnknown_085C7BE0, 0xF0, 0x20); + sTransitionStructPtr->field_16 = 0; + + task->tState++; + return FALSE; +} + +bool8 Phase2_30_Func2(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LZ77UnCompVram(gUnknown_085C828C, dst1); + + task->tState++; + return TRUE; +} + +bool8 Phase2_30_Func3(struct Task *task) +{ + u8 i; + + for (i = 0; i < 160; i++) + { + gUnknown_02038C28[1][i] = sTransitionStructPtr->field_16; + } + + SetVBlankCallback(VBlankCB_Phase2_30); + SetHBlankCallback(HBlankCB_Phase2_30); + EnableInterrupts(INTR_FLAG_HBLANK); + + task->tState++; + return TRUE; +} + +bool8 Phase2_30_Func4(struct Task *task) +{ + u8 i; + u16 var6, amplitude, var8; + + sTransitionStructPtr->VBlank_DMA = FALSE; + + amplitude = task->tData2 >> 8; + var6 = task->tData1; + var8 = 384; + + task->tData1 = var6 - task->tData7; + + if (task->tData3 >= 70) + { + if (task->tData2 - 384 >= 0) + task->tData2 -= 384; + else + task->tData2 = 0; + } + + if (task->tData3 >= 0 && task->tData3 % 3 == 0) + { + if (task->tData5 < 16) + task->tData5++; + else if (task->tData6 > 0) + task->tData6--; + + sTransitionStructPtr->BLDALPHA = (task->tData6 << 8) | (task->tData5); + } + + for (i = 0; i < 160; i++, var6 += var8) + { + s16 index = var6 / 256; + asm(""); + gUnknown_02038C28[0][i] = sTransitionStructPtr->field_16 + Sin(index, amplitude); + } + + if (++task->tData3 == 101) + { + task->tData4++; + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + } + + if (task->tData4 != 0 && !gPaletteFade.active) + DestroyTask(FindTaskIdByFunc(Phase2Task_30)); + + task->tData7 -= 17; + sTransitionStructPtr->VBlank_DMA++; + return FALSE; +} + +void VBlankCB_Phase2_30(void) +{ + VBlankCB_BattleTransition(); + REG_BLDCNT = sTransitionStructPtr->BLDCNT; + REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; + + if (sTransitionStructPtr->VBlank_DMA) + DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); +} + +void HBlankCB_Phase2_30(void) +{ + u16 var = gUnknown_02038C28[1][REG_VCOUNT]; + REG_BG0VOFS = var; +} + +void Phase2Task_31(u8 taskId) +{ + while (sPhase2_31_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_33(u8 taskId) +{ + while (sPhase2_33_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +void Phase2Task_32(u8 taskId) +{ + while (sPhase2_32_Funcs[gTasks[taskId].tState](&gTasks[taskId])); +} + +#undef tData1 +#undef tData2 +#undef tData3 +#undef tData4 +#undef tData5 +#undef tData6 +#undef tData7 diff --git a/src/tileset_anims.c b/src/tileset_anims.c index 4ad787e1c..062647202 100644 --- a/src/tileset_anims.c +++ b/src/tileset_anims.c @@ -5,6 +5,7 @@ #include "blend_palette.h" #include "battle_transition.h" #include "task.h" +#include "battle_transition.h" // Static type declarations @@ -1392,7 +1393,7 @@ static void sub_80A1818(u16 a1) { CpuCopy16(gTilesetAnims_BattleDomePals0[a1 & 0x3], gPlttBufferUnfaded + 0x80, 32); BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); - if ((u8)FindTaskIdByFunc(sub_8149DFC) != 0xFF ) + if ((u8)FindTaskIdByFunc(Phase1_Task_RunFuncs) != 0xFF ) { sSecondaryTilesetCB = sub_80A1670; sSecondaryTilesetCBBufferSize = 0x20; @@ -1402,7 +1403,7 @@ static void sub_80A1818(u16 a1) static void sub_80A1884(u16 a1) { CpuCopy16(gTilesetAnims_BattleDomePals0[a1 & 0x3], gPlttBufferUnfaded + 0x80, 32); - if ((u8)FindTaskIdByFunc(sub_8149DFC) == 0xFF ) + if ((u8)FindTaskIdByFunc(Phase1_Task_RunFuncs) == 0xFF ) { BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); if (!--sSecondaryTilesetCBBufferSize) From d7644cd3d8070cb12c84263a4707ec0211bd434a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 14 Jan 2018 22:09:35 +0100 Subject: [PATCH 5/7] battle transition is decompiled --- asm/battle_transition.s | 859 ---------------------- include/battle_transition.h | 11 +- include/bg.h | 2 +- ld_script.txt | 1 - src/battle_transition.c | 1386 +++++++++++++++++++++-------------- src/tileset_anims.c | 4 +- 6 files changed, 861 insertions(+), 1402 deletions(-) delete mode 100644 asm/battle_transition.s diff --git a/asm/battle_transition.s b/asm/battle_transition.s deleted file mode 100644 index eb87f0563..000000000 --- a/asm/battle_transition.s +++ /dev/null @@ -1,859 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start Phase2_31_Func1 -Phase2_31_Func1: @ 814A798 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x14 - mov r8, r0 - add r1, sp, 0x10 - add r0, sp, 0xC - bl sub_8149F58 - ldr r0, =gUnknown_085C8598 - ldr r1, [sp, 0x10] - bl LZ77UnCompVram - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r6, 0x1 - str r6, [sp] - str r4, [sp, 0x4] - movs r5, 0xF - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r6, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1D - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_085C8578 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - mov r1, r8 - strh r6, [r1, 0xC] - strh r0, [r1, 0xE] - strh r0, [r1, 0x10] - movs r0, 0xA - strh r0, [r1, 0x16] - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - movs r0, 0 - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_31_Func1 - - thumb_func_start Phase2_31_Func2 -Phase2_31_Func2: @ 814A828 - push {r4,r5,lr} - sub sp, 0x24 - adds r4, r0, 0 - ldr r1, =gUnknown_085C8928 - movs r2, 0x4 - str r2, [sp] - str r2, [sp, 0x4] - ldrb r0, [r4, 0xC] - str r0, [sp, 0x8] - ldrb r0, [r4, 0xE] - str r0, [sp, 0xC] - str r2, [sp, 0x10] - str r2, [sp, 0x14] - movs r0, 0xF - str r0, [sp, 0x18] - movs r5, 0 - str r5, [sp, 0x1C] - str r5, [sp, 0x20] - movs r0, 0 - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrh r0, [r4, 0xC] - adds r0, 0x4 - strh r0, [r4, 0xC] - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - bne _0814A88A - movs r0, 0x1 - strh r0, [r4, 0xC] - ldrh r0, [r4, 0xE] - adds r0, 0x4 - strh r0, [r4, 0xE] - strh r5, [r4, 0x10] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0814A88A - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_0814A88A: - movs r0, 0 - add sp, 0x24 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_31_Func2 - - thumb_func_start Phase2_31_Func3 -Phase2_31_Func3: @ 814A898 - push {r4-r6,lr} - sub sp, 0x10 - adds r4, r0, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldrh r0, [r4, 0x14] - adds r1, r0, 0x1 - strh r1, [r4, 0x14] - lsls r0, 16 - asrs r0, 16 - movs r2, 0x16 - ldrsh r1, [r4, r2] - cmp r0, r1 - blt _0814A956 - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0814A8FC - cmp r0, 0x1 - bgt _0814A8CA - cmp r0, 0 - beq _0814A8D4 - b _0814A92C -_0814A8CA: - cmp r0, 0x2 - beq _0814A914 - cmp r0, 0x3 - beq _0814A91C - b _0814A92C -_0814A8D4: - movs r2, 0xFA - ldr r6, =gPlttBufferUnfaded - movs r3, 0 - ldr r5, =gPlttBufferFaded -_0814A8DC: - lsls r1, r2, 1 - adds r0, r1, r6 - strh r3, [r0] - adds r1, r5 - strh r3, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFE - bls _0814A8DC - b _0814A94C - .pool -_0814A8FC: - ldr r0, =0xffff7fff - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r0, =gUnknown_085C86F4 - b _0814A91E - .pool -_0814A914: - ldr r0, =gUnknown_085C87F4 - b _0814A91E - .pool -_0814A91C: - ldr r0, =gUnknown_085C88A4 -_0814A91E: - ldr r1, [sp, 0xC] - bl LZ77UnCompVram - b _0814A94C - .pool -_0814A92C: - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0814A956 -_0814A94C: - movs r0, 0 - strh r0, [r4, 0x14] - ldrh r0, [r4, 0x12] - adds r0, 0x1 - strh r0, [r4, 0x12] -_0814A956: - movs r0, 0 - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end Phase2_31_Func3 - - thumb_func_start Phase2_33_Func1 -Phase2_33_Func1: @ 814A960 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x14 - mov r8, r0 - add r1, sp, 0x10 - add r0, sp, 0xC - bl sub_8149F58 - ldr r0, =gUnknown_085C8598 - ldr r1, [sp, 0x10] - bl LZ77UnCompVram - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r6, 0x1 - str r6, [sp] - str r4, [sp, 0x4] - movs r5, 0xF - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r6, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1D - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r4, =gUnknown_085C8578 - adds r0, r4, 0 - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - adds r0, r4, 0 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0xE0 - movs r1, 0x10 - movs r2, 0x8 - movs r3, 0 - bl BlendPalette - movs r1, 0 - movs r0, 0x22 - mov r2, r8 - strh r0, [r2, 0xC] - strh r1, [r2, 0xE] - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - movs r0, 0 - add sp, 0x14 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_33_Func1 - - thumb_func_start Phase2_33_Func2 -Phase2_33_Func2: @ 814AA04 - push {r4-r6,lr} - sub sp, 0x24 - adds r6, r0, 0 - ldr r1, =gUnknown_085C9A30 - movs r2, 0xC - ldrsh r0, [r6, r2] - adds r0, r1 - ldrb r5, [r0] - adds r0, r5, 0 - movs r1, 0x7 - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x7 - bl __udivsi3 - ldr r1, =gUnknown_085C8928 - movs r2, 0x4 - str r2, [sp] - str r2, [sp, 0x4] - lsls r4, 2 - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - str r4, [sp, 0x8] - lsls r0, 26 - lsrs r0, 24 - str r0, [sp, 0xC] - str r2, [sp, 0x10] - str r2, [sp, 0x14] - movs r0, 0xF - str r0, [sp, 0x18] - movs r0, 0 - str r0, [sp, 0x1C] - str r0, [sp, 0x20] - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrh r0, [r6, 0xC] - subs r0, 0x1 - strh r0, [r6, 0xC] - lsls r0, 16 - cmp r0, 0 - bge _0814AA70 - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] -_0814AA70: - movs r0, 0 - add sp, 0x24 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_33_Func2 - - thumb_func_start Phase2_33_Func3 -Phase2_33_Func3: @ 814AA84 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0xE0 - movs r1, 0x10 - movs r2, 0x3 - movs r3, 0 - bl BlendPalette - ldr r0, =0xffff3fff - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - strh r0, [r4, 0xC] - strh r0, [r4, 0xE] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_33_Func3 - - thumb_func_start Phase2_33_Func4 -Phase2_33_Func4: @ 814AAB8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x24 - adds r7, r0, 0 - ldrh r0, [r7, 0xE] - movs r1, 0x1 - eors r0, r1 - movs r6, 0 - strh r0, [r7, 0xE] - cmp r0, 0 - beq _0814AB2C - ldr r0, =gUnknown_085C8928 - mov r8, r0 - movs r4, 0x4 - str r4, [sp] - str r4, [sp, 0x4] - ldr r5, =gUnknown_085C9A30 - movs r1, 0xC - ldrsh r0, [r7, r1] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x7 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 22 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - movs r2, 0xC - ldrsh r0, [r7, r2] - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x7 - bl __udivsi3 - lsls r0, 26 - lsrs r0, 24 - str r0, [sp, 0xC] - str r4, [sp, 0x10] - str r4, [sp, 0x14] - movs r0, 0xE - str r0, [sp, 0x18] - str r6, [sp, 0x1C] - str r6, [sp, 0x20] - movs r0, 0 - mov r1, r8 - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - b _0814AB78 - .pool -_0814AB2C: - movs r1, 0xC - ldrsh r0, [r7, r1] - cmp r0, 0 - ble _0814AB72 - ldr r1, =gUnknown_085C9A30 - subs r0, 0x1 - adds r0, r1 - ldrb r5, [r0] - adds r0, r5, 0 - movs r1, 0x7 - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 22 - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x7 - bl __udivsi3 - adds r3, r0, 0 - lsls r3, 26 - lsrs r3, 24 - movs r0, 0x4 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl FillBgTilemapBufferRect -_0814AB72: - ldrh r0, [r7, 0xC] - adds r0, 0x1 - strh r0, [r7, 0xC] -_0814AB78: - movs r1, 0xC - ldrsh r0, [r7, r1] - cmp r0, 0x22 - ble _0814AB86 - ldrh r0, [r7, 0x8] - adds r0, 0x1 - strh r0, [r7, 0x8] -_0814AB86: - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - add sp, 0x24 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_33_Func4 - - thumb_func_start Phase2_31_33_Func5 -Phase2_31_33_Func5: @ 814ABA0 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r0, [r4] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - movs r0, 0 - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - thumb_func_end Phase2_31_33_Func5 - - thumb_func_start sub_814ABE4 -sub_814ABE4: @ 814ABE4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r6, r1, r2 - ldrh r0, [r6, 0xC] - movs r1, 0x1 - eors r0, r1 - strh r0, [r6, 0xC] - cmp r0, 0 - bne _0814AC24 - ldr r5, =gBattle_BG0_X - ldrh r1, [r5] - movs r0, 0x12 - bl SetGpuReg - ldr r4, =gBattle_BG0_Y - ldrh r1, [r4] - movs r0, 0x10 - bl SetGpuReg - ldrh r0, [r6, 0x8] - ldrh r1, [r5] - adds r0, r1 - strh r0, [r5] - ldrh r0, [r6, 0xA] - ldrh r1, [r4] - adds r0, r1 - strh r0, [r4] -_0814AC24: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814ABE4 - - thumb_func_start Phase2_32_Func1 -Phase2_32_Func1: @ 814AC38 - push {r4-r6,lr} - sub sp, 0x10 - adds r6, r0, 0 - movs r5, 0 - add r1, sp, 0xC - add r0, sp, 0x8 - bl sub_8149F58 - ldr r0, =gUnknown_085C8598 - ldr r1, [sp, 0xC] - bl LZ77UnCompVram - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_085C8578 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gBattle_BG0_X - strh r5, [r0] - ldr r4, =gBattle_BG0_Y - strh r5, [r4] - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - ldrh r1, [r4] - movs r0, 0x10 - bl SetGpuReg - strh r5, [r6, 0xC] - ldr r0, =sub_814ABE4 - movs r1, 0x1 - bl CreateTask - lsls r0, 24 - lsrs r5, r0, 24 - bl Random - lsls r0, 16 - movs r1, 0xC0 - lsls r1, 10 - ands r1, r0 - lsrs r1, 16 - cmp r1, 0x1 - beq _0814ACE4 - cmp r1, 0x1 - bgt _0814ACC8 - cmp r1, 0 - beq _0814ACCE - b _0814AD1C - .pool -_0814ACC8: - cmp r1, 0x2 - beq _0814AD00 - b _0814AD1C -_0814ACCE: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x8] - strh r0, [r1, 0xA] - b _0814AD2E - .pool -_0814ACE4: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =0x0000ffff - strh r1, [r0, 0x8] - movs r1, 0x1 - negs r1, r1 - b _0814AD2C - .pool -_0814AD00: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1 - strh r1, [r0, 0x8] - ldr r1, =0x0000ffff - b _0814AD2C - .pool -_0814AD1C: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =0x0000ffff - strh r1, [r0, 0x8] - movs r1, 0x1 -_0814AD2C: - strh r1, [r0, 0xA] -_0814AD2E: - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_32_Func1 - - thumb_func_start Phase2_32_Func2 -Phase2_32_Func2: @ 814AD48 - push {r4,lr} - sub sp, 0x24 - adds r4, r0, 0 - ldr r1, =gUnknown_085C9A53 - movs r2, 0xC - ldrsh r0, [r4, r2] - adds r0, r1 - ldrb r3, [r0] - lsrs r2, r3, 3 - movs r0, 0x7 - ands r3, r0 - ldr r1, =gUnknown_085C8928 - movs r0, 0x4 - str r0, [sp] - str r0, [sp, 0x4] - lsls r2, 2 - adds r2, 0x1 - str r2, [sp, 0x8] - lsls r3, 2 - str r3, [sp, 0xC] - str r0, [sp, 0x10] - str r0, [sp, 0x14] - movs r0, 0xF - str r0, [sp, 0x18] - movs r0, 0 - str r0, [sp, 0x1C] - str r0, [sp, 0x20] - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3F - ble _0814ADA0 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_0814ADA0: - movs r0, 0 - add sp, 0x24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_32_Func2 - - thumb_func_start Phase2_32_Func3 -Phase2_32_Func3: @ 814ADB4 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =0xffff7fff - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - movs r0, 0 - strh r0, [r4, 0xC] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_32_Func3 - - thumb_func_start Phase2_32_Func4 -Phase2_32_Func4: @ 814ADD8 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - ldr r1, =gUnknown_085C9A53 - movs r2, 0xC - ldrsh r0, [r4, r2] - adds r0, r1 - ldrb r3, [r0] - lsrs r2, r3, 3 - movs r0, 0x7 - ands r3, r0 - lsls r2, 2 - adds r2, 0x1 - lsls r3, 2 - movs r0, 0x4 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - bl FillBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3F - ble _0814AE2E - ldr r0, =sub_814ABE4 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_0814AE2E: - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_32_Func4 - - thumb_func_start Phase2_32_Func5 -Phase2_32_Func5: @ 814AE40 - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r4, =gBattle_BG0_Y - strh r1, [r4] - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - ldrh r1, [r4] - movs r0, 0x10 - bl SetGpuReg - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r0, [r5] - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end Phase2_32_Func5 - - .align 2, 0 @ Don't pad with nop. diff --git a/include/battle_transition.h b/include/battle_transition.h index cd4cdd1b3..0d6ef3c83 100644 --- a/include/battle_transition.h +++ b/include/battle_transition.h @@ -2,11 +2,14 @@ #define GUARD_BATTLE_TRANSITION_H void TestBattleTransition(u8 transitionId); -void sub_8149DFC(u8 a1); -void BattleTransition_StartOnField(u8 transitionID); -void BattleTransition_Start(u8 transitionID); +void BattleTransition_StartOnField(u8 transitionId); +void BattleTransition_Start(u8 transitionId); bool8 IsBattleTransitionDone(void); -void Phase1_Task_RunFuncs(u8 taskId); +bool8 FldEff_Pokeball(void); +void TransitionPhase1_Task_RunFuncs(u8 taskId); +void sub_8149F58(u16 **a0, u16 **a1); + +extern const struct SpritePalette gFieldEffectObjectPaletteInfo10; enum // TRANSITION_MUGSHOT { diff --git a/include/bg.h b/include/bg.h index 0c6b4ac26..de3897fa4 100644 --- a/include/bg.h +++ b/include/bg.h @@ -70,7 +70,7 @@ void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset); void CopyBgTilemapBufferToVram(u8 bg); void CopyToBgTilemapBufferRect(u8 bg, void* src, u8 destX, u8 destY, u8 width, u8 height); void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, void *src, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette); -void CopyRectToBgTilemapBufferRect(u8 bg, void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2); +void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2); void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height); void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette); void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, s16 tileNumDelta); diff --git a/ld_script.txt b/ld_script.txt index c74413f19..49a87503a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -197,7 +197,6 @@ SECTIONS { src/landmark.o(.text); asm/fldeff_strength.o(.text); src/battle_transition.o(.text); - asm/battle_transition.o(.text); src/battle_controller_link_partner.o(.text); src/battle_message.o(.text); asm/cable_car.o(.text); diff --git a/src/battle_transition.c b/src/battle_transition.c index def302889..af156da12 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -18,6 +18,8 @@ #include "malloc.h" #include "gpu_regs.h" #include "decompress.h" +#include "bg.h" +#include "blend_palette.h" struct TransitionData { @@ -56,6 +58,8 @@ typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite); extern u16 gUnknown_020393A8[]; extern u16 gUnknown_02038C28[][0x3C0]; +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; extern const struct OamData gFieldObjectBaseOam_32x32; @@ -64,206 +68,205 @@ extern void sub_80AC3D0(void); extern void dp12_8087EA4(void); // this file's functions -void LaunchBattleTransitionTask(u8 transitionId); -void Task_BattleTransitionMain(u8 taskId); -void Phase1Task_TransitionAll(u8 taskId); -void Phase2Task_Blur(u8 taskId); -void Phase2Task_Swirl(u8 taskId); -void Phase2Task_Shuffle(u8 taskId); -void Phase2Task_BigPokeball(u8 taskId); -void Phase2Task_PokeballsTrail(u8 taskId); -void Phase2Task_Clockwise_BlackFade(u8 taskId); -void Phase2Task_Ripple(u8 taskId); -void Phase2Task_Wave(u8 taskId); -void Phase2Task_Slice(u8 taskId); -void Phase2Task_WhiteFade(u8 taskId); -void Phase2Task_GridSquares(u8 taskId); -void Phase2Task_Shards(u8 taskId); -void Phase2Task_Sydney(u8 taskId); -void Phase2Task_Phoebe(u8 taskId); -void Phase2Task_Glacia(u8 taskId); -void Phase2Task_Drake(u8 taskId); -void Phase2Task_Champion(u8 taskId); -void Phase2Task_Aqua(u8 taskId); -void Phase2Task_Magma(u8 taskId); -void Phase2Task_Regice(u8 taskId); -void Phase2Task_Registeel(u8 taskId); -void Phase2Task_Regirock(u8 taskId); -void Phase2Task_Kyogre(u8 taskId); -void Phase2Task_Groudon(u8 taskId); -void Phase2Task_Rayquaza(u8 taskId); -void Phase2Task_ShredSplit(u8 taskId); -void Phase2Task_Blackhole1(u8 taskId); -void Phase2Task_Blackhole2(u8 taskId); -void Phase2Task_RectangularSpiral(u8 taskId); -void Phase2Task_29(u8 taskId); -void Phase2Task_30(u8 taskId); -void Phase2Task_31(u8 taskId); -void Phase2Task_32(u8 taskId); -void Phase2Task_33(u8 taskId); -void VBlankCB_BattleTransition(void); -void VBlankCB_Phase2_Swirl(void); -void HBlankCB_Phase2_Swirl(void); -void VBlankCB_Phase2_Shuffle(void); -void HBlankCB_Phase2_Shuffle(void); -void VBlankCB0_Phase2_BigPokeball(void); -void VBlankCB1_Phase2_BigPokeball(void); -void VBlankCB_Phase2_Clockwise_BlackFade(void); -void VBlankCB_Phase2_Ripple(void); -void HBlankCB_Phase2_Ripple(void); -void VBlankCB_Phase2_30(void); -void HBlankCB_Phase2_30(void); -void VBlankCB_Phase2_Wave(void); -void VBlankCB_Phase2_Slice(void); -void HBlankCB_Phase2_Slice(void); -void VBlankCB0_Phase2_WhiteFade(void); -void VBlankCB1_Phase2_WhiteFade(void); -void HBlankCB_Phase2_WhiteFade(void); -void VBlankCB_Phase2_Shards(void); -void VBlankCB_Phase2_Rayquaza(void); -bool8 Phase2_Blur_Func1(struct Task *task); -bool8 Phase2_Blur_Func2(struct Task *task); -bool8 Phase2_Blur_Func3(struct Task *task); -bool8 Phase2_Swirl_Func1(struct Task *task); -bool8 Phase2_Swirl_Func2(struct Task *task); -bool8 Phase2_Shuffle_Func1(struct Task *task); -bool8 Phase2_Shuffle_Func2(struct Task *task); -bool8 Phase2_Aqua_Func1(struct Task *task); -bool8 Phase2_Aqua_Func2(struct Task *task); -bool8 Phase2_Magma_Func1(struct Task *task); -bool8 Phase2_Magma_Func2(struct Task *task); -bool8 Phase2_FramesCountdown(struct Task *task); -bool8 Phase2_Regi_Func1(struct Task *task); -bool8 Phase2_Regice_Func2(struct Task *task); -bool8 Phase2_Registeel_Func2(struct Task *task); -bool8 Phase2_Regirock_Func2(struct Task *task); -bool8 Phase2_WeatherTrio_Func1(struct Task *task); -bool8 Phase2_WaitPaletteFade(struct Task *task); -bool8 Phase2_Kyogre_Func3(struct Task *task); -bool8 Phase2_Kyogre_Func4(struct Task *task); -bool8 Phase2_Kyogre_Func5(struct Task *task); -bool8 Phase2_Groudon_Func3(struct Task *task); -bool8 Phase2_Groudon_Func4(struct Task *task); -bool8 Phase2_Groudon_Func5(struct Task *task); -bool8 Phase2_WeatherDuo_Func6(struct Task *task); -bool8 Phase2_WeatherDuo_Func7(struct Task *task); -bool8 Phase2_BigPokeball_Func1(struct Task *task); -bool8 Phase2_BigPokeball_Func2(struct Task *task); -bool8 Phase2_BigPokeball_Func3(struct Task *task); -bool8 Phase2_BigPokeball_Func4(struct Task *task); -bool8 Phase2_BigPokeball_Func5(struct Task *task); -bool8 Phase2_BigPokeball_Func6(struct Task *task); -bool8 Phase2_PokeballsTrail_Func1(struct Task *task); -bool8 Phase2_PokeballsTrail_Func2(struct Task *task); -bool8 Phase2_PokeballsTrail_Func3(struct Task *task); -bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task); -bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task); -bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task); -bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task); -bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task); -bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task); -bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task); -bool8 Phase2_Ripple_Func1(struct Task *task); -bool8 Phase2_Ripple_Func2(struct Task *task); -bool8 Phase2_Wave_Func1(struct Task *task); -bool8 Phase2_Wave_Func2(struct Task *task); -bool8 Phase2_Wave_Func3(struct Task *task); -bool8 Phase2_Slice_Func1(struct Task *task); -bool8 Phase2_Slice_Func2(struct Task *task); -bool8 Phase2_Slice_Func3(struct Task *task); -bool8 Phase2_WhiteFade_Func1(struct Task *task); -bool8 Phase2_WhiteFade_Func2(struct Task *task); -bool8 Phase2_WhiteFade_Func3(struct Task *task); -bool8 Phase2_WhiteFade_Func4(struct Task *task); -bool8 Phase2_WhiteFade_Func5(struct Task *task); -bool8 Phase2_GridSquares_Func1(struct Task *task); -bool8 Phase2_GridSquares_Func2(struct Task *task); -bool8 Phase2_GridSquares_Func3(struct Task *task); -bool8 Phase2_Shards_Func1(struct Task *task); -bool8 Phase2_Shards_Func2(struct Task *task); -bool8 Phase2_Shards_Func3(struct Task *task); -bool8 Phase2_Shards_Func4(struct Task *task); -bool8 Phase2_Shards_Func5(struct Task *task); -bool8 Phase2_ShredSplit_Func1(struct Task *task); -bool8 Phase2_ShredSplit_Func2(struct Task *task); -bool8 Phase2_ShredSplit_Func3(struct Task *task); -bool8 Phase2_ShredSplit_Func4(struct Task *task); -bool8 Phase2_Blackhole_Func1(struct Task *task); -bool8 Phase2_Blackhole1_Func2(struct Task *task); -bool8 Phase2_Blackhole1_Func3(struct Task *task); -bool8 Phase2_Blackhole2_Func2(struct Task *task); -bool8 Phase2_RectangularSpiral_Func1(struct Task *task); -bool8 Phase2_RectangularSpiral_Func2(struct Task *task); -bool8 Phase2_RectangularSpiral_Func3(struct Task *task); -bool8 Phase2_29_Func1(struct Task *task); -bool8 Phase2_29_Func2(struct Task *task); -bool8 Phase2_30_Func1(struct Task *task); -bool8 Phase2_30_Func2(struct Task *task); -bool8 Phase2_30_Func3(struct Task *task); -bool8 Phase2_30_Func4(struct Task *task); -bool8 Phase2_Rayquaza_Func3(struct Task *task); -bool8 Phase2_Rayquaza_Func4(struct Task *task); -bool8 Phase2_Rayquaza_Func5(struct Task *task); -bool8 Phase2_Rayquaza_Func6(struct Task *task); -bool8 Phase2_Rayquaza_Func7(struct Task *task); -bool8 Phase2_Rayquaza_Func8(struct Task *task); -bool8 Phase2_Rayquaza_Func9(struct Task *task); -bool8 Phase2_31_Func1(struct Task *task); -bool8 Phase2_31_Func2(struct Task *task); -bool8 Phase2_31_Func3(struct Task *task); -bool8 Phase2_31_33_Func5(struct Task *task); -bool8 Phase2_33_Func1(struct Task *task); -bool8 Phase2_33_Func2(struct Task *task); -bool8 Phase2_33_Func3(struct Task *task); -bool8 Phase2_33_Func4(struct Task *task); -bool8 Phase2_32_Func1(struct Task *task); -bool8 Phase2_32_Func2(struct Task *task); -bool8 Phase2_32_Func3(struct Task *task); -bool8 Phase2_32_Func4(struct Task *task); -bool8 Phase2_32_Func5(struct Task *task); -bool8 Phase2_Mugshot_Func1(struct Task *task); -bool8 Phase2_Mugshot_Func2(struct Task *task); -bool8 Phase2_Mugshot_Func3(struct Task *task); -bool8 Phase2_Mugshot_Func4(struct Task *task); -bool8 Phase2_Mugshot_Func5(struct Task *task); -bool8 Phase2_Mugshot_Func6(struct Task *task); -bool8 Phase2_Mugshot_Func7(struct Task *task); -bool8 Phase2_Mugshot_Func8(struct Task *task); -bool8 Phase2_Mugshot_Func9(struct Task *task); -bool8 Phase2_Mugshot_Func10(struct Task *task); -void Phase2Task_MugShotTransition(u8 taskId); -void Mugshots_CreateOpponentPlayerSprites(struct Task *task); -void VBlankCB0_Phase2_Mugshots(void); -void VBlankCB1_Phase2_Mugshots(void); -void HBlankCB_Phase2_Mugshots(void); -bool8 Transition_Phase1(struct Task *task); -bool8 Transition_WaitForPhase1(struct Task *task); -bool8 Transition_Phase2(struct Task *task); -bool8 Transition_WaitForPhase2(struct Task *task); -void sub_8149F08(void); -void sub_8149F84(void); -void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4); -void sub_814A014(u16 *a0, s16 a1, s16 a2, s16 a3); -void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize); -void sub_8149F58(u16 **a0, u16 **a1); -void sub_8149F40(u16 **a0); -void sub_814A1AC(s16 *a0, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6); -bool8 sub_814A228(s16 *a0, bool8 a1, bool8 a2); -void sub_8148484(s16 spriteId, s16 value); -void sub_814849C(s16 spriteId); -s16 sub_81484B8(s16 spriteId); -bool8 Phase1_TransitionAll_Func1(struct Task *task); -bool8 Phase1_TransitionAll_Func2(struct Task *task); -bool8 IsPhase1Done(void); -bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1); -void sub_814713C(struct Sprite *sprite); -void sub_8148380(struct Sprite *sprite); -void sub_8149864(struct Sprite *sprite); -bool8 sub_81483A8(struct Sprite *sprite); -bool8 sub_81483AC(struct Sprite *sprite); -bool8 sub_81483F8(struct Sprite *sprite); -bool8 sub_814842C(struct Sprite *sprite); -bool8 sub_8148458(struct Sprite *sprite); +static void LaunchBattleTransitionTask(u8 transitionId); +static void Task_BattleTransitionMain(u8 taskId); +static void Phase1Task_TransitionAll(u8 taskId); +static void Phase2Task_Blur(u8 taskId); +static void Phase2Task_Swirl(u8 taskId); +static void Phase2Task_Shuffle(u8 taskId); +static void Phase2Task_BigPokeball(u8 taskId); +static void Phase2Task_PokeballsTrail(u8 taskId); +static void Phase2Task_Clockwise_BlackFade(u8 taskId); +static void Phase2Task_Ripple(u8 taskId); +static void Phase2Task_Wave(u8 taskId); +static void Phase2Task_Slice(u8 taskId); +static void Phase2Task_WhiteFade(u8 taskId); +static void Phase2Task_GridSquares(u8 taskId); +static void Phase2Task_Shards(u8 taskId); +static void Phase2Task_Sydney(u8 taskId); +static void Phase2Task_Phoebe(u8 taskId); +static void Phase2Task_Glacia(u8 taskId); +static void Phase2Task_Drake(u8 taskId); +static void Phase2Task_Champion(u8 taskId); +static void Phase2Task_Aqua(u8 taskId); +static void Phase2Task_Magma(u8 taskId); +static void Phase2Task_Regice(u8 taskId); +static void Phase2Task_Registeel(u8 taskId); +static void Phase2Task_Regirock(u8 taskId); +static void Phase2Task_Kyogre(u8 taskId); +static void Phase2Task_Groudon(u8 taskId); +static void Phase2Task_Rayquaza(u8 taskId); +static void Phase2Task_ShredSplit(u8 taskId); +static void Phase2Task_Blackhole1(u8 taskId); +static void Phase2Task_Blackhole2(u8 taskId); +static void Phase2Task_RectangularSpiral(u8 taskId); +static void Phase2Task_29(u8 taskId); +static void Phase2Task_30(u8 taskId); +static void Phase2Task_31(u8 taskId); +static void Phase2Task_32(u8 taskId); +static void Phase2Task_33(u8 taskId); +static void VBlankCB_BattleTransition(void); +static void VBlankCB_Phase2_Swirl(void); +static void HBlankCB_Phase2_Swirl(void); +static void VBlankCB_Phase2_Shuffle(void); +static void HBlankCB_Phase2_Shuffle(void); +static void VBlankCB0_Phase2_BigPokeball(void); +static void VBlankCB1_Phase2_BigPokeball(void); +static void VBlankCB_Phase2_Clockwise_BlackFade(void); +static void VBlankCB_Phase2_Ripple(void); +static void HBlankCB_Phase2_Ripple(void); +static void VBlankCB_Phase2_30(void); +static void HBlankCB_Phase2_30(void); +static void VBlankCB_Phase2_Wave(void); +static void VBlankCB_Phase2_Slice(void); +static void HBlankCB_Phase2_Slice(void); +static void VBlankCB0_Phase2_WhiteFade(void); +static void VBlankCB1_Phase2_WhiteFade(void); +static void HBlankCB_Phase2_WhiteFade(void); +static void VBlankCB_Phase2_Shards(void); +static void VBlankCB_Phase2_Rayquaza(void); +static bool8 Phase2_Blur_Func1(struct Task *task); +static bool8 Phase2_Blur_Func2(struct Task *task); +static bool8 Phase2_Blur_Func3(struct Task *task); +static bool8 Phase2_Swirl_Func1(struct Task *task); +static bool8 Phase2_Swirl_Func2(struct Task *task); +static bool8 Phase2_Shuffle_Func1(struct Task *task); +static bool8 Phase2_Shuffle_Func2(struct Task *task); +static bool8 Phase2_Aqua_Func1(struct Task *task); +static bool8 Phase2_Aqua_Func2(struct Task *task); +static bool8 Phase2_Magma_Func1(struct Task *task); +static bool8 Phase2_Magma_Func2(struct Task *task); +static bool8 Phase2_FramesCountdown(struct Task *task); +static bool8 Phase2_Regi_Func1(struct Task *task); +static bool8 Phase2_Regice_Func2(struct Task *task); +static bool8 Phase2_Registeel_Func2(struct Task *task); +static bool8 Phase2_Regirock_Func2(struct Task *task); +static bool8 Phase2_WeatherTrio_Func1(struct Task *task); +static bool8 Phase2_WaitPaletteFade(struct Task *task); +static bool8 Phase2_Kyogre_Func3(struct Task *task); +static bool8 Phase2_Kyogre_Func4(struct Task *task); +static bool8 Phase2_Kyogre_Func5(struct Task *task); +static bool8 Phase2_Groudon_Func3(struct Task *task); +static bool8 Phase2_Groudon_Func4(struct Task *task); +static bool8 Phase2_Groudon_Func5(struct Task *task); +static bool8 Phase2_WeatherDuo_Func6(struct Task *task); +static bool8 Phase2_WeatherDuo_Func7(struct Task *task); +static bool8 Phase2_BigPokeball_Func1(struct Task *task); +static bool8 Phase2_BigPokeball_Func2(struct Task *task); +static bool8 Phase2_BigPokeball_Func3(struct Task *task); +static bool8 Phase2_BigPokeball_Func4(struct Task *task); +static bool8 Phase2_BigPokeball_Func5(struct Task *task); +static bool8 Phase2_BigPokeball_Func6(struct Task *task); +static bool8 Phase2_PokeballsTrail_Func1(struct Task *task); +static bool8 Phase2_PokeballsTrail_Func2(struct Task *task); +static bool8 Phase2_PokeballsTrail_Func3(struct Task *task); +static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task); +static bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task); +static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task); +static bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task); +static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task); +static bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task); +static bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task); +static bool8 Phase2_Ripple_Func1(struct Task *task); +static bool8 Phase2_Ripple_Func2(struct Task *task); +static bool8 Phase2_Wave_Func1(struct Task *task); +static bool8 Phase2_Wave_Func2(struct Task *task); +static bool8 Phase2_Wave_Func3(struct Task *task); +static bool8 Phase2_Slice_Func1(struct Task *task); +static bool8 Phase2_Slice_Func2(struct Task *task); +static bool8 Phase2_Slice_Func3(struct Task *task); +static bool8 Phase2_WhiteFade_Func1(struct Task *task); +static bool8 Phase2_WhiteFade_Func2(struct Task *task); +static bool8 Phase2_WhiteFade_Func3(struct Task *task); +static bool8 Phase2_WhiteFade_Func4(struct Task *task); +static bool8 Phase2_WhiteFade_Func5(struct Task *task); +static bool8 Phase2_GridSquares_Func1(struct Task *task); +static bool8 Phase2_GridSquares_Func2(struct Task *task); +static bool8 Phase2_GridSquares_Func3(struct Task *task); +static bool8 Phase2_Shards_Func1(struct Task *task); +static bool8 Phase2_Shards_Func2(struct Task *task); +static bool8 Phase2_Shards_Func3(struct Task *task); +static bool8 Phase2_Shards_Func4(struct Task *task); +static bool8 Phase2_Shards_Func5(struct Task *task); +static bool8 Phase2_ShredSplit_Func1(struct Task *task); +static bool8 Phase2_ShredSplit_Func2(struct Task *task); +static bool8 Phase2_ShredSplit_Func3(struct Task *task); +static bool8 Phase2_ShredSplit_Func4(struct Task *task); +static bool8 Phase2_Blackhole_Func1(struct Task *task); +static bool8 Phase2_Blackhole1_Func2(struct Task *task); +static bool8 Phase2_Blackhole1_Func3(struct Task *task); +static bool8 Phase2_Blackhole2_Func2(struct Task *task); +static bool8 Phase2_RectangularSpiral_Func1(struct Task *task); +static bool8 Phase2_RectangularSpiral_Func2(struct Task *task); +static bool8 Phase2_RectangularSpiral_Func3(struct Task *task); +static bool8 Phase2_29_Func1(struct Task *task); +static bool8 Phase2_29_Func2(struct Task *task); +static bool8 Phase2_30_Func1(struct Task *task); +static bool8 Phase2_30_Func2(struct Task *task); +static bool8 Phase2_30_Func3(struct Task *task); +static bool8 Phase2_30_Func4(struct Task *task); +static bool8 Phase2_Rayquaza_Func3(struct Task *task); +static bool8 Phase2_Rayquaza_Func4(struct Task *task); +static bool8 Phase2_Rayquaza_Func5(struct Task *task); +static bool8 Phase2_Rayquaza_Func6(struct Task *task); +static bool8 Phase2_Rayquaza_Func7(struct Task *task); +static bool8 Phase2_Rayquaza_Func8(struct Task *task); +static bool8 Phase2_Rayquaza_Func9(struct Task *task); +static bool8 Phase2_31_Func1(struct Task *task); +static bool8 Phase2_31_Func2(struct Task *task); +static bool8 Phase2_31_Func3(struct Task *task); +static bool8 Phase2_31_33_Func5(struct Task *task); +static bool8 Phase2_33_Func1(struct Task *task); +static bool8 Phase2_33_Func2(struct Task *task); +static bool8 Phase2_33_Func3(struct Task *task); +static bool8 Phase2_33_Func4(struct Task *task); +static bool8 Phase2_32_Func1(struct Task *task); +static bool8 Phase2_32_Func2(struct Task *task); +static bool8 Phase2_32_Func3(struct Task *task); +static bool8 Phase2_32_Func4(struct Task *task); +static bool8 Phase2_32_Func5(struct Task *task); +static bool8 Phase2_Mugshot_Func1(struct Task *task); +static bool8 Phase2_Mugshot_Func2(struct Task *task); +static bool8 Phase2_Mugshot_Func3(struct Task *task); +static bool8 Phase2_Mugshot_Func4(struct Task *task); +static bool8 Phase2_Mugshot_Func5(struct Task *task); +static bool8 Phase2_Mugshot_Func6(struct Task *task); +static bool8 Phase2_Mugshot_Func7(struct Task *task); +static bool8 Phase2_Mugshot_Func8(struct Task *task); +static bool8 Phase2_Mugshot_Func9(struct Task *task); +static bool8 Phase2_Mugshot_Func10(struct Task *task); +static void Phase2Task_MugShotTransition(u8 taskId); +static void Mugshots_CreateOpponentPlayerSprites(struct Task *task); +static void VBlankCB0_Phase2_Mugshots(void); +static void VBlankCB1_Phase2_Mugshots(void); +static void HBlankCB_Phase2_Mugshots(void); +static bool8 Transition_Phase1(struct Task *task); +static bool8 Transition_WaitForPhase1(struct Task *task); +static bool8 Transition_Phase2(struct Task *task); +static bool8 Transition_WaitForPhase2(struct Task *task); +static void sub_8149F08(void); +static void sub_8149F84(void); +static void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4); +static void sub_814A014(u16 *a0, s16 a1, s16 a2, s16 a3); +static void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize); +static void sub_8149F40(u16 **a0); +static void sub_814A1AC(s16 *a0, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6); +static bool8 sub_814A228(s16 *a0, bool8 a1, bool8 a2); +static void sub_8148484(s16 spriteId, s16 value); +static void sub_814849C(s16 spriteId); +static s16 sub_81484B8(s16 spriteId); +static bool8 Phase1_TransitionAll_Func1(struct Task *task); +static bool8 Phase1_TransitionAll_Func2(struct Task *task); +static bool8 IsPhase1Done(void); +static bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1); +static void sub_814713C(struct Sprite *sprite); +static void sub_8148380(struct Sprite *sprite); +static void sub_8149864(struct Sprite *sprite); +static bool8 sub_81483A8(struct Sprite *sprite); +static bool8 sub_81483AC(struct Sprite *sprite); +static bool8 sub_81483F8(struct Sprite *sprite); +static bool8 sub_814842C(struct Sprite *sprite); +static bool8 sub_8148458(struct Sprite *sprite); // iwram bss vars IWRAM_DATA static s16 sUnusedRectangularSpiralVar; @@ -275,53 +278,53 @@ IWRAM_DATA static struct StructRectangularSpiral sRectangularSpiralTransition[4] EWRAM_DATA static struct TransitionData *sTransitionStructPtr = NULL; // const rom data -const u32 sBigPokeball_Tileset[] = INCBIN_U32("graphics/battle_transitions/big_pokeball.4bpp"); -const u32 sPokeballTrail_Tileset[] = INCBIN_U32("graphics/battle_transitions/pokeball_trail.4bpp"); -const u8 sSpriteImage_85B98F0[] = INCBIN_U8("graphics/battle_transitions/pokeball.4bpp"); -const u32 sUnknown_085B9AF0[] = INCBIN_U32("graphics/battle_transitions/elite_four_bg.4bpp"); -const u8 sSpriteImage_85B9CD0[] = INCBIN_U8("graphics/battle_transitions/unused_brendan.4bpp"); -const u8 sSpriteImage_85BA4D0[] = INCBIN_U8("graphics/battle_transitions/unused_lass.4bpp"); -const u32 sShrinkingBoxTileset[] = INCBIN_U32("graphics/battle_transitions/shrinking_box.4bpp"); -const u32 sEvilTeam_Palette[] = INCBIN_U32("graphics/battle_transitions/evil_team.gbapal"); -const u32 sTeamAqua_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_aqua.4bpp.lz"); -const u32 sTeamAqua_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_aqua.bin.lz"); -const u32 sTeamMagma_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_magma.4bpp.lz"); -const u32 sTeamMagma_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_magma.bin.lz"); -const u32 gUnknown_085BBC14[] = INCBIN_U32("graphics/battle_transitions/85BBC14.4bpp"); -const u32 gUnknown_085BC2B4[] = INCBIN_U32("graphics/battle_transitions/85BC2B4.gbapal"); -const u32 gUnknown_085BC2D4[] = INCBIN_U32("graphics/battle_transitions/85BC2D4.gbapal"); -const u32 gUnknown_085BC2F4[] = INCBIN_U32("graphics/battle_transitions/85BC2F4.gbapal"); -const u32 gUnknown_085BC314[] = INCBIN_U32("graphics/battle_transitions/85BC314.bin"); -const u32 gUnknown_085BCB14[] = INCBIN_U32("graphics/battle_transitions/85BCB14.bin"); -const u32 gUnknown_085BD314[] = INCBIN_U32("graphics/battle_transitions/85BD314.bin"); -const u16 gUnknown_085BDB14[] = INCBIN_U16("graphics/battle_transitions/85BDB14.gbapal"); -const u32 gUnknown_085BDB34[] = INCBIN_U32("graphics/battle_transitions/kyogre.4bpp.lz"); -const u32 gUnknown_085BE1E8[] = INCBIN_U32("graphics/battle_transitions/kyogre.bin.lz"); -const u32 gUnknown_085BE51C[] = INCBIN_U32("graphics/battle_transitions/groudon.4bpp.lz"); -const u32 gUnknown_085BEA88[] = INCBIN_U32("graphics/battle_transitions/groudon.bin.lz"); -const u16 gUnknown_085BEDA0[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt1.gbapal"); -const u16 gUnknown_085BEEE0[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt2.gbapal"); -const u16 gUnknown_085BF0A0[] = INCBIN_U16("graphics/battle_transitions/groudon_pt1.gbapal"); -const u16 gUnknown_085BF2A0[] = INCBIN_U16("graphics/battle_transitions/groudon_pt2.gbapal"); -const u16 gUnknown_085BF4A0[] = INCBIN_U16("graphics/battle_transitions/rayquaza.gbapal"); -const u32 gUnknown_085BF6A0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.4bpp"); -const u32 gUnknown_085C6BE0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.bin"); -const u32 gUnknown_085C7BE0[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.gbapal"); -const u32 gUnknown_085C7C00[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.4bpp.lz"); -const u32 gUnknown_085C828C[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.bin.lz"); -const u32 gUnknown_085C8578[] = INCBIN_U32("graphics/battle_transitions/frontier_squares_blanktiles.gbapal"); -const u32 gUnknown_085C8598[] = INCBIN_U32("graphics/battle_transitions/frontier_square_1.4bpp.lz"); -const u32 gUnknown_085C86F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_2.4bpp.lz"); -const u32 gUnknown_085C87F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_3.4bpp.lz"); -const u32 gUnknown_085C88A4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_4.4bpp.lz"); -const u32 gUnknown_085C8928[] = INCBIN_U32("graphics/battle_transitions/frontier_squares.bin"); +static const u32 sBigPokeball_Tileset[] = INCBIN_U32("graphics/battle_transitions/big_pokeball.4bpp"); +static const u32 sPokeballTrail_Tileset[] = INCBIN_U32("graphics/battle_transitions/pokeball_trail.4bpp"); +static const u8 sSpriteImage_85B98F0[] = INCBIN_U8("graphics/battle_transitions/pokeball.4bpp"); +static const u32 sUnknown_085B9AF0[] = INCBIN_U32("graphics/battle_transitions/elite_four_bg.4bpp"); +static const u8 sSpriteImage_85B9CD0[] = INCBIN_U8("graphics/battle_transitions/unused_brendan.4bpp"); +static const u8 sSpriteImage_85BA4D0[] = INCBIN_U8("graphics/battle_transitions/unused_lass.4bpp"); +static const u32 sShrinkingBoxTileset[] = INCBIN_U32("graphics/battle_transitions/shrinking_box.4bpp"); +static const u32 sEvilTeam_Palette[] = INCBIN_U32("graphics/battle_transitions/evil_team.gbapal"); +static const u32 sTeamAqua_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_aqua.4bpp.lz"); +static const u32 sTeamAqua_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_aqua.bin.lz"); +static const u32 sTeamMagma_Tileset[] = INCBIN_U32("graphics/battle_transitions/team_magma.4bpp.lz"); +static const u32 sTeamMagma_Tilemap[] = INCBIN_U32("graphics/battle_transitions/team_magma.bin.lz"); +static const u32 gUnknown_085BBC14[] = INCBIN_U32("graphics/battle_transitions/85BBC14.4bpp"); +static const u32 gUnknown_085BC2B4[] = INCBIN_U32("graphics/battle_transitions/85BC2B4.gbapal"); +static const u32 gUnknown_085BC2D4[] = INCBIN_U32("graphics/battle_transitions/85BC2D4.gbapal"); +static const u32 gUnknown_085BC2F4[] = INCBIN_U32("graphics/battle_transitions/85BC2F4.gbapal"); +static const u32 gUnknown_085BC314[] = INCBIN_U32("graphics/battle_transitions/85BC314.bin"); +static const u32 gUnknown_085BCB14[] = INCBIN_U32("graphics/battle_transitions/85BCB14.bin"); +static const u32 gUnknown_085BD314[] = INCBIN_U32("graphics/battle_transitions/85BD314.bin"); +static const u16 gUnknown_085BDB14[] = INCBIN_U16("graphics/battle_transitions/85BDB14.gbapal"); +static const u32 gUnknown_085BDB34[] = INCBIN_U32("graphics/battle_transitions/kyogre.4bpp.lz"); +static const u32 gUnknown_085BE1E8[] = INCBIN_U32("graphics/battle_transitions/kyogre.bin.lz"); +static const u32 gUnknown_085BE51C[] = INCBIN_U32("graphics/battle_transitions/groudon.4bpp.lz"); +static const u32 gUnknown_085BEA88[] = INCBIN_U32("graphics/battle_transitions/groudon.bin.lz"); +static const u16 gUnknown_085BEDA0[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt1.gbapal"); +static const u16 gUnknown_085BEEE0[] = INCBIN_U16("graphics/battle_transitions/kyogre_pt2.gbapal"); +static const u16 gUnknown_085BF0A0[] = INCBIN_U16("graphics/battle_transitions/groudon_pt1.gbapal"); +static const u16 gUnknown_085BF2A0[] = INCBIN_U16("graphics/battle_transitions/groudon_pt2.gbapal"); +static const u16 gUnknown_085BF4A0[] = INCBIN_U16("graphics/battle_transitions/rayquaza.gbapal"); +static const u32 gUnknown_085BF6A0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.4bpp"); +static const u32 gUnknown_085C6BE0[] = INCBIN_U32("graphics/battle_transitions/rayquaza.bin"); +static const u32 gUnknown_085C7BE0[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.gbapal"); +static const u32 gUnknown_085C7C00[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.4bpp.lz"); +static const u32 gUnknown_085C828C[] = INCBIN_U32("graphics/battle_transitions/frontier_brain.bin.lz"); +static const u32 gUnknown_085C8578[] = INCBIN_U32("graphics/battle_transitions/frontier_squares_blanktiles.gbapal"); +static const u32 gUnknown_085C8598[] = INCBIN_U32("graphics/battle_transitions/frontier_square_1.4bpp.lz"); +static const u32 gUnknown_085C86F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_2.4bpp.lz"); +static const u32 gUnknown_085C87F4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_3.4bpp.lz"); +static const u32 gUnknown_085C88A4[] = INCBIN_U32("graphics/battle_transitions/frontier_square_4.4bpp.lz"); +static const u32 gUnknown_085C8928[] = INCBIN_U32("graphics/battle_transitions/frontier_squares.bin"); -const TaskFunc sPhase1_Tasks[B_TRANSITION_COUNT] = +static const TaskFunc sPhase1_Tasks[B_TRANSITION_COUNT] = { [0 ... B_TRANSITION_COUNT - 1] = &Phase1Task_TransitionAll }; -const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = +static const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = { Phase2Task_Blur, // 0 Phase2Task_Swirl, // 1 @@ -367,7 +370,7 @@ const TaskFunc sPhase2_Tasks[B_TRANSITION_COUNT] = Phase2Task_41, // 41 }; -const TransitionStateFunc sMainTransitionPhases[] = +static const TransitionStateFunc sMainTransitionPhases[] = { &Transition_Phase1, &Transition_WaitForPhase1, @@ -375,26 +378,26 @@ const TransitionStateFunc sMainTransitionPhases[] = &Transition_WaitForPhase2 }; -const TransitionStateFunc sPhase2_Blur_Funcs[] = +static const TransitionStateFunc sPhase2_Blur_Funcs[] = { Phase2_Blur_Func1, Phase2_Blur_Func2, Phase2_Blur_Func3 }; -const TransitionStateFunc sPhase2_Swirl_Funcs[] = +static const TransitionStateFunc sPhase2_Swirl_Funcs[] = { Phase2_Swirl_Func1, Phase2_Swirl_Func2, }; -const TransitionStateFunc sPhase2_Shuffle_Funcs[] = +static const TransitionStateFunc sPhase2_Shuffle_Funcs[] = { Phase2_Shuffle_Func1, Phase2_Shuffle_Func2, }; -const TransitionStateFunc sPhase2_Aqua_Funcs[] = +static const TransitionStateFunc sPhase2_Aqua_Funcs[] = { Phase2_Aqua_Func1, Phase2_Aqua_Func2, @@ -405,7 +408,7 @@ const TransitionStateFunc sPhase2_Aqua_Funcs[] = Phase2_BigPokeball_Func6 }; -const TransitionStateFunc sPhase2_Magma_Funcs[] = +static const TransitionStateFunc sPhase2_Magma_Funcs[] = { Phase2_Magma_Func1, Phase2_Magma_Func2, @@ -416,7 +419,7 @@ const TransitionStateFunc sPhase2_Magma_Funcs[] = Phase2_BigPokeball_Func6 }; -const TransitionStateFunc sPhase2_BigPokeball_Funcs[] = +static const TransitionStateFunc sPhase2_BigPokeball_Funcs[] = { Phase2_BigPokeball_Func1, Phase2_BigPokeball_Func2, @@ -426,7 +429,7 @@ const TransitionStateFunc sPhase2_BigPokeball_Funcs[] = Phase2_BigPokeball_Func6 }; -const TransitionStateFunc sPhase2_Regice_Funcs[] = +static const TransitionStateFunc sPhase2_Regice_Funcs[] = { Phase2_Regi_Func1, Phase2_Regice_Func2, @@ -436,7 +439,7 @@ const TransitionStateFunc sPhase2_Regice_Funcs[] = Phase2_BigPokeball_Func6 }; -const TransitionStateFunc sPhase2_Registeel_Funcs[] = +static const TransitionStateFunc sPhase2_Registeel_Funcs[] = { Phase2_Regi_Func1, Phase2_Registeel_Func2, @@ -446,7 +449,7 @@ const TransitionStateFunc sPhase2_Registeel_Funcs[] = Phase2_BigPokeball_Func6 }; -const TransitionStateFunc sPhase2_Regirock_Funcs[] = +static const TransitionStateFunc sPhase2_Regirock_Funcs[] = { Phase2_Regi_Func1, Phase2_Regirock_Func2, @@ -456,7 +459,7 @@ const TransitionStateFunc sPhase2_Regirock_Funcs[] = Phase2_BigPokeball_Func6 }; -const TransitionStateFunc sPhase2_Kyogre_Funcs[] = +static const TransitionStateFunc sPhase2_Kyogre_Funcs[] = { Phase2_WeatherTrio_Func1, Phase2_WaitPaletteFade, @@ -468,18 +471,18 @@ const TransitionStateFunc sPhase2_Kyogre_Funcs[] = Phase2_WeatherDuo_Func7 }; -const TransitionStateFunc sPhase2_PokeballsTrail_Funcs[] = +static const TransitionStateFunc sPhase2_PokeballsTrail_Funcs[] = { Phase2_PokeballsTrail_Func1, Phase2_PokeballsTrail_Func2, Phase2_PokeballsTrail_Func3 }; -const s16 sUnknown_085C8B88[2] = {-16, 256}; -const s16 sUnknown_085C8B8C[5] = {0, 32, 64, 18, 48}; -const s16 sUnknown_085C8B96[2] = {8, -8}; +static const s16 sUnknown_085C8B88[2] = {-16, 256}; +static const s16 sUnknown_085C8B8C[5] = {0, 32, 64, 18, 48}; +static const s16 sUnknown_085C8B96[2] = {8, -8}; -const TransitionStateFunc sPhase2_Clockwise_BlackFade_Funcs[] = +static const TransitionStateFunc sPhase2_Clockwise_BlackFade_Funcs[] = { Phase2_Clockwise_BlackFade_Func1, Phase2_Clockwise_BlackFade_Func2, @@ -490,20 +493,20 @@ const TransitionStateFunc sPhase2_Clockwise_BlackFade_Funcs[] = Phase2_Clockwise_BlackFade_Func7 }; -const TransitionStateFunc sPhase2_Ripple_Funcs[] = +static const TransitionStateFunc sPhase2_Ripple_Funcs[] = { Phase2_Ripple_Func1, Phase2_Ripple_Func2 }; -const TransitionStateFunc sPhase2_Wave_Funcs[] = +static const TransitionStateFunc sPhase2_Wave_Funcs[] = { Phase2_Wave_Func1, Phase2_Wave_Func2, Phase2_Wave_Func3 }; -const TransitionStateFunc sPhase2_Mugshot_Funcs[] = +static const TransitionStateFunc sPhase2_Mugshot_Funcs[] = { Phase2_Mugshot_Func1, Phase2_Mugshot_Func2, @@ -517,7 +520,7 @@ const TransitionStateFunc sPhase2_Mugshot_Funcs[] = Phase2_Mugshot_Func10 }; -const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] = +static const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] = { TRAINER_PIC_ELITE_FOUR_SIDNEY, TRAINER_PIC_ELITE_FOUR_PHOEBE, @@ -525,7 +528,7 @@ const u8 sMugshotsTrainerPicIDsTable[MUGSHOTS_COUNT] = TRAINER_PIC_ELITE_FOUR_DRAKE, TRAINER_PIC_CHAMPION_WALLACE }; -const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] = +static const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] = { {0x200, 0x200}, {0x200, 0x200}, @@ -533,7 +536,7 @@ const s16 sMugshotsOpponentRotationScales[MUGSHOTS_COUNT][2] = {0x1A0, 0x1A0}, {0x188, 0x188}, }; -const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] = +static const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] = { {0, 0}, {0, 0}, @@ -542,7 +545,7 @@ const s16 sMugshotsOpponentCoords[MUGSHOTS_COUNT][2] = {-8, 7}, }; -const TransitionSpriteCallback sUnknown_085C8C24[] = +static const TransitionSpriteCallback sUnknown_085C8C24[] = { sub_81483A8, sub_81483AC, @@ -553,17 +556,17 @@ const TransitionSpriteCallback sUnknown_085C8C24[] = sub_81483A8 }; -const s16 sUnknown_085C8C40[2] = {12, -12}; -const s16 sUnknown_085C8C44[2] = {-1, 1}; +static const s16 sUnknown_085C8C40[2] = {12, -12}; +static const s16 sUnknown_085C8C44[2] = {-1, 1}; -const TransitionStateFunc sPhase2_Slice_Funcs[] = +static const TransitionStateFunc sPhase2_Slice_Funcs[] = { Phase2_Slice_Func1, Phase2_Slice_Func2, Phase2_Slice_Func3 }; -const TransitionStateFunc sPhase2_ShredSplit_Funcs[] = +static const TransitionStateFunc sPhase2_ShredSplit_Funcs[] = { Phase2_ShredSplit_Func1, Phase2_ShredSplit_Func2, @@ -571,49 +574,49 @@ const TransitionStateFunc sPhase2_ShredSplit_Funcs[] = Phase2_ShredSplit_Func4 }; -const u8 gUnknown_085C8C64[] = {39, 119}; -const s16 gUnknown_085C8C66[] = {1, -1}; +static const u8 gUnknown_085C8C64[] = {39, 119}; +static const s16 gUnknown_085C8C66[] = {1, -1}; -const TransitionStateFunc sPhase2_Blackhole1_Funcs[] = +static const TransitionStateFunc sPhase2_Blackhole1_Funcs[] = { Phase2_Blackhole_Func1, Phase2_Blackhole1_Func2, Phase2_Blackhole1_Func3 }; -const TransitionStateFunc sPhase2_Blackhole2_Funcs[] = +static const TransitionStateFunc sPhase2_Blackhole2_Funcs[] = { Phase2_Blackhole_Func1, Phase2_Blackhole2_Func2 }; -const s16 gUnknown_085C8C80[] = {-6, 4}; +static const s16 gUnknown_085C8C80[] = {-6, 4}; -const TransitionStateFunc sPhase2_RectangularSpiral_Funcs[] = +static const TransitionStateFunc sPhase2_RectangularSpiral_Funcs[] = { Phase2_RectangularSpiral_Func1, Phase2_RectangularSpiral_Func2, Phase2_RectangularSpiral_Func3 }; -const s16 gUnknown_085C8C90[] = {1, 27, 275, -1}; -const s16 gUnknown_085C8C98[] = {2, 486, -1}; -const s16 gUnknown_085C8C9E[] = {3, 262, -1}; -const s16 gUnknown_085C8CA4[] = {4, 507, -2}; -const s16 gUnknown_085C8CAA[] = {1, 213, -1}; -const s16 gUnknown_085C8CB0[] = {2, 548, -2}; -const s16 gUnknown_085C8CB6[] = {3, 196, -1}; -const s16 gUnknown_085C8CBC[] = {4, 573, 309, -1}; -const s16 gUnknown_085C8CC4[] = {1, 474, -1}; -const s16 gUnknown_085C8CCA[] = {2, 295, 32, -1}; -const s16 gUnknown_085C8CD2[] = {3, 58, -1}; -const s16 gUnknown_085C8CD8[] = {4, 455, -1}; -const s16 gUnknown_085C8CDE[] = {1, 540, -1}; -const s16 gUnknown_085C8CE4[] = {2, 229, -1}; -const s16 gUnknown_085C8CEA[] = {3, 244, 28, -1}; -const s16 gUnknown_085C8CF2[] = {4, 517, -1}; +static const s16 gUnknown_085C8C90[] = {1, 27, 275, -1}; +static const s16 gUnknown_085C8C98[] = {2, 486, -1}; +static const s16 gUnknown_085C8C9E[] = {3, 262, -1}; +static const s16 gUnknown_085C8CA4[] = {4, 507, -2}; +static const s16 gUnknown_085C8CAA[] = {1, 213, -1}; +static const s16 gUnknown_085C8CB0[] = {2, 548, -2}; +static const s16 gUnknown_085C8CB6[] = {3, 196, -1}; +static const s16 gUnknown_085C8CBC[] = {4, 573, 309, -1}; +static const s16 gUnknown_085C8CC4[] = {1, 474, -1}; +static const s16 gUnknown_085C8CCA[] = {2, 295, 32, -1}; +static const s16 gUnknown_085C8CD2[] = {3, 58, -1}; +static const s16 gUnknown_085C8CD8[] = {4, 455, -1}; +static const s16 gUnknown_085C8CDE[] = {1, 540, -1}; +static const s16 gUnknown_085C8CE4[] = {2, 229, -1}; +static const s16 gUnknown_085C8CEA[] = {3, 244, 28, -1}; +static const s16 gUnknown_085C8CF2[] = {4, 517, -1}; -const s16 *const gUnknown_085C8CF8[] = +static const s16 *const gUnknown_085C8CF8[] = { gUnknown_085C8C90, gUnknown_085C8CA4, @@ -625,7 +628,7 @@ const s16 *const gUnknown_085C8CF8[] = gUnknown_085C8CDE }; -const s16 *const gUnknown_085C8D18[] = +static const s16 *const gUnknown_085C8D18[] = { gUnknown_085C8CBC, gUnknown_085C8CB0, @@ -637,13 +640,13 @@ const s16 *const gUnknown_085C8D18[] = gUnknown_085C8CD2 }; -const s16 *const *const gUnknown_085C8D38[] = +static const s16 *const *const gUnknown_085C8D38[] = { gUnknown_085C8CF8, gUnknown_085C8D18 }; -const TransitionStateFunc sPhase2_Groudon_Funcs[] = +static const TransitionStateFunc sPhase2_Groudon_Funcs[] = { Phase2_WeatherTrio_Func1, Phase2_WaitPaletteFade, @@ -655,7 +658,7 @@ const TransitionStateFunc sPhase2_Groudon_Funcs[] = Phase2_WeatherDuo_Func7 }; -const TransitionStateFunc sPhase2_Rayquaza_Funcs[] = +static const TransitionStateFunc sPhase2_Rayquaza_Funcs[] = { Phase2_WeatherTrio_Func1, Phase2_WaitPaletteFade, @@ -670,7 +673,7 @@ const TransitionStateFunc sPhase2_Rayquaza_Funcs[] = Phase2_Blackhole1_Func3 }; -const TransitionStateFunc sPhase2_WhiteFade_Funcs[] = +static const TransitionStateFunc sPhase2_WhiteFade_Funcs[] = { Phase2_WhiteFade_Func1, Phase2_WhiteFade_Func2, @@ -679,16 +682,16 @@ const TransitionStateFunc sPhase2_WhiteFade_Funcs[] = Phase2_WhiteFade_Func5 }; -const s16 sUnknown_085C8DA0[] = {0, 20, 15, 40, 10, 25, 35, 5}; +static const s16 sUnknown_085C8DA0[] = {0, 20, 15, 40, 10, 25, 35, 5}; -const TransitionStateFunc sPhase2_GridSquares_Funcs[] = +static const TransitionStateFunc sPhase2_GridSquares_Funcs[] = { Phase2_GridSquares_Func1, Phase2_GridSquares_Func2, Phase2_GridSquares_Func3 }; -const TransitionStateFunc sPhase2_Shards_Funcs[] = +static const TransitionStateFunc sPhase2_Shards_Funcs[] = { Phase2_Shards_Func1, Phase2_Shards_Func2, @@ -697,7 +700,7 @@ const TransitionStateFunc sPhase2_Shards_Funcs[] = Phase2_Shards_Func5 }; -const s16 sUnknown_085C8DD0[][5] = +static const s16 sUnknown_085C8DD0[][5] = { {56, 0, 0, 160, 0}, {104, 160, 240, 88, 1}, @@ -708,49 +711,49 @@ const s16 sUnknown_085C8DD0[][5] = {168, 160, 48, 0, 1}, }; -const s16 sUnknown_085C8E16[] = {8, 4, 2, 1, 1, 1, 0}; +static const s16 sUnknown_085C8E16[] = {8, 4, 2, 1, 1, 1, 0}; -const TransitionStateFunc sPhase1_TransitionAll_Funcs[] = +static const TransitionStateFunc sPhase1_TransitionAll_Funcs[] = { Phase1_TransitionAll_Func1, Phase1_TransitionAll_Func2 }; -const struct SpriteFrameImage sSpriteImageTable_85C8E2C[] = +static const struct SpriteFrameImage sSpriteImageTable_85C8E2C[] = { sSpriteImage_85B98F0, 0x200 }; -const union AnimCmd sSpriteAnim_85C8E34[] = +static const union AnimCmd sSpriteAnim_85C8E34[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END }; -const union AnimCmd *const sSpriteAnimTable_85C8E3C[] = +static const union AnimCmd *const sSpriteAnimTable_85C8E3C[] = { sSpriteAnim_85C8E34 }; -const union AffineAnimCmd sSpriteAffineAnim_85C8E40[] = +static const union AffineAnimCmd sSpriteAffineAnim_85C8E40[] = { AFFINEANIMCMD_FRAME(0, 0, -4, 1), AFFINEANIMCMD_JUMP(0) }; -const union AffineAnimCmd sSpriteAffineAnim_85C8E50[] = +static const union AffineAnimCmd sSpriteAffineAnim_85C8E50[] = { AFFINEANIMCMD_FRAME(0, 0, 4, 1), AFFINEANIMCMD_JUMP(0) }; -const union AffineAnimCmd *const sSpriteAffineAnimTable_85C8E60[] = +static const union AffineAnimCmd *const sSpriteAffineAnimTable_85C8E60[] = { sSpriteAffineAnim_85C8E40, sSpriteAffineAnim_85C8E50 }; -const struct SpriteTemplate gUnknown_085C8E68 = +static const struct SpriteTemplate gUnknown_085C8E68 = { .tileTag = 0xFFFF, .paletteTag = 4105, @@ -761,7 +764,7 @@ const struct SpriteTemplate gUnknown_085C8E68 = .callback = sub_814713C }; -const struct OamData gOamData_85C8E80 = +static const struct OamData gOamData_85C8E80 = { .y = 0, .affineMode = 0, @@ -778,28 +781,28 @@ const struct OamData gOamData_85C8E80 = .affineParam = 0, }; -const struct SpriteFrameImage sSpriteImageTable_85C8E88[] = +static const struct SpriteFrameImage sSpriteImageTable_85C8E88[] = { sSpriteImage_85B9CD0, 0x800 }; -const struct SpriteFrameImage sSpriteImageTable_85C8E90[] = +static const struct SpriteFrameImage sSpriteImageTable_85C8E90[] = { sSpriteImage_85BA4D0, 0x800 }; -const union AnimCmd sSpriteAnim_85C8E98[] = +static const union AnimCmd sSpriteAnim_85C8E98[] = { ANIMCMD_FRAME(0, 1), ANIMCMD_END }; -const union AnimCmd *const sSpriteAnimTable_85C8EA0[] = +static const union AnimCmd *const sSpriteAnimTable_85C8EA0[] = { sSpriteAnim_85C8E98 }; -const struct SpriteTemplate sSpriteTemplate_85C8EA4 = +static const struct SpriteTemplate sSpriteTemplate_85C8EA4 = { .tileTag = 0xFFFF, .paletteTag = 4106, @@ -810,7 +813,7 @@ const struct SpriteTemplate sSpriteTemplate_85C8EA4 = .callback = sub_8148380 }; -const struct SpriteTemplate sSpriteTemplate_85C8EBC = +static const struct SpriteTemplate sSpriteTemplate_85C8EBC = { .tileTag = 0xFFFF, .paletteTag = 4106, @@ -821,22 +824,22 @@ const struct SpriteTemplate sSpriteTemplate_85C8EBC = .callback = sub_8148380 }; -const u16 gFieldEffectObjectPalette10[] = INCBIN_U16("graphics/map_objects/palettes/field_effect_object_palette_10.gbapal"); +static const u16 gFieldEffectObjectPalette10[] = INCBIN_U16("graphics/map_objects/palettes/field_effect_object_palette_10.gbapal"); const struct SpritePalette gFieldEffectObjectPaletteInfo10 = { gFieldEffectObjectPalette10, 0x1009 }; -const u16 sMugshotPal_Sydney[] = INCBIN_U16("graphics/battle_transitions/sidney_bg.gbapal"); -const u16 sMugshotPal_Phoebe[] = INCBIN_U16("graphics/battle_transitions/phoebe_bg.gbapal"); -const u16 sMugshotPal_Glacia[] = INCBIN_U16("graphics/battle_transitions/glacia_bg.gbapal"); -const u16 sMugshotPal_Drake[] = INCBIN_U16("graphics/battle_transitions/drake_bg.gbapal"); -const u16 sMugshotPal_Champion[] = INCBIN_U16("graphics/battle_transitions/wallace_bg.gbapal"); -const u16 sMugshotPal_Brendan[] = INCBIN_U16("graphics/battle_transitions/brendan_bg.gbapal"); -const u16 sMugshotPal_May[] = INCBIN_U16("graphics/battle_transitions/may_bg.gbapal"); +static const u16 sMugshotPal_Sydney[] = INCBIN_U16("graphics/battle_transitions/sidney_bg.gbapal"); +static const u16 sMugshotPal_Phoebe[] = INCBIN_U16("graphics/battle_transitions/phoebe_bg.gbapal"); +static const u16 sMugshotPal_Glacia[] = INCBIN_U16("graphics/battle_transitions/glacia_bg.gbapal"); +static const u16 sMugshotPal_Drake[] = INCBIN_U16("graphics/battle_transitions/drake_bg.gbapal"); +static const u16 sMugshotPal_Champion[] = INCBIN_U16("graphics/battle_transitions/wallace_bg.gbapal"); +static const u16 sMugshotPal_Brendan[] = INCBIN_U16("graphics/battle_transitions/brendan_bg.gbapal"); +static const u16 sMugshotPal_May[] = INCBIN_U16("graphics/battle_transitions/may_bg.gbapal"); -const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT] = +static const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT] = { sMugshotPal_Sydney, sMugshotPal_Phoebe, @@ -845,22 +848,22 @@ const u16 *const sOpponentMugshotsPals[MUGSHOTS_COUNT] = sMugshotPal_Champion }; -const u16 *const sPlayerMugshotsPals[2] = +static const u16 *const sPlayerMugshotsPals[2] = { sMugshotPal_Brendan, sMugshotPal_May }; -const u16 sUnusedTrainerPalette[] = INCBIN_U16("graphics/battle_transitions/unused_trainer.gbapal"); -const struct SpritePalette sSpritePalette_UnusedTrainer = +static const u16 sUnusedTrainerPalette[] = INCBIN_U16("graphics/battle_transitions/unused_trainer.gbapal"); +static const struct SpritePalette sSpritePalette_UnusedTrainer = { sUnusedTrainerPalette, 0x100A }; -const u16 sBigPokeball_Tilemap[] = INCBIN_U16("graphics/battle_transitions/big_pokeball_map.bin"); -const u16 sMugshotsTilemap[] = INCBIN_U16("graphics/battle_transitions/elite_four_bg_map.bin"); +static const u16 sBigPokeball_Tilemap[] = INCBIN_U16("graphics/battle_transitions/big_pokeball_map.bin"); +static const u16 sMugshotsTilemap[] = INCBIN_U16("graphics/battle_transitions/elite_four_bg_map.bin"); -const TransitionStateFunc sPhase2_29_Funcs[] = +static const TransitionStateFunc sPhase2_29_Funcs[] = { Phase2_29_Func1, Phase2_29_Func2, @@ -870,7 +873,7 @@ const TransitionStateFunc sPhase2_29_Funcs[] = Phase2_BigPokeball_Func6 }; -const TransitionStateFunc sPhase2_30_Funcs[] = +static const TransitionStateFunc sPhase2_30_Funcs[] = { Phase2_30_Func1, Phase2_30_Func2, @@ -878,7 +881,7 @@ const TransitionStateFunc sPhase2_30_Funcs[] = Phase2_30_Func4 }; -const TransitionStateFunc sPhase2_31_Funcs[] = +static const TransitionStateFunc sPhase2_31_Funcs[] = { Phase2_31_Func1, Phase2_31_Func2, @@ -886,7 +889,7 @@ const TransitionStateFunc sPhase2_31_Funcs[] = Phase2_31_33_Func5 }; -const TransitionStateFunc sPhase2_33_Funcs[] = +static const TransitionStateFunc sPhase2_33_Funcs[] = { Phase2_33_Func1, Phase2_33_Func2, @@ -895,7 +898,7 @@ const TransitionStateFunc sPhase2_33_Funcs[] = Phase2_31_33_Func5 }; -const TransitionStateFunc sPhase2_32_Funcs[] = +static const TransitionStateFunc sPhase2_32_Funcs[] = { Phase2_32_Func1, Phase2_32_Func2, @@ -904,8 +907,8 @@ const TransitionStateFunc sPhase2_32_Funcs[] = Phase2_32_Func5 }; -const u8 gUnknown_085C9A30[] = {0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x1b, 0x14, 0x0d, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0e, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x13, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x10, 0x11, 0x12}; -const u8 gUnknown_085C9A53[] = {0x00, 0x10, 0x29, 0x16, 0x2c, 0x02, 0x2b, 0x15, 0x2e, 0x1b, 0x09, 0x30, 0x26, 0x05, 0x39, 0x3b, 0x0c, 0x3f, 0x23, 0x1c, 0x0a, 0x35, 0x07, 0x31, 0x27, 0x17, 0x37, 0x01, 0x3e, 0x11, 0x3d, 0x1e, 0x06, 0x22, 0x0f, 0x33, 0x20, 0x3a, 0x0d, 0x2d, 0x25, 0x34, 0x0b, 0x18, 0x3c, 0x13, 0x38, 0x21, 0x1d, 0x32, 0x28, 0x36, 0x0e, 0x03, 0x2f, 0x14, 0x12, 0x19, 0x04, 0x24, 0x1a, 0x2a, 0x1f, 0x08, 0x00}; +static const u8 gUnknown_085C9A30[] = {0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x1b, 0x14, 0x0d, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x07, 0x0e, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x13, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x10, 0x11, 0x12}; +static const u8 gUnknown_085C9A53[] = {0x00, 0x10, 0x29, 0x16, 0x2c, 0x02, 0x2b, 0x15, 0x2e, 0x1b, 0x09, 0x30, 0x26, 0x05, 0x39, 0x3b, 0x0c, 0x3f, 0x23, 0x1c, 0x0a, 0x35, 0x07, 0x31, 0x27, 0x17, 0x37, 0x01, 0x3e, 0x11, 0x3d, 0x1e, 0x06, 0x22, 0x0f, 0x33, 0x20, 0x3a, 0x0d, 0x2d, 0x25, 0x34, 0x0b, 0x18, 0x3c, 0x13, 0x38, 0x21, 0x1d, 0x32, 0x28, 0x36, 0x0e, 0x03, 0x2f, 0x14, 0x12, 0x19, 0x04, 0x24, 0x1a, 0x2a, 0x1f, 0x08, 0x00}; // code static void CB2_TestBattleTransition(void) @@ -970,19 +973,19 @@ bool8 IsBattleTransitionDone(void) } } -void LaunchBattleTransitionTask(u8 transitionId) +static void LaunchBattleTransitionTask(u8 transitionId) { u8 taskId = CreateTask(Task_BattleTransitionMain, 2); gTasks[taskId].tTransitionId = transitionId; sTransitionStructPtr = AllocZeroed(sizeof(*sTransitionStructPtr)); } -void Task_BattleTransitionMain(u8 taskId) +static void Task_BattleTransitionMain(u8 taskId) { while (sMainTransitionPhases[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Transition_Phase1(struct Task *task) +static bool8 Transition_Phase1(struct Task *task) { sub_80AC3D0(); CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, 0x400); @@ -999,7 +1002,7 @@ bool8 Transition_Phase1(struct Task *task) } } -bool8 Transition_WaitForPhase1(struct Task *task) +static bool8 Transition_WaitForPhase1(struct Task *task) { if (FindTaskIdByFunc(sPhase1_Tasks[task->tTransitionId]) == 0xFF) { @@ -1012,14 +1015,14 @@ bool8 Transition_WaitForPhase1(struct Task *task) } } -bool8 Transition_Phase2(struct Task *task) +static bool8 Transition_Phase2(struct Task *task) { CreateTask(sPhase2_Tasks[task->tTransitionId], 0); task->tState++; return FALSE; } -bool8 Transition_WaitForPhase2(struct Task *task) +static bool8 Transition_WaitForPhase2(struct Task *task) { task->tTransitionDone = FALSE; if (FindTaskIdByFunc(sPhase2_Tasks[task->tTransitionId]) == 0xFF) @@ -1030,7 +1033,7 @@ bool8 Transition_WaitForPhase2(struct Task *task) #undef tTransitionId #undef tTransitionDone -void Phase1Task_TransitionAll(u8 taskId) +static void Phase1Task_TransitionAll(u8 taskId) { if (gTasks[taskId].tState == 0) { @@ -1056,12 +1059,12 @@ void Phase1Task_TransitionAll(u8 taskId) #define tPlayerSpriteId data[14] #define tMugshotId data[15] -void Phase2Task_Blur(u8 taskId) +static void Phase2Task_Blur(u8 taskId) { while (sPhase2_Blur_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Blur_Func1(struct Task *task) +static bool8 Phase2_Blur_Func1(struct Task *task) { SetGpuReg(REG_OFFSET_MOSAIC, 0); SetGpuRegBits(REG_OFFSET_BG1CNT, BGCNT_MOSAIC); @@ -1071,7 +1074,7 @@ bool8 Phase2_Blur_Func1(struct Task *task) return TRUE; } -bool8 Phase2_Blur_Func2(struct Task *task) +static bool8 Phase2_Blur_Func2(struct Task *task) { if (task->tData1 != 0) { @@ -1089,7 +1092,7 @@ bool8 Phase2_Blur_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Blur_Func3(struct Task *task) +static bool8 Phase2_Blur_Func3(struct Task *task) { if (!gPaletteFade.active) { @@ -1099,12 +1102,12 @@ bool8 Phase2_Blur_Func3(struct Task *task) return FALSE; } -void Phase2Task_Swirl(u8 taskId) +static void Phase2Task_Swirl(u8 taskId) { while (sPhase2_Swirl_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Swirl_Func1(struct Task *task) +static bool8 Phase2_Swirl_Func1(struct Task *task) { sub_8149F08(); dp12_8087EA4(); @@ -1120,7 +1123,7 @@ bool8 Phase2_Swirl_Func1(struct Task *task) return FALSE; } -bool8 Phase2_Swirl_Func2(struct Task *task) +static bool8 Phase2_Swirl_Func2(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; task->tData1 += 4; @@ -1138,14 +1141,14 @@ bool8 Phase2_Swirl_Func2(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Swirl(void) +static void VBlankCB_Phase2_Swirl(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); } -void HBlankCB_Phase2_Swirl(void) +static void HBlankCB_Phase2_Swirl(void) { u16 var = gUnknown_02038C28[1][REG_VCOUNT]; REG_BG1HOFS = var; @@ -1153,12 +1156,12 @@ void HBlankCB_Phase2_Swirl(void) REG_BG3HOFS = var; } -void Phase2Task_Shuffle(u8 taskId) +static void Phase2Task_Shuffle(u8 taskId) { while (sPhase2_Shuffle_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Shuffle_Func1(struct Task *task) +static bool8 Phase2_Shuffle_Func1(struct Task *task) { sub_8149F08(); dp12_8087EA4(); @@ -1175,7 +1178,7 @@ bool8 Phase2_Shuffle_Func1(struct Task *task) return FALSE; } -bool8 Phase2_Shuffle_Func2(struct Task *task) +static bool8 Phase2_Shuffle_Func2(struct Task *task) { u8 i; u16 r3, r4; @@ -1199,14 +1202,14 @@ bool8 Phase2_Shuffle_Func2(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Shuffle(void) +static void VBlankCB_Phase2_Shuffle(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); } -void HBlankCB_Phase2_Shuffle(void) +static void HBlankCB_Phase2_Shuffle(void) { u16 var = gUnknown_02038C28[1][REG_VCOUNT]; REG_BG1VOFS = var; @@ -1214,42 +1217,42 @@ void HBlankCB_Phase2_Shuffle(void) REG_BG3VOFS = var; } -void Phase2Task_BigPokeball(u8 taskId) +static void Phase2Task_BigPokeball(u8 taskId) { while (sPhase2_BigPokeball_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_Aqua(u8 taskId) +static void Phase2Task_Aqua(u8 taskId) { while (sPhase2_Aqua_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_Magma(u8 taskId) +static void Phase2Task_Magma(u8 taskId) { while (sPhase2_Magma_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_Regice(u8 taskId) +static void Phase2Task_Regice(u8 taskId) { while (sPhase2_Regice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_Registeel(u8 taskId) +static void Phase2Task_Registeel(u8 taskId) { while (sPhase2_Registeel_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_Regirock(u8 taskId) +static void Phase2Task_Regirock(u8 taskId) { while (sPhase2_Regirock_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_Kyogre(u8 taskId) +static void Phase2Task_Kyogre(u8 taskId) { while (sPhase2_Kyogre_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void sub_814669C(struct Task *task) +static void sub_814669C(struct Task *task) { s32 i; @@ -1275,7 +1278,7 @@ void sub_814669C(struct Task *task) SetVBlankCallback(VBlankCB0_Phase2_BigPokeball); } -bool8 Phase2_Aqua_Func1(struct Task *task) +static bool8 Phase2_Aqua_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -1290,7 +1293,7 @@ bool8 Phase2_Aqua_Func1(struct Task *task) return FALSE; } -bool8 Phase2_Magma_Func1(struct Task *task) +static bool8 Phase2_Magma_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -1305,7 +1308,7 @@ bool8 Phase2_Magma_Func1(struct Task *task) return FALSE; } -bool8 Phase2_Regi_Func1(struct Task *task) +static bool8 Phase2_Regi_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -1319,7 +1322,7 @@ bool8 Phase2_Regi_Func1(struct Task *task) return FALSE; } -bool8 Phase2_BigPokeball_Func1(struct Task *task) +static bool8 Phase2_BigPokeball_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -1333,7 +1336,7 @@ bool8 Phase2_BigPokeball_Func1(struct Task *task) return FALSE; } -bool8 Phase2_BigPokeball_Func2(struct Task *task) +static bool8 Phase2_BigPokeball_Func2(struct Task *task) { s16 i, j; u16 *dst1, *dst2; @@ -1354,7 +1357,7 @@ bool8 Phase2_BigPokeball_Func2(struct Task *task) return TRUE; } -bool8 Phase2_Aqua_Func2(struct Task *task) +static bool8 Phase2_Aqua_Func2(struct Task *task) { u16 *dst1, *dst2; @@ -1366,7 +1369,7 @@ bool8 Phase2_Aqua_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Magma_Func2(struct Task *task) +static bool8 Phase2_Magma_Func2(struct Task *task) { u16 *dst1, *dst2; @@ -1378,7 +1381,7 @@ bool8 Phase2_Magma_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Regice_Func2(struct Task *task) +static bool8 Phase2_Regice_Func2(struct Task *task) { u16 *dst1, *dst2; @@ -1391,7 +1394,7 @@ bool8 Phase2_Regice_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Registeel_Func2(struct Task *task) +static bool8 Phase2_Registeel_Func2(struct Task *task) { u16 *dst1, *dst2; @@ -1404,7 +1407,7 @@ bool8 Phase2_Registeel_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Regirock_Func2(struct Task *task) +static bool8 Phase2_Regirock_Func2(struct Task *task) { u16 *dst1, *dst2; @@ -1417,7 +1420,7 @@ bool8 Phase2_Regirock_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Kyogre_Func3(struct Task *task) +static bool8 Phase2_Kyogre_Func3(struct Task *task) { u16 *dst1, *dst2; @@ -1430,7 +1433,7 @@ bool8 Phase2_Kyogre_Func3(struct Task *task) return FALSE; } -bool8 Phase2_Kyogre_Func4(struct Task *task) +static bool8 Phase2_Kyogre_Func4(struct Task *task) { if (task->tData1 % 3 == 0) { @@ -1447,7 +1450,7 @@ bool8 Phase2_Kyogre_Func4(struct Task *task) return FALSE; } -bool8 Phase2_Kyogre_Func5(struct Task *task) +static bool8 Phase2_Kyogre_Func5(struct Task *task) { if (task->tData1 % 5 == 0) { @@ -1464,14 +1467,14 @@ bool8 Phase2_Kyogre_Func5(struct Task *task) return FALSE; } -bool8 Phase2_WeatherDuo_Func6(struct Task *task) +static bool8 Phase2_WeatherDuo_Func6(struct Task *task) { BeginNormalPaletteFade(0xFFFF8000, 1, 0, 0x10, 0); task->tState++; return FALSE; } -bool8 Phase2_WeatherDuo_Func7(struct Task *task) +static bool8 Phase2_WeatherDuo_Func7(struct Task *task) { if (!gPaletteFade.active) { @@ -1482,7 +1485,7 @@ bool8 Phase2_WeatherDuo_Func7(struct Task *task) return FALSE; } -bool8 Phase2_BigPokeball_Func3(struct Task *task) +static bool8 Phase2_BigPokeball_Func3(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; if (task->tData3 == 0 || --task->tData3 == 0) @@ -1502,7 +1505,7 @@ bool8 Phase2_BigPokeball_Func3(struct Task *task) return FALSE; } -bool8 Phase2_BigPokeball_Func4(struct Task *task) +static bool8 Phase2_BigPokeball_Func4(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; if (task->tData3 == 0 || --task->tData3 == 0) @@ -1522,7 +1525,7 @@ bool8 Phase2_BigPokeball_Func4(struct Task *task) return FALSE; } -bool8 Phase2_BigPokeball_Func5(struct Task *task) +static bool8 Phase2_BigPokeball_Func5(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; task->tData4 += 8; @@ -1542,28 +1545,28 @@ bool8 Phase2_BigPokeball_Func5(struct Task *task) return FALSE; } -bool8 Phase2_FramesCountdown(struct Task *task) +static bool8 Phase2_FramesCountdown(struct Task *task) { if (--task->tFrames == 0) task->tState++; return FALSE; } -bool8 Phase2_WeatherTrio_Func1(struct Task *task) +static bool8 Phase2_WeatherTrio_Func1(struct Task *task) { BeginNormalPaletteFade(0x0000FFFF, 1, 0, 0x10, 0); task->tState++; return FALSE; } -bool8 Phase2_WaitPaletteFade(struct Task *task) +static bool8 Phase2_WaitPaletteFade(struct Task *task) { if (!gPaletteFade.active) task->tState++; return FALSE; } -bool8 Phase2_BigPokeball_Func6(struct Task *task) +static bool8 Phase2_BigPokeball_Func6(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; if (task->tData2 < 1024) @@ -1596,7 +1599,7 @@ bool8 Phase2_BigPokeball_Func6(struct Task *task) return FALSE; } -void Transition_BigPokeball_Vblank(void) +static void Transition_BigPokeball_Vblank(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -1609,24 +1612,24 @@ void Transition_BigPokeball_Vblank(void) REG_BLDALPHA = sTransitionStructPtr->BLDALPHA; } -void VBlankCB0_Phase2_BigPokeball(void) +static void VBlankCB0_Phase2_BigPokeball(void) { Transition_BigPokeball_Vblank(); DmaSet(0, gUnknown_020393A8, ®_BG0HOFS, 0xA2400001); } -void VBlankCB1_Phase2_BigPokeball(void) +static void VBlankCB1_Phase2_BigPokeball(void) { Transition_BigPokeball_Vblank(); DmaSet(0, gUnknown_020393A8, ®_WIN0H, 0xA2400001); } -void Phase2Task_PokeballsTrail(u8 taskId) +static void Phase2Task_PokeballsTrail(u8 taskId) { while (sPhase2_PokeballsTrail_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_PokeballsTrail_Func1(struct Task *task) +static bool8 Phase2_PokeballsTrail_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -1639,7 +1642,7 @@ bool8 Phase2_PokeballsTrail_Func1(struct Task *task) return FALSE; } -bool8 Phase2_PokeballsTrail_Func2(struct Task *task) +static bool8 Phase2_PokeballsTrail_Func2(struct Task *task) { s16 i; s16 rand; @@ -1662,7 +1665,7 @@ bool8 Phase2_PokeballsTrail_Func2(struct Task *task) return FALSE; } -bool8 Phase2_PokeballsTrail_Func3(struct Task *task) +static bool8 Phase2_PokeballsTrail_Func3(struct Task *task) { if (!FieldEffectActiveListContains(FLDEFF_POKEBALL)) { @@ -1691,7 +1694,7 @@ bool8 FldEff_Pokeball(void) ptr[index] = toStore; \ } -void sub_814713C(struct Sprite *sprite) +static void sub_814713C(struct Sprite *sprite) { s16 arr0[ARRAY_COUNT(sUnknown_085C8B96)]; @@ -1728,12 +1731,12 @@ void sub_814713C(struct Sprite *sprite) } } -void Phase2Task_Clockwise_BlackFade(u8 taskId) +static void Phase2Task_Clockwise_BlackFade(u8 taskId) { while (sPhase2_Clockwise_BlackFade_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) +static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) { u16 i; @@ -1757,7 +1760,7 @@ bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) return TRUE; } -bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) +static bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; @@ -1778,7 +1781,7 @@ bool8 Phase2_Clockwise_BlackFade_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) +static bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) { s16 r1, r3; vu8 var = 0; @@ -1816,7 +1819,7 @@ bool8 Phase2_Clockwise_BlackFade_Func3(struct Task *task) return FALSE; } -bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) +static bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; @@ -1837,7 +1840,7 @@ bool8 Phase2_Clockwise_BlackFade_Func4(struct Task *task) return FALSE; } -bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) +static bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) { s16 r1, r2, var4; vu8 var = 0; @@ -1877,7 +1880,7 @@ bool8 Phase2_Clockwise_BlackFade_Func5(struct Task *task) return FALSE; } -bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) +static bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; @@ -1901,7 +1904,7 @@ bool8 Phase2_Clockwise_BlackFade_Func6(struct Task *task) return FALSE; } -bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task) +static bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task) { DmaStop(0); sub_8149F84(); @@ -1909,7 +1912,7 @@ bool8 Phase2_Clockwise_BlackFade_Func7(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Clockwise_BlackFade(void) +static void VBlankCB_Phase2_Clockwise_BlackFade(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -1922,12 +1925,12 @@ void VBlankCB_Phase2_Clockwise_BlackFade(void) DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); } -void Phase2Task_Ripple(u8 taskId) +static void Phase2Task_Ripple(u8 taskId) { while (sPhase2_Ripple_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Ripple_Func1(struct Task *task) +static bool8 Phase2_Ripple_Func1(struct Task *task) { u8 i; @@ -1948,7 +1951,7 @@ bool8 Phase2_Ripple_Func1(struct Task *task) return TRUE; } -bool8 Phase2_Ripple_Func2(struct Task *task) +static bool8 Phase2_Ripple_Func2(struct Task *task) { u8 i; s16 r3; @@ -1984,14 +1987,14 @@ bool8 Phase2_Ripple_Func2(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Ripple(void) +static void VBlankCB_Phase2_Ripple(void) { VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA) DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); } -void HBlankCB_Phase2_Ripple(void) +static void HBlankCB_Phase2_Ripple(void) { u16 var = gUnknown_02038C28[1][REG_VCOUNT]; REG_BG1VOFS = var; @@ -1999,12 +2002,12 @@ void HBlankCB_Phase2_Ripple(void) REG_BG3VOFS = var; } -void Phase2Task_Wave(u8 taskId) +static void Phase2Task_Wave(u8 taskId) { while (sPhase2_Wave_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Wave_Func1(struct Task *task) +static bool8 Phase2_Wave_Func1(struct Task *task) { u8 i; @@ -2027,7 +2030,7 @@ bool8 Phase2_Wave_Func1(struct Task *task) return TRUE; } -bool8 Phase2_Wave_Func2(struct Task *task) +static bool8 Phase2_Wave_Func2(struct Task *task) { u8 i, r5; u16* toStore; @@ -2057,7 +2060,7 @@ bool8 Phase2_Wave_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Wave_Func3(struct Task *task) +static bool8 Phase2_Wave_Func3(struct Task *task) { DmaStop(0); sub_8149F84(); @@ -2065,7 +2068,7 @@ bool8 Phase2_Wave_Func3(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Wave(void) +static void VBlankCB_Phase2_Wave(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -2077,42 +2080,42 @@ void VBlankCB_Phase2_Wave(void) DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); } -void Phase2Task_Sydney(u8 taskId) +static void Phase2Task_Sydney(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_SYDNEY; Phase2Task_MugShotTransition(taskId); } -void Phase2Task_Phoebe(u8 taskId) +static void Phase2Task_Phoebe(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_PHOEBE; Phase2Task_MugShotTransition(taskId); } -void Phase2Task_Glacia(u8 taskId) +static void Phase2Task_Glacia(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_GLACIA; Phase2Task_MugShotTransition(taskId); } -void Phase2Task_Drake(u8 taskId) +static void Phase2Task_Drake(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_DRAKE; Phase2Task_MugShotTransition(taskId); } -void Phase2Task_Champion(u8 taskId) +static void Phase2Task_Champion(u8 taskId) { gTasks[taskId].tMugshotId = MUGSHOT_CHAMPION; Phase2Task_MugShotTransition(taskId); } -void Phase2Task_MugShotTransition(u8 taskId) +static void Phase2Task_MugShotTransition(u8 taskId) { while (sPhase2_Mugshot_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Mugshot_Func1(struct Task *task) +static bool8 Phase2_Mugshot_Func1(struct Task *task) { u8 i; @@ -2138,7 +2141,7 @@ bool8 Phase2_Mugshot_Func1(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func2(struct Task *task) +static bool8 Phase2_Mugshot_Func2(struct Task *task) { s16 i, j; u16 *dst1, *dst2; @@ -2165,7 +2168,7 @@ bool8 Phase2_Mugshot_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func3(struct Task *task) +static bool8 Phase2_Mugshot_Func3(struct Task *task) { u8 i, r5; u16* toStore; @@ -2213,7 +2216,7 @@ bool8 Phase2_Mugshot_Func3(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func4(struct Task *task) +static bool8 Phase2_Mugshot_Func4(struct Task *task) { u8 i; u16* toStore; @@ -2242,7 +2245,7 @@ bool8 Phase2_Mugshot_Func4(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func5(struct Task *task) +static bool8 Phase2_Mugshot_Func5(struct Task *task) { sTransitionStructPtr->field_18 -= 8; sTransitionStructPtr->field_1A += 8; @@ -2254,7 +2257,7 @@ bool8 Phase2_Mugshot_Func5(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func6(struct Task *task) +static bool8 Phase2_Mugshot_Func6(struct Task *task) { sTransitionStructPtr->field_18 -= 8; sTransitionStructPtr->field_1A += 8; @@ -2276,7 +2279,7 @@ bool8 Phase2_Mugshot_Func6(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func7(struct Task *task) +static bool8 Phase2_Mugshot_Func7(struct Task *task) { bool32 r6; @@ -2317,7 +2320,7 @@ bool8 Phase2_Mugshot_Func7(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func8(struct Task *task) +static bool8 Phase2_Mugshot_Func8(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; BlendPalettes(-1, 0x10, 0x7FFF); @@ -2328,7 +2331,7 @@ bool8 Phase2_Mugshot_Func8(struct Task *task) return TRUE; } -bool8 Phase2_Mugshot_Func9(struct Task *task) +static bool8 Phase2_Mugshot_Func9(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; @@ -2341,7 +2344,7 @@ bool8 Phase2_Mugshot_Func9(struct Task *task) return FALSE; } -bool8 Phase2_Mugshot_Func10(struct Task *task) +static bool8 Phase2_Mugshot_Func10(struct Task *task) { DmaStop(0); sub_8149F84(); @@ -2349,7 +2352,7 @@ bool8 Phase2_Mugshot_Func10(struct Task *task) return FALSE; } -void VBlankCB0_Phase2_Mugshots(void) +static void VBlankCB0_Phase2_Mugshots(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -2362,7 +2365,7 @@ void VBlankCB0_Phase2_Mugshots(void) DmaSet(0, gUnknown_02038C28[1], ®_WIN0H, 0xA2400001); } -void VBlankCB1_Phase2_Mugshots(void) +static void VBlankCB1_Phase2_Mugshots(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -2372,7 +2375,7 @@ void VBlankCB1_Phase2_Mugshots(void) DmaSet(0, gUnknown_02038C28[1], ®_BLDY, 0xA2400001); } -void HBlankCB_Phase2_Mugshots(void) +static void HBlankCB_Phase2_Mugshots(void) { if (REG_VCOUNT < 80) REG_BG0HOFS = sTransitionStructPtr->field_18; @@ -2380,7 +2383,7 @@ void HBlankCB_Phase2_Mugshots(void) REG_BG0HOFS = sTransitionStructPtr->field_1A; } -void Mugshots_CreateOpponentPlayerSprites(struct Task *task) +static void Mugshots_CreateOpponentPlayerSprites(struct Task *task) { struct Sprite *opponentSprite, *playerSprite; @@ -2416,17 +2419,17 @@ void Mugshots_CreateOpponentPlayerSprites(struct Task *task) SetOamMatrixRotationScaling(playerSprite->oam.matrixNum, -512, 512, 0); } -void sub_8148380(struct Sprite *sprite) +static void sub_8148380(struct Sprite *sprite) { while (sUnknown_085C8C24[sprite->data[0]](sprite)); } -bool8 sub_81483A8(struct Sprite *sprite) +static bool8 sub_81483A8(struct Sprite *sprite) { return FALSE; } -bool8 sub_81483AC(struct Sprite *sprite) +static bool8 sub_81483AC(struct Sprite *sprite) { s16 arr0[2]; s16 arr1[2]; @@ -2440,7 +2443,7 @@ bool8 sub_81483AC(struct Sprite *sprite) return TRUE; } -bool8 sub_81483F8(struct Sprite *sprite) +static bool8 sub_81483F8(struct Sprite *sprite) { sprite->pos1.x += sprite->data[1]; if (sprite->data[7] && sprite->pos1.x < 133) @@ -2450,7 +2453,7 @@ bool8 sub_81483F8(struct Sprite *sprite) return FALSE; } -bool8 sub_814842C(struct Sprite *sprite) +static bool8 sub_814842C(struct Sprite *sprite) { sprite->data[1] += sprite->data[2]; sprite->pos1.x += sprite->data[1]; @@ -2463,7 +2466,7 @@ bool8 sub_814842C(struct Sprite *sprite) return FALSE; } -bool8 sub_8148458(struct Sprite *sprite) +static bool8 sub_8148458(struct Sprite *sprite) { sprite->data[1] += sprite->data[2]; sprite->pos1.x += sprite->data[1]; @@ -2472,27 +2475,27 @@ bool8 sub_8148458(struct Sprite *sprite) return FALSE; } -void sub_8148484(s16 spriteId, s16 value) +static void sub_8148484(s16 spriteId, s16 value) { gSprites[spriteId].data[7] = value; } -void sub_814849C(s16 spriteId) +static void sub_814849C(s16 spriteId) { gSprites[spriteId].data[0]++; } -s16 sub_81484B8(s16 spriteId) +static s16 sub_81484B8(s16 spriteId) { return gSprites[spriteId].data[6]; } -void Phase2Task_Slice(u8 taskId) +static void Phase2Task_Slice(u8 taskId) { while (sPhase2_Slice_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Slice_Func1(struct Task *task) +static bool8 Phase2_Slice_Func1(struct Task *task) { u16 i; @@ -2522,7 +2525,7 @@ bool8 Phase2_Slice_Func1(struct Task *task) return TRUE; } -bool8 Phase2_Slice_Func2(struct Task *task) +static bool8 Phase2_Slice_Func2(struct Task *task) { u16 i; @@ -2559,7 +2562,7 @@ bool8 Phase2_Slice_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Slice_Func3(struct Task *task) +static bool8 Phase2_Slice_Func3(struct Task *task) { DmaStop(0); sub_8149F84(); @@ -2567,7 +2570,7 @@ bool8 Phase2_Slice_Func3(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Slice(void) +static void VBlankCB_Phase2_Slice(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -2579,7 +2582,7 @@ void VBlankCB_Phase2_Slice(void) DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); } -void HBlankCB_Phase2_Slice(void) +static void HBlankCB_Phase2_Slice(void) { if (REG_VCOUNT < 160) { @@ -2590,12 +2593,12 @@ void HBlankCB_Phase2_Slice(void) } } -void Phase2Task_ShredSplit(u8 taskId) +static void Phase2Task_ShredSplit(u8 taskId) { while (sPhase2_ShredSplit_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_ShredSplit_Func1(struct Task *task) +static bool8 Phase2_ShredSplit_Func1(struct Task *task) { u16 i; @@ -2630,7 +2633,7 @@ bool8 Phase2_ShredSplit_Func1(struct Task *task) return TRUE; } -bool8 Phase2_ShredSplit_Func2(struct Task *task) +static bool8 Phase2_ShredSplit_Func2(struct Task *task) { u16 i, j, k; u8 arr1[ARRAY_COUNT(gUnknown_085C8C64)]; @@ -2727,7 +2730,7 @@ bool8 Phase2_ShredSplit_Func2(struct Task *task) return FALSE; } -bool8 Phase2_ShredSplit_Func3(struct Task *task) +static bool8 Phase2_ShredSplit_Func3(struct Task *task) { u16 i; bool32 done = TRUE; @@ -2745,7 +2748,7 @@ bool8 Phase2_ShredSplit_Func3(struct Task *task) return FALSE; } -bool8 Phase2_ShredSplit_Func4(struct Task *task) +static bool8 Phase2_ShredSplit_Func4(struct Task *task) { DmaStop(0); sub_8149F84(); @@ -2753,17 +2756,17 @@ bool8 Phase2_ShredSplit_Func4(struct Task *task) return FALSE; } -void Phase2Task_Blackhole1(u8 taskId) +static void Phase2Task_Blackhole1(u8 taskId) { while (sPhase2_Blackhole1_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_Blackhole2(u8 taskId) +static void Phase2Task_Blackhole2(u8 taskId) { while (sPhase2_Blackhole2_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Blackhole_Func1(struct Task *task) +static bool8 Phase2_Blackhole_Func1(struct Task *task) { s32 i; @@ -2790,7 +2793,7 @@ bool8 Phase2_Blackhole_Func1(struct Task *task) return FALSE; } -bool8 Phase2_Blackhole1_Func3(struct Task *task) +static bool8 Phase2_Blackhole1_Func3(struct Task *task) { if (task->tFuncState == 1) { @@ -2822,7 +2825,7 @@ bool8 Phase2_Blackhole1_Func3(struct Task *task) return FALSE; } -bool8 Phase2_Blackhole1_Func2(struct Task *task) +static bool8 Phase2_Blackhole1_Func2(struct Task *task) { sTransitionStructPtr->VBlank_DMA = FALSE; if (task->tFuncState == 0) @@ -2844,7 +2847,7 @@ bool8 Phase2_Blackhole1_Func2(struct Task *task) return FALSE; } -bool8 Phase2_Blackhole2_Func2(struct Task *task) +static bool8 Phase2_Blackhole2_Func2(struct Task *task) { u16 index; // should be s16 I think s16 amplitude; @@ -2889,12 +2892,12 @@ bool8 Phase2_Blackhole2_Func2(struct Task *task) return FALSE; } -void Phase2Task_RectangularSpiral(u8 taskId) +static void Phase2Task_RectangularSpiral(u8 taskId) { while (sPhase2_RectangularSpiral_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_RectangularSpiral_Func1(struct Task *task) +static bool8 Phase2_RectangularSpiral_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -2934,7 +2937,7 @@ bool8 Phase2_RectangularSpiral_Func1(struct Task *task) return FALSE; } -bool8 Phase2_RectangularSpiral_Func2(struct Task *task) +static bool8 Phase2_RectangularSpiral_Func2(struct Task *task) { u16 *dst1, *dst2; u8 i; @@ -2972,7 +2975,7 @@ bool8 Phase2_RectangularSpiral_Func2(struct Task *task) return FALSE; } -bool8 Phase2_RectangularSpiral_Func3(struct Task *task) +static bool8 Phase2_RectangularSpiral_Func3(struct Task *task) { DmaStop(0); sub_8149F84(); @@ -2980,7 +2983,7 @@ bool8 Phase2_RectangularSpiral_Func3(struct Task *task) return FALSE; } -bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1) +static bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1) { const s16 *array = arg0[arg1->field_0]; if (array[arg1->field_4] == -1) @@ -3043,12 +3046,12 @@ bool16 sub_8149048(const s16 * const *arg0, struct StructRectangularSpiral *arg1 return TRUE; } -void Phase2Task_Groudon(u8 taskId) +static void Phase2Task_Groudon(u8 taskId) { while (sPhase2_Groudon_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Groudon_Func3(struct Task *task) +static bool8 Phase2_Groudon_Func3(struct Task *task) { u16 *dst1, *dst2; @@ -3062,7 +3065,7 @@ bool8 Phase2_Groudon_Func3(struct Task *task) return FALSE; } -bool8 Phase2_Groudon_Func4(struct Task *task) +static bool8 Phase2_Groudon_Func4(struct Task *task) { if (task->tData1 % 3 == 0) { @@ -3078,7 +3081,7 @@ bool8 Phase2_Groudon_Func4(struct Task *task) return FALSE; } -bool8 Phase2_Groudon_Func5(struct Task *task) +static bool8 Phase2_Groudon_Func5(struct Task *task) { if (task->tData1 % 5 == 0) { @@ -3095,12 +3098,12 @@ bool8 Phase2_Groudon_Func5(struct Task *task) return FALSE; } -void Phase2Task_Rayquaza(u8 taskId) +static void Phase2Task_Rayquaza(u8 taskId) { while (sPhase2_Rayquaza_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Rayquaza_Func3(struct Task *task) +static bool8 Phase2_Rayquaza_Func3(struct Task *task) { u16 *dst1, *dst2; u16 i; @@ -3127,7 +3130,7 @@ bool8 Phase2_Rayquaza_Func3(struct Task *task) return FALSE; } -bool8 Phase2_Rayquaza_Func4(struct Task *task) +static bool8 Phase2_Rayquaza_Func4(struct Task *task) { u16 *dst1, *dst2; @@ -3137,7 +3140,7 @@ bool8 Phase2_Rayquaza_Func4(struct Task *task) return FALSE; } -bool8 Phase2_Rayquaza_Func5(struct Task *task) +static bool8 Phase2_Rayquaza_Func5(struct Task *task) { if ((task->tData1 % 4) == 0) { @@ -3154,7 +3157,7 @@ bool8 Phase2_Rayquaza_Func5(struct Task *task) return FALSE; } -bool8 Phase2_Rayquaza_Func6(struct Task *task) +static bool8 Phase2_Rayquaza_Func6(struct Task *task) { if (++task->tData1 > 20) { @@ -3166,7 +3169,7 @@ bool8 Phase2_Rayquaza_Func6(struct Task *task) return FALSE; } -bool8 Phase2_Rayquaza_Func7(struct Task *task) +static bool8 Phase2_Rayquaza_Func7(struct Task *task) { if (!gPaletteFade.active) { @@ -3177,7 +3180,7 @@ bool8 Phase2_Rayquaza_Func7(struct Task *task) return FALSE; } -bool8 Phase2_Rayquaza_Func8(struct Task *task) +static bool8 Phase2_Rayquaza_Func8(struct Task *task) { BlendPalettes(0x00007FFF, 8, 0); BlendPalettes(0xFFFF8000, 0, 0); @@ -3186,7 +3189,7 @@ bool8 Phase2_Rayquaza_Func8(struct Task *task) return FALSE; } -bool8 Phase2_Rayquaza_Func9(struct Task *task) +static bool8 Phase2_Rayquaza_Func9(struct Task *task) { if ((task->tData1 % 3) == 0) { @@ -3218,7 +3221,7 @@ bool8 Phase2_Rayquaza_Func9(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Rayquaza(void) +static void VBlankCB_Phase2_Rayquaza(void) { void *dmaSrc; @@ -3235,12 +3238,12 @@ void VBlankCB_Phase2_Rayquaza(void) DmaSet(0, dmaSrc, ®_BG0VOFS, 0xA2400001); } -void Phase2Task_WhiteFade(u8 taskId) +static void Phase2Task_WhiteFade(u8 taskId) { while (sPhase2_WhiteFade_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_WhiteFade_Func1(struct Task *task) +static bool8 Phase2_WhiteFade_Func1(struct Task *task) { u16 i; @@ -3267,7 +3270,7 @@ bool8 Phase2_WhiteFade_Func1(struct Task *task) return FALSE; } -bool8 Phase2_WhiteFade_Func2(struct Task *task) +static bool8 Phase2_WhiteFade_Func2(struct Task *task) { s16 i, posY; s16 arr1[ARRAY_COUNT(sUnknown_085C8DA0)]; @@ -3287,7 +3290,7 @@ bool8 Phase2_WhiteFade_Func2(struct Task *task) return FALSE; } -bool8 Phase2_WhiteFade_Func3(struct Task *task) +static bool8 Phase2_WhiteFade_Func3(struct Task *task) { sTransitionStructPtr->VBlank_DMA = 0; if (sTransitionStructPtr->field_20 > 7) @@ -3298,7 +3301,7 @@ bool8 Phase2_WhiteFade_Func3(struct Task *task) return FALSE; } -bool8 Phase2_WhiteFade_Func4(struct Task *task) +static bool8 Phase2_WhiteFade_Func4(struct Task *task) { sTransitionStructPtr->VBlank_DMA = 0; @@ -3317,7 +3320,7 @@ bool8 Phase2_WhiteFade_Func4(struct Task *task) return FALSE; } -bool8 Phase2_WhiteFade_Func5(struct Task *task) +static bool8 Phase2_WhiteFade_Func5(struct Task *task) { if (++sTransitionStructPtr->BLDY > 16) { @@ -3327,7 +3330,7 @@ bool8 Phase2_WhiteFade_Func5(struct Task *task) return FALSE; } -void VBlankCB0_Phase2_WhiteFade(void) +static void VBlankCB0_Phase2_WhiteFade(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -3340,7 +3343,7 @@ void VBlankCB0_Phase2_WhiteFade(void) DmaSet(0, &gUnknown_02038C28[1][160], ®_WIN0H, 0xA2400001); } -void VBlankCB1_Phase2_WhiteFade(void) +static void VBlankCB1_Phase2_WhiteFade(void) { VBlankCB_BattleTransition(); REG_BLDY = sTransitionStructPtr->BLDY; @@ -3351,12 +3354,12 @@ void VBlankCB1_Phase2_WhiteFade(void) REG_WIN0V = sTransitionStructPtr->WIN0V; } -void HBlankCB_Phase2_WhiteFade(void) +static void HBlankCB_Phase2_WhiteFade(void) { REG_BLDY = gUnknown_02038C28[1][REG_VCOUNT]; } -void sub_8149864(struct Sprite *sprite) +static void sub_8149864(struct Sprite *sprite) { if (sprite->data[5]) { @@ -3399,12 +3402,12 @@ void sub_8149864(struct Sprite *sprite) } } -void Phase2Task_GridSquares(u8 taskId) +static void Phase2Task_GridSquares(u8 taskId) { while (sPhase2_GridSquares_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_GridSquares_Func1(struct Task *task) +static bool8 Phase2_GridSquares_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -3417,7 +3420,7 @@ bool8 Phase2_GridSquares_Func1(struct Task *task) return FALSE; } -bool8 Phase2_GridSquares_Func2(struct Task *task) +static bool8 Phase2_GridSquares_Func2(struct Task *task) { u16* dst1; @@ -3438,7 +3441,7 @@ bool8 Phase2_GridSquares_Func2(struct Task *task) return FALSE; } -bool8 Phase2_GridSquares_Func3(struct Task *task) +static bool8 Phase2_GridSquares_Func3(struct Task *task) { if (--task->tData1 == 0) { @@ -3448,12 +3451,12 @@ bool8 Phase2_GridSquares_Func3(struct Task *task) return FALSE; } -void Phase2Task_Shards(u8 taskId) +static void Phase2Task_Shards(u8 taskId) { while (sPhase2_Shards_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_Shards_Func1(struct Task *task) +static bool8 Phase2_Shards_Func1(struct Task *task) { u16 i; @@ -3476,7 +3479,7 @@ bool8 Phase2_Shards_Func1(struct Task *task) return TRUE; } -bool8 Phase2_Shards_Func2(struct Task *task) +static bool8 Phase2_Shards_Func2(struct Task *task) { sub_814A1AC(sTransitionStructPtr->data, sUnknown_085C8DD0[task->tData1][0], @@ -3489,7 +3492,7 @@ bool8 Phase2_Shards_Func2(struct Task *task) return TRUE; } -bool8 Phase2_Shards_Func3(struct Task *task) +static bool8 Phase2_Shards_Func3(struct Task *task) { s16 i; bool8 nextFunc; @@ -3528,7 +3531,7 @@ bool8 Phase2_Shards_Func3(struct Task *task) return FALSE; } -bool8 Phase2_Shards_Func4(struct Task *task) +static bool8 Phase2_Shards_Func4(struct Task *task) { if (++task->tData1 < 7) { @@ -3545,7 +3548,7 @@ bool8 Phase2_Shards_Func4(struct Task *task) } } -bool8 Phase2_Shards_Func5(struct Task *task) +static bool8 Phase2_Shards_Func5(struct Task *task) { if (--task->tData3 == 0) { @@ -3556,7 +3559,7 @@ bool8 Phase2_Shards_Func5(struct Task *task) return FALSE; } -void VBlankCB_Phase2_Shards(void) +static void VBlankCB_Phase2_Shards(void) { DmaStop(0); VBlankCB_BattleTransition(); @@ -3591,9 +3594,9 @@ void VBlankCB_Phase2_Shards(void) #define tData6 data[6] #define tData7 data[7] -void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4) +static void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4) { - u8 taskId = CreateTask(Phase1_Task_RunFuncs, 3); + u8 taskId = CreateTask(TransitionPhase1_Task_RunFuncs, 3); gTasks[taskId].tData1 = a0; gTasks[taskId].tData2 = a1; gTasks[taskId].tData3 = a2; @@ -3602,20 +3605,20 @@ void CreatePhase1Task(s16 a0, s16 a1, s16 a2, s16 a3, s16 a4) gTasks[taskId].tData6 = a0; } -bool8 IsPhase1Done(void) +static bool8 IsPhase1Done(void) { - if (FindTaskIdByFunc(Phase1_Task_RunFuncs) == 0xFF) + if (FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == 0xFF) return TRUE; else return FALSE; } -void Phase1_Task_RunFuncs(u8 taskId) +void TransitionPhase1_Task_RunFuncs(u8 taskId) { while (sPhase1_TransitionAll_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase1_TransitionAll_Func1(struct Task *task) +static bool8 Phase1_TransitionAll_Func1(struct Task *task) { if (task->tData6 == 0 || --task->tData6 == 0) { @@ -3633,7 +3636,7 @@ bool8 Phase1_TransitionAll_Func1(struct Task *task) return FALSE; } -bool8 Phase1_TransitionAll_Func2(struct Task *task) +static bool8 Phase1_TransitionAll_Func2(struct Task *task) { if (task->tData6 == 0 || --task->tData6 == 0) { @@ -3646,7 +3649,7 @@ bool8 Phase1_TransitionAll_Func2(struct Task *task) if (task->tData7 == 0) { if (--task->tData3 == 0) - DestroyTask(FindTaskIdByFunc(Phase1_Task_RunFuncs)); + DestroyTask(FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs)); else { task->tData6 = task->tData1; @@ -3664,20 +3667,20 @@ bool8 Phase1_TransitionAll_Func2(struct Task *task) #undef tData6 #undef tData7 -void sub_8149F08(void) +static void sub_8149F08(void) { memset(sTransitionStructPtr, 0, sizeof(*sTransitionStructPtr)); sub_8089C08(&sTransitionStructPtr->field_14, &sTransitionStructPtr->field_16); } -void VBlankCB_BattleTransition(void) +static void VBlankCB_BattleTransition(void) { LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); } -void sub_8149F40(u16 **a0) +static void sub_8149F40(u16 **a0) { u16 reg, *vram; @@ -3705,12 +3708,12 @@ void sub_8149F58(u16 **a0, u16 **a1) *a1 = vram1; } -void sub_8149F84(void) +static void sub_8149F84(void) { BlendPalettes(-1, 0x10, 0); } -void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize) +static void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 amplitude, s16 arrSize) { u8 i; for (i = 0; arrSize > 0; arrSize--, i++, index += indexIncrementer) @@ -3719,7 +3722,7 @@ void sub_8149F98(s16 *array, s16 sinAdd, s16 index, s16 indexIncrementer, s16 am } } -void sub_814A014(u16 *array, s16 a1, s16 a2, s16 a3) +static void sub_814A014(u16 *array, s16 a1, s16 a2, s16 a3) { s16 i; @@ -3771,7 +3774,7 @@ void sub_814A014(u16 *array, s16 a1, s16 a2, s16 a3) } } -void sub_814A1AC(s16 *data, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) +static void sub_814A1AC(s16 *data, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) { data[0] = a1; data[1] = a2; @@ -3796,7 +3799,7 @@ void sub_814A1AC(s16 *data, s16 a1, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) data[10] = 0; } -bool8 sub_814A228(s16 *data, bool8 a1, bool8 a2) +static bool8 sub_814A228(s16 *data, bool8 a1, bool8 a2) { u8 var; if (data[8] > data[9]) @@ -3848,7 +3851,7 @@ bool8 sub_814A228(s16 *data, bool8 a1, bool8 a2) #define tData6 data[6] #define tData7 data[7] -bool8 Phase2_29_Func1(struct Task *task) +static bool8 Phase2_29_Func1(struct Task *task) { u16 *dst1, *dst2; @@ -3862,7 +3865,7 @@ bool8 Phase2_29_Func1(struct Task *task) return FALSE; } -bool8 Phase2_29_Func2(struct Task *task) +static bool8 Phase2_29_Func2(struct Task *task) { u16 *dst1, *dst2; @@ -3874,28 +3877,28 @@ bool8 Phase2_29_Func2(struct Task *task) return TRUE; } -void Phase2Task_29(u8 taskId) +static void Phase2Task_29(u8 taskId) { while (sPhase2_29_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_30(u8 taskId) +static void Phase2Task_30(u8 taskId) { while (sPhase2_30_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -bool8 Phase2_30_Func1(struct Task *task) +static bool8 Phase2_30_Func1(struct Task *task) { u16 *dst1, *dst2; sub_8149F08(); dp12_8087EA4(); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); - task->data[2] = 0x2000; - task->data[1] = 0x7FFF; - task->data[5] = 0; - task->data[6] = 16; - task->data[7] = 2560; + task->tData2 = 0x2000; + task->tData1 = 0x7FFF; + task->tData5 = 0; + task->tData6 = 16; + task->tData7 = 2560; sTransitionStructPtr->BLDCNT = 0x3F41; sTransitionStructPtr->BLDALPHA = (task->tData6 << 8) | (task->tData5); REG_BLDCNT = sTransitionStructPtr->BLDCNT; @@ -3910,7 +3913,7 @@ bool8 Phase2_30_Func1(struct Task *task) return FALSE; } -bool8 Phase2_30_Func2(struct Task *task) +static bool8 Phase2_30_Func2(struct Task *task) { u16 *dst1, *dst2; @@ -3921,7 +3924,7 @@ bool8 Phase2_30_Func2(struct Task *task) return TRUE; } -bool8 Phase2_30_Func3(struct Task *task) +static bool8 Phase2_30_Func3(struct Task *task) { u8 i; @@ -3938,7 +3941,7 @@ bool8 Phase2_30_Func3(struct Task *task) return TRUE; } -bool8 Phase2_30_Func4(struct Task *task) +static bool8 Phase2_30_Func4(struct Task *task) { u8 i; u16 var6, amplitude, var8; @@ -3990,7 +3993,7 @@ bool8 Phase2_30_Func4(struct Task *task) return FALSE; } -void VBlankCB_Phase2_30(void) +static void VBlankCB_Phase2_30(void) { VBlankCB_BattleTransition(); REG_BLDCNT = sTransitionStructPtr->BLDCNT; @@ -4000,27 +4003,340 @@ void VBlankCB_Phase2_30(void) DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); } -void HBlankCB_Phase2_30(void) +static void HBlankCB_Phase2_30(void) { u16 var = gUnknown_02038C28[1][REG_VCOUNT]; REG_BG0VOFS = var; } -void Phase2Task_31(u8 taskId) +static void Phase2Task_31(u8 taskId) { while (sPhase2_31_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_33(u8 taskId) +static void Phase2Task_33(u8 taskId) { while (sPhase2_33_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } -void Phase2Task_32(u8 taskId) +static void Phase2Task_32(u8 taskId) { while (sPhase2_32_Funcs[gTasks[taskId].tState](&gTasks[taskId])); } +static bool8 Phase2_31_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LZ77UnCompVram(gUnknown_085C8598, dst2); + + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect(0, 1, 0, 0, 1, 0x20, 0xF); + FillBgTilemapBufferRect(0, 1, 0x1D, 0, 1, 0x20, 0xF); + CopyBgTilemapBufferToVram(0); + LoadPalette(gUnknown_085C8578, 0xF0, 0x20); + + task->tData2 = 1; + task->tData3 = 0; + task->tData4 = 0; + task->tData7 = 10; + + task->tState++; + return FALSE; +} + +static bool8 Phase2_31_Func2(struct Task *task) +{ + CopyRectToBgTilemapBufferRect(0, gUnknown_085C8928, 0, 0, 4, 4, task->tData2, task->tData3, 4, 4, 0xF, 0, 0); + CopyBgTilemapBufferToVram(0); + + task->tData2 += 4; + if (++task->tData4 == 7) + { + task->tData2 = 1; + task->tData3 += 4; + task->tData4 = 0; + if (task->tData3 > 19) + task->tState++; + } + + return FALSE; +} + +static bool8 Phase2_31_Func3(struct Task *task) +{ + u8 i; + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + if (task->tData6++ >= task->tData7) + { + switch (task->tData5) + { + case 0: + for (i = 250; i < 255; i++) + { + gPlttBufferUnfaded[i] = 0; + gPlttBufferFaded[i] = 0; + } + break; + case 1: + BlendPalettes(0xFFFF7FFF, 0x10, 0); + LZ77UnCompVram(gUnknown_085C86F4, dst2); + break; + case 2: + LZ77UnCompVram(gUnknown_085C87F4, dst2); + break; + case 3: + LZ77UnCompVram(gUnknown_085C88A4, dst2); + break; + default: + FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); + CopyBgTilemapBufferToVram(0); + task->tState++; + return FALSE; + } + + task->tData6 = 0; + task->tData5++; + } + + return FALSE; +} + +static bool8 Phase2_33_Func1(struct Task *task) +{ + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LZ77UnCompVram(gUnknown_085C8598, dst2); + + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); + FillBgTilemapBufferRect(0, 1, 0, 0, 1, 0x20, 0xF); + FillBgTilemapBufferRect(0, 1, 0x1D, 0, 1, 0x20, 0xF); + CopyBgTilemapBufferToVram(0); + LoadPalette(gUnknown_085C8578, 0xE0, 0x20); + LoadPalette(gUnknown_085C8578, 0xF0, 0x20); + BlendPalette(0xE0, 0x10, 8, 0); + + task->tData2 = 34; + task->tData3 = 0; + + task->tState++; + return FALSE; +} + +static bool8 Phase2_33_Func2(struct Task *task) +{ + u8 var = gUnknown_085C9A30[task->tData2]; + u8 varMod = var % 7; + u8 varDiv = var / 7; + CopyRectToBgTilemapBufferRect(0, &gUnknown_085C8928, 0, 0, 4, 4, 4 * varMod + 1, 4 * varDiv, 4, 4, 0xF, 0, 0); + CopyBgTilemapBufferToVram(0); + + if (--task->tData2 < 0) + task->tState++; + return FALSE; +} + +static bool8 Phase2_33_Func3(struct Task *task) +{ + BlendPalette(0xE0, 0x10, 3, 0); + BlendPalettes(0xFFFF3FFF, 0x10, 0); + + task->tData2 = 0; + task->tData3 = 0; + + task->tState++; + return FALSE; +} + +static bool8 Phase2_33_Func4(struct Task *task) +{ + if ((task->tData3 ^= 1)) + { + CopyRectToBgTilemapBufferRect( + 0, + gUnknown_085C8928, + 0, + 0, + 4, + 4, + 4 * (gUnknown_085C9A30[task->tData2] % 7) + 1, + 4 * (gUnknown_085C9A30[task->tData2] / 7), + 4, + 4, + 0xE, + 0, + 0); + } + else + { + if (task->tData2 > 0) + { + FillBgTilemapBufferRect( + 0, + 1, + 4 * (gUnknown_085C9A30[task->tData2 - 1] % 7) + 1, + 4 * (gUnknown_085C9A30[task->tData2 - 1] / 7), + 4, + 4, + 0xF); + } + + task->tData2++; + } + + if (task->tData2 > 34) + task->tState++; + + CopyBgTilemapBufferToVram(0); + return FALSE; +} + +static bool8 Phase2_31_33_Func5(struct Task *task) +{ + FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); + CopyBgTilemapBufferToVram(0); + BlendPalettes(0xFFFFFFFF, 0x10, 0); + DestroyTask(FindTaskIdByFunc(task->func)); + return FALSE; +} + +// sub task for phase2 32 +#define tSub32_X_delta data[0] +#define tSub32_Y_delta data[1] +#define tSub32_Bool data[2] + +static void sub_814ABE4(u8 taskId) +{ + if (!(gTasks[taskId].tSub32_Bool ^= 1)) + { + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y); + gBattle_BG0_X += gTasks[taskId].tSub32_X_delta; + gBattle_BG0_Y += gTasks[taskId].tSub32_Y_delta; + } +} + +static bool8 Phase2_32_Func1(struct Task *task) +{ + u8 taskId = 0; + u16 *dst1, *dst2; + + sub_8149F58(&dst1, &dst2); + LZ77UnCompVram(gUnknown_085C8598, dst2); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); + CopyBgTilemapBufferToVram(0); + LoadPalette(gUnknown_085C8578, 0xF0, 0x20); + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y); + + task->tData2 = 0; + taskId = CreateTask(sub_814ABE4, 1); + switch (Random() % 4) + { + case 0: + gTasks[taskId].tSub32_X_delta = 1; + gTasks[taskId].tSub32_Y_delta = 1; + break; + case 1: + gTasks[taskId].tSub32_X_delta = -1; + gTasks[taskId].tSub32_Y_delta = -1; + break; + case 2: + gTasks[taskId].tSub32_X_delta = 1; + gTasks[taskId].tSub32_Y_delta = -1; + break; + default: + gTasks[taskId].tSub32_X_delta = -1; + gTasks[taskId].tSub32_Y_delta = 1; + break; + } + + task->tState++; + return FALSE; +} + +static bool8 Phase2_32_Func2(struct Task *task) +{ + u8 var = gUnknown_085C9A53[task->tData2]; + u8 varDiv = var / 8; + u8 varAnd = var & 7; + + CopyRectToBgTilemapBufferRect( + 0, + &gUnknown_085C8928, + 0, + 0, + 4, + 4, + 4 * varDiv + 1, + 4 * varAnd, + 4, + 4, + 0xF, + 0, + 0); + CopyBgTilemapBufferToVram(0); + + if (++task->tData2 > 63) + task->tState++; + return 0; +} + +static bool8 Phase2_32_Func3(struct Task *task) +{ + BlendPalettes(0xFFFF7FFF, 0x10, 0); + + task->tData2 = 0; + + task->tState++; + return FALSE; +} + +static bool8 Phase2_32_Func4(struct Task *task) +{ + u8 var = gUnknown_085C9A53[task->tData2]; + u8 varDiv = var / 8; + u8 varAnd = var & 7; + + FillBgTilemapBufferRect(0, 1, 4 * varDiv + 1, 4 * varAnd, 4, 4, 0xF); + CopyBgTilemapBufferToVram(0); + + if (++task->tData2 > 63) + { + DestroyTask(FindTaskIdByFunc(sub_814ABE4)); + task->tState++; + } + + return FALSE; +} + +#undef tSub32_X_delta +#undef tSub32_Y_delta +#undef tSub32_Bool + +static bool8 Phase2_32_Func5(struct Task *task) +{ + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_Y); + + FillBgTilemapBufferRect_Palette0(0, 1, 0, 0, 0x20, 0x20); + CopyBgTilemapBufferToVram(0); + BlendPalettes(0xFFFFFFFF, 0x10, 0); + + DestroyTask(FindTaskIdByFunc(task->func)); + task->tState++; // UB: changing value of a destroyed task + return FALSE; +} + #undef tData1 #undef tData2 #undef tData3 diff --git a/src/tileset_anims.c b/src/tileset_anims.c index 062647202..f89cfdd2b 100644 --- a/src/tileset_anims.c +++ b/src/tileset_anims.c @@ -1393,7 +1393,7 @@ static void sub_80A1818(u16 a1) { CpuCopy16(gTilesetAnims_BattleDomePals0[a1 & 0x3], gPlttBufferUnfaded + 0x80, 32); BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); - if ((u8)FindTaskIdByFunc(Phase1_Task_RunFuncs) != 0xFF ) + if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) != 0xFF ) { sSecondaryTilesetCB = sub_80A1670; sSecondaryTilesetCBBufferSize = 0x20; @@ -1403,7 +1403,7 @@ static void sub_80A1818(u16 a1) static void sub_80A1884(u16 a1) { CpuCopy16(gTilesetAnims_BattleDomePals0[a1 & 0x3], gPlttBufferUnfaded + 0x80, 32); - if ((u8)FindTaskIdByFunc(Phase1_Task_RunFuncs) == 0xFF ) + if ((u8)FindTaskIdByFunc(TransitionPhase1_Task_RunFuncs) == 0xFF ) { BlendPalette(0x80, 0x10, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF); if (!--sSecondaryTilesetCBBufferSize) From bc1a957674e84daf181c508afd2b623304de121d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 14 Jan 2018 22:15:50 +0100 Subject: [PATCH 6/7] make battle transition compile --- include/gba/io_reg.h | 8 +++++++- src/bg.c | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 6dbe5e8ed..0364c38bc 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -137,6 +137,8 @@ #define REG_OFFSET_DMA3CNT_H 0xde #define REG_OFFSET_TMCNT 0x100 +#define REG_OFFSET_TMCNT_L 0x100 +#define REG_OFFSET_TMCNT_H 0x102 #define REG_OFFSET_TM0CNT 0x100 #define REG_OFFSET_TM0CNT_L 0x100 #define REG_OFFSET_TM0CNT_H 0x102 @@ -298,6 +300,8 @@ #define REG_ADDR_DMA3CNT_H (REG_BASE + REG_OFFSET_DMA3CNT_H) #define REG_ADDR_TMCNT (REG_BASE + REG_OFFSET_TMCNT) +#define REG_ADDR_TMCNT_L (REG_BASE + REG_OFFSET_TMCNT_L) +#define REG_ADDR_TMCNT_H (REG_BASE + REG_OFFSET_TMCNT_H) #define REG_ADDR_TM0CNT (REG_BASE + REG_OFFSET_TM0CNT) #define REG_ADDR_TM0CNT_L (REG_BASE + REG_OFFSET_TM0CNT_L) #define REG_ADDR_TM0CNT_H (REG_BASE + REG_OFFSET_TM0CNT_H) @@ -458,6 +462,8 @@ #define REG_DMA3CNT_H (*(vu16 *)REG_ADDR_DMA3CNT_H) #define REG_TMCNT(n) (*(vu16 *)(REG_ADDR_TMCNT + ((n) * 4))) +#define REG_TMCNT_L(n) (*(vu16 *)(REG_ADDR_TMCNT_L + ((n) * 4))) +#define REG_TMCNT_H(n) (*(vu16 *)(REG_ADDR_TMCNT_H + ((n) * 4))) #define REG_TM0CNT (*(vu32 *)REG_ADDR_TM0CNT) #define REG_TM0CNT_L (*(vu16 *)REG_ADDR_TM0CNT_L) #define REG_TM0CNT_H (*(vu16 *)REG_ADDR_TM0CNT_H) @@ -660,7 +666,7 @@ #define KEY_INTR_ENABLE 0x0400 #define KEY_OR_INTR 0x0000 #define KEY_AND_INTR 0x8000 -#define DPAD_ANY 0x00F0 +#define DPAD_ANY ((DPAD_RIGHT | DPAD_LEFT | DPAD_UP | DPAD_DOWN)) #define JOY_EXCL_DPAD 0x030F // interrupt flags diff --git a/src/bg.c b/src/bg.c index 74e3ea830..b699a0b1f 100644 --- a/src/bg.c +++ b/src/bg.c @@ -1007,7 +1007,7 @@ void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, void *src, u8 destX, u8 dest } // Skipping for now, it probably uses structs passed by value /* -void CopyRectToBgTilemapBufferRect(u8 bg, void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2) +void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2) { u16 attribute; u16 mode; @@ -1049,7 +1049,7 @@ void CopyRectToBgTilemapBufferRect(u8 bg, void* src, u8 srcX, u8 srcY, u8 srcWid } }*/ __attribute__((naked)) -void CopyRectToBgTilemapBufferRect(u8 bg, void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2) +void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2) { asm("push {r4-r7,lr}\n\ mov r7, r10\n\ From 50f9615dc9021bc811869a27b5fa400aac25aaf0 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 16 Jan 2018 21:37:46 +0100 Subject: [PATCH 7/7] battle transition review changes --- src/battle_transition.c | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/battle_transition.c b/src/battle_transition.c index af156da12..ca2134837 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -23,21 +23,21 @@ struct TransitionData { - vs8 VBlank_DMA; + vu8 VBlank_DMA; u16 WININ; u16 WINOUT; - u16 field_6; + u16 WIN0H; u16 WIN0V; - u16 field_A; - u16 field_C; + u16 field_A; // unused + u16 field_C; // unused u16 BLDCNT; u16 BLDALPHA; u16 BLDY; s16 field_14; s16 field_16; - s16 field_18; - s16 field_1A; - s16 field_1C; + s16 BG0HOFS_1; + s16 BG0HOFS_2; + s16 BG0VOFS; // used but not set s16 field_1E; // unused s16 field_20; s16 field_22; // unused @@ -1265,7 +1265,7 @@ static void sub_814669C(struct Task *task) task->tData5 = 0x4000; sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0H = 240; sTransitionStructPtr->WIN0V = 160; sTransitionStructPtr->BLDCNT = 0x3F41; sTransitionStructPtr->BLDALPHA = (task->tData1 << 8) | (task->tData2); @@ -1745,7 +1745,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; - sTransitionStructPtr->field_6 = -3855; + sTransitionStructPtr->WIN0H = -3855; sTransitionStructPtr->WIN0V = 160; for (i = 0; i < 160; i++) @@ -2016,7 +2016,7 @@ static bool8 Phase2_Wave_Func1(struct Task *task) sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0H = 240; sTransitionStructPtr->WIN0V = 160; for (i = 0; i < 160; i++) @@ -2210,8 +2210,8 @@ static bool8 Phase2_Mugshot_Func3(struct Task *task) if (mergedValue == 0xF0) task->tState++; - sTransitionStructPtr->field_18 -= 8; - sTransitionStructPtr->field_1A += 8; + sTransitionStructPtr->BG0HOFS_1 -= 8; + sTransitionStructPtr->BG0HOFS_2 += 8; sTransitionStructPtr->VBlank_DMA++; return FALSE; } @@ -2232,8 +2232,8 @@ static bool8 Phase2_Mugshot_Func4(struct Task *task) task->tData1 = 0; task->tData2 = 0; task->tData3 = 0; - sTransitionStructPtr->field_18 -= 8; - sTransitionStructPtr->field_1A += 8; + sTransitionStructPtr->BG0HOFS_1 -= 8; + sTransitionStructPtr->BG0HOFS_2 += 8; sub_8148484(task->tOpponentSpriteId, 0); sub_8148484(task->tPlayerSpriteId, 1); @@ -2247,8 +2247,8 @@ static bool8 Phase2_Mugshot_Func4(struct Task *task) static bool8 Phase2_Mugshot_Func5(struct Task *task) { - sTransitionStructPtr->field_18 -= 8; - sTransitionStructPtr->field_1A += 8; + sTransitionStructPtr->BG0HOFS_1 -= 8; + sTransitionStructPtr->BG0HOFS_2 += 8; if (sub_81484B8(task->tOpponentSpriteId)) { task->tState++; @@ -2259,8 +2259,8 @@ static bool8 Phase2_Mugshot_Func5(struct Task *task) static bool8 Phase2_Mugshot_Func6(struct Task *task) { - sTransitionStructPtr->field_18 -= 8; - sTransitionStructPtr->field_1A += 8; + sTransitionStructPtr->BG0HOFS_1 -= 8; + sTransitionStructPtr->BG0HOFS_2 += 8; if (sub_81484B8(task->tPlayerSpriteId)) { sTransitionStructPtr->VBlank_DMA = FALSE; @@ -2285,8 +2285,8 @@ static bool8 Phase2_Mugshot_Func7(struct Task *task) sTransitionStructPtr->VBlank_DMA = FALSE; r6 = TRUE; - sTransitionStructPtr->field_18 -= 8; - sTransitionStructPtr->field_1A += 8; + sTransitionStructPtr->BG0HOFS_1 -= 8; + sTransitionStructPtr->BG0HOFS_2 += 8; if (task->tData4 < 0x50) task->tData4 += 2; @@ -2358,7 +2358,7 @@ static void VBlankCB0_Phase2_Mugshots(void) VBlankCB_BattleTransition(); if (sTransitionStructPtr->VBlank_DMA != 0) DmaCopy16(3, gUnknown_02038C28[0], gUnknown_02038C28[1], 320); - REG_BG0VOFS = sTransitionStructPtr->field_1C; + REG_BG0VOFS = sTransitionStructPtr->BG0VOFS; REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; REG_WIN0V = sTransitionStructPtr->WIN0V; @@ -2378,9 +2378,9 @@ static void VBlankCB1_Phase2_Mugshots(void) static void HBlankCB_Phase2_Mugshots(void) { if (REG_VCOUNT < 80) - REG_BG0HOFS = sTransitionStructPtr->field_18; + REG_BG0HOFS = sTransitionStructPtr->BG0HOFS_1; else - REG_BG0HOFS = sTransitionStructPtr->field_1A; + REG_BG0HOFS = sTransitionStructPtr->BG0HOFS_2; } static void Mugshots_CreateOpponentPlayerSprites(struct Task *task) @@ -2541,9 +2541,9 @@ static bool8 Phase2_Slice_Func2(struct Task *task) for (i = 0; i < 160; i++) { - u16* storeLoc1 = &gUnknown_02038C28[0][i]; - u16* storeLoc2 = &gUnknown_02038C28[0][i + 160]; - if (1 & i) + u16 *storeLoc1 = &gUnknown_02038C28[0][i]; + u16 *storeLoc2 = &gUnknown_02038C28[0][i + 160]; + if (i & 1) { *storeLoc1 = sTransitionStructPtr->field_14 + task->tData1; *storeLoc2 = 0xF0 - task->tData1; @@ -2775,7 +2775,7 @@ static bool8 Phase2_Blackhole_Func1(struct Task *task) sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; - sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0H = 240; sTransitionStructPtr->WIN0V = 160; for (i = 0; i < 0xA0; i++) @@ -3203,7 +3203,7 @@ static bool8 Phase2_Rayquaza_Func9(struct Task *task) sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; - sTransitionStructPtr->field_6 = 240; + sTransitionStructPtr->WIN0H = 240; sTransitionStructPtr->WIN0V = 160; for (i = 0; i < 160; i++) @@ -3309,7 +3309,7 @@ static bool8 Phase2_WhiteFade_Func4(struct Task *task) SetVBlankCallback(0); SetHBlankCallback(0); - sTransitionStructPtr->field_6 = 0xF0; + sTransitionStructPtr->WIN0H = 0xF0; sTransitionStructPtr->BLDY = 0; sTransitionStructPtr->BLDCNT = 0xFF; sTransitionStructPtr->WININ = 0x3F; @@ -3350,7 +3350,7 @@ static void VBlankCB1_Phase2_WhiteFade(void) REG_BLDCNT = sTransitionStructPtr->BLDCNT; REG_WININ = sTransitionStructPtr->WININ; REG_WINOUT = sTransitionStructPtr->WINOUT; - REG_WIN0H = sTransitionStructPtr->field_6; + REG_WIN0H = sTransitionStructPtr->WIN0H; REG_WIN0V = sTransitionStructPtr->WIN0V; }