From 0a206ee52c19963c778e6e15e4b92e1f0c58a13f Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Thu, 15 Feb 2018 22:30:39 -0600 Subject: [PATCH] Finish decompiling intro --- asm/intro.s | 285 ---- common_syms/intro.txt | 2 + data/intro.s | 551 ------- include/constants/rgb.h | 1 + include/global.h | 6 + include/graphics.h | 15 + include/intro_credits_graphics.h | 4 + ld_script.txt | 3 +- src/intro.c | 2577 +++++++++++++++++++----------- src/intro_credits_graphics.c | 5 + sym_common.txt | 8 +- sym_ewram.txt | 18 +- 12 files changed, 1696 insertions(+), 1779 deletions(-) delete mode 100644 asm/intro.s create mode 100644 common_syms/intro.txt delete mode 100644 data/intro.s create mode 100644 src/intro_credits_graphics.c diff --git a/asm/intro.s b/asm/intro.s deleted file mode 100644 index 97dd9b6de..000000000 --- a/asm/intro.s +++ /dev/null @@ -1,285 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - thumb_func_start sub_816FEDC -sub_816FEDC: @ 816FEDC - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0816FF48 - ldr r2, =gSineTable - ldrh r1, [r4, 0x32] - lsls r0, r1, 24 - lsrs r0, 23 - adds r0, r2 - ldrh r3, [r0] - adds r1, 0x40 - lsls r1, 24 - lsrs r1, 23 - adds r1, r2 - movs r2, 0 - ldrsh r0, [r1, r2] - movs r1, 0x30 - ldrsh r2, [r4, r1] - adds r1, r0, 0 - muls r1, r2 - adds r0, r1, 0 - cmp r1, 0 - bge _0816FF18 - adds r0, 0xFF -_0816FF18: - lsls r0, 8 - lsrs r6, r0, 16 - lsls r0, r3, 16 - asrs r3, r0, 16 - negs r0, r3 - muls r0, r2 - cmp r0, 0 - bge _0816FF2A - adds r0, 0xFF -_0816FF2A: - lsls r0, 8 - lsrs r5, r0, 16 - adds r0, r3, 0 - muls r0, r2 - cmp r0, 0 - bge _0816FF38 - adds r0, 0xFF -_0816FF38: - lsls r0, 8 - lsrs r2, r0, 16 - adds r1, r6, 0 - adds r3, r5, 0 - str r1, [sp] - movs r0, 0x1 - bl SetOamMatrix -_0816FF48: - movs r2, 0x2E - ldrsh r0, [r4, r2] - cmp r0, 0x1 - beq _0816FF9C - cmp r0, 0x1 - ble _0816FF58 - cmp r0, 0x2 - beq _0816FFFE -_0816FF58: - ldrb r0, [r4, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r1, [r4, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r4, 0x3] - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0x3 - movs r3, 0x3 - bl CalcCenterToCornerVec - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - movs r1, 0 - movs r0, 0x1 - strh r0, [r4, 0x2E] - movs r0, 0x80 - strh r0, [r4, 0x30] - strh r1, [r4, 0x32] - strh r1, [r4, 0x34] - b _08170038 - .pool -_0816FF9C: - ldrh r0, [r4, 0x34] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x8C - bl Sin - negs r0, r0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x34] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x78 - bl Sin - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0x7 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x34] - adds r0, 0x3 - strh r0, [r4, 0x34] - movs r1, 0x20 - ldrsh r0, [r4, r1] - movs r2, 0x24 - ldrsh r1, [r4, r2] - adds r0, r1 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bgt _08170038 - ldrb r0, [r4, 0x5] - movs r1, 0xC - orrs r0, r1 - strb r0, [r4, 0x5] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r0, 0x14 - strh r0, [r4, 0x20] - movs r0, 0x28 - strh r0, [r4, 0x22] - movs r0, 0x80 - lsls r0, 2 - strh r0, [r4, 0x30] - movs r0, 0 - strh r0, [r4, 0x32] - movs r0, 0x10 - b _08170036 -_0816FFFE: - ldrh r0, [r4, 0x34] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x22 - bl Sin - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x34] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x3C - bl Cos - negs r0, r0 - strh r0, [r4, 0x26] - ldrh r0, [r4, 0x30] - adds r0, 0x2 - strh r0, [r4, 0x30] - movs r1, 0x3C - ldrsh r0, [r4, r1] - movs r1, 0x5 - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _08170038 - ldrh r0, [r4, 0x34] - adds r0, 0x1 -_08170036: - strh r0, [r4, 0x34] -_08170038: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_816FEDC - - thumb_func_start sub_8170040 -sub_8170040: @ 8170040 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _08170056 - adds r4, r5, 0 - adds r4, 0x3E - cmp r0, 0x1 - beq _0817008E -_08170056: - adds r4, r5, 0 - adds r4, 0x3E - ldrb r1, [r4] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r4] - ldrb r0, [r5, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r5, 0x1] - ldrb r1, [r5, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - movs r1, 0x24 - orrs r0, r1 - strb r0, [r5, 0x3] - adds r0, r5, 0 - movs r1, 0 - movs r2, 0x3 - movs r3, 0x3 - bl CalcCenterToCornerVec - movs r0, 0 - strh r0, [r5, 0x30] - movs r0, 0x1 - strh r0, [r5, 0x2E] -_0817008E: - ldrh r0, [r5, 0x3C] - adds r0, 0x1 - strh r0, [r5, 0x3C] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081700A6 - ldrb r0, [r4] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4] - b _081700BE -_081700A6: - ldrb r0, [r4] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r4] - ldrh r1, [r5, 0x30] - movs r2, 0x30 - ldrsh r0, [r5, r2] - cmp r0, 0x3F - bgt _081700BE - adds r0, r1, 0x1 - strh r0, [r5, 0x30] -_081700BE: - ldr r1, =gSineTable - ldrh r0, [r5, 0x30] - lsls r0, 24 - lsrs r0, 23 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - movs r2, 0x80 - lsls r2, 1 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - movs r0, 0x12 - movs r2, 0 - movs r3, 0 - bl SetOamMatrix - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8170040 - - .align 2, 0 @ Don't pad with nop. diff --git a/common_syms/intro.txt b/common_syms/intro.txt new file mode 100644 index 000000000..d069b1014 --- /dev/null +++ b/common_syms/intro.txt @@ -0,0 +1,2 @@ +gIntroFrameCounter +gMultibootProgramStruct diff --git a/data/intro.s b/data/intro.s deleted file mode 100644 index 142d1c69e..000000000 --- a/data/intro.s +++ /dev/null @@ -1,551 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gIntro1DropsPal:: @ 85DFF90 - .incbin "graphics/intro/intro1_drops.gbapal" - - .align 2 -gIntro1GFLogoPal:: @ 85DFFB0 - .incbin "graphics/intro/intro1_gflogo.gbapal" - - .align 2 -gIntroTiles:: @ 85DFFD0 - .incbin "graphics/intro/intro.4bpp.lz" - - .align 2 -gIntro1BGPals:: @ 85E05C4 - .incbin "graphics/intro/intro1_bgpal.gbapal" - - .align 2 -gIntro1BG0_Tilemap:: @ 85E07C4 - .incbin "graphics/intro/intro1_bg0_map.bin.lz" - - .align 2 -gIntro1BG1_Tilemap:: @ 85E0B78 - .incbin "graphics/intro/intro1_bg1_map.bin.lz" - - .align 2 -gIntro1BG2_Tilemap:: @ 85E0EAC - .incbin "graphics/intro/intro1_bg2_map.bin.lz" - - .align 2 -gIntro1BG3_Tilemap:: @ 85E119C - .incbin "graphics/intro/intro1_bg3_map.bin.lz" - - .align 2 -gIntro1BGLeavesGfx:: @ 85E13B4 - .incbin "graphics/intro/introgfx.4bpp.lz" - - .align 2 -gIntro3PokeballPal:: @ 85E3524 - .incbin "graphics/intro/intro3_pokeball.gbapal" - - .align 2 -gIntro3Pokeball_Tilemap:: @ 85E3724 - .incbin "graphics/intro/intro3_pokeball_map.bin.lz" - - .align 2 -gIntro3Pokeball_Gfx:: @ 85E3854 - .incbin "graphics/intro/intro3_pokeball.8bpp.lz" - - .align 2 - .incbin "graphics/intro/intro3_streaks.gbapal" - - .align 2 - .incbin "graphics/intro/intro3_streaks.4bpp.lz" - - .align 2 - .incbin "graphics/intro/intro3_streaks_map.bin.lz" - - .align 2 -gIntro3Misc1Pal:: @ 85E4570 - .incbin "graphics/intro/intro3_misc1.gbapal" - - .align 2 - .incbin "graphics/intro/intro3_misc2.gbapal" - - .align 2 -gIntro3MiscTiles:: @ 85E45B0 - .incbin "graphics/intro/intro3_misc.4bpp.lz" - - .align 2 -gIntro1FlygonPal:: @ 85E492C - .incbin "graphics/intro/intro1_flygon.gbapal" - - .align 2 - .incbin "graphics/intro/intro1_eon.4bpp.lz" - - .align 2 - .byte 0x02, 0x03, 0x04, 0x05, 0x01, 0x01, 0x01, 0x06 - .byte 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x02, 0x0d - .byte 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 - .byte 0x16, 0x17, 0x18, 0x19, 0x02, 0x0d, 0x0e, 0x0f - .byte 0x10, 0x11, 0x12, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e - .byte 0x1f, 0x20, 0x21, 0x02, 0x0d, 0x0e, 0x0f, 0x10 - .byte 0x11, 0x12, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27 - .byte 0x28, 0x29, 0x2a, 0x00 - - .align 2 -gUnknown_085E4A74:: @ 85E4A74 - obj_tiles gIntro1SparkleGfx, 0x0400, 0x05e1 - null_obj_tiles - - .align 2 -gUnknown_085E4A84:: @ 85E4A84 - obj_pal gIntro3LightningPal, 0x05e1 - null_obj_pal - - .align 2 -gUnknown_085E4A94:: @ 85E4A94 - .byte 0xa0, 0x00, 0x00, 0x40, 0x00, 0x04, 0x00, 0x00 - - .align 2 -gUnknown_085E4A9C:: @ 85E4A9C - .2byte 0x0000, 0x0002, 0x0004, 0x0002, 0x0008, 0x0002, 0x000c, 0x0002, 0x0010, 0x0002, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4AB4:: @ 85E4AB4 - .4byte gUnknown_085E4A9C - - .align 2 -gUnknown_085E4AB8:: @ 85E4AB8 - spr_template 0x05e1, 0x05e1, gUnknown_085E4A94, gUnknown_085E4AB4, NULL, gDummySpriteAffineAnimTable, sub_816D338 - - .align 2 -gUnknown_085E4AD0:: @ 85E4AD0 - .byte 0x7c, 0x28, 0x66, 0x1e, 0x4d, 0x1e, 0x36, 0x0f - .byte 0x94, 0x09, 0x3f, 0x1c, 0x5d, 0x28, 0x94, 0x20 - .byte 0xad, 0x29, 0x5e, 0x14, 0xd0, 0x26, 0x00, 0x00 - - .align 2 -gUnknown_085E4AE8:: @ 85E4AE8 - obj_tiles gIntro2VolbeatGfx, 0x0400, 0x05dc - obj_tiles gIntro2TorchicGfx, 0x0c00, 0x05dd - obj_tiles gIntro2ManectricGfx, 0x2000, 0x05de - null_obj_tiles - - .align 2 -gUnknown_085E4B08:: @ 85E4B08 - obj_pal gIntro2VolbeatPal, 0x05dc - obj_pal gIntro2TorchicPal, 0x05dd - obj_pal gIntro2ManectricPal, 0x05de - null_obj_pal - - .align 2 -gUnknown_085E4B28:: @ 85E4B28 - .byte 0xa0, 0x00, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00 - - .align 2 -gUnknown_085E4B30:: @ 85E4B30 - .2byte 0x0000, 0x0002, 0x0010, 0x0002, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4B3C:: @ 85E4B3C - .4byte gUnknown_085E4B30 - - .align 2 -gUnknown_085E4B40:: @ 85E4B40 - spr_template 0x05dc, 0x05dc, gUnknown_085E4B28, gUnknown_085E4B3C, NULL, gDummySpriteAffineAnimTable, sub_816D81C - - .align 2 -gUnknown_085E4B58:: @ 85E4B58 - .byte 0xa0, 0x00, 0x00, 0x80, 0x00, 0x04, 0x00, 0x00 - - .align 2 -gUnknown_085E4B60:: @ 85E4B60 - .2byte 0x0000, 0x0005, 0x0010, 0x0005, 0x0020, 0x0005, 0x0010, 0x0005, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4B74:: @ 85E4B74 - .2byte 0x0000, 0x0003, 0x0010, 0x0003, 0x0020, 0x0003, 0x0010, 0x0003, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4B88:: @ 85E4B88 - .2byte 0x0030, 0x0004, 0x0040, 0x0006, 0x0050, 0x0000, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4B98:: @ 85E4B98 - .4byte gUnknown_085E4B60 - .4byte gUnknown_085E4B74 - .4byte gUnknown_085E4B88 - - .align 2 -gUnknown_085E4BA4:: @ 85E4BA4 - spr_template 0x05dd, 0x05dd, gUnknown_085E4B58, gUnknown_085E4B98, NULL, gDummySpriteAffineAnimTable, sub_816D9C0 - - .align 2 -gUnknown_085E4BBC:: @ 85E4BBC - .byte 0xa0, 0x00, 0x00, 0xc0, 0x00, 0x04, 0x00, 0x00 - - .align 2 -gUnknown_085E4BC4:: @ 85E4BC4 - .2byte 0x0000, 0x0004, 0x0040, 0x0004, 0x0080, 0x0004, 0x00c0, 0x0004, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4BD8:: @ 85E4BD8 - .4byte gUnknown_085E4BC4 - - .align 2 -gUnknown_085E4BDC:: @ 85E4BDC - spr_template 0x05de, 0x05de, gUnknown_085E4BBC, gUnknown_085E4BD8, NULL, gDummySpriteAffineAnimTable, sub_816DAE8 - - .align 2 -gUnknown_085E4BF4:: @ 85E4BF4 - obj_tiles gIntro3LightningGfx, 0x0c00, 0x05df - null_obj_tiles - - .align 2 -gUnknown_085E4C04:: @ 85E4C04 - obj_pal gIntro3LightningPal, 0x05df - null_obj_pal - - .align 2 -gUnknown_085E4C14:: @ 85E4C14 - .byte 0xa0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_085E4C1C:: @ 85E4C1C - .2byte 0x0000, 0x0002, 0x0030, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4C28:: @ 85E4C28 - .2byte 0x0010, 0x0002, 0x0040, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4C34:: @ 85E4C34 - .2byte 0x0020, 0x0002, 0x0050, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4C40:: @ 85E4C40 - .4byte gUnknown_085E4C1C - .4byte gUnknown_085E4C28 - .4byte gUnknown_085E4C34 - - .align 2 -gUnknown_085E4C4C:: @ 85E4C4C - spr_template 0x05df, 0x05df, gUnknown_085E4C14, gUnknown_085E4C40, NULL, gDummySpriteAffineAnimTable, sub_816EC6C - - .align 2 -gUnknown_085E4C64:: @ 85E4C64 - .2byte 0x0068, 0x0000, 0x00c0 - .2byte 0x008e, 0x0003, 0x0280 - .2byte 0x0053, 0x0001, 0x0180 - .2byte 0x009b, 0x0000, 0x0080 - .2byte 0x0038, 0x0002, 0x0200 - .2byte 0x00ae, 0x0001, 0x0100 - - .align 2 -gUnknown_085E4C88:: @ 85E4C88 - obj_tiles gIntro2BubblesGfx, 0x0600, 0x05e0 - null_obj_tiles - - .align 2 -gUnknown_085E4C98:: @ 85E4C98 - obj_pal gIntro2BubblesPal, 0x05e0 - null_obj_pal - - .align 2 -gUnknown_085E4CA8:: @ 85E4CA8 - .2byte 0x0042, 0x0040, 0x0001 - .2byte 0x0060, 0x0060, 0x0008 - .2byte 0x0080, 0x0040, 0x0001 - .2byte 0x0090, 0x0030, 0x0008 - .2byte 0x00a0, 0x0048, 0x0001 - .2byte 0x00b0, 0x0060, 0x0008 - .2byte 0x0060, 0x0060, 0x0004 - .2byte 0x0070, 0x0068, 0x0008 - .2byte 0x0080, 0x0060, 0x0004 - .2byte 0x0058, 0x0020, 0x0004 - .2byte 0x0068, 0x0018, 0x0008 - .2byte 0x0078, 0x0020, 0x0004 - - .align 2 -gUnknown_085E4CF0:: @ 85E4CF0 - .byte 0xa0, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_085E4CF8:: @ 85E4CF8 - .2byte 0x0000, 0x0004, 0x0008, 0x0004, 0x0010, 0x0004, 0x0018, 0x0004 - .2byte 0x0020, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4D10:: @ 85E4D10 - .4byte gUnknown_085E4CF8 - - .align 2 -gUnknown_085E4D14:: @ 85E4D14 - spr_template 0x05e0, 0x05e0, gUnknown_085E4CF0, gUnknown_085E4D10, NULL, gDummySpriteAffineAnimTable, sub_816E7B4 - - .align 2 -gUnknown_085E4D2C:: @ 85E4D2C - .byte 0xa0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_085E4D34:: @ 85E4D34 - .2byte 0x0010, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4D3C:: @ 85E4D3C - .2byte 0x0018, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4D44:: @ 85E4D44 - .2byte 0x0000, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4D4C:: @ 85E4D4C - .2byte 0x0030, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4D54:: @ 85E4D54 - .4byte gUnknown_085E4D34 - .4byte gUnknown_085E4D3C - .4byte gUnknown_085E4D44 - .4byte gUnknown_085E4D4C - - .align 2 -gUnknown_085E4D64:: @ 85E4D64 - spr_template 0x07d0, 0x07d0, gUnknown_085E4D2C, gUnknown_085E4D54, NULL, gDummySpriteAffineAnimTable, sub_816F454 - - .align 2 -gUnknown_085E4D7C:: @ 85E4D7C - .byte 0x00, 0x00, 0x04, 0x00, 0x40, 0x00, 0x04, 0x00 - - .align 2 -gUnknown_085E4D84:: @ 85E4D84 - .2byte 0x0080, 0x0004, 0x00c0, 0x0004, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4D90:: @ 85E4D90 - .2byte 0x0000, 0x0008, 0x0040, 0x0008, 0x0080, 0x0008, 0x00c0, 0x0008, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4DA4:: @ 85E4DA4 - .2byte 0x0100, 0x0004, 0x0140, 0x0004, 0x0180, 0x0004, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4DB4:: @ 85E4DB4 - .2byte 0x0180, 0x0010, 0x0140, 0x0010, 0x0100, 0x0010, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4DC4:: @ 85E4DC4 - .4byte gUnknown_085E4D7C - .4byte gUnknown_085E4D90 - .4byte gUnknown_085E4DA4 - .4byte gUnknown_085E4DB4 - - .align 2 -gUnknown_085E4DD4:: @ 85E4DD4 - .2byte 0x03a0, 0x4000, 0x0000, 0x0000 - - .align 2 -gUnknown_085E4DDC:: @ 85E4DDC - .2byte 0x00a0, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085E4DE4:: @ 85E4DE4 - .2byte 0x87a0, 0xc000, 0x0000, 0x0000 - - .align 2 -gUnknown_085E4DEC:: @ 85E4DEC - .2byte 0x0050, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4DF4:: @ 85E4DF4 - .2byte 0x0054, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4DFC:: @ 85E4DFC - .2byte 0x0058, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E04:: @ 85E4E04 - .2byte 0x005c, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E0C:: @ 85E4E0C - .2byte 0x0060, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E14:: @ 85E4E14 - .2byte 0x0064, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E1C:: @ 85E4E1C - .2byte 0x0068, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E24:: @ 85E4E24 - .2byte 0x0070, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E2C:: @ 85E4E2C - .2byte 0x0071, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E34:: @ 85E4E34 - .2byte 0x0072, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E3C:: @ 85E4E3C - .2byte 0x0073, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E44:: @ 85E4E44 - .2byte 0x0074, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E4C:: @ 85E4E4C - .2byte 0x0075, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E54:: @ 85E4E54 - .2byte 0x0080, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E4E5C:: @ 85E4E5C - .4byte gUnknown_085E4DEC - .4byte gUnknown_085E4DF4 - .4byte gUnknown_085E4DFC - .4byte gUnknown_085E4E04 - .4byte gUnknown_085E4E0C - .4byte gUnknown_085E4E14 - .4byte gUnknown_085E4E1C - - .align 2 -gUnknown_085E4E78:: @ 85E4E78 - .4byte gUnknown_085E4E24 - .4byte gUnknown_085E4E2C - .4byte gUnknown_085E4E34 - .4byte gUnknown_085E4E3C - .4byte gUnknown_085E4E44 - .4byte gUnknown_085E4E4C - - .align 2 -gUnknown_085E4E90:: @ 85E4E90 - .4byte gUnknown_085E4E54 - - .align 2 -gUnknown_085E4E94:: @ 85E4E94 - .2byte 0x0000, 0xffb8 - .2byte 0x0001, 0xffc8 - .2byte 0x0002, 0xffd8 - .2byte 0x0003, 0xffe8 - .2byte 0x0004, 0x0008 - .2byte 0x0005, 0x0018 - .2byte 0x0003, 0x0028 - .2byte 0x0001, 0x0038 - .2byte 0x0006, 0x0048 - .2byte 0x0000, 0xffe4 - .2byte 0x0001, 0xffec - .2byte 0x0002, 0xfff4 - .2byte 0x0003, 0xfffc - .2byte 0x0002, 0x0004 - .2byte 0x0004, 0x000c - .2byte 0x0005, 0x0014 - .2byte 0x0003, 0x001c - - .align 2 -gUnknown_085E4ED8:: @ 85E4ED8 - .2byte 0x0080, 0x0080, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085E4EE8:: @ 85E4EE8 - .2byte 0x0080, 0x0080, 0x0000, 0x0000, 0x0010, 0x0010, 0x1000, 0x0000 - .2byte 0xfff0, 0xfff0, 0x0800, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085E4F08:: @ 85E4F08 - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0008, 0x0008, 0x3000, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085E4F20:: @ 85E4F20 - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0002, 0x0002, 0x3000, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gUnknown_085E4F38:: @ 85E4F38 - .4byte gUnknown_085E4ED8 - .4byte gUnknown_085E4EE8 - .4byte gUnknown_085E4F08 - .4byte gUnknown_085E4F20 - - .align 2 -gUnknown_085E4F48:: @ 85E4F48 - .2byte 0x0100, 0x00c0, 0x0080, 0x0040, 0x0000, 0x0040, 0x0080, 0x00c0 - .2byte 0x0100, 0x0000 - - .align 2 -gUnknown_085E4F5C:: @ 85E4F5C - spr_template 0x07d0, 0x07d1, gUnknown_085E4DD4, gUnknown_085E4E5C, NULL, gUnknown_085E4F38, sub_816FB38 - spr_template 0x07d0, 0x07d1, gUnknown_085E4DDC, gUnknown_085E4E78, NULL, gDummySpriteAffineAnimTable, sub_816FB38 - - .align 2 -gUnknown_085E4F8C:: @ 85E4F8C - spr_template 0x07d0, 0x07d1, gUnknown_085E4DE4, gUnknown_085E4E90, NULL, gUnknown_085E4F38, sub_816FD44 - - .align 2 -gUnknown_085E4FA4:: @ 85E4FA4 - .byte 0x00, 0x17, 0x17, 0x31, 0x3e, 0x24, 0x24, 0x0a, 0x0a, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_085E4FB0:: @ 85E4FB0 - .byte 0xa0, 0x40, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_085E4FB8:: @ 85E4FB8 - .2byte 0x0000, 0x000a, 0xfffe, 0x0000 - - .align 2 -gUnknown_085E4FC0:: @ 85E4FC0 - .4byte gUnknown_085E4FB8 - - .align 2 -gUnknown_085E4FC4:: @ 85E4FC4 - spr_template 0x07d2, 0x07d2, gUnknown_085E4FB0, gUnknown_085E4FC0, NULL, gDummySpriteAffineAnimTable, sub_816FEDC - - .align 2 -gUnknown_085E4FDC:: @ 85E4FDC - obj_tiles gIntroTiles, 0x1400, 0x07d0 - null_obj_tiles - -gUnknown_085E4FEC:: @ 85E4FEC - obj_tiles gIntro1FlygonGfx, 0x0400, 0x07d2 - null_obj_tiles - - .align 2 -gUnknown_085E4FFC:: @ 85E4FFC - obj_pal gIntro1DropsPal, 0x07d0 - obj_pal gIntro1GFLogoPal, 0x07d1 - obj_pal gIntro1FlygonPal, 0x07d2 - null_obj_pal - - .align 2 -gUnknown_085E501C:: @ 85E501C - .byte 0xa0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_085E5024:: @ 85E5024 - .2byte 0x0010, 0x0008, 0xffff, 0x0000 - - .align 2 -gUnknown_085E502C:: @ 85E502C - .4byte gUnknown_085E5024 - - .align 2 -gUnknown_085E5030:: @ 85E5030 - spr_template 0x07d3, 0x07d3, gUnknown_085E501C, gUnknown_085E502C, NULL, gDummySpriteAffineAnimTable, sub_8170040 - - .align 2 -gUnknown_085E5048:: @ 85E5048 - obj_tiles gIntro3MiscTiles, 0x0a00, 0x07d3 - null_obj_tiles - -gUnknown_085E5058:: @ 85E5058 - obj_pal gIntro3Misc1Pal, 0x07d3 - null_obj_pal - diff --git a/include/constants/rgb.h b/include/constants/rgb.h index 8b323799f..fd9c5c5a7 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -12,5 +12,6 @@ #define RGB_YELLOW RGB(31, 31, 0) #define RGB_MAGENTA RGB(31, 0, 31) #define RGB_CYAN RGB(0, 31, 31) +#define RGB_WHITEALPHA RGB_WHITE | 0x8000 #endif // GUARD_RGB_H diff --git a/include/global.h b/include/global.h index 4a71a8a87..94afcde91 100644 --- a/include/global.h +++ b/include/global.h @@ -35,6 +35,12 @@ // Converts a number to Q4.12 fixed-point format #define Q_4_12(n) ((s16)((n) * 4096)) +// Converts a Q8.8 fixed-point format number to a regular integer +#define Q_8_8_TO_INT(n) ((int)((n) / 256)) + +// Converts a Q4.12 fixed-point format number to a regular integer +#define Q_4_12_TO_INT(n) ((int)((n) / 4096)) + #define PARTY_SIZE 6 #define POKEMON_NAME_LENGTH 10 diff --git a/include/graphics.h b/include/graphics.h index 76eaff28f..770a01ade 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2726,6 +2726,21 @@ extern const u16 gBagScreenMale_Pal[]; extern const u8 gBagMenuHMIcon_Gfx[]; //intro graphics +extern const u8 gIntro1SparkleGfx[]; +extern const u8 gIntro1FlygonGfx[]; +extern const u16 gIntro3LightningPal[]; +extern const u8 gIntroCopyright_Gfx[]; +extern const u8 gIntroCopyright_Tilemap[]; +extern const u16 gIntroCopyright_Pal[]; +extern const u8 gIntro2VolbeatGfx[]; +extern const u8 gIntro2TorchicGfx[]; +extern const u8 gIntro2ManectricGfx[]; +extern const u16 gIntro2VolbeatPal[]; +extern const u16 gIntro2TorchicPal[]; +extern const u16 gIntro2ManectricPal[]; +extern const u8 gIntro2BubblesGfx[]; +extern const u16 gIntro2BubblesPal[]; +extern const u8 gIntro3LightningGfx[]; extern const u8 gIntro3GroudonGfx[]; extern const u8 gIntro3GroudonTilemap[]; extern const u8 gIntro3LegendBgGfx[]; diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h index c63861d87..4e5d025a5 100644 --- a/include/intro_credits_graphics.h +++ b/include/intro_credits_graphics.h @@ -1,6 +1,10 @@ #ifndef GUARD_INTRO_CREDITS_GRAPHICS_H #define GUARD_INTRO_CREDITS_GRAPHICS_H +extern u16 gUnknown_0203BD24; +extern u16 gUnknown_0203BD26; +extern u16 gUnknown_0203BD28; + extern const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[]; diff --git a/ld_script.txt b/ld_script.txt index 79914e172..e282cd418 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -219,7 +219,6 @@ SECTIONS { src/battle_controller_wally.o(.text); asm/player_pc.o(.text); src/intro.o(.text); - asm/intro.o(.text); src/reset_save_heap.o(.text); src/field_region_map.o(.text); asm/battle_anim_8170478.o(.text); @@ -495,7 +494,7 @@ SECTIONS { data/use_pokeblock.o(.rodata); src/battle_controller_wally.o(.rodata); data/player_pc.o(.rodata); - data/intro.o(.rodata); + src/intro.o(.rodata); src/field_region_map.o(.rodata); data/battle_anim_8170478.o(.rodata); src/hall_of_fame.o(.rodata); diff --git a/src/intro.c b/src/intro.c index 0b66decfc..f21ad348d 100644 --- a/src/intro.c +++ b/src/intro.c @@ -24,166 +24,868 @@ #include "constants/species.h" #include "blend_palette.h" #include "title_screen.h" - -extern EWRAM_DATA u16 gUnknown_0203BCC8; -extern EWRAM_DATA u16 gUnknown_0203BCCA; -extern EWRAM_DATA u16 gUnknown_0203BCCC; - -extern u16 gUnknown_0203BD24; -extern u16 gUnknown_0203BD26; -extern u16 gUnknown_0203BD28; - -extern u32 gIntroFrameCounter; -extern struct GcmbStruct gMultibootProgramStruct; +#include "constants/rgb.h" extern const struct CompressedSpriteSheet gBattleAnimPicTable[]; extern const struct CompressedSpritePalette gBattleAnimPaletteTable[]; - extern const struct SpriteTemplate gUnknown_08596C10[]; -extern u8 gIntroCopyright_Gfx[]; -extern u8 gIntroCopyright_Tilemap[]; -extern u16 gIntroCopyright_Pal[]; +//ewram +EWRAM_DATA u16 gUnknown_0203BCC8 = 0; +EWRAM_DATA u16 gUnknown_0203BCCA = 0; +EWRAM_DATA u16 gUnknown_0203BCCC = 0; -extern const u16 gIntro1BGPals[16][16]/* = +//iwram +u32 gIntroFrameCounter; +struct GcmbStruct gMultibootProgramStruct; + +//.rodata +static const u16 gIntro1DropsPal[] = INCBIN_U16("graphics/intro/intro1_drops.gbapal"); +static const u16 gIntro1GFLogoPal[] = INCBIN_U16("graphics/intro/intro1_gflogo.gbapal"); +static const u8 gIntroTiles[] = INCBIN_U8("graphics/intro/intro.4bpp.lz"); +static const u16 gIntro1BGPals[16][16] = INCBIN_U16("graphics/intro/intro1_bgpal.gbapal"); +static const u8 gIntro1BG0_Tilemap[] = INCBIN_U8("graphics/intro/intro1_bg0_map.bin.lz"); +static const u8 gIntro1BG1_Tilemap[] = INCBIN_U8("graphics/intro/intro1_bg1_map.bin.lz"); +static const u8 gIntro1BG2_Tilemap[] = INCBIN_U8("graphics/intro/intro1_bg2_map.bin.lz"); +static const u8 gIntro1BG3_Tilemap[] = INCBIN_U8("graphics/intro/intro1_bg3_map.bin.lz"); +static const u8 gIntro1BGLeavesGfx[] = INCBIN_U8("graphics/intro/introgfx.4bpp.lz"); +static const u16 gIntro3PokeballPal[] = INCBIN_U16("graphics/intro/intro3_pokeball.gbapal"); +static const u8 gIntro3Pokeball_Tilemap[] = INCBIN_U8("graphics/intro/intro3_pokeball_map.bin.lz"); +static const u8 gIntro3Pokeball_Gfx[] = INCBIN_U8("graphics/intro/intro3_pokeball.8bpp.lz"); +static const u16 gIntro3Streaks_Pal_Unused[] = INCBIN_U16("graphics/intro/intro3_streaks.gbapal"); +static const u8 gIntro3Streaks_Gfx_Unused[] = INCBIN_U8("graphics/intro/intro3_streaks.4bpp.lz"); +static const u8 gIntro3Streaks_Tilemap_Unused[] = INCBIN_U8("graphics/intro/intro3_streaks_map.bin.lz"); +static const u16 gIntro3Misc1Palette[] = INCBIN_U16("graphics/intro/intro3_misc1.gbapal"); +static const u16 gIntro3Misc2Palette_Unused[] = INCBIN_U16("graphics/intro/intro3_misc2.gbapal"); +static const u8 gIntro3MiscTiles[] = INCBIN_U8("graphics/intro/intro3_misc.4bpp.lz"); +static const u16 gIntro1FlygonPalette[] = INCBIN_U16("graphics/intro/intro1_flygon.gbapal"); +static const u8 gIntro1EonTiles_Unused[] = INCBIN_U8("graphics/intro/intro1_eon.4bpp.lz"); +static const u8 sUnknownBytes[] = { + 0x02, 0x03, 0x04, 0x05, 0x01, 0x01, 0x01, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x02, 0x0D, + 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x02, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x02, 0x0D, 0x0E, 0x0F, 0x10, + 0x11, 0x12, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x00 +}; +static const struct CompressedSpriteSheet gUnknown_085E4A74[] = { - INCBIN_U16("graphics/intro/intro1_bgpal1.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal2.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal3.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal4.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal5.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal6.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal7.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal8.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal9.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal10.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal11.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal12.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal13.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal14.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal15.gbapal"), - INCBIN_U16("graphics/intro/intro1_bgpal16.gbapal"), -}*/; -extern const u8 gIntro1BG0_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg0_map.bin.lz")*/; -extern const u8 gIntro1BG1_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg1_map.bin.lz")*/; -extern const u8 gIntro1BG2_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg2_map.bin.lz")*/; -extern const u8 gIntro1BG3_Tilemap[]/* = INCBIN_U8("graphics/intro/intro1_bg3_map.bin.lz")*/; -extern const u8 gIntro1BGLeavesGfx[]/* = INCBIN_U8("graphics/intro/introgfx.4bpp.lz")*/; -extern const u16 gIntro3PokeballPal[]/* = INCBIN_U16("graphics/intro/intro3_pokeball.gbapal")*/; -extern const u8 gIntro3Pokeball_Tilemap[]/* = INCBIN_U8("graphics/intro/intro3_pokeball_map.bin.lz")*/; -extern const u8 gIntro3Pokeball_Gfx[]/* = INCBIN_U8("graphics/intro/intro3_pokeball.8bpp.lz")*/; - -extern const struct CompressedSpriteSheet gUnknown_085E4A74[]; -extern const struct SpritePalette gUnknown_085E4A84[]; -extern const struct SpriteTemplate gUnknown_085E4AB8[]; -extern const struct CompressedSpriteSheet gUnknown_085E4AE8[3]; -extern const u8 gUnknown_085E4AD0[][2]; -extern const struct SpritePalette gUnknown_085E4B08[]; -extern const struct SpriteTemplate gUnknown_085E4B40[]; -extern const struct SpriteTemplate gUnknown_085E4BA4[]; -extern const struct SpriteTemplate gUnknown_085E4BDC[]; -extern const struct CompressedSpriteSheet gUnknown_085E4BF4[]; -extern const struct SpritePalette gUnknown_085E4C04[]; -extern const struct SpriteTemplate gUnknown_085E4C4C[]; -extern const s16 gUnknown_085E4C64[][3]; -extern const struct CompressedSpriteSheet gUnknown_085E4C88[]; -extern const struct SpritePalette gUnknown_085E4C98[]; -extern const s16 gUnknown_085E4CA8[][3]; -extern const struct SpriteTemplate gUnknown_085E4D14[]; -extern const struct SpriteTemplate gUnknown_085E4D64/* = + {gIntro1SparkleGfx, 0x400, 1505}, + {NULL}, +}; +static const struct SpritePalette gUnknown_085E4A84[] = +{ + {gIntro3LightningPal, 1505}, + {NULL}, +}; +static const struct OamData gUnknown_085E4A94 = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4A9C[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(4, 2), + ANIMCMD_FRAME(8, 2), + ANIMCMD_FRAME(12, 2), + ANIMCMD_FRAME(16, 2), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd *const gUnknown_085E4AB4[] = +{ + gUnknown_085E4A9C, +}; +static void sub_816D338(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4AB8 = +{ + .tileTag = 1505, + .paletteTag = 1505, + .oam = &gUnknown_085E4A94, + .anims = gUnknown_085E4AB4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816D338, +}; +static const u8 gUnknown_085E4AD0[][2] = +{ + {0x7C, 0x28}, + {0x66, 0x1E}, + {0x4D, 0x1E}, + {0x36, 0x0F}, + {0x94, 0x09}, + {0x3F, 0x1C}, + {0x5D, 0x28}, + {0x94, 0x20}, + {0xAD, 0x29}, + {0x5E, 0x14}, + {0xD0, 0x26}, + {0x00, 0x00}, +}; +static const struct CompressedSpriteSheet gUnknown_085E4AE8[] = +{ + {gIntro2VolbeatGfx, 0x400, 1500}, + {gIntro2TorchicGfx, 0xC00, 1501}, + {gIntro2ManectricGfx, 0x2000, 1502}, + {NULL}, +}; +static const struct SpritePalette gUnknown_085E4B08[] = +{ + {gIntro2VolbeatPal, 1500}, + {gIntro2TorchicPal, 1501}, + {gIntro2ManectricPal, 1502}, + {NULL}, +}; +static const struct OamData gUnknown_085E4B28 = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4B30[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(16, 2), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd *const gUnknown_085E4B3C[] = +{ + gUnknown_085E4B30, +}; +static void sub_816D81C(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4B40 = +{ + .tileTag = 1500, + .paletteTag = 1500, + .oam = &gUnknown_085E4B28, + .anims = gUnknown_085E4B3C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816D81C, +}; +static const struct OamData gUnknown_085E4B58 = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4B60[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(16, 5), + ANIMCMD_FRAME(32, 5), + ANIMCMD_FRAME(16, 5), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd gUnknown_085E4B74[] = +{ + ANIMCMD_FRAME(0, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_FRAME(32, 3), + ANIMCMD_FRAME(16, 3), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd gUnknown_085E4B88[] = +{ + ANIMCMD_FRAME(48, 4), + ANIMCMD_FRAME(64, 6), + ANIMCMD_FRAME(80, 0), + ANIMCMD_END, +}; +static const union AnimCmd *const gUnknown_085E4B98[] = +{ + gUnknown_085E4B60, + gUnknown_085E4B74, + gUnknown_085E4B88, +}; +static void sub_816D9C0(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4BA4 = +{ + .tileTag = 1501, + .paletteTag = 1501, + .oam = &gUnknown_085E4B58, + .anims = gUnknown_085E4B98, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816D9C0, +}; +static const struct OamData gUnknown_085E4BBC = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4BC4[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(64, 4), + ANIMCMD_FRAME(128, 4), + ANIMCMD_FRAME(192, 4), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd *const gUnknown_085E4BD8[] = +{ + gUnknown_085E4BC4, +}; +static void sub_816DAE8(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4BDC = +{ + .tileTag = 1502, + .paletteTag = 1502, + .oam = &gUnknown_085E4BBC, + .anims = gUnknown_085E4BD8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816DAE8, +}; +static const struct CompressedSpriteSheet gUnknown_085E4BF4[] = +{ + {gIntro3LightningGfx, 0xC00, 1503}, + {NULL}, +}; +static const struct SpritePalette gUnknown_085E4C04[] = +{ + {gIntro3LightningPal, 1503}, + {NULL}, +}; +static const struct OamData gUnknown_085E4C14 = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4C1C[] = +{ + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(48, 2), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4C28[] = +{ + ANIMCMD_FRAME(16, 2), + ANIMCMD_FRAME(64, 2), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4C34[] = +{ + ANIMCMD_FRAME(32, 2), + ANIMCMD_FRAME(80, 2), + ANIMCMD_END, +}; +static const union AnimCmd *const gUnknown_085E4C40[] = +{ + gUnknown_085E4C1C, + gUnknown_085E4C28, + gUnknown_085E4C34, +}; +static void sub_816EC6C(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4C4C = +{ + .tileTag = 1503, + .paletteTag = 1503, + .oam = &gUnknown_085E4C14, + .anims = gUnknown_085E4C40, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816EC6C, +}; +static const s16 gUnknown_085E4C64[][3] = +{ + {0x68, 0x00, 0x0C0}, + {0x8E, 0x03, 0x280}, + {0x53, 0x01, 0x180}, + {0x9B, 0x00, 0x080}, + {0x38, 0x02, 0x200}, + {0xAE, 0x01, 0x100}, +}; +static const struct CompressedSpriteSheet gUnknown_085E4C88[] = +{ + {gIntro2BubblesGfx, 0x600, 1504}, + {NULL}, +}; +static const struct SpritePalette gUnknown_085E4C98[] = +{ + {gIntro2BubblesPal, 1504}, + {NULL}, +}; +static const s16 gUnknown_085E4CA8[][3] = +{ + {0x42, 0x40, 0x1}, + {0x60, 0x60, 0x8}, + {0x80, 0x40, 0x1}, + {0x90, 0x30, 0x8}, + {0xA0, 0x48, 0x1}, + {0xB0, 0x60, 0x8}, + {0x60, 0x60, 0x4}, + {0x70, 0x68, 0x8}, + {0x80, 0x60, 0x4}, + {0x58, 0x20, 0x4}, + {0x68, 0x18, 0x8}, + {0x78, 0x20, 0x4}, +}; +static const struct OamData gUnknown_085E4CF0 = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 2, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4CF8[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(8, 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(24, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_END, +}; +static const union AnimCmd *const gUnknown_085E4D10[] = +{ + gUnknown_085E4CF8, +}; +static void sub_816E7B4(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4D14 = +{ + .tileTag = 1504, + .paletteTag = 1504, + .oam = &gUnknown_085E4CF0, + .anims = gUnknown_085E4D10, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816E7B4, +}; +static const struct OamData gUnknown_085E4D2C = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4D34[] = +{ + ANIMCMD_FRAME(16, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4D3C[] = +{ + ANIMCMD_FRAME(24, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4D44[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4D4C[] = +{ + ANIMCMD_FRAME(48, 8), + ANIMCMD_END, +}; +static const union AnimCmd *const gUnknown_085E4D54[] = +{ + gUnknown_085E4D34, + gUnknown_085E4D3C, + gUnknown_085E4D44, + gUnknown_085E4D4C, +}; +static void sub_816F454(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4D64 = { .tileTag = 2000, .paletteTag = 2000, - .oam = &gOamData_840ADE8, - .anims = gSpriteAnimTable_840AE10, + .oam = &gUnknown_085E4D2C, + .anims = gUnknown_085E4D54, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_813D208, -}*/; -extern const union AnimCmd *const gUnknown_085E4DC4[]/* = + .callback = sub_816F454, +}; +static const union AnimCmd gUnknown_085E4D7C[] = { - Unknown_40AE38, - Unknown_40AE4C, - Unknown_40AE60, - Unknown_40AE70, -}*/; -extern const s16 gUnknown_085E4E94[][2]; -extern const u16 gUnknown_085E4F48[]; -extern const struct SpriteTemplate gUnknown_085E4F5C[]; -extern const struct SpriteTemplate gUnknown_085E4F8C[]; -extern const u8 gUnknown_085E4FA4[]; -extern const struct SpriteTemplate gUnknown_085E4FC4[]; -extern const struct CompressedSpriteSheet gUnknown_085E4FDC[]/* = + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(64, 4), + ANIMCMD_FRAME(128, 4), + ANIMCMD_FRAME(192, 4), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd gUnknown_085E4D90[] = +{ + ANIMCMD_FRAME(0, 8), + ANIMCMD_FRAME(64, 8), + ANIMCMD_FRAME(128, 8), + ANIMCMD_FRAME(192, 8), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd gUnknown_085E4DA4[] = +{ + ANIMCMD_FRAME(256, 4), + ANIMCMD_FRAME(0x140, 4), + ANIMCMD_FRAME(0x180, 4), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4DB4[] = +{ + ANIMCMD_FRAME(0x180, 16), + ANIMCMD_FRAME(0x140, 16), + ANIMCMD_FRAME(256, 16), + ANIMCMD_END, +}; +static const union AnimCmd *const gUnknown_085E4DC4[] = +{ + gUnknown_085E4D7C, + gUnknown_085E4D90, + gUnknown_085E4DA4, + gUnknown_085E4DB4, +}; +static const struct OamData gUnknown_085E4DD4 = +{ + .y = 160, + .affineMode = 3, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const struct OamData gUnknown_085E4DDC = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const struct OamData gUnknown_085E4DE4 = +{ + .y = 160, + .affineMode = 3, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 2, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4DEC[] = +{ + ANIMCMD_FRAME(80, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4DF4[] = +{ + ANIMCMD_FRAME(84, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4DFC[] = +{ + ANIMCMD_FRAME(88, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E04[] = +{ + ANIMCMD_FRAME(92, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E0C[] = +{ + ANIMCMD_FRAME(96, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E14[] = +{ + ANIMCMD_FRAME(100, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E1C[] = +{ + ANIMCMD_FRAME(104, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E24[] = +{ + ANIMCMD_FRAME(112, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E2C[] = +{ + ANIMCMD_FRAME(113, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E34[] = +{ + ANIMCMD_FRAME(114, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E3C[] = +{ + ANIMCMD_FRAME(115, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E44[] = +{ + ANIMCMD_FRAME(116, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E4C[] = +{ + ANIMCMD_FRAME(117, 8), + ANIMCMD_END, +}; +static const union AnimCmd gUnknown_085E4E54[] = +{ + ANIMCMD_FRAME(128, 8), + ANIMCMD_END, +}; +static const union AnimCmd *const gUnknown_085E4E5C[] = +{ + gUnknown_085E4DEC, + gUnknown_085E4DF4, + gUnknown_085E4DFC, + gUnknown_085E4E04, + gUnknown_085E4E0C, + gUnknown_085E4E14, + gUnknown_085E4E1C, +}; +static const union AnimCmd *const gUnknown_085E4E78[] = +{ + gUnknown_085E4E24, + gUnknown_085E4E2C, + gUnknown_085E4E34, + gUnknown_085E4E3C, + gUnknown_085E4E44, + gUnknown_085E4E4C, +}; +static const union AnimCmd *const gUnknown_085E4E90[] = +{ + gUnknown_085E4E54, +}; +static const s16 gUnknown_085E4E94[][2] = +{ + {0, -72}, + {1, -56}, + {2, -40}, + {3, -24}, + {4, 8}, + {5, 24}, + {3, 40}, + {1, 56}, + {6, 72}, + {0, -28}, + {1, -20}, + {2, -12}, + {3, -4}, + {2, 4}, + {4, 12}, + {5, 20}, + {3, 28}, +}; +static const union AffineAnimCmd gUnknown_085E4ED8[] = +{ + AFFINEANIMCMD_FRAME(128, 128, 0, 0), + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd gUnknown_085E4EE8[] = +{ + AFFINEANIMCMD_FRAME(128, 128, 0, 0), + AFFINEANIMCMD_FRAME(16, 16, 0, 16), + AFFINEANIMCMD_FRAME(-16, -16, 0, 8), + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd gUnknown_085E4F08[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(8, 8, 0, 48), + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd gUnknown_085E4F20[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(2, 2, 0, 48), + AFFINEANIMCMD_END, +}; +static const union AffineAnimCmd *const gUnknown_085E4F38[] = +{ + gUnknown_085E4ED8, + gUnknown_085E4EE8, + gUnknown_085E4F08, + gUnknown_085E4F20, +}; +static const u16 gUnknown_085E4F48[] = +{ + 0x100, 0xC0, 0x80, 0x40, 0x00, 0x40, 0x80, 0xC0, 0x100 +}; +static void sub_816FB38(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4F5C = +{ + .tileTag = 2000, + .paletteTag = 2001, + .oam = &gUnknown_085E4DD4, + .anims = gUnknown_085E4E5C, + .images = NULL, + .affineAnims = gUnknown_085E4F38, + .callback = sub_816FB38, +}; +static const struct SpriteTemplate gUnknown_085E4F74 = +{ + .tileTag = 2000, + .paletteTag = 2001, + .oam = &gUnknown_085E4DDC, + .anims = gUnknown_085E4E78, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816FB38, +}; +static void sub_816FD44(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4F8C = +{ + .tileTag = 2000, + .paletteTag = 2001, + .oam = &gUnknown_085E4DE4, + .anims = gUnknown_085E4E90, + .images = NULL, + .affineAnims = gUnknown_085E4F38, + .callback = sub_816FD44, +}; +static const u8 gUnknown_085E4FA4[] = +{ + 0x00, 0x17, 0x17, 0x31, 0x3E, 0x24, 0x24, 0x0A, 0x0A +}; +static const struct OamData gUnknown_085E4FB0 = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E4FB8[] = +{ + ANIMCMD_FRAME(0, 10), + ANIMCMD_JUMP(0), +}; +static const union AnimCmd *const gUnknown_085E4FC0[] = +{ + gUnknown_085E4FB8, +}; +static void sub_816FEDC(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E4FC4 = +{ + .tileTag = 2002, + .paletteTag = 2002, + .oam = &gUnknown_085E4FB0, + .anims = gUnknown_085E4FC0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_816FEDC, +}; +static const struct CompressedSpriteSheet gUnknown_085E4FDC[] = { {gIntroTiles, 0x1400, 2000}, {NULL}, -}*/; -extern const struct CompressedSpriteSheet gUnknown_085E4FEC[]/* = +}; +static const struct CompressedSpriteSheet gUnknown_085E4FEC[] = { - {gIntro1EonTiles, 0x400, 2002}, + {gIntro1FlygonGfx, 0x400, 2002}, {NULL}, -}*/; -extern const struct SpritePalette gUnknown_085E4FFC[]/* = +}; +static const struct SpritePalette gUnknown_085E4FFC[] = { - {Palette_406340, 2000}, - {Palette_406360, 2001}, - {gIntro1EonPalette, 2002}, + {gIntro1DropsPal, 2000}, + {gIntro1GFLogoPal, 2001}, + {gIntro1FlygonPalette, 2002}, {NULL}, -}*/; -extern const struct SpriteTemplate gUnknown_085E5030[]; -extern const struct CompressedSpriteSheet gUnknown_085E5048[]; -extern const struct SpritePalette gUnknown_085E5058[]; +}; +static const struct OamData gUnknown_085E501C = +{ + .y = 160, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; +static const union AnimCmd gUnknown_085E5024[] = +{ + ANIMCMD_FRAME(16, 8), + ANIMCMD_END, +}; +static const union AnimCmd *const gUnknown_085E502C[] = +{ + gUnknown_085E5024, +}; +static void sub_8170040(struct Sprite *sprite); +static const struct SpriteTemplate gUnknown_085E5030 = +{ + .tileTag = 2003, + .paletteTag = 2003, + .oam = &gUnknown_085E501C, + .anims = gUnknown_085E502C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8170040, +}; +static const struct CompressedSpriteSheet gUnknown_085E5048[] = +{ + {gIntro3MiscTiles, 0xA00, 2003}, + {NULL}, +}; +static const struct SpritePalette gUnknown_085E5058[] = +{ + {gIntro3Misc1Palette, 2003}, + {NULL}, +}; -extern void MainCB2_EndIntro(void); -extern void Task_IntroLoadPart1Graphics(u8); -extern u8 CreateWaterDrop(s16, s16, u16, u16, u16, u8); -extern void Task_IntroFadeIn(u8); -extern void intro_reset_and_hide_bgs(void); -extern void Task_IntroWaterDrops(u8); -extern void Task_IntroWaterDrops_1(u8); -extern void Task_IntroWaterDrops_2(u8); -extern void Task_IntroWaterDrops_3(u8); -extern void Task_IntroScrollDownAndShowFlygon(u8); -extern void Task_IntroWaitToSetupPart2(u8); -extern void Task_IntroLoadPart2Graphics(u8); -extern void Task_IntroStartBikeRide(u8); -extern void Task_IntroHandleBikeAndFlygonMovement(u8); -extern void Task_IntroWaitToSetupPart3(u8); -extern void Task_IntroLoadPart3Graphics(u8); -extern void Task_IntroSpinAndZoomPokeball(u8); -extern void Task_IntroWaitToSetupPart3LegendsFight(u8); -extern void Task_IntroLoadPart1Graphics3(u8); -extern void Task_IntroLoadPart1Graphics4(u8); -extern void Task_IntroLoadPart1Graphics5(u8); -extern void Task_IntroLoadPart1Graphics6(u8); -extern void Task_IntroLoadPart1Graphics7(u8); -extern void Task_IntroLoadPart1Graphics8(u8); -extern void Task_IntroLoadPart1Graphics9(u8); -extern void Task_IntroFadeIn0(u8); -extern void Task_IntroFadeIn1(u8); -extern void Task_IntroFadeIn2(u8); -extern void Task_IntroFadeIn3(u8); -extern void Task_IntroFadeIn4(u8); -extern void Task_IntroFadeIn5(u8); -extern void Task_IntroFadeIn6(u8); -extern void Task_IntroFadeIn7(u8); -extern void Task_IntroFadeIn8(u8); -extern void Task_IntroFadeIn9(u8); -extern void sub_816E190(u8); -extern void sub_816E1F8(struct Sprite *); -extern void sub_816E6D4(u8); -extern void sub_816E74C(void); -extern void sub_816EEA8(u8); -extern void sub_816F46C(struct Sprite *); -extern void sub_816F5B4(struct Sprite *); -extern void sub_816F660(struct Sprite *); -extern void SpriteCB_WaterDropFall(struct Sprite *); -extern void sub_816F318(struct Sprite *); -extern void sub_816F9D4(struct Sprite *); -extern void sub_816FAB0(struct Sprite *); -extern u8 sub_816FDB8(s16, s16, s16); +// this file's functions +static void MainCB2_EndIntro(void); +static void Task_IntroLoadPart1Graphics(u8); +static u8 CreateWaterDrop(s16, s16, u16, u16, u16, u8); +static void Task_IntroFadeIn(u8); +static void intro_reset_and_hide_bgs(void); +static void Task_IntroWaterDrops(u8); +static void Task_IntroWaterDrops_1(u8); +static void Task_IntroWaterDrops_2(u8); +static void Task_IntroWaterDrops_3(u8); +static void Task_IntroScrollDownAndShowFlygon(u8); +static void Task_IntroWaitToSetupPart2(u8); +static void Task_IntroLoadPart2Graphics(u8); +static void Task_IntroStartBikeRide(u8); +static void Task_IntroHandleBikeAndFlygonMovement(u8); +static void Task_IntroWaitToSetupPart3(u8); +static void Task_IntroLoadPart3Graphics(u8); +static void Task_IntroSpinAndZoomPokeball(u8); +static void Task_IntroWaitToSetupPart3LegendsFight(u8); +static void Task_IntroLoadPart1Graphics3(u8); +static void Task_IntroLoadPart1Graphics4(u8); +static void Task_IntroLoadPart1Graphics5(u8); +static void Task_IntroLoadPart1Graphics6(u8); +static void Task_IntroLoadPart1Graphics7(u8); +static void Task_IntroLoadPart1Graphics8(u8); +static void Task_IntroLoadPart1Graphics9(u8); +static void Task_IntroFadeIn0(u8); +static void Task_IntroFadeIn1(u8); +static void Task_IntroFadeIn2(u8); +static void Task_IntroFadeIn3(u8); +static void Task_IntroFadeIn4(u8); +static void Task_IntroFadeIn5(u8); +static void Task_IntroFadeIn6(u8); +static void Task_IntroFadeIn7(u8); +static void Task_IntroFadeIn8(u8); +static void Task_IntroFadeIn9(u8); +static void sub_816E190(u8); +static void sub_816E1F8(struct Sprite *); +static void sub_816E6D4(u8); +static void sub_816E74C(void); +static void sub_816EEA8(u8); +static void sub_816F46C(struct Sprite *); +static void sub_816F5B4(struct Sprite *); +static void sub_816F660(struct Sprite *); +static void SpriteCB_WaterDropFall(struct Sprite *); +static void sub_816F318(struct Sprite *); +static void sub_816F9D4(struct Sprite *); +static void sub_816FAB0(struct Sprite *); +static u8 sub_816FDB8(s16, s16, s16); -void VBlankCB_Intro(void) +static void VBlankCB_Intro(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -191,7 +893,7 @@ void VBlankCB_Intro(void) ScanlineEffect_InitHBlankDmaTransfer(); } -void MainCB2_Intro(void) +static void MainCB2_Intro(void) { RunTasks(); AnimateSprites(); @@ -203,25 +905,25 @@ void MainCB2_Intro(void) gIntroFrameCounter++; } -void MainCB2_EndIntro(void) +static void MainCB2_EndIntro(void) { if (!UpdatePaletteFade()) SetMainCallback2(CB2_InitTitleScreen); } -void LoadCopyrightGraphics(u16 tilesetAddress, u16 tilemapAddress, u16 paletteAddress) +static void LoadCopyrightGraphics(u16 tilesetAddress, u16 tilemapAddress, u16 paletteAddress) { LZ77UnCompVram(gIntroCopyright_Gfx, (void *)(VRAM + tilesetAddress)); LZ77UnCompVram(gIntroCopyright_Tilemap, (void *)(VRAM + tilemapAddress)); LoadPalette(gIntroCopyright_Pal, paletteAddress, 0x20); } -void SerialCB_CopyrightScreen(void) +static void SerialCB_CopyrightScreen(void) { GameCubeMultiBoot_HandleSerialInterrupt(&gMultibootProgramStruct); } -u8 SetUpCopyrightScreen(void) +static u8 SetUpCopyrightScreen(void) { u16 ime; @@ -245,7 +947,7 @@ u8 SetUpCopyrightScreen(void) ResetTasks(); ResetSpriteData(); FreeAllSpritePalettes(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) @@ -265,7 +967,7 @@ u8 SetUpCopyrightScreen(void) GameCubeMultiBoot_Main(&gMultibootProgramStruct); if (gMultibootProgramStruct.gcmb_field_2 != 1) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); gMain.state++; } break; @@ -318,7 +1020,7 @@ void CB2_InitCopyrightScreenAfterTitleScreen(void) SetUpCopyrightScreen(); } -void Task_IntroLoadPart1Graphics(u8 taskId) +static void Task_IntroLoadPart1Graphics(u8 taskId) { SetVBlankCallback(NULL); gUnknown_0203BCC8 = Random() & 1; @@ -358,9 +1060,9 @@ void Task_IntroLoadPart1Graphics(u8 taskId) gTasks[taskId].func = Task_IntroFadeIn; } -void Task_IntroFadeIn(u8 taskId) +static void Task_IntroFadeIn(u8 taskId) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); SetVBlankCallback(VBlankCB_Intro); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON); gTasks[taskId].func = Task_IntroWaterDrops; @@ -369,7 +1071,7 @@ void Task_IntroFadeIn(u8 taskId) ResetSerial(); } -void Task_IntroWaterDrops(u8 taskId) +static void Task_IntroWaterDrops(u8 taskId) { //start moving rock if (gIntroFrameCounter == 76) @@ -406,7 +1108,7 @@ void Task_IntroWaterDrops(u8 taskId) } } -void Task_IntroWaterDrops_3(u8 taskId) +static void Task_IntroWaterDrops_3(u8 taskId) { s16 *data = gTasks[taskId].data; if (++data[2] & 1) @@ -414,29 +1116,29 @@ void Task_IntroWaterDrops_3(u8 taskId) switch (data[0]) { - case 0: - CreateSprite(gUnknown_085E4AB8, gUnknown_085E4AD0[data[4]][0], gUnknown_085E4AD0[data[4]][1] + data[3], 0); - data[0]++; - data[1] = 0xC; - data[4]++; - break; - case 1: - if (!--data[1]) - data[0] = 0; - break; + case 0: + CreateSprite(&gUnknown_085E4AB8, gUnknown_085E4AD0[data[4]][0], gUnknown_085E4AD0[data[4]][1] + data[3], 0); + data[0]++; + data[1] = 0xC; + data[4]++; + break; + case 1: + if (!--data[1]) + data[0] = 0; + break; } if (data[3] > 0x3C) DestroyTask(taskId); } -void sub_816D338(struct Sprite *sprite) +static void sub_816D338(struct Sprite *sprite) { if (++sprite->data[0] == 0xC) DestroySprite(sprite); } -void Task_IntroScrollDownAndShowFlygon(u8 taskId) +static void Task_IntroScrollDownAndShowFlygon(u8 taskId) { if (gIntroFrameCounter < 904) { @@ -462,7 +1164,7 @@ void Task_IntroScrollDownAndShowFlygon(u8 taskId) //show Flygon sprite if (gIntroFrameCounter == 832) { - u8 spriteId = CreateSprite(gUnknown_085E4FC4, 120, 160, 10); + u8 spriteId = CreateSprite(&gUnknown_085E4FC4, 120, 160, 10); gSprites[spriteId].invisible = TRUE; } } @@ -471,19 +1173,19 @@ void Task_IntroScrollDownAndShowFlygon(u8 taskId) //fade to white if (gIntroFrameCounter > 1007) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_WHITEALPHA); gTasks[taskId].func = Task_IntroWaitToSetupPart2; } } } -void Task_IntroWaitToSetupPart2(u8 taskId) +static void Task_IntroWaitToSetupPart2(u8 taskId) { if (gIntroFrameCounter > 1026) gTasks[taskId].func = Task_IntroLoadPart2Graphics; } -void Task_IntroLoadPart2Graphics(u8 taskId) +static void Task_IntroLoadPart2Graphics(u8 taskId) { intro_reset_and_hide_bgs(); SetVBlankCallback(NULL); @@ -496,7 +1198,7 @@ void Task_IntroLoadPart2Graphics(u8 taskId) gTasks[taskId].func = Task_IntroStartBikeRide; } -void Task_IntroStartBikeRide(u8 taskId) +static void Task_IntroStartBikeRide(u8 taskId) { u8 spriteId; @@ -515,8 +1217,8 @@ void Task_IntroStartBikeRide(u8 taskId) LoadSpritePalettes(gUnknown_085F530C); LoadSpritePalettes(gUnknown_085E4B08); - CreateSprite(gUnknown_085E4BDC, 0x110, 0x80, 0); - CreateSprite(gUnknown_085E4BA4, 0x120, 0x6E, 1); + CreateSprite(&gUnknown_085E4BDC, 0x110, 0x80, 0); + CreateSprite(&gUnknown_085E4BA4, 0x120, 0x6E, 1); if (gUnknown_0203BCC8 == 0) spriteId = intro_create_brendan_sprite(0x110, 100); @@ -526,18 +1228,18 @@ void Task_IntroStartBikeRide(u8 taskId) gSprites[spriteId].callback = sub_816F9D4; gSprites[spriteId].anims = gUnknown_085E4DC4; gTasks[taskId].data[1] = spriteId; - CreateSprite(gUnknown_085E4B40, 0x110, 0x50, 0x4); + CreateSprite(&gUnknown_085E4B40, 0x110, 0x50, 0x4); spriteId = intro_create_flygon_sprite(-0x40, 0x3C); gSprites[spriteId].callback = sub_816FAB0; gTasks[taskId].data[2] = spriteId; - BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_WHITEALPHA); SetVBlankCallback(VBlankCB_Intro); gTasks[taskId].data[0] = sub_817B3DC(1, 0x4000, 0x400, 0x10); sub_817B150(1); gTasks[taskId].func = Task_IntroHandleBikeAndFlygonMovement; } -void Task_IntroHandleBikeAndFlygonMovement(u8 taskId) +static void Task_IntroHandleBikeAndFlygonMovement(u8 taskId) { s16 a; u16 sine; @@ -549,7 +1251,7 @@ void Task_IntroHandleBikeAndFlygonMovement(u8 taskId) } if (gIntroFrameCounter > 1946) { - BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 16, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 16, RGB_WHITEALPHA); gTasks[taskId].func = Task_IntroWaitToSetupPart3; } if (gIntroFrameCounter == 1109) @@ -572,215 +1274,215 @@ void Task_IntroHandleBikeAndFlygonMovement(u8 taskId) sub_817B540(0); } -void Task_IntroWaitToSetupPart3(u8 taskId) +static void Task_IntroWaitToSetupPart3(u8 taskId) { if (gIntroFrameCounter > 2068) gTasks[taskId].func = Task_IntroLoadPart3Graphics; } -void sub_816D81C(struct Sprite *sprite) +static void sub_816D81C(struct Sprite *sprite) { sprite->data[3] += 4; switch (sprite->data[0]) { - case 0: - if (++sprite->data[1] < 180) - break; - ++sprite->data[0]; - case 1: - sprite->pos1.x -= 4; - if (sprite->pos1.x == 0x3C) + case 0: + if (++sprite->data[1] < 180) + break; + ++sprite->data[0]; + case 1: + sprite->pos1.x -= 4; + if (sprite->pos1.x == 0x3C) + { + sprite->data[0] = 8; + sprite->data[1] = 20; + sprite->data[2] = 2; + } + break; + case 2: + sprite->pos1.x += 8; + sprite->pos1.y -= 2; + if (sprite->pos1.x == 0x7C) + { + sprite->data[0] = 8; + sprite->data[1] = 20; + sprite->data[2] = 3; + } + break; + case 3: + sprite->pos1.y += 4; + if (sprite->pos1.y == 0x50) + { + sprite->data[0] = 8; + sprite->data[1] = 10; + sprite->data[2] = 4; + } + break; + case 4: + sprite->pos1.x -= 8; + sprite->pos1.y -= 2; + if (sprite->pos1.x == 0x3C) + { + sprite->data[0] = 8; + sprite->data[1] = 10; + sprite->data[2] = 5; + } + break; + case 5: + sprite->pos1.x += 0x3C; + sprite->data[4] = 0xC0; + sprite->data[5] = 0x80; + sprite->data[6] = 0x3; + sprite->data[0]++; + case 6: + sprite->pos2.x = Sin((u8)sprite->data[4], 0x3C); + sprite->pos2.y = Sin((u8)sprite->data[5], 0x14); + sprite->data[4] += 2; + sprite->data[5] += 4; + if ((sprite->data[4] & 0xFF) == 0x40) + { + sprite->hFlip = FALSE; + if (!--sprite->data[6]) { - sprite->data[0] = 8; - sprite->data[1] = 20; - sprite->data[2] = 2; + sprite->pos1.x += sprite->pos2.x; + sprite->pos2.x = 0; + sprite->data[0]++; } - break; - case 2: - sprite->pos1.x += 8; - sprite->pos1.y -= 2; - if (sprite->pos1.x == 0x7C) - { - sprite->data[0] = 8; - sprite->data[1] = 20; - sprite->data[2] = 3; - } - break; - case 3: - sprite->pos1.y += 4; - if (sprite->pos1.y == 0x50) - { - sprite->data[0] = 8; - sprite->data[1] = 10; - sprite->data[2] = 4; - } - break; - case 4: - sprite->pos1.x -= 8; - sprite->pos1.y -= 2; - if (sprite->pos1.x == 0x3C) - { - sprite->data[0] = 8; - sprite->data[1] = 10; - sprite->data[2] = 5; - } - break; - case 5: - sprite->pos1.x += 0x3C; - sprite->data[4] = 0xC0; - sprite->data[5] = 0x80; - sprite->data[6] = 0x3; - sprite->data[0]++; - case 6: - sprite->pos2.x = Sin((u8)sprite->data[4], 0x3C); - sprite->pos2.y = Sin((u8)sprite->data[5], 0x14); - sprite->data[4] += 2; - sprite->data[5] += 4; - if ((sprite->data[4] & 0xFF) == 0x40) - { - sprite->hFlip = FALSE; - if (!--sprite->data[6]) - { - sprite->pos1.x += sprite->pos2.x; - sprite->pos2.x = 0; - sprite->data[0]++; - } - } - break; - case 7: - sprite->pos1.x -= 2; - sprite->pos2.y = Sin((u8)sprite->data[5], 0x14); - sprite->data[5] += 4; - if (sprite->pos1.x < -16) - DestroySprite(sprite); - break; - case 8: - sprite->pos2.y = Cos((u8)sprite->data[3], 2); - if (!--sprite->data[1]) - sprite->data[0] = sprite->data[2]; - break; + } + break; + case 7: + sprite->pos1.x -= 2; + sprite->pos2.y = Sin((u8)sprite->data[5], 0x14); + sprite->data[5] += 4; + if (sprite->pos1.x < -16) + DestroySprite(sprite); + break; + case 8: + sprite->pos2.y = Cos((u8)sprite->data[3], 2); + if (!--sprite->data[1]) + sprite->data[0] = sprite->data[2]; + break; } } -void sub_816D9C0(struct Sprite *sprite) +static void sub_816D9C0(struct Sprite *sprite) { switch (sprite->data[0]) { - case 0: - if (gIntroFrameCounter == 1224) + case 0: + if (gIntroFrameCounter == 1224) + { + StartSpriteAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 1: + if (gIntroFrameCounter == 1576) + { + StartSpriteAnim(sprite, 0); + sprite->data[0]++; + } + else + { + sprite->data[1] += 0x40; + if (sprite->data[1] & 0xFF00) { - StartSpriteAnim(sprite, 1); - sprite->data[0]++; + sprite->pos1.x--; + sprite->data[1] &= 0xFF; } - break; - case 1: - if (gIntroFrameCounter == 1576) + } + break; + case 2: + if (gIntroFrameCounter != 1735) + { + sprite->data[1] += 0x20; + if (sprite->data[1] & 0xFF00) { - StartSpriteAnim(sprite, 0); - sprite->data[0]++; + sprite->pos1.x++; + sprite->data[1] &= 0xFF; } - else + } + else + { + StartSpriteAnim(sprite, 1); + sprite->data[0]++; + sprite->data[2] = 0x50; + } + break; + case 3: + if (--sprite->data[2]) + { + sprite->data[1] += 0x40; + if (sprite->data[1] & 0xFF00) { - sprite->data[1] += 0x40; - if (sprite->data[1] & 0xFF00) - { - sprite->pos1.x--; - sprite->data[1] &= 0xFF; - } + sprite->pos1.x--; + sprite->data[1] &= 0xFF; } - break; - case 2: - if (gIntroFrameCounter != 1735) - { - sprite->data[1] += 0x20; - if (sprite->data[1] & 0xFF00) - { - sprite->pos1.x++; - sprite->data[1] &= 0xFF; - } - } - else - { - StartSpriteAnim(sprite, 1); - sprite->data[0]++; - sprite->data[2] = 0x50; - } - break; - case 3: - if (--sprite->data[2]) - { - sprite->data[1] += 0x40; - if (sprite->data[1] & 0xFF00) - { - sprite->pos1.x--; - sprite->data[1] &= 0xFF; - } - } - else - { - StartSpriteAnim(sprite, 2); - sprite->data[0]++; - } - break; - case 4: - if (sprite->animEnded) - sprite->pos1.x += 4; - - if (sprite->pos1.x > 336) - { - StartSpriteAnim(sprite, 1); - sprite->data[0]++; - } - break; - case 5: - if (gIntroFrameCounter > 1855) - sprite->pos1.x -= 2; - break; + } + else + { + StartSpriteAnim(sprite, 2); + sprite->data[0]++; + } + break; + case 4: + if (sprite->animEnded) + sprite->pos1.x += 4; + + if (sprite->pos1.x > 336) + { + StartSpriteAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 5: + if (gIntroFrameCounter > 1855) + sprite->pos1.x -= 2; + break; } } -void sub_816DAE8(struct Sprite *sprite) +static void sub_816DAE8(struct Sprite *sprite) { switch (sprite->data[0]) { - case 0: - if (gIntroFrameCounter == 1088) - sprite->data[0]++; - break; - case 1: - sprite->pos1.x -= 2; - if (gIntroFrameCounter != 1168) - break; - sprite->pos1.y -= 12; - sprite->data[1] = 0x80; - sprite->data[2] = 0; + case 0: + if (gIntroFrameCounter == 1088) sprite->data[0]++; - case 2: - if (sprite->pos1.x + sprite->pos2.x <= -0x20) + break; + case 1: + sprite->pos1.x -= 2; + if (gIntroFrameCounter != 1168) + break; + sprite->pos1.y -= 12; + sprite->data[1] = 0x80; + sprite->data[2] = 0; + sprite->data[0]++; + case 2: + if (sprite->pos1.x + sprite->pos2.x <= -0x20) + { + DestroySprite(sprite); + } + else + { + if ((sprite->data[1] & 0xFF) < 0x40) { - DestroySprite(sprite); + sprite->pos2.x = Sin((u8)sprite->data[1], 0x10); } else { - if ((sprite->data[1] & 0xFF) < 0x40) - { - sprite->pos2.x = Sin((u8)sprite->data[1], 0x10); - } - else - { - if ((sprite->data[1] & 0xFF) == 0x40) - sprite->pos1.x -= 0x30; - sprite->pos2.x = Sin((u8)sprite->data[1], 0x40); - } - sprite->data[1]++; - sprite->pos2.y = Cos((u8)sprite->data[2], 0xC); - sprite->data[2]++; + if ((sprite->data[1] & 0xFF) == 0x40) + sprite->pos1.x -= 0x30; + sprite->pos2.x = Sin((u8)sprite->data[1], 0x40); } - break; + sprite->data[1]++; + sprite->pos2.y = Cos((u8)sprite->data[2], 0xC); + sprite->data[2]++; + } + break; } } -void Task_IntroLoadPart3Graphics(u8 taskId) +static void Task_IntroLoadPart3Graphics(u8 taskId) { intro_reset_and_hide_bgs(); LZ77UnCompVram(gIntro3Pokeball_Gfx, (void *)VRAM); @@ -793,7 +1495,7 @@ void Task_IntroLoadPart3Graphics(u8 taskId) sub_816F2A8(0x78, 0x50, 0, 0); ResetSpriteData(); FreeAllSpritePalettes(); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA); SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(8) | BGCNT_256COLOR | BGCNT_AFF256x256); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG2_ON | DISPCNT_OBJ_ON); gTasks[taskId].func = Task_IntroSpinAndZoomPokeball; @@ -801,7 +1503,7 @@ void Task_IntroLoadPart3Graphics(u8 taskId) m4aSongNumStart(MUS_T_BATTLE); } -void Task_IntroSpinAndZoomPokeball(u8 taskId) +static void Task_IntroSpinAndZoomPokeball(u8 taskId) { gTasks[taskId].data[0] += 0x400; @@ -818,16 +1520,16 @@ void Task_IntroSpinAndZoomPokeball(u8 taskId) sub_816F2A8(0x78, 0x50, 0x10000 / gTasks[taskId].data[1], gTasks[taskId].data[0]); if (gIntroFrameCounter == 28) - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA); } -void Task_IntroWaitToSetupPart3LegendsFight(u8 taskId) +static void Task_IntroWaitToSetupPart3LegendsFight(u8 taskId) { if (gIntroFrameCounter > 43) gTasks[taskId].func = Task_IntroLoadPart1Graphics3; } -void Task_IntroLoadPart1Graphics3(u8 taskId) +static void Task_IntroLoadPart1Graphics3(u8 taskId) { u16 i; @@ -848,7 +1550,7 @@ void Task_IntroLoadPart1Graphics3(u8 taskId) } } -void Task_IntroLoadPart1Graphics4(u8 taskId) +static void Task_IntroLoadPart1Graphics4(u8 taskId) { SetGpuReg(REG_OFFSET_WIN0H, 0xF0); SetGpuReg(REG_OFFSET_WIN0V, 0xA0); @@ -871,7 +1573,7 @@ void Task_IntroLoadPart1Graphics4(u8 taskId) | DISPCNT_BG2_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0xFFA0; gTasks[taskId].data[2] = 0xFF51; @@ -880,7 +1582,7 @@ void Task_IntroLoadPart1Graphics4(u8 taskId) gTasks[taskId].func = Task_IntroLoadPart1Graphics5; } -void Task_IntroLoadPart1Graphics5(u8 taskId) +static void Task_IntroLoadPart1Graphics5(u8 taskId) { u16 foo = gTasks[taskId].data[0]; @@ -896,19 +1598,19 @@ void Task_IntroLoadPart1Graphics5(u8 taskId) } } -void Task_IntroLoadPart1Graphics6(u8 taskId) +static void Task_IntroLoadPart1Graphics6(u8 taskId) { gTasks[taskId].func = Task_IntroLoadPart1Graphics7; } -void Task_IntroLoadPart1Graphics7(u8 taskId) +static void Task_IntroLoadPart1Graphics7(u8 taskId) { gTasks[taskId].data[0] = 0; gTasks[taskId].func = Task_IntroLoadPart1Graphics8; ScanlineEffect_InitWave(0, 0xA0, 0x4, 4, 1, 4, 0); } -void Task_IntroLoadPart1Graphics8(u8 taskId) +static void Task_IntroLoadPart1Graphics8(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -918,103 +1620,103 @@ void Task_IntroLoadPart1Graphics8(u8 taskId) sub_816F2A8(data[1], data[2] + data[4], data[3], 0); switch (data[0]) { - case 0: - data[1] += 0x10; - if (data[1] == 0xA0) - { + case 0: + data[1] += 0x10; + if (data[1] == 0xA0) + { + data[0]++; + data[6] = 2; + data[7] = 0x1E2; + sub_816E190(taskId); + } + break; + case 1: + if (--data[6] == 0) + { + data[6] = 2; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[31], sizeof(u16)); + data[7] += 2; + if (data[7] == 0x1EC) data[0]++; - data[6] = 2; - data[7] = 0x1E2; - sub_816E190(taskId); - } - break; - case 1: - if (--data[6] == 0) + } + break; + case 2: + if (--data[6] == 0) + { + data[6] = 2; + data[0]++; + } + break; + case 3: + if (--data[6] == 0) + { + data[6] = 2; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[31], sizeof(u16)); + data[7] -= 2; + if (data[7] == 0x1E0) { - data[6] = 2; - CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[31], sizeof(u16)); - data[7] += 2; - if (data[7] == 0x1EC) - data[0]++; - } - break; - case 2: - if (--data[6] == 0) - { - data[6] = 2; + data[6] = 8; data[0]++; } - break; - case 3: - if (--data[6] == 0) - { - data[6] = 2; - CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[31], sizeof(u16)); - data[7] -= 2; - if (data[7] == 0x1E0) - { - data[6] = 8; - data[0]++; - } - } - break; - case 4: - if (--data[6] == 0) - { - data[1] = -0x60; - data[2] = 0xA9; - data[6] = 3; - data[0]++; - } - break; - case 5: - if (--data[6] == 0) - { - data[1] = 0x50; - data[2] = 0x29; - data[6] = 0x10; - PlayCryInternal(SPECIES_GROUDON, 0, 100, 10, 0); - data[0]++; - } - break; - case 6: - if (--data[6] == 0) - { - data[1] = 0x50; - data[2] = 0x28; - data[0]++; - } - break; - case 7: - data[1] += 4; - data[2] += 4; - data[6] += 0x666; - data[3] = Sin((data[6] & 0xFF00) >> 8, 0x40) + 0x100; - if (data[1] == 0x78) - { - BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, 0x7FFF); - data[3] = 0x100; - data[4] = 0; - data[0]++; - } - break; - case 8: - if (data[3]) - data[3] -= 8; - else - data[0]++; - break; - case 9: - if (!gPaletteFade.active) - { - gTasks[taskId].func = Task_IntroLoadPart1Graphics9; - gScanlineEffect.state = 3; - } - break; + } + break; + case 4: + if (--data[6] == 0) + { + data[1] = -0x60; + data[2] = 0xA9; + data[6] = 3; + data[0]++; + } + break; + case 5: + if (--data[6] == 0) + { + data[1] = 0x50; + data[2] = 0x29; + data[6] = 0x10; + PlayCryInternal(SPECIES_GROUDON, 0, 100, 10, 0); + data[0]++; + } + break; + case 6: + if (--data[6] == 0) + { + data[1] = 0x50; + data[2] = 0x28; + data[0]++; + } + break; + case 7: + data[1] += 4; + data[2] += 4; + data[6] += 0x666; + data[3] = Sin((data[6] & 0xFF00) >> 8, 0x40) + 0x100; + if (data[1] == 0x78) + { + BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, RGB_WHITE); + data[3] = 0x100; + data[4] = 0; + data[0]++; + } + break; + case 8: + if (data[3]) + data[3] -= 8; + else + data[0]++; + break; + case 9: + if (!gPaletteFade.active) + { + gTasks[taskId].func = Task_IntroLoadPart1Graphics9; + gScanlineEffect.state = 3; + } + break; } } -void sub_816E190(u8 a0) +static void sub_816E190(u8 a0) { int i; u8 spriteId; @@ -1030,7 +1732,7 @@ void sub_816E190(u8 a0) } } -void sub_816E1F8(struct Sprite *sprite) +static void sub_816E1F8(struct Sprite *sprite) { sprite->data[3]++; if (sprite->data[3] % 2 == 0) @@ -1038,28 +1740,28 @@ void sub_816E1F8(struct Sprite *sprite) switch(sprite->data[0]) { - case 0: - sprite->data[2] += gUnknown_085E4C64[sprite->data[1]][2]; - sprite->pos1.y -= (sprite->data[2] & 0xFF00) >> 8; - sprite->data[2] &= 0xFF; - if (gTasks[sprite->data[4]].data[0] > 7) - sprite->data[0]++; - break; - case 1: - if (sprite->pos1.x < 0x78) - sprite->pos1.x -= 2; - else - sprite->pos1.x += 2; - - if (sprite->pos1.y < 0x50) - sprite->pos1.y -= 2; - else - sprite->pos1.y += 2; - break; + case 0: + sprite->data[2] += gUnknown_085E4C64[sprite->data[1]][2]; + sprite->pos1.y -= (sprite->data[2] & 0xFF00) >> 8; + sprite->data[2] &= 0xFF; + if (gTasks[sprite->data[4]].data[0] > 7) + sprite->data[0]++; + break; + case 1: + if (sprite->pos1.x < 0x78) + sprite->pos1.x -= 2; + else + sprite->pos1.x += 2; + + if (sprite->pos1.y < 0x50) + sprite->pos1.y -= 2; + else + sprite->pos1.y += 2; + break; } } -void Task_IntroLoadPart1Graphics9(u8 taskId) +static void Task_IntroLoadPart1Graphics9(u8 taskId) { ResetSpriteData(); LZDecompressVram(gIntro3KyogreGfx, (void *)VRAM); @@ -1067,7 +1769,7 @@ void Task_IntroLoadPart1Graphics9(u8 taskId) LZDecompressVram(gIntro3KyogreBgTilemap, (void *)(VRAM + 0xE000)); LoadCompressedObjectPic(gUnknown_085E4C88); LoadSpritePalette(gUnknown_085E4C98); - BeginNormalPaletteFade(0xFFFFFFFE, 0, 0x10, 0, 0xFFFF); + BeginNormalPaletteFade(0xFFFFFFFE, 0, 0x10, 0, RGB_WHITEALPHA); gTasks[taskId].func = Task_IntroFadeIn0; gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0x150; @@ -1078,7 +1780,7 @@ void Task_IntroLoadPart1Graphics9(u8 taskId) ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, 6, 0); } -void Task_IntroFadeIn0(u8 taskId) +static void Task_IntroFadeIn0(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -1086,150 +1788,150 @@ void Task_IntroFadeIn0(u8 taskId) switch (data[0]) { - case 0: - if (--data[6] != 0) - break; + case 0: + if (--data[6] != 0) + break; + data[0]++; + case 1: + data[6] += 4; + gTasks[taskId].data[1] = 0x158 - Sin(data[6], 0x100); + gTasks[taskId].data[2] = 0x54 - Cos(data[6], 0x40); + if (data[6] == 0x40) + { + data[6] = 0x19; + data[7] = 1; data[0]++; - case 1: - data[6] += 4; - gTasks[taskId].data[1] = 0x158 - Sin(data[6], 0x100); - gTasks[taskId].data[2] = 0x54 - Cos(data[6], 0x40); - if (data[6] == 0x40) + sub_816E6D4(0); + } + break; + case 2: + if (--data[6] == 0) + { + gTasks[taskId].data[1] += 0x100; + gTasks[taskId].data[2] -= 0x102; + data[6] = 8; + data[0]++; + sub_816E6D4(0); + sub_816E74C(); + } + break; + case 3: + if (--data[6] == 0) + { + gTasks[taskId].data[1] -= 0x100; + gTasks[taskId].data[2] += 0x102; + data[6] = 8; + data[0]++; + } + break; + case 4: + if (--data[6] == 0) + { + gTasks[taskId].data[2] -= 0xFC; + data[6] = 8; + data[0]++; + } + break; + case 5: + if (--data[6] == 0) + { + gTasks[taskId].data[2] += 0xFC; + if (data[7] != 0) { - data[6] = 0x19; - data[7] = 1; - data[0]++; - sub_816E6D4(0); + data[6] = 12; + data[7]--; + data[0] = 2; } - break; - case 2: - if (--data[6] == 0) + else { - gTasks[taskId].data[1] += 0x100; - gTasks[taskId].data[2] -= 0x102; - data[6] = 8; + data[6] = 1; data[0]++; - sub_816E6D4(0); - sub_816E74C(); + PlayCryInternal(SPECIES_KYOGRE, 0, 120, 10, 0); } - break; - case 3: - if (--data[6] == 0) + } + break; + case 6: + if (--data[6] == 0) + { + data[6] = 4; + data[7] = 0x1EA; + data[0]++; + } + break; + case 7: + if (--data[6] == 0) + { + data[6] = 4; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[47], sizeof(u16)); + data[7] -= 2; + if (data[7] == 0x1E0) + data[0]++; + } + break; + case 8: + if (--data[6] == 0) + { + data[6] = 4; + data[7] = 0x1E2; + data[0]++; + } + break; + case 9: + if (--data[6] == 0) + { + data[6] = 4; + CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[47], sizeof(u16)); + data[7] += 2; + if (data[7] == 0x1EE) { - gTasks[taskId].data[1] -= 0x100; - gTasks[taskId].data[2] += 0x102; - data[6] = 8; + data[6] = 0x10; data[0]++; } - break; - case 4: - if (--data[6] == 0) - { - gTasks[taskId].data[2] -= 0xFC; - data[6] = 8; - data[0]++; - } - break; - case 5: - if (--data[6] == 0) - { - gTasks[taskId].data[2] += 0xFC; - if (data[7] != 0) - { - data[6] = 12; - data[7]--; - data[0] = 2; - } - else - { - data[6] = 1; - data[0]++; - PlayCryInternal(SPECIES_KYOGRE, 0, 120, 10, 0); - } - } - break; - case 6: - if (--data[6] == 0) - { - data[6] = 4; - data[7] = 0x1EA; - data[0]++; - } - break; - case 7: - if (--data[6] == 0) - { - data[6] = 4; - CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[47], sizeof(u16)); - data[7] -= 2; - if (data[7] == 0x1E0) - data[0]++; - } - break; - case 8: - if (--data[6] == 0) - { - data[6] = 4; - data[7] = 0x1E2; - data[0]++; - } - break; - case 9: - if (--data[6] == 0) - { - data[6] = 4; - CpuCopy16(&gIntro3BgPal[data[7]], &gPlttBufferFaded[47], sizeof(u16)); - data[7] += 2; - if (data[7] == 0x1EE) - { - data[6] = 0x10; - data[0]++; - } - } - break; - case 10: - if (--data[6] == 0) - { - data[6] = 0; - data[0]++; - sub_816E6D4(taskId); - } - break; - case 11: - data[6] += 4; - data[3] -= 8; - gTasks[taskId].data[1] = Sin(data[6], 0x3C) + 0x58; - if (data[6] == 0x40) - { - BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, 0x7FFF); - data[0]++; - } - break; - case 12: - data[6] += 4; - data[3] -= 8; - gTasks[taskId].data[1] = Sin(data[6], 0x14) + 0x80; - if (data[6] == 0x80) - data[0]++; - break; - case 13: - if (!gPaletteFade.active) - { - gTasks[taskId].func = Task_IntroFadeIn1; - gScanlineEffect.state = 3; - } - break; + } + break; + case 10: + if (--data[6] == 0) + { + data[6] = 0; + data[0]++; + sub_816E6D4(taskId); + } + break; + case 11: + data[6] += 4; + data[3] -= 8; + gTasks[taskId].data[1] = Sin(data[6], 0x3C) + 0x58; + if (data[6] == 0x40) + { + BeginNormalPaletteFade(0xFFFFFFFE, 3, 0, 16, RGB_WHITE); + data[0]++; + } + break; + case 12: + data[6] += 4; + data[3] -= 8; + gTasks[taskId].data[1] = Sin(data[6], 0x14) + 0x80; + if (data[6] == 0x80) + data[0]++; + break; + case 13: + if (!gPaletteFade.active) + { + gTasks[taskId].func = Task_IntroFadeIn1; + gScanlineEffect.state = 3; + } + break; } } -void sub_816E6D4(u8 a0) +static void sub_816E6D4(u8 a0) { int i; u8 spriteId; for (i = 0; i < 6; i++) { - spriteId = CreateSprite(gUnknown_085E4D14, gUnknown_085E4CA8[i][0], gUnknown_085E4CA8[i][1], i); + spriteId = CreateSprite(&gUnknown_085E4D14, gUnknown_085E4CA8[i][0], gUnknown_085E4CA8[i][1], i); gSprites[spriteId].invisible = TRUE; gSprites[spriteId].data[5] = a0; gSprites[spriteId].data[6] = gUnknown_085E4CA8[i][2]; @@ -1237,59 +1939,59 @@ void sub_816E6D4(u8 a0) } } -void sub_816E74C(void) +static void sub_816E74C(void) { int i; u8 spriteId; for (i = 0; i < 6; i++) { - spriteId = CreateSprite(gUnknown_085E4D14, gUnknown_085E4CA8[i + 6][0], gUnknown_085E4CA8[i + 6][1], i); + spriteId = CreateSprite(&gUnknown_085E4D14, gUnknown_085E4CA8[i + 6][0], gUnknown_085E4CA8[i + 6][1], i); gSprites[spriteId].invisible = TRUE; gSprites[spriteId].data[6] = gUnknown_085E4CA8[i][2]; gSprites[spriteId].data[7] = 0x40; } } -void sub_816E7B4(struct Sprite *sprite) +static void sub_816E7B4(struct Sprite *sprite) { switch(sprite->data[0]) { - case 0: - if (sprite->data[6] == 0) - { - sprite->data[1] = (sprite->data[1] + 11) & 0xFF; - sprite->pos2.x = Sin(sprite->data[1], 4); - sprite->data[2] += 0x30; - sprite->pos2.y = -(sprite->data[2] >> 8); - if (sprite->animEnded) - DestroySprite(sprite); - } - else if (--sprite->data[6] == 0) - { - StartSpriteAnim(sprite, 0); - sprite->invisible = FALSE; - } - if (gTasks[sprite->data[5]].data[0] > 11) - sprite->data[0]++; - break; - case 1: - if (sprite->pos1.x < 120) - sprite->pos1.x -= 3; - else - sprite->pos1.x += 3; - - if (sprite->pos1.y < 80) - sprite->pos1.y -= 3; - else - sprite->pos1.y += 3; - if ((u16)(sprite->pos1.y - 20) > 140) + case 0: + if (sprite->data[6] == 0) + { + sprite->data[1] = (sprite->data[1] + 11) & 0xFF; + sprite->pos2.x = Sin(sprite->data[1], 4); + sprite->data[2] += 0x30; + sprite->pos2.y = -(sprite->data[2] >> 8); + if (sprite->animEnded) DestroySprite(sprite); - break; + } + else if (--sprite->data[6] == 0) + { + StartSpriteAnim(sprite, 0); + sprite->invisible = FALSE; + } + if (gTasks[sprite->data[5]].data[0] > 11) + sprite->data[0]++; + break; + case 1: + if (sprite->pos1.x < 120) + sprite->pos1.x -= 3; + else + sprite->pos1.x += 3; + + if (sprite->pos1.y < 80) + sprite->pos1.y -= 3; + else + sprite->pos1.y += 3; + if ((u16)(sprite->pos1.y - 20) > 140) + DestroySprite(sprite); + break; } } -void Task_IntroFadeIn1(u8 taskId) +static void Task_IntroFadeIn1(u8 taskId) { SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1 @@ -1331,14 +2033,14 @@ void Task_IntroFadeIn1(u8 taskId) gTasks[taskId].func = Task_IntroFadeIn2; } -void Task_IntroFadeIn2(u8 taskId) +static void Task_IntroFadeIn2(u8 taskId) { LZDecompressVram(gIntro3Clouds1Tilemap, (void *)(VRAM + 0xC000)); LZDecompressVram(gIntro3Clouds2Tilemap, (void *)(VRAM + 0xD000)); gTasks[taskId].func = Task_IntroFadeIn3; } -void Task_IntroFadeIn3(u8 taskId) +static void Task_IntroFadeIn3(u8 taskId) { SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0); @@ -1348,7 +2050,7 @@ void Task_IntroFadeIn3(u8 taskId) gTasks[taskId].data[6] = 16; } -void Task_IntroFadeIn4(u8 taskId) +static void Task_IntroFadeIn4(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -1357,27 +2059,27 @@ void Task_IntroFadeIn4(u8 taskId) switch (data[0]) { - case 0: - if (--data[6] == 0) - { - BeginNormalPaletteFade(0xFFFFFFFE, 0, 16, 0, 0xFFFF); - data[6] = 0x5000; - data[0]++; - } - break; - case 1: - if (data[6] == 0x2800) - BeginNormalPaletteFade(0x0000FFFE, 3, 0, 16, 0x2949); - - if (data[6] != 0) - data[6] -= 0x80; - else if (!gPaletteFade.active) - gTasks[taskId].func = Task_IntroFadeIn5; - break; + case 0: + if (--data[6] == 0) + { + BeginNormalPaletteFade(0xFFFFFFFE, 0, 16, 0, RGB_WHITEALPHA); + data[6] = 0x5000; + data[0]++; + } + break; + case 1: + if (data[6] == 0x2800) + BeginNormalPaletteFade(0x0000FFFE, 3, 0, 16, RGB(9, 10, 10)); + + if (data[6] != 0) + data[6] -= 0x80; + else if (!gPaletteFade.active) + gTasks[taskId].func = Task_IntroFadeIn5; + break; } } -void Task_IntroFadeIn5(u8 taskId) +static void Task_IntroFadeIn5(u8 taskId) { LZDecompressVram(gIntro3RayquazaTilemap, (void *)(VRAM + 0xE000)); LZDecompressVram(gIntro3Clouds4Tilemap, (void *)(VRAM + 0xC000)); @@ -1397,76 +2099,76 @@ void Task_IntroFadeIn5(u8 taskId) LoadSpritePalettes(gUnknown_085E4C04); } -void Task_IntroFadeIn6(u8 taskId) +static void Task_IntroFadeIn6(u8 taskId) { s16 *data = gTasks[taskId].data; u8 spriteId; switch (data[0]) { - case 0: - if (--data[6] == 0) - { - CreateSprite(gUnknown_085E4C4C, 200, 48, 0); - spriteId = CreateSprite(gUnknown_085E4C4C, 200, 80, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - spriteId = CreateSprite(gUnknown_085E4C4C, 200, 112, 2); - StartSpriteAnim(&gSprites[spriteId], 2); - data[0]++; - data[6] = 72; - } - break; - case 1: - if (--data[6] == 0) - { - CreateSprite(gUnknown_085E4C4C, 40, 48, 0); - spriteId = CreateSprite(gUnknown_085E4C4C, 40, 80, 1); - StartSpriteAnim(&gSprites[spriteId], 1); - spriteId = CreateSprite(gUnknown_085E4C4C, 40, 112, 2); - StartSpriteAnim(&gSprites[spriteId], 2); - data[0]++; - data[6] = 48; - } - break; - case 2: - if (--data[6] == 0) - gTasks[taskId].func = Task_IntroFadeIn7; - break; + case 0: + if (--data[6] == 0) + { + CreateSprite(&gUnknown_085E4C4C, 200, 48, 0); + spriteId = CreateSprite(&gUnknown_085E4C4C, 200, 80, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + spriteId = CreateSprite(&gUnknown_085E4C4C, 200, 112, 2); + StartSpriteAnim(&gSprites[spriteId], 2); + data[0]++; + data[6] = 72; + } + break; + case 1: + if (--data[6] == 0) + { + CreateSprite(&gUnknown_085E4C4C, 40, 48, 0); + spriteId = CreateSprite(&gUnknown_085E4C4C, 40, 80, 1); + StartSpriteAnim(&gSprites[spriteId], 1); + spriteId = CreateSprite(&gUnknown_085E4C4C, 40, 112, 2); + StartSpriteAnim(&gSprites[spriteId], 2); + data[0]++; + data[6] = 48; + } + break; + case 2: + if (--data[6] == 0) + gTasks[taskId].func = Task_IntroFadeIn7; + break; } } -void sub_816EC6C(struct Sprite *sprite) +static void sub_816EC6C(struct Sprite *sprite) { if (sprite->animEnded) sprite->invisible = TRUE; switch(sprite->data[0]) { - case 0: - sprite->data[1] = 0x1C2; - sprite->data[0]++; - case 1: - CpuCopy16(&gIntro3BgPal[sprite->data[1]], &gPlttBufferFaded[93], 2); - sprite->data[1] += 2; - if (sprite->data[1] != 0x1CE) - break; - sprite->data[1] = 0x1CC; - sprite->data[2] = 4; - sprite->data[0]++; - case 2: - if (--sprite->data[2] == 0) - { - sprite->data[2] = 4; - CpuCopy16(&gIntro3BgPal[sprite->data[1]], &gPlttBufferFaded[93], 2); - sprite->data[1] -= 2; - if (sprite->data[1] == 0x1C0) - DestroySprite(sprite); - } + case 0: + sprite->data[1] = 0x1C2; + sprite->data[0]++; + case 1: + CpuCopy16(&gIntro3BgPal[sprite->data[1]], &gPlttBufferFaded[93], 2); + sprite->data[1] += 2; + if (sprite->data[1] != 0x1CE) break; + sprite->data[1] = 0x1CC; + sprite->data[2] = 4; + sprite->data[0]++; + case 2: + if (--sprite->data[2] == 0) + { + sprite->data[2] = 4; + CpuCopy16(&gIntro3BgPal[sprite->data[1]], &gPlttBufferFaded[93], 2); + sprite->data[1] -= 2; + if (sprite->data[1] == 0x1C0) + DestroySprite(sprite); + } + break; } } -void Task_IntroFadeIn7(u8 taskId) +static void Task_IntroFadeIn7(u8 taskId) { u8 newTaskId; @@ -1479,7 +2181,7 @@ void Task_IntroFadeIn7(u8 taskId) | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); gTasks[taskId].func = Task_IntroFadeIn8; - BeginNormalPaletteFade(0x0000FFDE, 0, 16, 0, 0x2949); + BeginNormalPaletteFade(0x0000FFDE, 0, 16, 0, RGB(9, 10, 10)); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0xA8; gTasks[taskId].data[2] = -0x10; @@ -1489,7 +2191,7 @@ void Task_IntroFadeIn7(u8 taskId) gTasks[newTaskId].data[4] = taskId; } -void Task_IntroFadeIn8(u8 taskId) +static void Task_IntroFadeIn8(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -1500,49 +2202,49 @@ void Task_IntroFadeIn8(u8 taskId) switch(data[0]) { - case 0: - if ((data[7] & 1) != 0) - { - data[1] -= 2; - data[2]++; - data[3] += 2; - data[4]++; - } - if (data[1] == 0x68) - { - data[0]++; - data[5] = 1; - } - break; - case 1: + case 0: + if ((data[7] & 1) != 0) + { + data[1] -= 2; + data[2]++; + data[3] += 2; + data[4]++; + } + if (data[1] == 0x68) + { data[0]++; - data[5] = 4; - break; - case 2: - data[1] += 4; - data[2] -= 2; - data[3] -= 4; - data[4] -= 2; - if (!gPaletteFade.active) - { - data[5] = 0x8C; - data[0]++; - } - break; - case 3: - if (--data[5] == 0) - gTasks[taskId].func = Task_IntroFadeIn9; - break; + data[5] = 1; + } + break; + case 1: + data[0]++; + data[5] = 4; + break; + case 2: + data[1] += 4; + data[2] -= 2; + data[3] -= 4; + data[4] -= 2; + if (!gPaletteFade.active) + { + data[5] = 0x8C; + data[0]++; + } + break; + case 3: + if (--data[5] == 0) + gTasks[taskId].func = Task_IntroFadeIn9; + break; } } -void Task_IntroFadeIn9(u8 taskId) +static void Task_IntroFadeIn9(u8 taskId) { DestroyTask(taskId); SetMainCallback2(MainCB2_EndIntro); } -void sub_816EEA8(u8 taskId) +static void sub_816EEA8(u8 taskId) { u8 spriteId; s16 *data = gTasks[taskId].data; @@ -1551,93 +2253,93 @@ void sub_816EEA8(u8 taskId) switch(data[0]) { - case 0: + case 0: + if ((data[2] & 1) != 0) + { + CpuCopy16(&gIntro3BgPal[0x1A2 + data[1] * 2], &gPlttBufferFaded[94], 2); + data[1]++; + } + if (data[1] == 6) + { + data[0]++; + data[1] = 0; + data[3] = 10; + } + break; + case 1: + if (data[3] == 0) + { if ((data[2] & 1) != 0) { - CpuCopy16(&gIntro3BgPal[0x1A2 + data[1] * 2], &gPlttBufferFaded[94], 2); + CpuCopy16(&gIntro3BgPal[0x1A2 + data[1] * 2], &gPlttBufferFaded[88], 2); data[1]++; } if (data[1] == 6) { data[0]++; - data[1] = 0; data[3] = 10; } - break; - case 1: - if (data[3] == 0) - { - if ((data[2] & 1) != 0) - { - CpuCopy16(&gIntro3BgPal[0x1A2 + data[1] * 2], &gPlttBufferFaded[88], 2); - data[1]++; - } - if (data[1] == 6) - { - data[0]++; - data[3] = 10; - } - } - else - { - data[3]--; - } - break; - case 2: - if (data[3] == 0) - { - if ((data[2] & 1) != 0) - { - CpuCopy16(&gIntro3BgPal[0x182 + data[1] * 2], &gPlttBufferFaded[92], 2); - data[1]++; - } - if (data[1] == 6) - { - spriteId = CreateSprite(gUnknown_085E5030, 120, 88, 15); - PlaySE(SE_OP_BASYU); - gSprites[spriteId].invisible = TRUE; - gSprites[spriteId].data[3] = data[4]; - data[0]++; - data[3] = 16; - } - } - else - { - data[3]--; - } - break; - case 3: + } + else + { + data[3]--; + } + break; + case 2: + if (data[3] == 0) + { if ((data[2] & 1) != 0) { - if (--data[3] != 0) - { - BlendPalette(0x50, 16, data[3], 0x2949); - CpuCopy16(&gIntro3BgPal[0x1AC], &gPlttBufferFaded[94], 2); - CpuCopy16(&gIntro3BgPal[0x1AC], &gPlttBufferFaded[88], 2); - CpuCopy16(&gIntro3BgPal[0x18C], &gPlttBufferFaded[92], 2); - } - else - { - data[0]++; - data[3] = 53; - } + CpuCopy16(&gIntro3BgPal[0x182 + data[1] * 2], &gPlttBufferFaded[92], 2); + data[1]++; } - break; - case 4: - if (--data[3] == 0) + if (data[1] == 6) { - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0x7FFF); + spriteId = CreateSprite(&gUnknown_085E5030, 120, 88, 15); + PlaySE(SE_OP_BASYU); + gSprites[spriteId].invisible = TRUE; + gSprites[spriteId].data[3] = data[4]; data[0]++; + data[3] = 16; } - break; - case 5: - if (!gPaletteFade.active) - DestroyTask(taskId); - break; + } + else + { + data[3]--; + } + break; + case 3: + if ((data[2] & 1) != 0) + { + if (--data[3] != 0) + { + BlendPalette(0x50, 16, data[3], RGB(9, 10, 10)); + CpuCopy16(&gIntro3BgPal[0x1AC], &gPlttBufferFaded[94], 2); + CpuCopy16(&gIntro3BgPal[0x1AC], &gPlttBufferFaded[88], 2); + CpuCopy16(&gIntro3BgPal[0x18C], &gPlttBufferFaded[92], 2); + } + else + { + data[0]++; + data[3] = 53; + } + } + break; + case 4: + if (--data[3] == 0) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_WHITE); + data[0]++; + } + break; + case 5: + if (!gPaletteFade.active) + DestroyTask(taskId); + break; } } -void intro_reset_and_hide_bgs(void) +static void intro_reset_and_hide_bgs(void) { SetGpuReg(REG_OFFSET_DISPCNT, 0); SetGpuReg(REG_OFFSET_BG3HOFS, 0); @@ -1653,7 +2355,7 @@ void intro_reset_and_hide_bgs(void) SetGpuReg(REG_OFFSET_BLDY, 0); } -void Task_IntroWaterDrops_1(u8 taskId) +static void Task_IntroWaterDrops_1(u8 taskId) { switch (gTasks[taskId].data[0]) { @@ -1696,7 +2398,7 @@ void Task_IntroWaterDrops_1(u8 taskId) } } -void Task_IntroWaterDrops_2(u8 taskId) +static void Task_IntroWaterDrops_2(u8 taskId) { switch (gTasks[taskId].data[0]) { @@ -1769,7 +2471,7 @@ void sub_816F2A8(u16 scrX, u16 scrY, u16 zoom, u16 alpha) SetGpuReg(REG_OFFSET_BG2Y_H, dest.dy >> 16); } -void sub_816F318(struct Sprite *sprite) +static void sub_816F318(struct Sprite *sprite) { u8 r0; @@ -1796,7 +2498,7 @@ void sub_816F318(struct Sprite *sprite) } } -void sub_816F3A4(struct Sprite *sprite) +static void sub_816F3A4(struct Sprite *sprite) { if (gSprites[sprite->data[7]].data[7] != 0) { @@ -1820,13 +2522,13 @@ void sub_816F3A4(struct Sprite *sprite) } } -void sub_816F454(struct Sprite *sprite) +static void sub_816F454(struct Sprite *sprite) { if (sprite->data[0] != 0) sprite->callback = sub_816F46C; } -void sub_816F46C(struct Sprite *sprite) +static void sub_816F46C(struct Sprite *sprite) { if (sprite->pos1.x <= 116) { @@ -1875,7 +2577,7 @@ void sub_816F46C(struct Sprite *sprite) } } -void sub_816F5B4(struct Sprite *sprite) +static void sub_816F5B4(struct Sprite *sprite) { SetOamMatrix(sprite->data[1], sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); SetOamMatrix(sprite->data[1] + 1, sprite->data[6] + 64, 0, 0, sprite->data[6] + 64); @@ -1896,7 +2598,7 @@ void sub_816F5B4(struct Sprite *sprite) } } -void sub_816F660(struct Sprite *sprite) +static void sub_816F660(struct Sprite *sprite) { if (sprite->data[0] != 2) { @@ -1913,7 +2615,7 @@ void sub_816F660(struct Sprite *sprite) } } -void SpriteCB_WaterDropFall(struct Sprite *sprite) +static void SpriteCB_WaterDropFall(struct Sprite *sprite) { if (sprite->pos1.y < sprite->data[5]) { @@ -1936,7 +2638,7 @@ void SpriteCB_WaterDropFall(struct Sprite *sprite) } //Duplicate function -void SpriteCB_WaterDropFall_2(struct Sprite *sprite) +static void SpriteCB_WaterDropFall_2(struct Sprite *sprite) { if (sprite->pos1.y < sprite->data[5]) { @@ -1958,7 +2660,7 @@ void SpriteCB_WaterDropFall_2(struct Sprite *sprite) } } -u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately) +static u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately) { u8 spriteId; u8 oldSpriteId; @@ -2005,7 +2707,7 @@ u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately) return oldSpriteId; } -void sub_816F9D4(struct Sprite *sprite) +static void sub_816F9D4(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -2054,7 +2756,7 @@ void sub_816F9D4(struct Sprite *sprite) } } -void sub_816FAB0(struct Sprite *sprite) +static void sub_816FAB0(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -2081,130 +2783,130 @@ void sub_816FAB0(struct Sprite *sprite) sprite->data[1] += 4; } -void sub_816FB38(struct Sprite *sprite) +static void sub_816FB38(struct Sprite *sprite) { switch (sprite->data[0]) { - case 0: + case 0: + if (sprite->data[1] != 0) + { + sprite->data[1]--; + } + else + { + sprite->invisible = FALSE; + StartSpriteAffineAnim(sprite, 1); + sprite->data[0]++; + } + break; + case 1: + if (gIntroFrameCounter == 0x90) + { + sprite->data[0]++; + sprite->data[1] = 9; + sprite->data[3] = 2; + } + break; + case 2: + if (sprite->data[3] == 0) + { + sprite->data[3] = 2; if (sprite->data[1] != 0) { + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); sprite->data[1]--; } else { - sprite->invisible = FALSE; - StartSpriteAffineAnim(sprite, 1); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); sprite->data[0]++; } - break; - case 1: - if (gIntroFrameCounter == 0x90) + } + else + { + sprite->data[3]--; + } + break; + case 3: + if (sprite->data[3] != 0) + { + sprite->data[3]--; + } + else + { + sprite->data[3] = 2; + if (sprite->data[1] < 10) { - sprite->data[0]++; - sprite->data[1] = 9; - sprite->data[3] = 2; - } - break; - case 2: - if (sprite->data[3] == 0) - { - sprite->data[3] = 2; - if (sprite->data[1] != 0) - { - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); - sprite->data[1]--; - } - else - { - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); - sprite->data[0]++; - } + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); + CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); + sprite->data[1]++; } else { - sprite->data[3]--; - } - break; - case 3: - if (sprite->data[3] != 0) - { - sprite->data[3]--; - } - else - { - sprite->data[3] = 2; - if (sprite->data[1] < 10) - { - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1]], &gPlttBufferFaded[0x11F], 2); - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x10], &gPlttBufferFaded[0x114], 2); - CpuCopy16(&gIntro1GameFreakTextFadePal[sprite->data[1] + 0x20], &gPlttBufferFaded[0x11A], 2); - sprite->data[1]++; - } - else - { - sprite->data[0]++; - } - } - break; - case 4: - if (gIntroFrameCounter == 0x110) - { - StartSpriteAffineAnim(sprite, 2); - sprite->oam.objMode = 1; sprite->data[0]++; } - break; - case 5: - sprite->data[3] += gUnknown_085E4F48[sprite->data[2]]; - sprite->pos2.x = (sprite->data[3] & 0xFF00) >> 8; - if (sprite->data[2] < 4) - { - s16 temp = sprite->pos2.x; - sprite->pos2.x = -temp; - } - if (sprite->affineAnimEnded) - DestroySprite(sprite); - break; + } + break; + case 4: + if (gIntroFrameCounter == 0x110) + { + StartSpriteAffineAnim(sprite, 2); + sprite->oam.objMode = 1; + sprite->data[0]++; + } + break; + case 5: + sprite->data[3] += gUnknown_085E4F48[sprite->data[2]]; + sprite->pos2.x = (sprite->data[3] & 0xFF00) >> 8; + if (sprite->data[2] < 4) + { + s16 temp = sprite->pos2.x; + sprite->pos2.x = -temp; + } + if (sprite->affineAnimEnded) + DestroySprite(sprite); + break; } } -void sub_816FD44(struct Sprite *sprite) +static void sub_816FD44(struct Sprite *sprite) { switch(sprite->data[0]) { - case 0: - if (gIntroFrameCounter == 0x80) - { - sprite->invisible = FALSE; - sprite->data[0]++; - } - break; - case 1: - if (gIntroFrameCounter == 0x110) - { - StartSpriteAffineAnim(sprite, 3); - sprite->data[0]++; - } - break; - case 2: - if (sprite->affineAnimEnded) - DestroySprite(sprite); - break; + case 0: + if (gIntroFrameCounter == 0x80) + { + sprite->invisible = FALSE; + sprite->data[0]++; + } + break; + case 1: + if (gIntroFrameCounter == 0x110) + { + StartSpriteAffineAnim(sprite, 3); + sprite->data[0]++; + } + break; + case 2: + if (sprite->affineAnimEnded) + DestroySprite(sprite); + break; } } -u8 sub_816FDB8(s16 a0, s16 a1, s16 a2) +static u8 sub_816FDB8(s16 a0, s16 a1, s16 a2) { u16 i; u8 spriteId; for (i = 0; i < 9; i++) { - spriteId = CreateSprite(gUnknown_085E4F5C, gUnknown_085E4E94[i][1] + a0, a1 - 4, 0); + spriteId = CreateSprite(&gUnknown_085E4F5C, gUnknown_085E4E94[i][1] + a0, a1 - 4, 0); gSprites[spriteId].data[0] = 0; gSprites[spriteId].data[1] = gUnknown_085E4FA4[i]; gSprites[spriteId].data[2] = i; @@ -2213,7 +2915,7 @@ u8 sub_816FDB8(s16 a0, s16 a1, s16 a2) StartSpriteAnim(&gSprites[spriteId], gUnknown_085E4E94[i][0]); StartSpriteAffineAnim(&gSprites[spriteId], 0); } - spriteId = CreateSprite(gUnknown_085E4F8C, 120, a1 - 6, 0); + spriteId = CreateSprite(&gUnknown_085E4F8C, 120, a1 - 6, 0); gSprites[spriteId].data[0] = 0; gSprites[spriteId].invisible = TRUE; gSprites[spriteId].oam.matrixNum = i + 12; @@ -2221,7 +2923,7 @@ u8 sub_816FDB8(s16 a0, s16 a1, s16 a2) return spriteId; } -/*void sub_816FEDC(struct Sprite *sprite) +static void sub_816FEDC(struct Sprite *sprite) { sprite->data[7]++; @@ -2229,16 +2931,18 @@ u8 sub_816FDB8(s16 a0, s16 a1, s16 a2) { s16 sin1; s16 sin2; - s16 var1; - s16 var2; - s16 var3; + + s16 a, b, c, d; sin1 = gSineTable[(u8)sprite->data[2]]; sin2 = gSineTable[(u8)(sprite->data[2] + 64)]; - var1 = sin2 * sprite->data[1] / 256; - var2 = -sin1 * sprite->data[1] / 256; - var3 = sin1 * sprite->data[1] / 256; - SetOamMatrix(1, var1, var3, var2, var1); + + d = Q_8_8_TO_INT(sin2 * sprite->data[1]); + c = Q_8_8_TO_INT(-sin1 * sprite->data[1]); + b = Q_8_8_TO_INT(sin1 * sprite->data[1]); + a = Q_8_8_TO_INT(sin2 * sprite->data[1]); + + SetOamMatrix(1, a, b, c, d); } switch (sprite->data[0]) @@ -2278,4 +2982,39 @@ u8 sub_816FDB8(s16 a0, s16 a1, s16 a2) sprite->data[3]++; break; } -}*/ +} + +static void sub_8170040(struct Sprite *sprite) +{ + u16 foo; + + //I'm not sure why a switch statement was used here. + //if (sprite->data[0] != 1) would have been more appropriate. + switch (sprite->data[0]) + { + case 0: + default: + sprite->invisible = FALSE; + sprite->oam.affineMode = 3; + sprite->oam.matrixNum = 18; + CalcCenterToCornerVec(sprite, 0, 3, 3); + sprite->data[1] = 0; + sprite->data[0] = 1; + //fall through + case 1: + sprite->data[7]++; + if (sprite->data[7] & 1) + { + sprite->invisible = TRUE; + } + else + { + sprite->invisible = FALSE; + if (sprite->data[1] < 64) + sprite->data[1]++; + } + foo = 256 - gSineTable[(u8)sprite->data[1]] / 2; + SetOamMatrix(18, foo, 0, 0, foo); + break; + } +} diff --git a/src/intro_credits_graphics.c b/src/intro_credits_graphics.c new file mode 100644 index 000000000..b287f6b10 --- /dev/null +++ b/src/intro_credits_graphics.c @@ -0,0 +1,5 @@ +#include "global.h" + +EWRAM_DATA u16 gUnknown_0203BD24 = 0; +EWRAM_DATA u16 gUnknown_0203BD26 = 0; +EWRAM_DATA u16 gUnknown_0203BD28 = 0; diff --git a/sym_common.txt b/sym_common.txt index 34eb950d3..46c4bfa5a 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -142,7 +142,7 @@ gCB2_AfterEvolution: @ 30061E8 gUnknown_030061EC: @ 30061EC .space 0x4 - .include"save.o" + .include "save.o" .space 0x8 @@ -155,11 +155,7 @@ gUnknown_03006294: @ 3006294 gUnknown_03006298: @ 3006298 .space 0x8 -gIntroFrameCounter: @ 30062A0 - .space 0x10 - -gMultibootProgramStruct: @ 30062B0 - .space 0x2C + .include "intro.o" gUnknown_030062DC: @ 30062DC .space 0x4 diff --git a/sym_ewram.txt b/sym_ewram.txt index b4fd1f114..47186c545 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -855,12 +855,7 @@ gUnknown_0203BCBC: @ 203BCBC gUnknown_0203BCC4: @ 203BCC4 .space 0x4 -gUnknown_0203BCC8: @ 203BCC8 - .space 0x4 - -gUnknown_0203BCCC: @ 203BCCC - .space 0x4 - + .include "src/intro.o" .include "src/field_region_map.o" gUnknown_0203BCD4: @ 203BCD4 @@ -893,16 +888,7 @@ gBraillePuzzleCallbackFlag: @ 203BD14 .space 0x4 .include "src/pokeblock_feed.o" - -gUnknown_0203BD24: @ 203BD24 - .space 0x2 - -gUnknown_0203BD26: @ 203BD26 - .space 0x2 - -gUnknown_0203BD28: @ 203BD28 - .space 0x4 - + .include "src/intro_credits_graphics.o" .include "src/recorded_battle.o" .include "src/battle_dome_cards.o" .include "src/lilycove_lady.o"