Document the intro movie state machine

Need to study the water droplet animation more closely before they can
be renamed; otherwise, this names every major symbol in this file.
This commit is contained in:
Phlosioneer 2019-02-09 21:07:07 -05:00
parent 6f1d2b870c
commit 45297797e6
10 changed files with 242 additions and 179 deletions

View File

@ -9,6 +9,6 @@
void CB2_InitCopyrightScreenAfterBootup(void);
void CB2_InitCopyrightScreenAfterBootup(void);
void CB2_InitCopyrightScreenAfterTitleScreen(void);
void sub_816F2A8(u16, u16, u16, u16);
void PanFadeAndZoomScreen(u16, u16, u16, u16);
#endif // GUARD_INTRO_H

View File

@ -9,7 +9,7 @@ extern const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[];
extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[];
extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[];
extern const struct CompressedSpriteSheet gIntro2FlygonSpriteSheet[];
extern const struct SpritePalette gUnknown_085F530C[];
extern const struct SpritePalette gIntroBikeAndFlygonPalette[];
extern const struct CompressedSpriteSheet gUnknown_085F5334[];
extern const struct CompressedSpriteSheet gUnknown_085F5344[];
extern const struct CompressedSpriteSheet gUnknown_085F5354[];
@ -21,7 +21,7 @@ void load_intro_part2_graphics(u8 a);
void sub_817B150(u8 a);
void sub_817B1C8(u8);
void sub_817B3A8(u8);
u8 sub_817B3DC(u8 a, u16 b, u16 c, u16 d);
u8 CreateBicycleAnimationTask(u8 a, u16 b, u16 c, u16 d);
void sub_817B540(u8);
u8 intro_create_brendan_sprite(s16 a, s16 b);
u8 intro_create_may_sprite(s16 a, s16 b);

View File

@ -8,7 +8,7 @@ void SetTrainerId(u32 trainerId, u8 *dst);
u32 GetTrainerId(u8 *trainerId);
void CopyTrainerId(u8 *dst, u8 *src);
void NewGameInitData(void);
void sub_808447C(void);
void ResetMenuAndMonGlobals(void);
void Sav2_ClearSetDefault(void);
#endif // GUARD_NEW_GAME_H

View File

@ -1,7 +1,7 @@
#ifndef GUARD_TITLE_SCREEN_H
#define GUARD_TITLE_SCREEN_H
extern const u16 gUnknown_0853FF70[];
extern const u16 gIntroWaterDropData[];
void CB2_InitTitleScreen(void);

View File

@ -1869,7 +1869,7 @@ static void sub_817664C(u8 data, u8 taskIdA)
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].data[0] = 0;
gTasks[taskIdA].data[TDA_0] = sub_817B3DC(0, 0x2000, 0x20, 8);
gTasks[taskIdA].data[TDA_0] = CreateBicycleAnimationTask(0, 0x2000, 0x20, 8);
break;
case 1:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE;
@ -1880,7 +1880,7 @@ static void sub_817664C(u8 data, u8 taskIdA)
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].data[0] = 0;
gTasks[taskIdA].data[TDA_0] = sub_817B3DC(0, 0x2000, 0x20, 8);
gTasks[taskIdA].data[TDA_0] = CreateBicycleAnimationTask(0, 0x2000, 0x20, 8);
break;
case 2:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE;
@ -1891,7 +1891,7 @@ static void sub_817664C(u8 data, u8 taskIdA)
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].data[0] = 0;
gTasks[taskIdA].data[TDA_0] = sub_817B3DC(1, 0x2000, 0x200, 8);
gTasks[taskIdA].data[TDA_0] = CreateBicycleAnimationTask(1, 0x2000, 0x200, 8);
break;
case 3:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE;
@ -1902,7 +1902,7 @@ static void sub_817664C(u8 data, u8 taskIdA)
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].data[0] = 0;
gTasks[taskIdA].data[TDA_0] = sub_817B3DC(1, 0x2000, 0x200, 8);
gTasks[taskIdA].data[TDA_0] = CreateBicycleAnimationTask(1, 0x2000, 0x200, 8);
break;
case 4:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE;
@ -1913,7 +1913,7 @@ static void sub_817664C(u8 data, u8 taskIdA)
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_CYCLIST]].data[0] = 0;
gTasks[taskIdA].data[TDA_0] = sub_817B3DC(2, 0x2000, 0x200, 8);
gTasks[taskIdA].data[TDA_0] = CreateBicycleAnimationTask(2, 0x2000, 0x200, 8);
break;
}

View File

@ -27,14 +27,75 @@
#include "constants/rgb.h"
#include "constants/battle_anim.h"
/*
* Intro animation sequence state machine
* --------------------------------------
*
* Entry Point: CB2_InitCopyrightScreenAfterBootup
*
* Note: States advance sequentially unless otherwise stated.
*
* CB2_InitCopyrightScreenAfterBootup
* - Registers a serial interrupt handler that listens for a GameCube.
* - Waits for 140 frames, and then until palette fading completes.
* - Stops looking for a GameCube for dualboot.
* - Check the save file for corruption
* - Setup global pointers to save file
* - Initialize gHeap
*
* MainCB2_Intro
* - Spawn Task_IntroLoadPart1Graphics
* - If any keys are pressed during the intro, advance to
* MainCB2_EndIntro (which will then kill all tasks).
*
* Task_IntroLoadPart1Graphics
* Task_IntroFadeIn (frame counter starts at 0 here)
* Task_IntroWaterDrops
* - At frame 128 of this state, spawn Task_IntroWaterDrops_1
* - At frame 256 of this state, spawn Task_IntroWaterDrops_2
* - At frame 560 of this state, spawn Task_IntroWaterDrops_3
* Task_IntroScrollDownAndShowFlygon
* Task_IntroWaitToSetupPart2
* Task_IntroLoadPart2Graphics
* Task_IntroStartBikeRide
* - Spawn Task_AdvanceBicycleAnimation
* Task_IntroHandleBikeAndFlygonMovement
* - At frame 1856, kills the bicycle animation task
* Task_IntroWaitToSetupPart3
* Task_IntroLoadPart3Graphics (frame counter resets to 0 here)
* Task_IntroSpinAndZoomPokeball
* - Continues until the zoom reaches a certain point
* Task_IntroWaitToSetupPart3LegendsFight
* Task_IntroLoadGroudonScene
* Task_IntroLoadPart3Graphics1
* Task_IntroLoadPart3Graphics2
* Task_IntroLoadPart3Graphics3
* Task_IntroLoadPart3Graphics4
* Task_IntroGroudonScene
* Task_IntroLoadKyogreScene
* Task_IntroKyogreScene
* Task_IntroLoadClouds1
* Task_IntroLoadClouds2
* Task_IntroLoadClouds3
* Task_IntroCloudsScene
* Task_IntroLoadRayquazaLightningScene
* Task_IntroRaquazaLightningScene
* Task_IntroLoadRaquazaGlowScene
* Task_IntroRaquazaGlowScene_0
* - Runs concurrently with Task_IntroRaquazaGlowScene_1
* Task_EndIntroMovie
* MainCB2_EndIntro
* - Advances to CB2_InitTitleScreen
*/
extern const struct CompressedSpriteSheet gBattleAnimPicTable[];
extern const struct CompressedSpritePalette gBattleAnimPaletteTable[];
extern const struct SpriteTemplate gUnknown_08596C10[];
//ewram
EWRAM_DATA u16 gUnknown_0203BCC8 = 0;
EWRAM_DATA u16 gIntroCharacterGender = 0;
EWRAM_DATA u16 gUnknown_0203BCCA = 0;
EWRAM_DATA u16 gUnknown_0203BCCC = 0;
EWRAM_DATA u16 gIntroGraphicsFlygonYOffset = 0;
//iwram
u32 gIntroFrameCounter;
@ -67,12 +128,12 @@ static const u8 sUnknownBytes[] = {
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[] =
static const struct CompressedSpriteSheet gIntroSpriteSheet_Sparkle[] =
{
{gIntro1SparkleGfx, 0x400, 1505},
{NULL},
};
static const struct SpritePalette gUnknown_085E4A84[] =
static const struct SpritePalette gIntroPalette_Lightning[] =
{
{gIntro3LightningPal, 1505},
{NULL},
@ -132,14 +193,14 @@ static const u8 gUnknown_085E4AD0[][2] =
{0xD0, 0x26},
{0x00, 0x00},
};
static const struct CompressedSpriteSheet gUnknown_085E4AE8[] =
static const struct CompressedSpriteSheet gIntroPokemonRunningSpriteSheet[] =
{
{gIntro2VolbeatGfx, 0x400, 1500},
{gIntro2TorchicGfx, 0xC00, 1501},
{gIntro2ManectricGfx, 0x2000, 1502},
{NULL},
};
static const struct SpritePalette gUnknown_085E4B08[] =
static const struct SpritePalette gIntroPokemonRunningPalette[] =
{
{gIntro2VolbeatPal, 1500},
{gIntro2TorchicPal, 1501},
@ -278,12 +339,12 @@ static const struct SpriteTemplate gUnknown_085E4BDC =
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_816DAE8,
};
static const struct CompressedSpriteSheet gUnknown_085E4BF4[] =
static const struct CompressedSpriteSheet gIntroRayquazaLightningSpriteSheet[] =
{
{gIntro3LightningGfx, 0xC00, 1503},
{NULL},
};
static const struct SpritePalette gUnknown_085E4C04[] =
static const struct SpritePalette gIntroRayquazaLightningPalette[] =
{
{gIntro3LightningPal, 1503},
{NULL},
@ -328,8 +389,8 @@ static const union AnimCmd *const gUnknown_085E4C40[] =
gUnknown_085E4C28,
gUnknown_085E4C34,
};
static void sub_816EC6C(struct Sprite *sprite);
static const struct SpriteTemplate gUnknown_085E4C4C =
static void SpriteCB_IntroRaquazaLightning(struct Sprite *sprite);
static const struct SpriteTemplate gIntroLightningSprite =
{
.tileTag = 1503,
.paletteTag = 1503,
@ -337,9 +398,9 @@ static const struct SpriteTemplate gUnknown_085E4C4C =
.anims = gUnknown_085E4C40,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_816EC6C,
.callback = SpriteCB_IntroRaquazaLightning,
};
static const s16 gUnknown_085E4C64[][3] =
static const s16 gIntroGroudonRockData[][3] =
{
{0x68, 0x00, 0x0C0},
{0x8E, 0x03, 0x280},
@ -358,7 +419,7 @@ static const struct SpritePalette gUnknown_085E4C98[] =
{gIntro2BubblesPal, 1504},
{NULL},
};
static const s16 gUnknown_085E4CA8[][3] =
static const s16 gIntroKyogreBubbleData[][3] =
{
{0x42, 0x40, 0x1},
{0x60, 0x60, 0x8},
@ -402,7 +463,7 @@ static const union AnimCmd *const gUnknown_085E4D10[] =
{
gUnknown_085E4CF8,
};
static void sub_816E7B4(struct Sprite *sprite);
static void SpriteCB_IntroKyogreBubbles(struct Sprite *sprite);
static const struct SpriteTemplate gUnknown_085E4D14 =
{
.tileTag = 1504,
@ -411,7 +472,7 @@ static const struct SpriteTemplate gUnknown_085E4D14 =
.anims = gUnknown_085E4D10,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_816E7B4,
.callback = SpriteCB_IntroKyogreBubbles,
};
static const struct OamData gUnknown_085E4D2C =
{
@ -457,7 +518,7 @@ static const union AnimCmd *const gUnknown_085E4D54[] =
gUnknown_085E4D4C,
};
static void sub_816F454(struct Sprite *sprite);
static const struct SpriteTemplate gUnknown_085E4D64 =
static const struct SpriteTemplate gIntroWaterDropSprite =
{
.tileTag = 2000,
.paletteTag = 2000,
@ -497,7 +558,7 @@ static const union AnimCmd gUnknown_085E4DB4[] =
ANIMCMD_FRAME(256, 16),
ANIMCMD_END,
};
static const union AnimCmd *const gUnknown_085E4DC4[] =
static const union AnimCmd *const gIntroBicycleAnimationCommands[] =
{
gUnknown_085E4D7C,
gUnknown_085E4D90,
@ -772,17 +833,17 @@ static const struct SpriteTemplate gUnknown_085E4FC4 =
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_816FEDC,
};
static const struct CompressedSpriteSheet gUnknown_085E4FDC[] =
static const struct CompressedSpriteSheet gIntroSpriteSheet_WaterDropAndLogo[] =
{
{gIntroTiles, 0x1400, 2000},
{NULL},
};
static const struct CompressedSpriteSheet gUnknown_085E4FEC[] =
static const struct CompressedSpriteSheet gIntroSpriteSheet_Flygon[] =
{
{gIntro1FlygonGfx, 0x400, 2002},
{NULL},
};
static const struct SpritePalette gUnknown_085E4FFC[] =
static const struct SpritePalette gIntroPalette_DropLogoFlygon[] =
{
{gIntro1DropsPal, 2000},
{gIntro1GFLogoPal, 2001},
@ -814,8 +875,8 @@ static const union AnimCmd *const gUnknown_085E502C[] =
{
gUnknown_085E5024,
};
static void sub_8170040(struct Sprite *sprite);
static const struct SpriteTemplate gUnknown_085E5030 =
static void SpriteCB_IntroRaquazaHyperbeam(struct Sprite *sprite);
static const struct SpriteTemplate gIntroRaquazaHyperbeamSprite =
{
.tileTag = 2003,
.paletteTag = 2003,
@ -823,14 +884,14 @@ static const struct SpriteTemplate gUnknown_085E5030 =
.anims = gUnknown_085E502C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_8170040,
.callback = SpriteCB_IntroRaquazaHyperbeam,
};
static const struct CompressedSpriteSheet gUnknown_085E5048[] =
static const struct CompressedSpriteSheet gIntroRaquazaGlowSpriteSheet[] =
{
{gIntro3MiscTiles, 0xA00, 2003},
{NULL},
};
static const struct SpritePalette gUnknown_085E5058[] =
static const struct SpritePalette gIntroRaquazaGlowPalette[] =
{
{gIntro3Misc1Palette, 2003},
{NULL},
@ -855,36 +916,36 @@ 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 Task_IntroLoadGroudonScene(u8);
static void Task_IntroLoadPart3Graphics1(u8);
static void Task_IntroLoadPart3Graphics2(u8);
static void Task_IntroLoadPart3Graphics3(u8);
static void Task_IntroLoadPart3Graphics4(u8);
static void Task_IntroGroudonScene(u8);
static void Task_IntroLoadKyogreScene(u8);
static void Task_IntroKyogreScene(u8);
static void Task_IntroLoadClouds1(u8);
static void Task_IntroLoadClouds2(u8);
static void Task_IntroLoadClouds3(u8);
static void Task_IntroCloudScene(u8);
static void Task_IntroLoadRaquazaLightningScene(u8);
static void Task_IntroRaquazaLightningScene(u8);
static void Task_IntroLoadRaquazaGlowScene(u8);
static void Task_IntroRaquazaGlowScene_0(u8);
static void Task_EndIntroMovie(u8);
static void CreateGroudonRockSprites(u8);
static void SpriteCB_IntroGroudonRocks(struct Sprite *);
static void CreateKyogreBubbleSprites_0(u8);
static void CreateKyogreBubbleSprites_1(void);
static void Task_IntroRaquazaGlowScene_1(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);
static void SpriteCB_IntroGraphicsBicycle(struct Sprite *);
static void SpriteCB_IntroGraphicsFlygon(struct Sprite *);
static u8 CreatePart1Animations(s16, s16, s16);
static void VBlankCB_Intro(void)
{
@ -1006,7 +1067,7 @@ void CB2_InitCopyrightScreenAfterBootup(void)
if (!SetUpCopyrightScreen())
{
SetSaveBlocksPointers(sub_815355C());
sub_808447C();
ResetMenuAndMonGlobals();
Save_ResetSaveCounters();
Save_LoadGameData(SAVE_NORMAL);
if (gSaveFileStatus == 0 || gSaveFileStatus == 2)
@ -1024,7 +1085,7 @@ void CB2_InitCopyrightScreenAfterTitleScreen(void)
static void Task_IntroLoadPart1Graphics(u8 taskId)
{
SetVBlankCallback(NULL);
gUnknown_0203BCC8 = Random() & 1;
gIntroCharacterGender = Random() & 1;
intro_reset_and_hide_bgs();
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0x50);
@ -1044,11 +1105,11 @@ static void Task_IntroLoadPart1Graphics(u8 taskId)
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(20) | BGCNT_16COLOR | BGCNT_TXT256x512);
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(18) | BGCNT_16COLOR | BGCNT_TXT256x512);
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(16) | BGCNT_16COLOR | BGCNT_TXT256x512);
LoadCompressedSpriteSheet(gUnknown_085E4FDC);
LoadCompressedSpriteSheet(gUnknown_085E4FEC);
LoadSpritePalettes(gUnknown_085E4FFC);
LoadCompressedSpriteSheet(gUnknown_085E4A74);
LoadSpritePalettes(gUnknown_085E4A84);
LoadCompressedSpriteSheet(gIntroSpriteSheet_WaterDropAndLogo);
LoadCompressedSpriteSheet(gIntroSpriteSheet_Flygon);
LoadSpritePalettes(gIntroPalette_DropLogoFlygon);
LoadCompressedSpriteSheet(gIntroSpriteSheet_Sparkle);
LoadSpritePalettes(gIntroPalette_Lightning);
CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1F0, 0x20);
CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1E1, 0x1E);
CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1D2, 0x1C);
@ -1056,7 +1117,7 @@ static void Task_IntroLoadPart1Graphics(u8 taskId)
CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1B4, 0x18);
CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1A5, 0x16);
CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x196, 0x14);
sub_816FDB8(0x78, 0x50, 0);
CreatePart1Animations(0x78, 0x50, 0);
gTasks[taskId].data[0] = CreateWaterDrop(236, -14, 0x200, 1, 0x78, FALSE);
gTasks[taskId].func = Task_IntroFadeIn;
}
@ -1194,7 +1255,7 @@ static void Task_IntroLoadPart2Graphics(u8 taskId)
FreeAllSpritePalettes();
gUnknown_0203BD24 = 0;
gUnknown_0203BD26 = 0;
gUnknown_0203BCCC = 0;
gIntroGraphicsFlygonYOffset = 0;
load_intro_part2_graphics(1);
gTasks[taskId].func = Task_IntroStartBikeRide;
}
@ -1203,7 +1264,7 @@ static void Task_IntroStartBikeRide(u8 taskId)
{
u8 spriteId;
if (gUnknown_0203BCC8 == 0)
if (gIntroCharacterGender == 0)
LoadCompressedSpriteSheet(gIntro2BrendanSpriteSheet);
else
LoadCompressedSpriteSheet(gIntro2MaySpriteSheet);
@ -1213,29 +1274,29 @@ static void Task_IntroStartBikeRide(u8 taskId)
for (spriteId = 0; spriteId < 3; spriteId++)
{
LoadCompressedSpriteSheet(&gUnknown_085E4AE8[spriteId]);
LoadCompressedSpriteSheet(&gIntroPokemonRunningSpriteSheet[spriteId]);
}
LoadSpritePalettes(gUnknown_085F530C);
LoadSpritePalettes(gUnknown_085E4B08);
LoadSpritePalettes(gIntroBikeAndFlygonPalette);
LoadSpritePalettes(gIntroPokemonRunningPalette);
CreateSprite(&gUnknown_085E4BDC, 0x110, 0x80, 0);
CreateSprite(&gUnknown_085E4BA4, 0x120, 0x6E, 1);
if (gUnknown_0203BCC8 == 0)
if (gIntroCharacterGender == 0)
spriteId = intro_create_brendan_sprite(0x110, 100);
else
spriteId = intro_create_may_sprite(0x110, 100);
gSprites[spriteId].callback = sub_816F9D4;
gSprites[spriteId].anims = gUnknown_085E4DC4;
gSprites[spriteId].callback = SpriteCB_IntroGraphicsBicycle;
gSprites[spriteId].anims = gIntroBicycleAnimationCommands;
gTasks[taskId].data[1] = spriteId;
CreateSprite(&gUnknown_085E4B40, 0x110, 0x50, 0x4);
spriteId = intro_create_flygon_sprite(-0x40, 0x3C);
gSprites[spriteId].callback = sub_816FAB0;
gSprites[spriteId].callback = SpriteCB_IntroGraphicsFlygon;
gTasks[taskId].data[2] = spriteId;
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_WHITEALPHA);
SetVBlankCallback(VBlankCB_Intro);
gTasks[taskId].data[0] = sub_817B3DC(1, 0x4000, 0x400, 0x10);
gTasks[taskId].data[0] = CreateBicycleAnimationTask(1, 0x4000, 0x400, 0x10);
sub_817B150(1);
gTasks[taskId].func = Task_IntroHandleBikeAndFlygonMovement;
}
@ -1243,11 +1304,12 @@ static void Task_IntroStartBikeRide(u8 taskId)
static void Task_IntroHandleBikeAndFlygonMovement(u8 taskId)
{
s16 a;
u16 sine;
u16 offset;
if (gIntroFrameCounter == 1856)
{
gUnknown_0203BD28 = 2;
// Destroys the CreateBicycleAnimationTask created earlier.
DestroyTask(gTasks[taskId].data[0]);
}
if (gIntroFrameCounter > 1946)
@ -1268,8 +1330,8 @@ static void Task_IntroHandleBikeAndFlygonMovement(u8 taskId)
if (gIntroFrameCounter == 1727)
gSprites[gTasks[taskId].data[1]].data[0] = 4;
sine = Sin(gTasks[taskId].data[3] >> 2 & 0x7F, 48);
gUnknown_0203BCCC = sine;
offset = Sin(gTasks[taskId].data[3] >> 2 & 0x7F, 48);
gIntroGraphicsFlygonYOffset = offset;
if (gTasks[taskId].data[3] < 512)
gTasks[taskId].data[3]++;
sub_817B540(0);
@ -1493,7 +1555,7 @@ static void Task_IntroLoadPart3Graphics(u8 taskId)
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
sub_816F2A8(0x78, 0x50, 0, 0);
PanFadeAndZoomScreen(0x78, 0x50, 0, 0);
ResetSpriteData();
FreeAllSpritePalettes();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_WHITEALPHA);
@ -1518,7 +1580,7 @@ static void Task_IntroSpinAndZoomPokeball(u8 taskId)
gTasks[taskId].func = Task_IntroWaitToSetupPart3LegendsFight;
}
sub_816F2A8(0x78, 0x50, 0x10000 / gTasks[taskId].data[1], gTasks[taskId].data[0]);
PanFadeAndZoomScreen(0x78, 0x50, 0x10000 / gTasks[taskId].data[1], gTasks[taskId].data[0]);
if (gIntroFrameCounter == 28)
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA);
@ -1527,10 +1589,10 @@ static void Task_IntroSpinAndZoomPokeball(u8 taskId)
static void Task_IntroWaitToSetupPart3LegendsFight(u8 taskId)
{
if (gIntroFrameCounter > 43)
gTasks[taskId].func = Task_IntroLoadPart1Graphics3;
gTasks[taskId].func = Task_IntroLoadGroudonScene;
}
static void Task_IntroLoadPart1Graphics3(u8 taskId)
static void Task_IntroLoadGroudonScene(u8 taskId)
{
if (!gPaletteFade.active)
{
@ -1545,11 +1607,11 @@ static void Task_IntroLoadPart1Graphics3(u8 taskId)
LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]);
LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]);
CpuCopy16(gIntro3BgPal, gPlttBufferUnfaded, sizeof(gIntro3BgPal));
gTasks[taskId].func = Task_IntroLoadPart1Graphics4;
gTasks[taskId].func = Task_IntroLoadPart3Graphics1;
}
}
static void Task_IntroLoadPart1Graphics4(u8 taskId)
static void Task_IntroLoadPart3Graphics1(u8 taskId)
{
SetGpuReg(REG_OFFSET_WIN0H, 0xF0);
SetGpuReg(REG_OFFSET_WIN0V, 0xA0);
@ -1577,11 +1639,11 @@ static void Task_IntroLoadPart1Graphics4(u8 taskId)
gTasks[taskId].data[1] = 0xFFA0;
gTasks[taskId].data[2] = 0xFF51;
gTasks[taskId].data[3] = 0x100;
sub_816F2A8(0xFFA0, 0xFF51, 0x100, 0);
gTasks[taskId].func = Task_IntroLoadPart1Graphics5;
PanFadeAndZoomScreen(0xFFA0, 0xFF51, 0x100, 0);
gTasks[taskId].func = Task_IntroLoadPart3Graphics2;
}
static void Task_IntroLoadPart1Graphics5(u8 taskId)
static void Task_IntroLoadPart3Graphics2(u8 taskId)
{
if (gTasks[taskId].data[0] != 32)
{
@ -1591,30 +1653,30 @@ static void Task_IntroLoadPart1Graphics5(u8 taskId)
else
{
SetGpuReg(REG_OFFSET_WIN0V, 0x2080);
gTasks[taskId].func = Task_IntroLoadPart1Graphics6;
gTasks[taskId].func = Task_IntroLoadPart3Graphics3;
}
}
static void Task_IntroLoadPart1Graphics6(u8 taskId)
static void Task_IntroLoadPart3Graphics3(u8 taskId)
{
gTasks[taskId].func = Task_IntroLoadPart1Graphics7;
gTasks[taskId].func = Task_IntroLoadPart3Graphics4;
}
static void Task_IntroLoadPart1Graphics7(u8 taskId)
static void Task_IntroLoadPart3Graphics4(u8 taskId)
{
gTasks[taskId].data[0] = 0;
gTasks[taskId].func = Task_IntroLoadPart1Graphics8;
gTasks[taskId].func = Task_IntroGroudonScene;
ScanlineEffect_InitWave(0, 0xA0, 0x4, 4, 1, 4, 0);
}
static void Task_IntroLoadPart1Graphics8(u8 taskId)
static void Task_IntroGroudonScene(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[5]++;
if ((u16)(data[0] - 1) < 7 && data[5] % 2 == 0)
data[4] ^= 3;
sub_816F2A8(data[1], data[2] + data[4], data[3], 0);
PanFadeAndZoomScreen(data[1], data[2] + data[4], data[3], 0);
switch (data[0])
{
case 0:
@ -1624,7 +1686,7 @@ static void Task_IntroLoadPart1Graphics8(u8 taskId)
data[0]++;
data[6] = 2;
data[7] = 0x1E2;
sub_816E190(taskId);
CreateGroudonRockSprites(taskId);
}
break;
case 1:
@ -1706,30 +1768,30 @@ static void Task_IntroLoadPart1Graphics8(u8 taskId)
case 9:
if (!gPaletteFade.active)
{
gTasks[taskId].func = Task_IntroLoadPart1Graphics9;
gTasks[taskId].func = Task_IntroLoadKyogreScene;
gScanlineEffect.state = 3;
}
break;
}
}
static void sub_816E190(u8 a0)
static void CreateGroudonRockSprites(u8 a0)
{
int i;
u8 spriteId;
for (i = 0; i < 6; i++)
{
spriteId = CreateSprite(gUnknown_08596C10, gUnknown_085E4C64[i][0], 0xA0, i);
gSprites[spriteId].callback = sub_816E1F8;
spriteId = CreateSprite(gUnknown_08596C10, gIntroGroudonRockData[i][0], 0xA0, i);
gSprites[spriteId].callback = SpriteCB_IntroGroudonRocks;
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].data[1] = i;
gSprites[spriteId].data[4] = a0;
StartSpriteAnim(&gSprites[spriteId], gUnknown_085E4C64[i][1]);
StartSpriteAnim(&gSprites[spriteId], gIntroGroudonRockData[i][1]);
}
}
static void sub_816E1F8(struct Sprite *sprite)
static void SpriteCB_IntroGroudonRocks(struct Sprite *sprite)
{
sprite->data[3]++;
if (sprite->data[3] % 2 == 0)
@ -1738,7 +1800,7 @@ static void sub_816E1F8(struct Sprite *sprite)
switch(sprite->data[0])
{
case 0:
sprite->data[2] += gUnknown_085E4C64[sprite->data[1]][2];
sprite->data[2] += gIntroGroudonRockData[sprite->data[1]][2];
sprite->pos1.y -= (sprite->data[2] & 0xFF00) >> 8;
sprite->data[2] &= 0xFF;
if (gTasks[sprite->data[4]].data[0] > 7)
@ -1758,7 +1820,7 @@ static void sub_816E1F8(struct Sprite *sprite)
}
}
static void Task_IntroLoadPart1Graphics9(u8 taskId)
static void Task_IntroLoadKyogreScene(u8 taskId)
{
ResetSpriteData();
LZDecompressVram(gIntro3KyogreGfx, (void *)VRAM);
@ -1767,21 +1829,21 @@ static void Task_IntroLoadPart1Graphics9(u8 taskId)
LoadCompressedSpriteSheet(gUnknown_085E4C88);
LoadSpritePalette(gUnknown_085E4C98);
BeginNormalPaletteFade(0xFFFFFFFE, 0, 0x10, 0, RGB_WHITEALPHA);
gTasks[taskId].func = Task_IntroFadeIn0;
gTasks[taskId].func = Task_IntroKyogreScene;
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0x150;
gTasks[taskId].data[2] = 0x50;
gTasks[taskId].data[6] = 0x10;
gTasks[taskId].data[3] = 0x100;
sub_816F2A8(0x150, 0x50, 0x100, 0);
PanFadeAndZoomScreen(0x150, 0x50, 0x100, 0);
ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, 6, 0);
}
static void Task_IntroFadeIn0(u8 taskId)
static void Task_IntroKyogreScene(u8 taskId)
{
s16 *data = gTasks[taskId].data;
sub_816F2A8(data[1], data[2], data[3], 0);
PanFadeAndZoomScreen(data[1], data[2], data[3], 0);
switch (data[0])
{
@ -1798,7 +1860,7 @@ static void Task_IntroFadeIn0(u8 taskId)
data[6] = 0x19;
data[7] = 1;
data[0]++;
sub_816E6D4(0);
CreateKyogreBubbleSprites_0(0);
}
break;
case 2:
@ -1808,8 +1870,8 @@ static void Task_IntroFadeIn0(u8 taskId)
gTasks[taskId].data[2] -= 0x102;
data[6] = 8;
data[0]++;
sub_816E6D4(0);
sub_816E74C();
CreateKyogreBubbleSprites_0(0);
CreateKyogreBubbleSprites_1();
}
break;
case 3:
@ -1891,7 +1953,7 @@ static void Task_IntroFadeIn0(u8 taskId)
{
data[6] = 0;
data[0]++;
sub_816E6D4(taskId);
CreateKyogreBubbleSprites_0(taskId);
}
break;
case 11:
@ -1914,43 +1976,43 @@ static void Task_IntroFadeIn0(u8 taskId)
case 13:
if (!gPaletteFade.active)
{
gTasks[taskId].func = Task_IntroFadeIn1;
gTasks[taskId].func = Task_IntroLoadClouds1;
gScanlineEffect.state = 3;
}
break;
}
}
static void sub_816E6D4(u8 a0)
static void CreateKyogreBubbleSprites_0(u8 taskId)
{
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, gIntroKyogreBubbleData[i][0], gIntroKyogreBubbleData[i][1], i);
gSprites[spriteId].invisible = TRUE;
gSprites[spriteId].data[5] = a0;
gSprites[spriteId].data[6] = gUnknown_085E4CA8[i][2];
gSprites[spriteId].data[5] = taskId;
gSprites[spriteId].data[6] = gIntroKyogreBubbleData[i][2];
gSprites[spriteId].data[7] = 0x40;
}
}
static void sub_816E74C(void)
static void CreateKyogreBubbleSprites_1(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, gIntroKyogreBubbleData[i + 6][0], gIntroKyogreBubbleData[i + 6][1], i);
gSprites[spriteId].invisible = TRUE;
gSprites[spriteId].data[6] = gUnknown_085E4CA8[i][2];
gSprites[spriteId].data[6] = gIntroKyogreBubbleData[i][2];
gSprites[spriteId].data[7] = 0x40;
}
}
static void sub_816E7B4(struct Sprite *sprite)
static void SpriteCB_IntroKyogreBubbles(struct Sprite *sprite)
{
switch(sprite->data[0])
{
@ -1988,7 +2050,7 @@ static void sub_816E7B4(struct Sprite *sprite)
}
}
static void Task_IntroFadeIn1(u8 taskId)
static void Task_IntroLoadClouds1(u8 taskId)
{
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
| BLDCNT_TGT1_BG1
@ -2027,27 +2089,27 @@ static void Task_IntroFadeIn1(u8 taskId)
LZDecompressVram(gIntro3CloudsGfx, (void *)VRAM);
LZDecompressVram(gIntro3CloudsGfx, (void *)(VRAM + 0x4000));
LZDecompressVram(gIntro3Clouds3Tilemap, (void *)(VRAM + 0xE000));
gTasks[taskId].func = Task_IntroFadeIn2;
gTasks[taskId].func = Task_IntroLoadClouds2;
}
static void Task_IntroFadeIn2(u8 taskId)
static void Task_IntroLoadClouds2(u8 taskId)
{
LZDecompressVram(gIntro3Clouds1Tilemap, (void *)(VRAM + 0xC000));
LZDecompressVram(gIntro3Clouds2Tilemap, (void *)(VRAM + 0xD000));
gTasks[taskId].func = Task_IntroFadeIn3;
gTasks[taskId].func = Task_IntroLoadClouds3;
}
static void Task_IntroFadeIn3(u8 taskId)
static void Task_IntroLoadClouds3(u8 taskId)
{
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
gTasks[taskId].func = Task_IntroFadeIn4;
gTasks[taskId].func = Task_IntroCloudScene;
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[6] = 16;
}
static void Task_IntroFadeIn4(u8 taskId)
static void Task_IntroCloudScene(u8 taskId)
{
s16 *data = gTasks[taskId].data;
@ -2071,12 +2133,12 @@ static void Task_IntroFadeIn4(u8 taskId)
if (data[6] != 0)
data[6] -= 0x80;
else if (!gPaletteFade.active)
gTasks[taskId].func = Task_IntroFadeIn5;
gTasks[taskId].func = Task_IntroLoadRaquazaLightningScene;
break;
}
}
static void Task_IntroFadeIn5(u8 taskId)
static void Task_IntroLoadRaquazaLightningScene(u8 taskId)
{
LZDecompressVram(gIntro3RayquazaTilemap, (void *)(VRAM + 0xE000));
LZDecompressVram(gIntro3Clouds4Tilemap, (void *)(VRAM + 0xC000));
@ -2088,15 +2150,15 @@ static void Task_IntroFadeIn5(u8 taskId)
| DISPCNT_BG2_ON
| DISPCNT_OBJ_ON
| DISPCNT_WIN0_ON);
gTasks[taskId].func = Task_IntroFadeIn6;
gTasks[taskId].func = Task_IntroRaquazaLightningScene;
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[6] = 1;
gTasks[taskId].data[7] = 0;
LoadCompressedSpriteSheetUsingHeap(gUnknown_085E4BF4);
LoadSpritePalettes(gUnknown_085E4C04);
LoadCompressedSpriteSheetUsingHeap(gIntroRayquazaLightningSpriteSheet);
LoadSpritePalettes(gIntroRayquazaLightningPalette);
}
static void Task_IntroFadeIn6(u8 taskId)
static void Task_IntroRaquazaLightningScene(u8 taskId)
{
s16 *data = gTasks[taskId].data;
u8 spriteId;
@ -2106,10 +2168,10 @@ static void Task_IntroFadeIn6(u8 taskId)
case 0:
if (--data[6] == 0)
{
CreateSprite(&gUnknown_085E4C4C, 200, 48, 0);
spriteId = CreateSprite(&gUnknown_085E4C4C, 200, 80, 1);
CreateSprite(&gIntroLightningSprite, 200, 48, 0);
spriteId = CreateSprite(&gIntroLightningSprite, 200, 80, 1);
StartSpriteAnim(&gSprites[spriteId], 1);
spriteId = CreateSprite(&gUnknown_085E4C4C, 200, 112, 2);
spriteId = CreateSprite(&gIntroLightningSprite, 200, 112, 2);
StartSpriteAnim(&gSprites[spriteId], 2);
data[0]++;
data[6] = 72;
@ -2118,10 +2180,10 @@ static void Task_IntroFadeIn6(u8 taskId)
case 1:
if (--data[6] == 0)
{
CreateSprite(&gUnknown_085E4C4C, 40, 48, 0);
spriteId = CreateSprite(&gUnknown_085E4C4C, 40, 80, 1);
CreateSprite(&gIntroLightningSprite, 40, 48, 0);
spriteId = CreateSprite(&gIntroLightningSprite, 40, 80, 1);
StartSpriteAnim(&gSprites[spriteId], 1);
spriteId = CreateSprite(&gUnknown_085E4C4C, 40, 112, 2);
spriteId = CreateSprite(&gIntroLightningSprite, 40, 112, 2);
StartSpriteAnim(&gSprites[spriteId], 2);
data[0]++;
data[6] = 48;
@ -2129,12 +2191,12 @@ static void Task_IntroFadeIn6(u8 taskId)
break;
case 2:
if (--data[6] == 0)
gTasks[taskId].func = Task_IntroFadeIn7;
gTasks[taskId].func = Task_IntroLoadRaquazaGlowScene;
break;
}
}
static void sub_816EC6C(struct Sprite *sprite)
static void SpriteCB_IntroRaquazaLightning(struct Sprite *sprite)
{
if (sprite->animEnded)
sprite->invisible = TRUE;
@ -2165,30 +2227,30 @@ static void sub_816EC6C(struct Sprite *sprite)
}
}
static void Task_IntroFadeIn7(u8 taskId)
static void Task_IntroLoadRaquazaGlowScene(u8 taskId)
{
u8 newTaskId;
LoadCompressedSpriteSheet(gUnknown_085E5048);
LoadSpritePalettes(gUnknown_085E5058);
LoadCompressedSpriteSheet(gIntroRaquazaGlowSpriteSheet);
LoadSpritePalettes(gIntroRaquazaGlowPalette);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_BG2_ON
| DISPCNT_OBJ_ON
| DISPCNT_WIN0_ON);
gTasks[taskId].func = Task_IntroFadeIn8;
gTasks[taskId].func = Task_IntroRaquazaGlowScene_0;
BeginNormalPaletteFade(0x0000FFDE, 0, 16, 0, RGB(9, 10, 10));
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0xA8;
gTasks[taskId].data[2] = -0x10;
gTasks[taskId].data[3] = -0x88;
gTasks[taskId].data[4] = -0x10;
newTaskId = CreateTask(sub_816EEA8, 0);
newTaskId = CreateTask(Task_IntroRaquazaGlowScene_1, 0);
gTasks[newTaskId].data[4] = taskId;
}
static void Task_IntroFadeIn8(u8 taskId)
static void Task_IntroRaquazaGlowScene_0(u8 taskId)
{
s16 *data = gTasks[taskId].data;
@ -2230,22 +2292,22 @@ static void Task_IntroFadeIn8(u8 taskId)
break;
case 3:
if (--data[5] == 0)
gTasks[taskId].func = Task_IntroFadeIn9;
gTasks[taskId].func = Task_EndIntroMovie;
break;
}
}
static void Task_IntroFadeIn9(u8 taskId)
static void Task_EndIntroMovie(u8 taskId)
{
DestroyTask(taskId);
SetMainCallback2(MainCB2_EndIntro);
}
static void sub_816EEA8(u8 taskId)
static void Task_IntroRaquazaGlowScene_1(u8 taskId)
{
// Note: data[4] contains the taskId of Task_IntroRaquazaGlowScene_0
u8 spriteId;
s16 *data = gTasks[taskId].data;
data[2]++;
switch(data[0])
@ -2292,7 +2354,7 @@ static void sub_816EEA8(u8 taskId)
}
if (data[1] == 6)
{
spriteId = CreateSprite(&gUnknown_085E5030, 120, 88, 15);
spriteId = CreateSprite(&gIntroRaquazaHyperbeamSprite, 120, 88, 15);
PlaySE(SE_OP_BASYU);
gSprites[spriteId].invisible = TRUE;
gSprites[spriteId].data[3] = data[4];
@ -2365,7 +2427,7 @@ static void Task_IntroWaterDrops_1(u8 taskId)
| BLDCNT_TGT2_BG3
| BLDCNT_TGT2_OBJ
| BLDCNT_TGT2_BD);
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[31]);
SetGpuReg(REG_OFFSET_BLDALPHA, gIntroWaterDropData[31]);
SetGpuReg(REG_OFFSET_BLDY, 0);
gTasks[taskId].data[1] = 0x40;
gTasks[taskId].data[0]++;
@ -2377,11 +2439,11 @@ static void Task_IntroWaterDrops_1(u8 taskId)
gTasks[taskId].data[1]--;
tmp = gTasks[taskId].data[1] / 2;
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[tmp]);
SetGpuReg(REG_OFFSET_BLDALPHA, gIntroWaterDropData[tmp]);
}
else
{
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[0]);
SetGpuReg(REG_OFFSET_BLDALPHA, gIntroWaterDropData[0]);
gTasks[taskId].data[1] = 0x10;
gTasks[taskId].data[0]++;
}
@ -2408,7 +2470,7 @@ static void Task_IntroWaterDrops_2(u8 taskId)
| BLDCNT_TGT2_BG3
| BLDCNT_TGT2_OBJ
| BLDCNT_TGT2_BD);
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[0]);
SetGpuReg(REG_OFFSET_BLDALPHA, gIntroWaterDropData[0]);
SetGpuReg(REG_OFFSET_BLDY, 0);
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++;
@ -2420,11 +2482,11 @@ static void Task_IntroWaterDrops_2(u8 taskId)
gTasks[taskId].data[1]++;
tmp = gTasks[taskId].data[1] / 2;
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[tmp]);
SetGpuReg(REG_OFFSET_BLDALPHA, gIntroWaterDropData[tmp]);
}
else
{
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[31]);
SetGpuReg(REG_OFFSET_BLDALPHA, gIntroWaterDropData[31]);
gTasks[taskId].data[1] = 0x10;
gTasks[taskId].data[0]++;
}
@ -2445,15 +2507,15 @@ static void Task_IntroWaterDrops_2(u8 taskId)
}
}
void sub_816F2A8(u16 scrX, u16 scrY, u16 zoom, u16 alpha)
void PanFadeAndZoomScreen(u16 screenX, u16 screenY, u16 zoom, u16 alpha)
{
struct BgAffineSrcData src;
struct BgAffineDstData dest;
src.texX = 0x8000;
src.texY = 0x8000;
src.scrX = scrX;
src.scrY = scrY;
src.scrX = screenX;
src.scrY = screenY;
src.sx = zoom;
src.sy = zoom;
src.alpha = alpha;
@ -2662,7 +2724,7 @@ static u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately)
u8 spriteId;
u8 oldSpriteId;
spriteId = CreateSprite(&gUnknown_085E4D64, x, y, 1);
spriteId = CreateSprite(&gIntroWaterDropSprite, x, y, 1);
gSprites[spriteId].data[0] = 0;
gSprites[spriteId].data[7] = 0;
gSprites[spriteId].data[1] = d;
@ -2680,7 +2742,7 @@ static u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately)
gSprites[spriteId].callback = SpriteCB_WaterDropFall_2;
oldSpriteId = spriteId;
spriteId = CreateSprite(&gUnknown_085E4D64, x, y, 1);
spriteId = CreateSprite(&gIntroWaterDropSprite, x, y, 1);
gSprites[spriteId].data[7] = oldSpriteId;
gSprites[spriteId].data[1] = d + 1;
gSprites[spriteId].oam.affineMode = 3;
@ -2688,7 +2750,7 @@ static u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately)
CalcCenterToCornerVec(&gSprites[spriteId], 0, 2, 2);
gSprites[spriteId].callback = sub_816F3A4;
spriteId = CreateSprite(&gUnknown_085E4D64, x, y, 1);
spriteId = CreateSprite(&gIntroWaterDropSprite, x, y, 1);
gSprites[spriteId].data[7] = oldSpriteId;
gSprites[spriteId].data[1] = d + 2;
StartSpriteAnim(&gSprites[spriteId], 1);
@ -2704,7 +2766,7 @@ static u8 CreateWaterDrop(s16 x, s16 y, u16 c, u16 d, u16 e, u8 fallImmediately)
return oldSpriteId;
}
static void sub_816F9D4(struct Sprite *sprite)
static void SpriteCB_IntroGraphicsBicycle(struct Sprite *sprite)
{
switch (sprite->data[0])
{
@ -2753,7 +2815,7 @@ static void sub_816F9D4(struct Sprite *sprite)
}
}
static void sub_816FAB0(struct Sprite *sprite)
static void SpriteCB_IntroGraphicsFlygon(struct Sprite *sprite)
{
switch (sprite->data[0])
{
@ -2776,7 +2838,7 @@ static void sub_816FAB0(struct Sprite *sprite)
sprite->pos2.x -= 2;
break;
}
sprite->pos2.y = Sin((u8)sprite->data[1], 8) - gUnknown_0203BCCC;
sprite->pos2.y = Sin((u8)sprite->data[1], 8) - gIntroGraphicsFlygonYOffset;
sprite->data[1] += 4;
}
@ -2896,7 +2958,7 @@ static void sub_816FD44(struct Sprite *sprite)
}
}
static u8 sub_816FDB8(s16 a0, s16 a1, s16 a2)
static u8 CreatePart1Animations(s16 a0, s16 a1, s16 a2)
{
u16 i;
u8 spriteId;
@ -2981,7 +3043,7 @@ static void sub_816FEDC(struct Sprite *sprite)
}
}
static void sub_8170040(struct Sprite *sprite)
static void SpriteCB_IntroRaquazaHyperbeam(struct Sprite *sprite)
{
u16 foo;

View File

@ -269,7 +269,7 @@ const struct CompressedSpriteSheet gIntro2FlygonSpriteSheet[] = {
{ NULL }
};
const struct SpritePalette gUnknown_085F530C[] = {
const struct SpritePalette gIntroBikeAndFlygonPalette[] = {
{ gIntro2BrendanNoTurnPal, 1002 },
{ gIntro2BrendanNoTurnPal, 1003 },
{ gIntro2FlygonPal, 1004 },
@ -358,6 +358,7 @@ void load_intro_part2_graphics(u8 a)
gReservedSpritePaletteCount = 8;
}
// Note: This is only called with a=1.
void sub_817B150(u8 a)
{
switch (a)
@ -509,7 +510,7 @@ void sub_817B3A8(u8 a)
| DISPCNT_OBJ_ON);
}
u8 sub_817B3DC(u8 a, u16 b, u16 c, u16 d)
u8 CreateBicycleAnimationTask(u8 a, u16 b, u16 c, u16 d)
{
u8 taskId = CreateTask(&sub_817B458, 0);

View File

@ -146,7 +146,7 @@ void Sav2_ClearSetDefault(void)
SetDefaultOptions();
}
void sub_808447C(void)
void ResetMenuAndMonGlobals(void)
{
gDifferentSaveFile = 0;
sub_80BB358();

View File

@ -19,7 +19,7 @@ void sub_81700F8(void)
REG_IME = imeBackup;
gMain.inBattle = FALSE;
SetSaveBlocksPointers(sub_815355C());
sub_808447C();
ResetMenuAndMonGlobals();
Save_ResetSaveCounters();
Save_LoadGameData(0);
if (gSaveFileStatus == 0 || gSaveFileStatus == 2)

View File

@ -64,7 +64,7 @@ static const u32 sTitleScreenRayquazaTilemap[] = INCBIN_U32("graphics/title_scre
static const u32 sTitleScreenLogoShineGfx[] = INCBIN_U32("graphics/title_screen/logo_shine.4bpp.lz");
static const u32 sTitleScreenCloudsGfx[] = INCBIN_U32("graphics/title_screen/clouds.4bpp.lz");
const u16 gUnknown_0853FF70[] =
const u16 gIntroWaterDropData[] =
{
0x0010, 0x0110, 0x0210, 0x0310, 0x0410, 0x0510, 0x0610, 0x0710,
0x0810, 0x0910, 0x0a10, 0x0b10, 0x0c10, 0x0d10, 0x0e10, 0x0f10,
@ -324,7 +324,7 @@ static void SpriteCB_VersionBannerLeft(struct Sprite *sprite)
sprite->pos1.y++;
if (sprite->data[0] != 0)
sprite->data[0]--;
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[sprite->data[0]]);
SetGpuReg(REG_OFFSET_BLDALPHA, gIntroWaterDropData[sprite->data[0]]);
}
}
@ -542,7 +542,7 @@ void CB2_InitTitleScreen(void)
gMain.state = 4;
break;
case 4:
sub_816F2A8(0x78, 0x50, 0x100, 0);
PanFadeAndZoomScreen(0x78, 0x50, 0x100, 0);
SetGpuReg(REG_OFFSET_BG2X_L, -29 * 256);
SetGpuReg(REG_OFFSET_BG2X_H, -1);
SetGpuReg(REG_OFFSET_BG2Y_L, -32 * 256);