Use window constants in link

This commit is contained in:
GriffinR 2022-09-29 14:50:51 -04:00
parent 9ae918bb35
commit c719d5d9b1

View File

@ -28,6 +28,13 @@
#include "constants/rgb.h" #include "constants/rgb.h"
#include "constants/trade.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 struct BlockTransfer
{ {
u16 pos; u16 pos;
@ -193,8 +200,9 @@ static const struct BgTemplate sLinkErrorBgTemplates[] = {
.priority = 1 .priority = 1
} }
}; };
static const struct WindowTemplate sLinkErrorWindowTemplates[] = { static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
{ [WIN_LINK_ERROR_TOP] = {
.bg = 0, .bg = 0,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 0, .tilemapTop = 0,
@ -202,7 +210,8 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.height = 5, .height = 5,
.paletteNum = 15, .paletteNum = 15,
.baseBlock = 0x002 .baseBlock = 0x002
}, { },
[WIN_LINK_ERROR_MID] = {
.bg = 0, .bg = 0,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 6, .tilemapTop = 6,
@ -210,7 +219,8 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.height = 7, .height = 7,
.paletteNum = 15, .paletteNum = 15,
.baseBlock = 0x098 .baseBlock = 0x098
}, { },
[WIN_LINK_ERROR_BOTTOM] = {
.bg = 0, .bg = 0,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 13, .tilemapTop = 13,
@ -1641,26 +1651,26 @@ static void ErrorMsg_MoveCloserToPartner(void)
CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0); CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
LoadPalette(sWirelessLinkDisplayPal, 0, 0x20); LoadPalette(sWirelessLinkDisplayPal, 0, 0x20);
FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_LINK_ERROR_TOP, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_LINK_ERROR_BOTTOM, PIXEL_FILL(0));
AddTextPrinterParameterized3(0, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis); AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis);
AddTextPrinterParameterized3(2, FONT_SHORT_COPY_1, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner); AddTextPrinterParameterized3(WIN_LINK_ERROR_BOTTOM, FONT_SHORT_COPY_1, 2, 1, sTextColors, 0, gText_MoveCloserToLinkPartner);
PutWindowTilemap(0); PutWindowTilemap(WIN_LINK_ERROR_TOP);
PutWindowTilemap(2); PutWindowTilemap(WIN_LINK_ERROR_BOTTOM);
CopyWindowToVram(0, COPYWIN_NONE); // Does nothing CopyWindowToVram(WIN_LINK_ERROR_TOP, COPYWIN_NONE); // Does nothing
CopyWindowToVram(2, COPYWIN_FULL); CopyWindowToVram(WIN_LINK_ERROR_BOTTOM, COPYWIN_FULL);
} }
static void ErrorMsg_CheckConnections(void) static void ErrorMsg_CheckConnections(void)
{ {
LoadBgTiles(0, sCommErrorBg_Gfx, 0x20, 0); LoadBgTiles(0, sCommErrorBg_Gfx, 0x20, 0);
FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_LINK_ERROR_MID, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_LINK_ERROR_BOTTOM, PIXEL_FILL(0));
AddTextPrinterParameterized3(1, FONT_SHORT_COPY_1, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections); AddTextPrinterParameterized3(WIN_LINK_ERROR_MID, FONT_SHORT_COPY_1, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections);
PutWindowTilemap(1); PutWindowTilemap(WIN_LINK_ERROR_MID);
PutWindowTilemap(2); PutWindowTilemap(WIN_LINK_ERROR_BOTTOM);
CopyWindowToVram(1, COPYWIN_NONE); // Does nothing CopyWindowToVram(WIN_LINK_ERROR_MID, COPYWIN_NONE); // Does nothing
CopyWindowToVram(2, COPYWIN_FULL); CopyWindowToVram(WIN_LINK_ERROR_BOTTOM, COPYWIN_FULL);
} }
static void CB2_PrintErrorMessage(void) static void CB2_PrintErrorMessage(void)
@ -1691,9 +1701,9 @@ static void CB2_PrintErrorMessage(void)
break; break;
case 130: case 130:
if (gWirelessCommType == 2) 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) 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; break;
} }
if (gMain.state == 160) if (gMain.state == 160)