Merge branch 'master' of github.com:pret/pokeemerald into main-menu-state-machine

This commit is contained in:
Phlosioneer 2019-02-13 23:04:56 -05:00
commit 9e8a841bfa
33 changed files with 294 additions and 218 deletions

View File

@ -38,7 +38,7 @@ ASFLAGS := -mcpu=arm7tdmi
CC1 := tools/agbcc/bin/agbcc$(EXE) CC1 := tools/agbcc/bin/agbcc$(EXE)
override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm
CPPFLAGS := -I tools/agbcc/include -I tools/agbcc -iquote include CPPFLAGS := -I tools/agbcc/include -I tools/agbcc -iquote include -Wno-trigraphs
LDFLAGS = -Map ../../$(MAP) LDFLAGS = -Map ../../$(MAP)

View File

@ -313,7 +313,7 @@
.endm .endm
@ Runs time based events. In FireRed, this command is a nop. @ Runs time based events. In FireRed, this command is a nop.
.macro dodailyevents .macro dotimebasedevents
.byte 0x2d .byte 0x2d
.endm .endm

View File

@ -1748,7 +1748,7 @@ RustboroCity_Gym_EventScript_271E84:: @ 8271E84
DewfordTown_EventScript_271E8B:: @ 8271E8B DewfordTown_EventScript_271E8B:: @ 8271E8B
DewfordTown_Hall_EventScript_271E8B:: @ 8271E8B DewfordTown_Hall_EventScript_271E8B:: @ 8271E8B
dodailyevents dotimebasedevents
setvar VAR_0x8004, 0 setvar VAR_0x8004, 0
special BufferTrendyPhraseString special BufferTrendyPhraseString
return return

View File

@ -33,7 +33,7 @@ LilycoveCity_EventScript_1E2B6B:: @ 81E2B6B
LilycoveCity_EventScript_1E2BD8:: @ 81E2BD8 LilycoveCity_EventScript_1E2BD8:: @ 81E2BD8
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_LILYCOVE_RECEIVED_BERRY, LilycoveCity_EventScript_1E2C18 goto_if_set FLAG_DAILY_LILYCOVE_RECEIVED_BERRY, LilycoveCity_EventScript_1E2C18
msgbox LilycoveCity_Text_2A7244, MSGBOX_DEFAULT msgbox LilycoveCity_Text_2A7244, MSGBOX_DEFAULT
random 10 random 10

View File

@ -8,7 +8,7 @@ LilycoveCity_DepartmentStore_1F_EventScript_21F693:: @ 821F693
LilycoveCity_DepartmentStore_1F_EventScript_21F69C:: @ 821F69C LilycoveCity_DepartmentStore_1F_EventScript_21F69C:: @ 821F69C
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
compare VAR_POKELOT_PRIZE, 0 compare VAR_POKELOT_PRIZE, 0
goto_if_ne LilycoveCity_DepartmentStore_1F_EventScript_21F7F7 goto_if_ne LilycoveCity_DepartmentStore_1F_EventScript_21F7F7
goto_if_set FLAG_DAILY_PICKED_LOTO_TICKET, LilycoveCity_DepartmentStore_1F_EventScript_21F78D goto_if_set FLAG_DAILY_PICKED_LOTO_TICKET, LilycoveCity_DepartmentStore_1F_EventScript_21F78D

View File

@ -52,7 +52,7 @@ MossdeepCity_SpaceCenter_1F_EventScript_222FD8:: @ 8222FD8
faceplayer faceplayer
compare VAR_0x405D, 2 compare VAR_0x405D, 2
goto_if_eq MossdeepCity_SpaceCenter_1F_EventScript_223024 goto_if_eq MossdeepCity_SpaceCenter_1F_EventScript_223024
dodailyevents dotimebasedevents
specialvar VAR_RESULT, GetWeekCount specialvar VAR_RESULT, GetWeekCount
buffernumberstring 0, VAR_RESULT buffernumberstring 0, VAR_RESULT
compare VAR_RESULT, 0 compare VAR_RESULT, 0
@ -74,7 +74,7 @@ MossdeepCity_SpaceCenter_1F_EventScript_22301B:: @ 822301B
return return
MossdeepCity_SpaceCenter_1F_EventScript_223024:: @ 8223024 MossdeepCity_SpaceCenter_1F_EventScript_223024:: @ 8223024
dodailyevents dotimebasedevents
specialvar VAR_RESULT, GetWeekCount specialvar VAR_RESULT, GetWeekCount
buffernumberstring 0, VAR_RESULT buffernumberstring 0, VAR_RESULT
compare VAR_RESULT, 0 compare VAR_RESULT, 0

View File

@ -4,7 +4,7 @@ PacifidlogTown_House2_MapScripts:: @ 8203791
PacifidlogTown_House2_EventScript_203792:: @ 8203792 PacifidlogTown_House2_EventScript_203792:: @ 8203792
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
call PacifidlogTown_House2_EventScript_2037DE call PacifidlogTown_House2_EventScript_2037DE
goto_if_set FLAG_RECEIVED_FANCLUB_TM_THIS_WEEK, PacifidlogTown_House2_EventScript_20387E goto_if_set FLAG_RECEIVED_FANCLUB_TM_THIS_WEEK, PacifidlogTown_House2_EventScript_20387E
call_if_set FLAG_MET_FANCLUB_YOUNGER_BROTHER, PacifidlogTown_House2_EventScript_2037F8 call_if_set FLAG_MET_FANCLUB_YOUNGER_BROTHER, PacifidlogTown_House2_EventScript_2037F8

View File

@ -84,7 +84,7 @@ Route104_PrettyPetalFlowerShop_EventScript_22A421:: @ 822A421
Route104_PrettyPetalFlowerShop_EventScript_22A442:: @ 822A442 Route104_PrettyPetalFlowerShop_EventScript_22A442:: @ 822A442
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_FLOWER_SHOP_RECEIVED_BERRY, Route104_PrettyPetalFlowerShop_EventScript_22A482 goto_if_set FLAG_DAILY_FLOWER_SHOP_RECEIVED_BERRY, Route104_PrettyPetalFlowerShop_EventScript_22A482
msgbox Route104_PrettyPetalFlowerShop_Text_2A7A98, MSGBOX_DEFAULT msgbox Route104_PrettyPetalFlowerShop_Text_2A7A98, MSGBOX_DEFAULT
random 8 random 8

View File

@ -159,7 +159,7 @@ Route111_Movement_1F0EB1:: @ 81F0EB1
Route111_EventScript_1F0EB9:: @ 81F0EB9 Route111_EventScript_1F0EB9:: @ 81F0EB9
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_ROUTE_111_RECEIVED_BERRY, Route111_EventScript_1F0EF4 goto_if_set FLAG_DAILY_ROUTE_111_RECEIVED_BERRY, Route111_EventScript_1F0EF4
msgbox Route111_Text_2A6EBD, MSGBOX_DEFAULT msgbox Route111_Text_2A6EBD, MSGBOX_DEFAULT
giveitem_std ITEM_RAZZ_BERRY giveitem_std ITEM_RAZZ_BERRY

View File

@ -27,7 +27,7 @@ Route114_MapScript2_1F2578: @ 81F2578
Route114_EventScript_1F2582:: @ 81F2582 Route114_EventScript_1F2582:: @ 81F2582
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_ROUTE_114_RECEIVED_BERRY, Route114_EventScript_1F25C7 goto_if_set FLAG_DAILY_ROUTE_114_RECEIVED_BERRY, Route114_EventScript_1F25C7
msgbox Route114_Text_2A6FCB, MSGBOX_DEFAULT msgbox Route114_Text_2A6FCB, MSGBOX_DEFAULT
random 5 random 5

View File

@ -98,7 +98,7 @@ Route120_EventScript_1F5523:: @ 81F5523
Route120_EventScript_1F5527:: @ 81F5527 Route120_EventScript_1F5527:: @ 81F5527
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_ROUTE_120_RECEIVED_BERRY, Route120_EventScript_1F5625 goto_if_set FLAG_DAILY_ROUTE_120_RECEIVED_BERRY, Route120_EventScript_1F5625
msgbox Route120_Text_2A70C7, MSGBOX_YESNO msgbox Route120_Text_2A70C7, MSGBOX_YESNO
compare VAR_RESULT, 1 compare VAR_RESULT, 1

View File

@ -9,7 +9,7 @@ Route123_BerryMastersHouse_MapScript1_26F841: @ 826F841
Route123_BerryMastersHouse_EventScript_26F845:: @ 826F845 Route123_BerryMastersHouse_EventScript_26F845:: @ 826F845
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_BERRY_MASTER_RECEIVED_BERRY, Route123_BerryMastersHouse_EventScript_26F8B6 goto_if_set FLAG_DAILY_BERRY_MASTER_RECEIVED_BERRY, Route123_BerryMastersHouse_EventScript_26F8B6
msgbox Route123_BerryMastersHouse_Text_2A7386, MSGBOX_DEFAULT msgbox Route123_BerryMastersHouse_Text_2A7386, MSGBOX_DEFAULT
random 10 random 10
@ -38,7 +38,7 @@ Route123_BerryMastersHouse_EventScript_26F8B6:: @ 826F8B6
Route123_BerryMastersHouse_EventScript_26F8C0:: @ 826F8C0 Route123_BerryMastersHouse_EventScript_26F8C0:: @ 826F8C0
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_BERRY_MASTERS_WIFE, Route123_BerryMastersHouse_EventScript_26FA6F goto_if_set FLAG_DAILY_BERRY_MASTERS_WIFE, Route123_BerryMastersHouse_EventScript_26FA6F
msgbox Route123_BerryMastersHouse_Text_2A74E6, MSGBOX_DEFAULT msgbox Route123_BerryMastersHouse_Text_2A74E6, MSGBOX_DEFAULT
setvar VAR_0x8004, 13 setvar VAR_0x8004, 13

View File

@ -18,7 +18,7 @@ ShoalCave_LowTideEntranceRoom_EventScript_236DD5:: @ 8236DD5
ShoalCave_LowTideEntranceRoom_EventScript_236DD9:: @ 8236DD9 ShoalCave_LowTideEntranceRoom_EventScript_236DD9:: @ 8236DD9
lock lock
faceplayer faceplayer
dodailyevents dotimebasedevents
call_if_set FLAG_SYS_SHOAL_ITEM, ShoalCave_LowTideEntranceRoom_EventScript_236ED9 call_if_set FLAG_SYS_SHOAL_ITEM, ShoalCave_LowTideEntranceRoom_EventScript_236ED9
checkitem ITEM_SHOAL_SALT, 4 checkitem ITEM_SHOAL_SALT, 4
compare VAR_RESULT, 0 compare VAR_RESULT, 0

View File

@ -742,7 +742,7 @@ SootopolisCity_EventScript_1E5F10:: @ 81E5F10
end end
SootopolisCity_EventScript_1E5F1B:: @ 81E5F1B SootopolisCity_EventScript_1E5F1B:: @ 81E5F1B
dodailyevents dotimebasedevents
special GetPlayerBigGuyGirlString special GetPlayerBigGuyGirlString
goto_if_set FLAG_DAILY_SOOTOPOLIS_RECEIVED_BERRY, SootopolisCity_EventScript_1E5FBB goto_if_set FLAG_DAILY_SOOTOPOLIS_RECEIVED_BERRY, SootopolisCity_EventScript_1E5FBB
msgbox SootopolisCity_Text_2A7BB0, MSGBOX_DEFAULT msgbox SootopolisCity_Text_2A7BB0, MSGBOX_DEFAULT

View File

@ -45,7 +45,7 @@ gScriptCmdTable:: @ 81DB67C
.4byte ScrCmd_clearflag .4byte ScrCmd_clearflag
.4byte ScrCmd_checkflag .4byte ScrCmd_checkflag
.4byte ScrCmd_initclock .4byte ScrCmd_initclock
.4byte ScrCmd_dodailyevents .4byte ScrCmd_dotimebasedevents
.4byte ScrCmd_gettime .4byte ScrCmd_gettime
.4byte ScrCmd_playse .4byte ScrCmd_playse
.4byte ScrCmd_waitse .4byte ScrCmd_waitse

View File

@ -264,7 +264,7 @@ EventScript_Pblock1_No: @ 8293C70
EventScript_Pblock1_NoBerries: @ 8293C7A EventScript_Pblock1_NoBerries: @ 8293C7A
msgbox Text_Pblock1_NoBerries, MSGBOX_DEFAULT msgbox Text_Pblock1_NoBerries, MSGBOX_DEFAULT
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY, LilycoveCity_ContestLobby_EventScript_293C92 goto_if_set FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY, LilycoveCity_ContestLobby_EventScript_293C92
goto LilycoveCity_ContestLobby_EventScript_293C9C goto LilycoveCity_ContestLobby_EventScript_293C9C
end end
@ -551,7 +551,7 @@ LilycoveCity_ContestLobby_EventScript_293FF8: @ 8293FF8
specialvar VAR_RESULT, GetFirstFreePokeblockSlot specialvar VAR_RESULT, GetFirstFreePokeblockSlot
compare VAR_RESULT, 65535 compare VAR_RESULT, 65535
goto_if_eq LilycoveCity_ContestLobby_EventScript_294028 goto_if_eq LilycoveCity_ContestLobby_EventScript_294028
dodailyevents dotimebasedevents
goto_if_set FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY, LilycoveCity_ContestLobby_EventScript_294028 goto_if_set FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY, LilycoveCity_ContestLobby_EventScript_294028
goto LilycoveCity_ContestLobby_EventScript_294032 goto LilycoveCity_ContestLobby_EventScript_294032
end end

View File

@ -6,7 +6,7 @@
void InitEventData(void); void InitEventData(void);
void ClearTempFieldEventData(void); void ClearTempFieldEventData(void);
void ClearUpperFlags(void); void ClearDailyFlags(void);
void DisableNationalPokedex(void); void DisableNationalPokedex(void);
void EnableNationalPokedex(void); void EnableNationalPokedex(void);
bool32 IsNationalPokedexEnabled(void); bool32 IsNationalPokedexEnabled(void);

View File

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

View File

@ -9,7 +9,7 @@ extern const struct CompressedSpriteSheet gIntro2BrendanSpriteSheet[];
extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2MaySpriteSheet[];
extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[]; extern const struct CompressedSpriteSheet gIntro2BicycleSpriteSheet[];
extern const struct CompressedSpriteSheet gIntro2FlygonSpriteSheet[]; 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_085F5334[];
extern const struct CompressedSpriteSheet gUnknown_085F5344[]; extern const struct CompressedSpriteSheet gUnknown_085F5344[];
extern const struct CompressedSpriteSheet gUnknown_085F5354[]; extern const struct CompressedSpriteSheet gUnknown_085F5354[];
@ -21,7 +21,7 @@ void load_intro_part2_graphics(u8 a);
void sub_817B150(u8 a); void sub_817B150(u8 a);
void sub_817B1C8(u8); void sub_817B1C8(u8);
void sub_817B3A8(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); void sub_817B540(u8);
u8 intro_create_brendan_sprite(s16 a, s16 b); u8 intro_create_brendan_sprite(s16 a, s16 b);
u8 intro_create_may_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); u32 GetTrainerId(u8 *trainerId);
void CopyTrainerId(u8 *dst, u8 *src); void CopyTrainerId(u8 *dst, u8 *src);
void NewGameInitData(void); void NewGameInitData(void);
void sub_808447C(void); void ResetMenuAndMonGlobals(void);
void Sav2_ClearSetDefault(void); void Sav2_ClearSetDefault(void);
#endif // GUARD_NEW_GAME_H #endif // GUARD_NEW_GAME_H

View File

@ -9,6 +9,11 @@
#define PLTT_BUFFER_SIZE 0x200 #define PLTT_BUFFER_SIZE 0x200
#define PLTT_DECOMP_BUFFER_SIZE (PLTT_BUFFER_SIZE * 2) #define PLTT_DECOMP_BUFFER_SIZE (PLTT_BUFFER_SIZE * 2)
#define PALETTE_FADE_STATUS_DELAY 2
#define PALETTE_FADE_STATUS_ACTIVE 1
#define PALETTE_FADE_STATUS_DONE 0
#define PALETTE_FADE_STATUS_LOADING 0xFF
enum enum
{ {
FAST_FADE_IN_FROM_WHITE, FAST_FADE_IN_FROM_WHITE,

View File

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

View File

@ -41,7 +41,7 @@ static void UpdatePerDay(struct Time *localTime)
if (*days != localTime->days && *days <= localTime->days) if (*days != localTime->days && *days <= localTime->days)
{ {
daysSince = localTime->days - *days; daysSince = localTime->days - *days;
ClearUpperFlags(); ClearDailyFlags();
UpdateDewfordTrendPerDay(daysSince); UpdateDewfordTrendPerDay(daysSince);
UpdateTVShowsPerDay(daysSince); UpdateTVShowsPerDay(daysSince);
UpdateWeatherPerDay(daysSince); UpdateWeatherPerDay(daysSince);

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_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0; gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_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; break;
case 1: case 1:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE; 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_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0; gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_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; break;
case 2: case 2:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE; 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_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0; gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_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; break;
case 3: case 3:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE; 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_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0; gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_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; break;
case 4: case 4:
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].invisible = FALSE; 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_RIVAL_CYCLIST]].pos1.y = 46;
gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0; gSprites[gTasks[taskIdA].data[TDA_PLAYER_CYCLIST]].data[0] = 0;
gSprites[gTasks[taskIdA].data[TDA_RIVAL_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; break;
} }

View File

@ -3,7 +3,7 @@
#include "pokedex.h" #include "pokedex.h"
#define TEMP_FLAGS_SIZE 0x4 #define TEMP_FLAGS_SIZE 0x4
#define TEMP_UPPER_FLAGS_SIZE 0x8 #define DAILY_FLAGS_SIZE 0x8
#define TEMP_VARS_SIZE 0x20 #define TEMP_VARS_SIZE 0x20
EWRAM_DATA u16 gSpecialVar_0x8000 = 0; EWRAM_DATA u16 gSpecialVar_0x8000 = 0;
@ -48,10 +48,9 @@ void ClearTempFieldEventData(void)
FlagClear(FLAG_NURSE_UNION_ROOM_REMINDER); FlagClear(FLAG_NURSE_UNION_ROOM_REMINDER);
} }
// Probably had different flag splits at one point. void ClearDailyFlags(void)
void ClearUpperFlags(void)
{ {
memset(gSaveBlock1Ptr->flags + 0x124, 0, TEMP_UPPER_FLAGS_SIZE); memset(gSaveBlock1Ptr->flags + 0x124, 0, DAILY_FLAGS_SIZE);
} }
void DisableNationalPokedex(void) void DisableNationalPokedex(void)

View File

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

View File

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

View File

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

View File

@ -115,7 +115,7 @@ u8 UpdatePaletteFade(void)
u8 dummy = 0; u8 dummy = 0;
if (sPlttBufferTransferPending) if (sPlttBufferTransferPending)
return -1; return PALETTE_FADE_STATUS_LOADING;
if (gPaletteFade.mode == NORMAL_FADE) if (gPaletteFade.mode == NORMAL_FADE)
result = UpdateNormalPaletteFade(); result = UpdateNormalPaletteFade();
@ -409,11 +409,11 @@ static u8 UpdateNormalPaletteFade(void)
u16 selectedPalettes; u16 selectedPalettes;
if (!gPaletteFade.active) if (!gPaletteFade.active)
return 0; return PALETTE_FADE_STATUS_DONE;
if (IsSoftwarePaletteFadeFinishing()) if (IsSoftwarePaletteFadeFinishing())
{ {
return gPaletteFade.active; return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
} }
else else
{ {
@ -483,7 +483,9 @@ static u8 UpdateNormalPaletteFade(void)
} }
} }
return gPaletteFade.active; // gPaletteFade.active cannot change since the last time it was checked. So this
// is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
} }
} }
@ -578,10 +580,11 @@ static u8 UpdateFastPaletteFade(void)
s8 b; s8 b;
if (!gPaletteFade.active) if (!gPaletteFade.active)
return 0; return PALETTE_FADE_STATUS_DONE;
if (IsSoftwarePaletteFadeFinishing()) if (IsSoftwarePaletteFadeFinishing())
return gPaletteFade.active; return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
if (gPaletteFade.objPaletteToggle) if (gPaletteFade.objPaletteToggle)
{ {
@ -688,7 +691,9 @@ static u8 UpdateFastPaletteFade(void)
gPaletteFade.objPaletteToggle ^= 1; gPaletteFade.objPaletteToggle ^= 1;
if (gPaletteFade.objPaletteToggle) if (gPaletteFade.objPaletteToggle)
return gPaletteFade.active; // gPaletteFade.active cannot change since the last time it was checked. So this
// is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
if (gPaletteFade.y - gPaletteFade.deltaY < 0) if (gPaletteFade.y - gPaletteFade.deltaY < 0)
gPaletteFade.y = 0; gPaletteFade.y = 0;
@ -715,7 +720,9 @@ static u8 UpdateFastPaletteFade(void)
gPaletteFade.softwareFadeFinishing = 1; gPaletteFade.softwareFadeFinishing = 1;
} }
return gPaletteFade.active; // gPaletteFade.active cannot change since the last time it was checked. So this
// is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
} }
void BeginHardwarePaletteFade(u8 blendCnt, u8 delay, u8 y, u8 targetY, u8 shouldResetBlendRegisters) void BeginHardwarePaletteFade(u8 blendCnt, u8 delay, u8 y, u8 targetY, u8 shouldResetBlendRegisters)
@ -739,12 +746,12 @@ void BeginHardwarePaletteFade(u8 blendCnt, u8 delay, u8 y, u8 targetY, u8 should
static u8 UpdateHardwarePaletteFade(void) static u8 UpdateHardwarePaletteFade(void)
{ {
if (!gPaletteFade.active) if (!gPaletteFade.active)
return 0; return PALETTE_FADE_STATUS_DONE;
if (gPaletteFade.delayCounter < gPaletteFade_delay) if (gPaletteFade.delayCounter < gPaletteFade_delay)
{ {
gPaletteFade.delayCounter++; gPaletteFade.delayCounter++;
return 2; return PALETTE_FADE_STATUS_DELAY;
} }
gPaletteFade.delayCounter = 0; gPaletteFade.delayCounter = 0;
@ -778,7 +785,9 @@ static u8 UpdateHardwarePaletteFade(void)
gPaletteFade.shouldResetBlendRegisters = 0; gPaletteFade.shouldResetBlendRegisters = 0;
} }
return gPaletteFade.active; // gPaletteFade.active cannot change since the last time it was checked. So this
// is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;`
return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE;
} }
static void UpdateBlendRegisters(void) static void UpdateBlendRegisters(void)

View File

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

View File

@ -690,7 +690,7 @@ bool8 ScrCmd_initclock(struct ScriptContext *ctx)
return FALSE; return FALSE;
} }
bool8 ScrCmd_dodailyevents(struct ScriptContext *ctx) bool8 ScrCmd_dotimebasedevents(struct ScriptContext *ctx)
{ {
DoTimeBasedEvents(); DoTimeBasedEvents();
return FALSE; return FALSE;

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

View File

@ -134,7 +134,7 @@ bool CFile::ConsumeComment()
if (m_buffer[m_pos] == '/' && m_buffer[m_pos + 1] == '*') if (m_buffer[m_pos] == '/' && m_buffer[m_pos + 1] == '*')
{ {
m_pos += 2; m_pos += 2;
while (m_buffer[m_pos] != '*' && m_buffer[m_pos + 1] != '/') while (m_buffer[m_pos] != '*' || m_buffer[m_pos + 1] != '/')
{ {
if (m_buffer[m_pos] == 0) if (m_buffer[m_pos] == 0)
return false; return false;