summaryrefslogtreecommitdiff
path: root/src/main_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_menu.c')
-rw-r--r--src/main_menu.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/src/main_menu.c b/src/main_menu.c
index 38e7648d0..a60cf1a28 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -40,17 +40,17 @@
/*
* Main menu state machine
* -----------------------
- *
+ *
* Entry point: CB2_InitMainMenu
- *
+ *
* Note: States advance sequentially unless otherwise stated.
- *
+ *
* CB2_InitMainMenu / CB2_ReinitMainMenu
* - Both of these states call InitMainMenu, which does all the work.
* - In the Reinit case, the init code will check if the user came from
* the options screen. If they did, then the options menu item is
* pre-selected.
- *
+ *
* Task_MainMenuCheckSaveFile
* - Determines how many menu options to show based on whether
* the save file is Ok, empty, corrupted, etc.
@@ -59,33 +59,33 @@
* - If there were no errors, advance to Task_MainMenuCheckBattery.
* - Note that the check to enable Mystery Events would normally happen
* here, but this version of Emerald has them disabled.
- *
+ *
* Task_WaitForSaveFileErrorWindow
* - Wait for the text to finish printing and then for the A button
* to be pressed.
- *
+ *
* Task_MainMenuCheckBattery
* - If the battery is OK, advance to Task_DisplayMainMenu.
* - If the battery is dry, advance to Task_WaitForBatteryDryErrorWindow.
- *
+ *
* Task_WaitForBatteryDryErrorWindow
* - Wait for the text to finish printing and then for the A button
* to be pressed.
- *
+ *
* Task_DisplayMainWindow
* - Display the buttons to the user. If the menu is in HAS_MYSTERY_EVENTS
* mode, there are too many buttons for one screen and a scrollbar is added,
* and the scrollbar task is spawned (Task_ScrollIndicatorArrowPairOnMainMenu).
- *
+ *
* Task_HighlightSelectedMainMenuItem
* - Update the UI to match the currently selected item.
- *
+ *
* Task_HandleMainMenuInput
* - If A is pressed, advance to Task_HandleMainMenuAPressed.
* - If B is pressed, return to the title screen via CB2_InitTitleScreen.
* - If Up or Down is pressed, handle scrolling if there is a scroll bar, change
* the selection, then go back to Task_HighlightSelectedMainMenuItem.
- *
+ *
* Task_HandleMainMenuAPressed
* - If the user selected New Game, advance to Task_NewGameBirchSpeech_Init.
* - If the user selected Continue, advance to CB2_ContinueSavedGame.
@@ -95,15 +95,15 @@
* Task_DisplayMainMenuInvalidActionError.
* - Code to start a Mystery Event is present here, but is unreachable in this
* version.
- *
+ *
* Task_HandleMainMenuBPressed
* - Clean up the main menu and go back to CB2_InitTitleScreen.
- *
+ *
* Task_DisplayMainMenuInvalidActionError
* - Print one of three different error messages, wait for the text to stop
* printing, and then wait for A or B to be pressed.
* - Then advance to Task_HandleMainMenuBPressed.
- *
+ *
* Task_NewGameBirchSpeechInit
* - Load the sprites for the intro speech, start playing music
* Task_NewGameBirchSpeech_WaitToShowBirch
@@ -126,11 +126,11 @@
* - Animates by advancing to Task_NewGameBirchSpeech_SlideOutOldGenderSprite
* whenever the player's selection changes.
* - Advances to Task_NewGameBirchSpeech_WhatsYourName when done.
- *
+ *
* Task_NewGameBirchSpeech_SlideOutOldGenderSprite
* Task_NewGameBirchSpeech_SlideInNewGenderSprite
* - Returns back to Task_NewGameBirchSpeech_ChooseGender.
- *
+ *
* Task_NewGameBirchSpeech_WhatsYourName
* Task_NewGameBirchSpeech_WaitForWhatsYourNameToPrint
* Task_NewGameBirchSpeech_WaitPressBeforeNameChoice
@@ -144,7 +144,7 @@
* Task_NewGameBirchSpeech_ProcessNameYesNoMenu
* - If confirmed, advance to Task_NewGameBirchSpeech_SlidePlatformAway2.
* - Otherwise, return to Task_NewGameBirchSpeech_BoyOrGirl.
- *
+ *
* Task_NewGameBirchSpeech_SlidePlatformAway2
* Task_NewGameBirchSpeech_ReshowBirchLotad
* Task_NewGameBirchSpeech_WaitForSpriteFadeInAndTextPrinter
@@ -154,7 +154,7 @@
* Task_NewGameBirchSpeech_FadePlayerToWhite
* Task_NewGameBirchSpeech_Cleanup
* - Advances to CB2_NewGame.
- *
+ *
* Task_NewGameBirchSpeechSub_InitPokeball
* - Advances to Task_NewGameBirchSpeechSub_WaitForLotad
* Task_NewGameBirchSpeechSub_WaitForLotad
@@ -170,7 +170,7 @@
// Static RAM declarations
-static EWRAM_DATA u8 gUnknown_02022D04 = 0;
+static EWRAM_DATA bool8 sStartedPokeBallTask = 0;
static EWRAM_DATA u16 sCurrItemAndOptionMenuCheck = 0;
static u8 sBirchSpeechMainTaskId;
@@ -201,7 +201,7 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8, u8);
static void NewGameBirchSpeech_ClearWindow(u8);
static void Task_NewGameBirchSpeech_ThisIsAPokemon(u8);
static void Task_NewGameBirchSpeech_MainSpeech(u8);
-static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextPrinterTemplate *printer, u16 a);
+static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 a);
static void Task_NewGameBirchSpeech_AndYouAre(u8);
static void Task_NewGameBirchSpeechSub_WaitForLotad(u8);
static void Task_NewGameBirchSpeech_StartBirchLotadPlatformFade(u8);
@@ -1306,8 +1306,8 @@ static void Task_NewGameBirchSpeech_WaitToShowBirch(u8 taskId)
else
{
spriteId = gTasks[taskId].tBirchSpriteId;
- gSprites[spriteId].pos1.x = 136;
- gSprites[spriteId].pos1.y = 60;
+ gSprites[spriteId].x = 136;
+ gSprites[spriteId].y = 60;
gSprites[spriteId].invisible = FALSE;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
NewGameBirchSpeech_StartFadeInTarget1OutTarget2(taskId, 10);
@@ -1348,7 +1348,7 @@ static void Task_NewGameBirchSpeech_ThisIsAPokemon(u8 taskId)
{
gTasks[taskId].func = Task_NewGameBirchSpeech_MainSpeech;
StringExpandPlaceholders(gStringVar4, gText_ThisIsAPokemon);
- AddTextPrinterWithCallbackForMessage(1, NewGameBirchSpeech_ShowPokeBallPrinterCallback);
+ AddTextPrinterWithCallbackForMessage(1, NewGameBirchSpeech_WaitForThisIsPokemonText);
sBirchSpeechMainTaskId = taskId;
}
}
@@ -1369,8 +1369,8 @@ static void Task_NewGameBirchSpeechSub_InitPokeBall(u8 taskId)
{
u8 spriteId = gTasks[sBirchSpeechMainTaskId].tLotadSpriteId;
- gSprites[spriteId].pos1.x = 100;
- gSprites[spriteId].pos1.y = 75;
+ gSprites[spriteId].x = 100;
+ gSprites[spriteId].y = 75;
gSprites[spriteId].invisible = FALSE;
gSprites[spriteId].data[0] = 0;
@@ -1411,7 +1411,7 @@ static void Task_NewGameBirchSpeech_AndYouAre(u8 taskId)
{
if (!RunTextPrintersAndIsPrinter0Active())
{
- gUnknown_02022D04 = 0;
+ sStartedPokeBallTask = FALSE;
StringExpandPlaceholders(gStringVar4, gText_Birch_AndYouAre);
AddTextPrinterForMessage(1);
gTasks[taskId].func = Task_NewGameBirchSpeech_StartBirchLotadPlatformFade;
@@ -1459,8 +1459,8 @@ static void Task_NewGameBirchSpeech_StartPlayerFadeIn(u8 taskId)
{
u8 spriteId = gTasks[taskId].tBrendanSpriteId;
- gSprites[spriteId].pos1.x = 180;
- gSprites[spriteId].pos1.y = 60;
+ gSprites[spriteId].x = 180;
+ gSprites[spriteId].y = 60;
gSprites[spriteId].invisible = FALSE;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
gTasks[taskId].tPlayerSpriteId = spriteId;
@@ -1533,7 +1533,7 @@ static void Task_NewGameBirchSpeech_SlideOutOldGenderSprite(u8 taskId)
u8 spriteId = gTasks[taskId].tPlayerSpriteId;
if (gTasks[taskId].tIsDoneFadingSprites == 0)
{
- gSprites[spriteId].pos1.x += 4;
+ gSprites[spriteId].x += 4;
}
else
{
@@ -1542,8 +1542,8 @@ static void Task_NewGameBirchSpeech_SlideOutOldGenderSprite(u8 taskId)
spriteId = gTasks[taskId].tMaySpriteId;
else
spriteId = gTasks[taskId].tBrendanSpriteId;
- gSprites[spriteId].pos1.x = DISPLAY_WIDTH;
- gSprites[spriteId].pos1.y = 60;
+ gSprites[spriteId].x = DISPLAY_WIDTH;
+ gSprites[spriteId].y = 60;
gSprites[spriteId].invisible = FALSE;
gTasks[taskId].tPlayerSpriteId = spriteId;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
@@ -1556,13 +1556,13 @@ static void Task_NewGameBirchSpeech_SlideInNewGenderSprite(u8 taskId)
{
u8 spriteId = gTasks[taskId].tPlayerSpriteId;
- if (gSprites[spriteId].pos1.x > 180)
+ if (gSprites[spriteId].x > 180)
{
- gSprites[spriteId].pos1.x -= 4;
+ gSprites[spriteId].x -= 4;
}
else
{
- gSprites[spriteId].pos1.x = 180;
+ gSprites[spriteId].x = 180;
if (gTasks[taskId].tIsDoneFadingSprites)
{
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
@@ -1663,13 +1663,13 @@ static void Task_NewGameBirchSpeech_ReshowBirchLotad(u8 taskId)
gSprites[gTasks[taskId].tBrendanSpriteId].invisible = TRUE;
gSprites[gTasks[taskId].tMaySpriteId].invisible = TRUE;
spriteId = gTasks[taskId].tBirchSpriteId;
- gSprites[spriteId].pos1.x = 136;
- gSprites[spriteId].pos1.y = 60;
+ gSprites[spriteId].x = 136;
+ gSprites[spriteId].y = 60;
gSprites[spriteId].invisible = FALSE;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
spriteId = gTasks[taskId].tLotadSpriteId;
- gSprites[spriteId].pos1.x = 100;
- gSprites[spriteId].pos1.y = 75;
+ gSprites[spriteId].x = 100;
+ gSprites[spriteId].y = 75;
gSprites[spriteId].invisible = FALSE;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
NewGameBirchSpeech_StartFadeInTarget1OutTarget2(taskId, 2);
@@ -1716,8 +1716,8 @@ static void Task_NewGameBirchSpeech_AreYouReady(u8 taskId)
spriteId = gTasks[taskId].tMaySpriteId;
else
spriteId = gTasks[taskId].tBrendanSpriteId;
- gSprites[spriteId].pos1.x = 120;
- gSprites[spriteId].pos1.y = 60;
+ gSprites[spriteId].x = 120;
+ gSprites[spriteId].y = 60;
gSprites[spriteId].invisible = FALSE;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
gTasks[taskId].tPlayerSpriteId = spriteId;
@@ -1833,8 +1833,8 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void)
gTasks[taskId].tPlayerGender = MALE;
spriteId = gTasks[taskId].tBrendanSpriteId;
}
- gSprites[spriteId].pos1.x = 180;
- gSprites[spriteId].pos1.y = 60;
+ gSprites[spriteId].x = 180;
+ gSprites[spriteId].y = 60;
gSprites[spriteId].invisible = FALSE;
gTasks[taskId].tPlayerSpriteId = spriteId;
SetGpuReg(REG_OFFSET_BG1HOFS, -60);
@@ -1869,8 +1869,8 @@ static void SpriteCB_MovePlayerDownWhileShrinking(struct Sprite *sprite)
{
u32 y;
- y = (sprite->pos1.y << 16) + sprite->data[0] + 0xC000;
- sprite->pos1.y = y >> 16;
+ y = (sprite->y << 16) + sprite->data[0] + 0xC000;
+ sprite->y = y >> 16;
sprite->data[0] = y;
}
@@ -2250,21 +2250,21 @@ static void NewGameBirchSpeech_ClearWindow(u8 windowId)
CopyWindowToVram(windowId, 2);
}
-static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextPrinterTemplate *printer, u16 a)
+static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 a)
{
- if (*(printer->currentChar - 2) == 8 && gUnknown_02022D04 == 0)
+ // Wait for Birch's "This is a Pokémon" text to reach the pause
+ // Then start the PokéBall release (if it hasn't been started already)
+ if (*(printer->currentChar - 2) == EXT_CTRL_CODE_PAUSE && !sStartedPokeBallTask)
{
- gUnknown_02022D04 = 1;
+ sStartedPokeBallTask = TRUE;
CreateTask(Task_NewGameBirchSpeechSub_InitPokeBall, 0);
}
}
-void CreateYesNoMenuParameterized(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f)
+void CreateYesNoMenuParameterized(u8 x, u8 y, u16 baseTileNum, u16 baseBlock, u8 yesNoPalNum, u8 winPalNum)
{
- struct WindowTemplate sp;
-
- sp = CreateWindowTemplate(0, a + 1, b + 1, 5, 4, f, d);
- CreateYesNoMenu(&sp, c, e, 0);
+ struct WindowTemplate template = CreateWindowTemplate(0, x + 1, y + 1, 5, 4, winPalNum, baseBlock);
+ CreateYesNoMenu(&template, baseTileNum, yesNoPalNum, 0);
}
static void NewGameBirchSpeech_ShowDialogueWindow(u8 windowId, u8 copyToVram)