diff --git a/src/link.c b/src/link.c index b01be9d89..3d36755fc 100644 --- a/src/link.c +++ b/src/link.c @@ -28,6 +28,13 @@ #include "constants/rgb.h" #include "constants/trade.h" +// Window IDs for the link error screens +enum { + WIN_LINK_ERROR_TOP, + WIN_LINK_ERROR_MID, + WIN_LINK_ERROR_BOTTOM, +}; + struct BlockTransfer { u16 pos; @@ -193,8 +200,9 @@ static const struct BgTemplate sLinkErrorBgTemplates[] = { .priority = 1 } }; + static const struct WindowTemplate sLinkErrorWindowTemplates[] = { - { + [WIN_LINK_ERROR_TOP] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 0, @@ -202,7 +210,8 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = { .height = 5, .paletteNum = 15, .baseBlock = 0x002 - }, { + }, + [WIN_LINK_ERROR_MID] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 6, @@ -210,7 +219,8 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = { .height = 7, .paletteNum = 15, .baseBlock = 0x098 - }, { + }, + [WIN_LINK_ERROR_BOTTOM] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 13, @@ -1641,26 +1651,26 @@ static void ErrorMsg_MoveCloserToPartner(void) CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0); CopyBgTilemapBufferToVram(1); LoadPalette(sWirelessLinkDisplayPal, 0, 0x20); - FillWindowPixelBuffer(0, PIXEL_FILL(0)); - FillWindowPixelBuffer(2, PIXEL_FILL(0)); - AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis); - AddTextPrinterParameterized3(2, FONT_SHORT_COPY_1, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner); - PutWindowTilemap(0); - PutWindowTilemap(2); - CopyWindowToVram(0, COPYWIN_NONE); // Does nothing - CopyWindowToVram(2, COPYWIN_FULL); + FillWindowPixelBuffer(WIN_LINK_ERROR_TOP, PIXEL_FILL(0)); + FillWindowPixelBuffer(WIN_LINK_ERROR_BOTTOM, PIXEL_FILL(0)); + AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis); + AddTextPrinterParameterized3(WIN_LINK_ERROR_BOTTOM, FONT_SHORT_COPY_1, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner); + PutWindowTilemap(WIN_LINK_ERROR_TOP); + PutWindowTilemap(WIN_LINK_ERROR_BOTTOM); + CopyWindowToVram(WIN_LINK_ERROR_TOP, COPYWIN_NONE); // Does nothing + CopyWindowToVram(WIN_LINK_ERROR_BOTTOM, COPYWIN_FULL); } static void ErrorMsg_CheckConnections(void) { LoadBgTiles(0, sCommErrorBg_Gfx, 0x20, 0); - FillWindowPixelBuffer(1, PIXEL_FILL(0)); - FillWindowPixelBuffer(2, PIXEL_FILL(0)); - AddTextPrinterParameterized3(1, FONT_SHORT_COPY_1, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections); - PutWindowTilemap(1); - PutWindowTilemap(2); - CopyWindowToVram(1, COPYWIN_NONE); // Does nothing - CopyWindowToVram(2, COPYWIN_FULL); + FillWindowPixelBuffer(WIN_LINK_ERROR_MID, PIXEL_FILL(0)); + FillWindowPixelBuffer(WIN_LINK_ERROR_BOTTOM, PIXEL_FILL(0)); + AddTextPrinterParameterized3(WIN_LINK_ERROR_MID, FONT_SHORT_COPY_1, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections); + PutWindowTilemap(WIN_LINK_ERROR_MID); + PutWindowTilemap(WIN_LINK_ERROR_BOTTOM); + CopyWindowToVram(WIN_LINK_ERROR_MID, COPYWIN_NONE); // Does nothing + CopyWindowToVram(WIN_LINK_ERROR_BOTTOM, COPYWIN_FULL); } static void CB2_PrintErrorMessage(void) @@ -1691,9 +1701,9 @@ static void CB2_PrintErrorMessage(void) break; case 130: if (gWirelessCommType == 2) - AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnTitleScreen); + AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnTitleScreen); else if (gWirelessCommType == 1) - AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnRegistrationCounter); + AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 20, sTextColors, 0, gText_ABtnRegistrationCounter); break; } if (gMain.state == 160)