From 9106d8df1856c65b2bc85da6d61b6968669814ea Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 13 Jan 2018 21:03:07 +0100 Subject: [PATCH] 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 ef5c95332d..675f46bfda 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 98b0224320..68801b22e5 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 2ad27dc293..bb8505edba 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 e60a2d91fa..04f48b1261 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 0524f5545f..e413e08f9c 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