Use window constants in mystery_gift_menu

This commit is contained in:
GriffinR 2022-09-29 15:48:19 -04:00
parent 5af7355fbd
commit fb87616e9d
5 changed files with 91 additions and 82 deletions

View File

@ -5,11 +5,11 @@ extern bool8 gGiftIsFromEReader;
u16 GetMysteryGiftBaseBlock(void); u16 GetMysteryGiftBaseBlock(void);
void CB2_MysteryGiftEReader(void); void CB2_MysteryGiftEReader(void);
void PrintMysteryGiftOrEReaderTopMenu(bool8 isJapanese, bool32 usePickOkCancel); void PrintMysteryGiftOrEReaderHeader(bool8 isJapanese, bool32 usePickOkCancel);
void MG_DrawCheckerboardPattern(u32 bg); void MG_DrawCheckerboardPattern(u32 bg);
void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void); void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void);
bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str); bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str);
void AddTextPrinterToWindow1(const u8 *src); void MG_AddMessageTextPrinter(const u8 *src);
void CB2_InitEReader(void); void CB2_InitEReader(void);
void CB2_InitMysteryGift(void); void CB2_InitMysteryGift(void);
void MG_DrawTextBorder(u8 windowId); void MG_DrawTextBorder(u8 windowId);

View File

@ -342,7 +342,7 @@ static void Task_EReader(u8 taskId)
case ER_STATE_MSG_SELECT_CONNECT: case ER_STATE_MSG_SELECT_CONNECT:
if (PrintMysteryGiftMenuMessage(&data->textState, gJPText_SelectConnectFromEReaderMenu)) if (PrintMysteryGiftMenuMessage(&data->textState, gJPText_SelectConnectFromEReaderMenu))
{ {
AddTextPrinterToWindow1(gJPText_SelectConnectWithGBA); MG_AddMessageTextPrinter(gJPText_SelectConnectWithGBA);
ResetTimer(&data->timer); ResetTimer(&data->timer);
data->state = ER_STATE_MSG_SELECT_CONNECT_WAIT; data->state = ER_STATE_MSG_SELECT_CONNECT_WAIT;
} }
@ -396,7 +396,7 @@ static void Task_EReader(u8 taskId)
data->state = ER_STATE_MSG_SELECT_CONNECT; data->state = ER_STATE_MSG_SELECT_CONNECT;
break; break;
case ER_STATE_CONNECTING: case ER_STATE_CONNECTING:
AddTextPrinterToWindow1(gJPText_Connecting); MG_AddMessageTextPrinter(gJPText_Connecting);
// XXX: This (u32 *) cast is discarding the const qualifier from gMultiBootProgram_EReader_Start // XXX: This (u32 *) cast is discarding the const qualifier from gMultiBootProgram_EReader_Start
EReader_Load(&gEReaderData, gMultiBootProgram_EReader_End - gMultiBootProgram_EReader_Start, (u32 *)gMultiBootProgram_EReader_Start); EReader_Load(&gEReaderData, gMultiBootProgram_EReader_End - gMultiBootProgram_EReader_Start, (u32 *)gMultiBootProgram_EReader_Start);
data->state = ER_STATE_TRANSFER; data->state = ER_STATE_TRANSFER;
@ -415,7 +415,7 @@ static void Task_EReader(u8 taskId)
else if (data->status == TRANSFER_SUCCESS) else if (data->status == TRANSFER_SUCCESS)
{ {
ResetTimer(&data->timer); ResetTimer(&data->timer);
AddTextPrinterToWindow1(gJPText_PleaseWaitAMoment); MG_AddMessageTextPrinter(gJPText_PleaseWaitAMoment);
data->state = ER_STATE_TRANSFER_SUCCESS; data->state = ER_STATE_TRANSFER_SUCCESS;
} }
else // TRANSFER_CANCELED else // TRANSFER_CANCELED
@ -429,7 +429,7 @@ static void Task_EReader(u8 taskId)
break; break;
case ER_STATE_LOAD_CARD_START: case ER_STATE_LOAD_CARD_START:
OpenEReaderLink(); OpenEReaderLink();
AddTextPrinterToWindow1(gJPText_AllowEReaderToLoadCard); MG_AddMessageTextPrinter(gJPText_AllowEReaderToLoadCard);
data->state = ER_STATE_LOAD_CARD; data->state = ER_STATE_LOAD_CARD;
break; break;
case ER_STATE_LOAD_CARD: case ER_STATE_LOAD_CARD:
@ -438,7 +438,7 @@ static void Task_EReader(u8 taskId)
case RECV_ACTIVE: case RECV_ACTIVE:
break; break;
case RECV_SUCCESS: case RECV_SUCCESS:
AddTextPrinterToWindow1(gJPText_Connecting); MG_AddMessageTextPrinter(gJPText_Connecting);
data->state = ER_STATE_WAIT_RECV_CARD; data->state = ER_STATE_WAIT_RECV_CARD;
break; break;
case RECV_CANCELED: case RECV_CANCELED:
@ -486,7 +486,7 @@ static void Task_EReader(u8 taskId)
case ER_STATE_SAVE: case ER_STATE_SAVE:
if (TryWriteTrainerHill((struct EReaderTrainerHillSet *)&gDecompressionBuffer)) if (TryWriteTrainerHill((struct EReaderTrainerHillSet *)&gDecompressionBuffer))
{ {
AddTextPrinterToWindow1(gJPText_ConnectionComplete); MG_AddMessageTextPrinter(gJPText_ConnectionComplete);
ResetTimer(&data->timer); ResetTimer(&data->timer);
data->state = ER_STATE_SUCCESS_MSG; data->state = ER_STATE_SUCCESS_MSG;
} }
@ -498,7 +498,7 @@ static void Task_EReader(u8 taskId)
case ER_STATE_SUCCESS_MSG: case ER_STATE_SUCCESS_MSG:
if (UpdateTimer(&data->timer, 120)) if (UpdateTimer(&data->timer, 120))
{ {
AddTextPrinterToWindow1(gJPText_NewTrainerHasComeToHoenn); MG_AddMessageTextPrinter(gJPText_NewTrainerHasComeToHoenn);
PlayFanfare(MUS_OBTAIN_ITEM); PlayFanfare(MUS_OBTAIN_ITEM);
data->state = ER_STATE_SUCCESS_END; data->state = ER_STATE_SUCCESS_END;
} }

View File

@ -32,6 +32,12 @@
#include "wonder_news.h" #include "wonder_news.h"
#include "constants/cable_club.h" #include "constants/cable_club.h"
enum {
WIN_HEADER,
WIN_MSG,
WIN_UNK, // Cleared, but nothing is ever apparently rendered on it
};
#define LIST_MENU_TILE_NUM 10 #define LIST_MENU_TILE_NUM 10
#define LIST_MENU_PAL_NUM 224 #define LIST_MENU_PAL_NUM 224
@ -98,7 +104,7 @@ static const struct BgTemplate sBGTemplates[] = {
}; };
static const struct WindowTemplate sMainWindows[] = { static const struct WindowTemplate sMainWindows[] = {
{ [WIN_HEADER] = {
.bg = 0, .bg = 0,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 0, .tilemapTop = 0,
@ -106,7 +112,8 @@ static const struct WindowTemplate sMainWindows[] = {
.height = 2, .height = 2,
.paletteNum = 12, .paletteNum = 12,
.baseBlock = 0x0013 .baseBlock = 0x0013
}, { },
[WIN_MSG] = {
.bg = 0, .bg = 0,
.tilemapLeft = 1, .tilemapLeft = 1,
.tilemapTop = 15, .tilemapTop = 15,
@ -114,7 +121,8 @@ static const struct WindowTemplate sMainWindows[] = {
.height = 4, .height = 4,
.paletteNum = 12, .paletteNum = 12,
.baseBlock = 0x004f .baseBlock = 0x004f
}, { },
[WIN_UNK] = {
.bg = 0, .bg = 0,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 15, .tilemapTop = 15,
@ -224,7 +232,7 @@ static const struct ListMenuTemplate sListMenuTemplate_ThreeOptions = {
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = 3, .totalItems = 3,
.maxShowed = 3, .maxShowed = 3,
.windowId = 0, .windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0, .header_X = 0,
.item_X = 8, .item_X = 8,
.cursor_X = 0, .cursor_X = 0,
@ -269,7 +277,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveSendToss = {
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = 4, .totalItems = 4,
.maxShowed = 4, .maxShowed = 4,
.windowId = 0, .windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0, .header_X = 0,
.item_X = 8, .item_X = 8,
.cursor_X = 0, .cursor_X = 0,
@ -290,7 +298,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveToss = {
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = 3, .totalItems = 3,
.maxShowed = 3, .maxShowed = 3,
.windowId = 0, .windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0, .header_X = 0,
.item_X = 8, .item_X = 8,
.cursor_X = 0, .cursor_X = 0,
@ -311,7 +319,7 @@ static const struct ListMenuTemplate sListMenu_ReceiveSend = {
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = 3, .totalItems = 3,
.maxShowed = 3, .maxShowed = 3,
.windowId = 0, .windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0, .header_X = 0,
.item_X = 8, .item_X = 8,
.cursor_X = 0, .cursor_X = 0,
@ -332,7 +340,7 @@ static const struct ListMenuTemplate sListMenu_Receive = {
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = 2, .totalItems = 2,
.maxShowed = 2, .maxShowed = 2,
.windowId = 0, .windowId = 0, // Overwritten by DoMysteryGiftListMenu
.header_X = 0, .header_X = 0,
.item_X = 8, .item_X = 8,
.cursor_X = 0, .cursor_X = 0,
@ -354,9 +362,9 @@ static const u8 *const sUnusedMenuTexts[] = {
gText_ReturnToTitle gText_ReturnToTitle
}; };
ALIGNED(2) static const u8 sTextColors_TopMenu[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; ALIGNED(2) static const u8 sTextColors_Header[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY };
ALIGNED(2) static const u8 sTextColors_TopMenu_Copy[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY }; ALIGNED(2) static const u8 sTextColors_Header_Copy[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY };
ALIGNED(2) static const u8 sMG_Ereader_TextColor_2[] = { TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY }; ALIGNED(2) static const u8 sMG_Ereader_TextColor_2[] = { TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY };
static void VBlankCB_MysteryGiftEReader(void) static void VBlankCB_MysteryGiftEReader(void)
{ {
@ -420,7 +428,7 @@ static bool32 HandleMysteryGiftOrEReaderSetup(s32 isEReader)
FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11);
FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11);
MG_DrawCheckerboardPattern(3); MG_DrawCheckerboardPattern(3);
PrintMysteryGiftOrEReaderTopMenu(isEReader, FALSE); PrintMysteryGiftOrEReaderHeader(isEReader, FALSE);
gMain.state++; gMain.state++;
break; break;
case 2: case 2:
@ -474,26 +482,27 @@ void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void)
SetMainCallback2(CB2_InitTitleScreen); SetMainCallback2(CB2_InitTitleScreen);
} }
void PrintMysteryGiftOrEReaderTopMenu(bool8 isEReader, bool32 useCancel) // Print the text window at the top of the screen with the title and control instructions
void PrintMysteryGiftOrEReaderHeader(bool8 isEReader, bool32 useCancel)
{ {
const u8 * header; const u8 * title;
const u8 * options; const u8 * options;
FillWindowPixelBuffer(0, 0); FillWindowPixelBuffer(WIN_HEADER, 0);
if (!isEReader) if (!isEReader)
{ {
header = gText_MysteryGift; title = gText_MysteryGift;
options = !useCancel ? gText_PickOKExit : gText_PickOKCancel; options = !useCancel ? gText_PickOKExit : gText_PickOKCancel;
} }
else else
{ {
header = gJPText_MysteryGift; title = gJPText_MysteryGift;
options = gJPText_DecideStop; options = gJPText_DecideStop;
} }
AddTextPrinterParameterized4(0, FONT_NORMAL, 4, 1, 0, 0, sTextColors_TopMenu, TEXT_SKIP_DRAW, header); AddTextPrinterParameterized4(WIN_HEADER, FONT_NORMAL, 4, 1, 0, 0, sTextColors_Header, TEXT_SKIP_DRAW, title);
AddTextPrinterParameterized4(0, FONT_SMALL, GetStringRightAlignXOffset(FONT_SMALL, options, 0xDE), 1, 0, 0, sTextColors_TopMenu, TEXT_SKIP_DRAW, options); AddTextPrinterParameterized4(WIN_HEADER, FONT_SMALL, GetStringRightAlignXOffset(FONT_SMALL, options, 0xDE), 1, 0, 0, sTextColors_Header, TEXT_SKIP_DRAW, options);
CopyWindowToVram(0, COPYWIN_GFX); CopyWindowToVram(WIN_HEADER, COPYWIN_GFX);
PutWindowTilemap(0); PutWindowTilemap(WIN_HEADER);
} }
void MG_DrawTextBorder(u8 windowId) void MG_DrawTextBorder(u8 windowId)
@ -533,21 +542,21 @@ static void ClearScreenInBg0(bool32 ignoreTopTwoRows)
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
} }
void AddTextPrinterToWindow1(const u8 *str) void MG_AddMessageTextPrinter(const u8 *str)
{ {
StringExpandPlaceholders(gStringVar4, str); StringExpandPlaceholders(gStringVar4, str);
FillWindowPixelBuffer(1, 0x11); FillWindowPixelBuffer(WIN_MSG, 0x11);
AddTextPrinterParameterized4(1, FONT_NORMAL, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); AddTextPrinterParameterized4(WIN_MSG, FONT_NORMAL, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4);
DrawTextBorderOuter(1, 0x001, 0xF); DrawTextBorderOuter(WIN_MSG, 0x001, 0xF);
PutWindowTilemap(1); PutWindowTilemap(WIN_MSG);
CopyWindowToVram(1, COPYWIN_FULL); CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
} }
static void ClearTextWindow(void) static void ClearMessage(void)
{ {
rbox_fill_rectangle(1); rbox_fill_rectangle(WIN_MSG);
ClearWindowTilemap(1); ClearWindowTilemap(WIN_MSG);
CopyWindowToVram(1, COPYWIN_MAP); CopyWindowToVram(WIN_MSG, COPYWIN_MAP);
} }
#define DOWN_ARROW_X 208 #define DOWN_ARROW_X 208
@ -558,18 +567,18 @@ bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str)
switch (*textState) switch (*textState)
{ {
case 0: case 0:
AddTextPrinterToWindow1(str); MG_AddMessageTextPrinter(str);
(*textState)++; (*textState)++;
break; break;
case 1: case 1:
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
if (({JOY_NEW(A_BUTTON | B_BUTTON);})) if (JOY_NEW(A_BUTTON | B_BUTTON))
(*textState)++; (*textState)++;
break; break;
case 2: case 2:
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
*textState = 0; *textState = 0;
ClearTextWindow(); ClearMessage();
return TRUE; return TRUE;
case 0xFF: case 0xFF:
*textState = 2; *textState = 2;
@ -580,12 +589,12 @@ bool32 PrintMysteryGiftMenuMessage(u8 *textState, const u8 *str)
static void HideDownArrow(void) static void HideDownArrow(void)
{ {
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
} }
static void ShowDownArrow(void) static void ShowDownArrow(void)
{ {
DrawDownArrow(1, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); DrawDownArrow(WIN_MSG, DOWN_ARROW_X, DOWN_ARROW_Y, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
} }
// Unused // Unused
@ -609,12 +618,12 @@ static bool32 HideDownArrowAndWaitButton(u8 * textState)
static bool32 PrintStringAndWait2Seconds(u8 * counter, const u8 * str) static bool32 PrintStringAndWait2Seconds(u8 * counter, const u8 * str)
{ {
if (*counter == 0) if (*counter == 0)
AddTextPrinterToWindow1(str); MG_AddMessageTextPrinter(str);
if (++(*counter) > 120) if (++(*counter) > 120)
{ {
*counter = 0; *counter = 0;
ClearTextWindow(); ClearMessage();
return TRUE; return TRUE;
} }
else else
@ -648,8 +657,8 @@ static u32 MysteryGift_HandleThreeOptionMenu(u8 * unused0, u16 * unused1, u8 whi
response = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, LIST_MENU_TILE_NUM, LIST_MENU_PAL_NUM); response = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, LIST_MENU_TILE_NUM, LIST_MENU_PAL_NUM);
if (response != LIST_NOTHING_CHOSEN) if (response != LIST_NOTHING_CHOSEN)
{ {
ClearWindowTilemap(2); ClearWindowTilemap(WIN_UNK);
CopyWindowToVram(2, COPYWIN_MAP); CopyWindowToVram(WIN_UNK, COPYWIN_MAP);
} }
return response; return response;
} }
@ -865,7 +874,7 @@ static bool32 SaveOnMysteryGiftMenu(u8 * state)
switch (*state) switch (*state)
{ {
case 0: case 0:
AddTextPrinterToWindow1(gText_DataWillBeSaved); MG_AddMessageTextPrinter(gText_DataWillBeSaved);
(*state)++; (*state)++;
break; break;
case 1: case 1:
@ -873,7 +882,7 @@ static bool32 SaveOnMysteryGiftMenu(u8 * state)
(*state)++; (*state)++;
break; break;
case 2: case 2:
AddTextPrinterToWindow1(gText_SaveCompletedPressA); MG_AddMessageTextPrinter(gText_SaveCompletedPressA);
(*state)++; (*state)++;
break; break;
case 3: case 3:
@ -882,7 +891,7 @@ static bool32 SaveOnMysteryGiftMenu(u8 * state)
break; break;
case 4: case 4:
*state = 0; *state = 0;
ClearTextWindow(); ClearMessage();
return TRUE; return TRUE;
} }
@ -967,7 +976,7 @@ static bool32 PrintSuccessMessage(u8 * state, const u8 * msg, u16 * timer)
{ {
case 0: case 0:
if (msg != NULL) if (msg != NULL)
AddTextPrinterToWindow1(msg); MG_AddMessageTextPrinter(msg);
PlayFanfare(MUS_OBTAIN_ITEM); PlayFanfare(MUS_OBTAIN_ITEM);
*timer = 0; *timer = 0;
(*state)++; (*state)++;
@ -980,7 +989,7 @@ static bool32 PrintSuccessMessage(u8 * state, const u8 * msg, u16 * timer)
if (IsFanfareTaskInactive()) if (IsFanfareTaskInactive())
{ {
*state = 0; *state = 0;
ClearTextWindow(); ClearMessage();
return TRUE; return TRUE;
} }
break; break;
@ -1161,7 +1170,7 @@ static void Task_MysteryGift(u8 taskId)
if (PrintMysteryGiftMenuMessage(&data->textState, gText_DontHaveCardNewOneInput)) if (PrintMysteryGiftMenuMessage(&data->textState, gText_DontHaveCardNewOneInput))
{ {
data->state = MG_STATE_SOURCE_PROMPT; data->state = MG_STATE_SOURCE_PROMPT;
PrintMysteryGiftOrEReaderTopMenu(FALSE, TRUE); PrintMysteryGiftOrEReaderHeader(FALSE, TRUE);
} }
} }
else else
@ -1169,16 +1178,16 @@ static void Task_MysteryGift(u8 taskId)
if (PrintMysteryGiftMenuMessage(&data->textState, gText_DontHaveNewsNewOneInput)) if (PrintMysteryGiftMenuMessage(&data->textState, gText_DontHaveNewsNewOneInput))
{ {
data->state = MG_STATE_SOURCE_PROMPT; data->state = MG_STATE_SOURCE_PROMPT;
PrintMysteryGiftOrEReaderTopMenu(FALSE, TRUE); PrintMysteryGiftOrEReaderHeader(FALSE, TRUE);
} }
} }
break; break;
} }
case MG_STATE_SOURCE_PROMPT: case MG_STATE_SOURCE_PROMPT:
if (!data->isWonderNews) if (!data->isWonderNews)
AddTextPrinterToWindow1(gText_WhereShouldCardBeAccessed); MG_AddMessageTextPrinter(gText_WhereShouldCardBeAccessed);
else else
AddTextPrinterToWindow1(gText_WhereShouldNewsBeAccessed); MG_AddMessageTextPrinter(gText_WhereShouldNewsBeAccessed);
data->state = MG_STATE_SOURCE_PROMPT_INPUT; data->state = MG_STATE_SOURCE_PROMPT_INPUT;
break; break;
case MG_STATE_SOURCE_PROMPT_INPUT: case MG_STATE_SOURCE_PROMPT_INPUT:
@ -1186,17 +1195,17 @@ static void Task_MysteryGift(u8 taskId)
switch (MysteryGift_HandleThreeOptionMenu(&data->textState, &data->var, TRUE)) switch (MysteryGift_HandleThreeOptionMenu(&data->textState, &data->var, TRUE))
{ {
case 0: // "Wireless Communication" case 0: // "Wireless Communication"
ClearTextWindow(); ClearMessage();
data->state = MG_STATE_CLIENT_LINK_START; data->state = MG_STATE_CLIENT_LINK_START;
data->sourceIsFriend = FALSE; data->sourceIsFriend = FALSE;
break; break;
case 1: // "Friend" case 1: // "Friend"
ClearTextWindow(); ClearMessage();
data->state = MG_STATE_CLIENT_LINK_START; data->state = MG_STATE_CLIENT_LINK_START;
data->sourceIsFriend = TRUE; data->sourceIsFriend = TRUE;
break; break;
case LIST_CANCEL: case LIST_CANCEL:
ClearTextWindow(); ClearMessage();
if (ValidateCardOrNews(data->isWonderNews)) if (ValidateCardOrNews(data->isWonderNews))
{ {
data->state = MG_STATE_LOAD_GIFT; data->state = MG_STATE_LOAD_GIFT;
@ -1204,7 +1213,7 @@ static void Task_MysteryGift(u8 taskId)
else else
{ {
data->state = MG_STATE_TO_MAIN_MENU; data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE); PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
} }
break; break;
} }
@ -1246,7 +1255,7 @@ static void Task_MysteryGift(u8 taskId)
} }
break; break;
case MG_STATE_CLIENT_COMMUNICATING: case MG_STATE_CLIENT_COMMUNICATING:
AddTextPrinterToWindow1(gText_Communicating); MG_AddMessageTextPrinter(gText_Communicating);
data->state = MG_STATE_CLIENT_LINK; data->state = MG_STATE_CLIENT_LINK;
break; break;
case MG_STATE_CLIENT_LINK: case MG_STATE_CLIENT_LINK:
@ -1379,7 +1388,7 @@ static void Task_MysteryGift(u8 taskId)
{ {
// Did not receive card/news, return to main menu // Did not receive card/news, return to main menu
data->state = MG_STATE_TO_MAIN_MENU; data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE); PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
} }
else else
{ {
@ -1500,7 +1509,7 @@ static void Task_MysteryGift(u8 taskId)
if (PrintThrownAway(&data->textState, data->isWonderNews)) if (PrintThrownAway(&data->textState, data->isWonderNews))
{ {
data->state = MG_STATE_TO_MAIN_MENU; data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE); PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
} }
break; break;
case MG_STATE_GIFT_INPUT_EXIT: case MG_STATE_GIFT_INPUT_EXIT:
@ -1546,12 +1555,12 @@ static void Task_MysteryGift(u8 taskId)
if (!data->isWonderNews) if (!data->isWonderNews)
{ {
AddTextPrinterToWindow1(gText_SendingWonderCard); MG_AddMessageTextPrinter(gText_SendingWonderCard);
MysterGiftServer_CreateForCard(); MysterGiftServer_CreateForCard();
} }
else else
{ {
AddTextPrinterToWindow1(gText_SendingWonderNews); MG_AddMessageTextPrinter(gText_SendingWonderNews);
MysterGiftServer_CreateForNews(); MysterGiftServer_CreateForNews();
} }
data->state = MG_STATE_SERVER_LINK; data->state = MG_STATE_SERVER_LINK;
@ -1586,7 +1595,7 @@ static void Task_MysteryGift(u8 taskId)
else else
{ {
data->state = MG_STATE_TO_MAIN_MENU; data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE); PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
} }
} }
break; break;
@ -1595,7 +1604,7 @@ static void Task_MysteryGift(u8 taskId)
if (PrintMysteryGiftMenuMessage(&data->textState, gText_CommunicationError)) if (PrintMysteryGiftMenuMessage(&data->textState, gText_CommunicationError))
{ {
data->state = MG_STATE_TO_MAIN_MENU; data->state = MG_STATE_TO_MAIN_MENU;
PrintMysteryGiftOrEReaderTopMenu(FALSE, FALSE); PrintMysteryGiftOrEReaderHeader(FALSE, FALSE);
} }
break; break;
case MG_STATE_EXIT: case MG_STATE_EXIT:

View File

@ -310,7 +310,7 @@ s32 WonderCard_Exit(bool32 useCancel)
FreeMonIconPalettes(); FreeMonIconPalettes();
break; break;
case 5: case 5:
PrintMysteryGiftOrEReaderTopMenu(gGiftIsFromEReader, useCancel); PrintMysteryGiftOrEReaderHeader(gGiftIsFromEReader, useCancel);
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK); BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
break; break;
@ -785,7 +785,7 @@ s32 WonderNews_Exit(bool32 useCancel)
} }
break; break;
case 5: case 5:
PrintMysteryGiftOrEReaderTopMenu(gGiftIsFromEReader, useCancel); PrintMysteryGiftOrEReaderHeader(gGiftIsFromEReader, useCancel);
MG_DrawCheckerboardPattern(3); MG_DrawCheckerboardPattern(3);
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(3); CopyBgTilemapBufferToVram(3);

View File

@ -1927,7 +1927,7 @@ static void Task_SendMysteryGift(u8 taskId)
data->state = 3; data->state = 3;
break; break;
case 3: case 3:
AddTextPrinterToWindow1(gStringVar4); MG_AddMessageTextPrinter(gStringVar4);
data->state = 4; data->state = 4;
break; break;
case 4: case 4:
@ -2001,7 +2001,7 @@ static void Task_SendMysteryGift(u8 taskId)
} }
break; break;
case 9: case 9:
AddTextPrinterToWindow1(gStringVar4); MG_AddMessageTextPrinter(gStringVar4);
data->state = 10; data->state = 10;
break; break;
case 10: case 10:
@ -2104,7 +2104,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
data->state = 1; data->state = 1;
break; break;
case 1: case 1:
AddTextPrinterToWindow1(sText_ChooseTrainer); MG_AddMessageTextPrinter(sText_ChooseTrainer);
data->state = 2; data->state = 2;
break; break;
case 2: case 2:
@ -2177,7 +2177,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
} }
break; break;
case 4: case 4:
AddTextPrinterToWindow1(sText_AwaitingPlayersResponse); MG_AddMessageTextPrinter(sText_AwaitingPlayersResponse);
CopyAndTranslatePlayerName(gStringVar1, &data->playerList->players[data->leaderId]); CopyAndTranslatePlayerName(gStringVar1, &data->playerList->players[data->leaderId]);
data->state = 5; data->state = 5;
break; break;
@ -2196,7 +2196,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
data->state = 8; data->state = 8;
break; break;
case RFU_STATUS_JOIN_GROUP_OK: case RFU_STATUS_JOIN_GROUP_OK:
AddTextPrinterToWindow1(sText_PlayerSentBackOK); MG_AddMessageTextPrinter(sText_PlayerSentBackOK);
RfuSetStatus(RFU_STATUS_OK, 0); RfuSetStatus(RFU_STATUS_OK, 0);
break; break;
} }
@ -2224,7 +2224,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
break; break;
case 7: case 7:
DestroyWirelessStatusIndicatorSprite(); DestroyWirelessStatusIndicatorSprite();
AddTextPrinterToWindow1(sText_PleaseStartOver); MG_AddMessageTextPrinter(sText_PleaseStartOver);
DestroyTask(taskId); DestroyTask(taskId);
LinkRfu_Shutdown(); LinkRfu_Shutdown();
gSpecialVar_Result = LINKUP_FAILED; gSpecialVar_Result = LINKUP_FAILED;
@ -2273,7 +2273,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
data->state = 1; data->state = 1;
break; break;
case 1: case 1:
AddTextPrinterToWindow1(sText_SearchingForWirelessSystemWait); MG_AddMessageTextPrinter(sText_SearchingForWirelessSystemWait);
data->state = 2; data->state = 2;
break; break;
case 2: case 2:
@ -2342,7 +2342,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
} }
break; break;
case 4: case 4:
AddTextPrinterToWindow1(sText_AwaitingResponseFromWirelessSystem); MG_AddMessageTextPrinter(sText_AwaitingResponseFromWirelessSystem);
CopyAndTranslatePlayerName(gStringVar1, &data->playerList->players[data->leaderId]); CopyAndTranslatePlayerName(gStringVar1, &data->playerList->players[data->leaderId]);
data->state = 5; data->state = 5;
break; break;
@ -2361,7 +2361,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
data->state = 8; data->state = 8;
break; break;
case RFU_STATUS_JOIN_GROUP_OK: case RFU_STATUS_JOIN_GROUP_OK:
AddTextPrinterToWindow1(sText_WirelessLinkEstablished); MG_AddMessageTextPrinter(sText_WirelessLinkEstablished);
RfuSetStatus(RFU_STATUS_OK, 0); RfuSetStatus(RFU_STATUS_OK, 0);
break; break;
} }