Add window constants in pokemon_storage_system

This commit is contained in:
GriffinR 2022-01-07 17:02:12 -05:00
parent a837d1fe2c
commit 5cbe572607

View File

@ -331,6 +331,13 @@ enum {
TILEMAPID_COUNT TILEMAPID_COUNT
}; };
// Window IDs for sWindowTemplates
enum {
WIN_DISPLAY_INFO,
WIN_MESSAGE,
WIN_ITEM_DESC,
};
struct Wallpaper struct Wallpaper
{ {
const u32 *tiles; const u32 *tiles;
@ -981,7 +988,8 @@ static const u16 sUnknown_Pal[] = INCBIN_U16("graphics/pokemon_storage/unknown.
static const struct WindowTemplate sWindowTemplates[] = static const struct WindowTemplate sWindowTemplates[] =
{ {
{ // The panel below the currently displayed Pokémon
[WIN_DISPLAY_INFO] = {
.bg = 1, .bg = 1,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 11, .tilemapTop = 11,
@ -990,7 +998,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 3, .paletteNum = 3,
.baseBlock = 0xC0, .baseBlock = 0xC0,
}, },
{ [WIN_MESSAGE] = {
.bg = 0, .bg = 0,
.tilemapLeft = 11, .tilemapLeft = 11,
.tilemapTop = 17, .tilemapTop = 17,
@ -999,7 +1007,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15, .paletteNum = 15,
.baseBlock = 0x14, .baseBlock = 0x14,
}, },
{ [WIN_ITEM_DESC] = {
.bg = 0, .bg = 0,
.tilemapLeft = 0, .tilemapLeft = 0,
.tilemapTop = 13, .tilemapTop = 13,
@ -2136,10 +2144,10 @@ static void Task_InitPokeStorage(u8 taskId)
} }
break; break;
case 2: case 2:
PutWindowTilemap(0); PutWindowTilemap(WIN_DISPLAY_INFO);
ClearWindowTilemap(1); ClearWindowTilemap(WIN_MESSAGE);
CpuFill32(0, (void *)VRAM, 0x200); CpuFill32(0, (void *)VRAM, 0x200);
LoadUserWindowBorderGfx(1, 0xB, 0xE0); LoadUserWindowBorderGfx(WIN_MESSAGE, 0xB, 0xE0);
break; break;
case 3: case 3:
ResetAllBgCoords(); ResetAllBgCoords();
@ -4001,23 +4009,23 @@ static void LoadDisplayMonGfx(u16 species, u32 pid)
static void PrintDisplayMonInfo(void) static void PrintDisplayMonInfo(void)
{ {
FillWindowPixelBuffer(0, PIXEL_FILL(1)); FillWindowPixelBuffer(WIN_DISPLAY_INFO, PIXEL_FILL(1));
if (sStorage->boxOption != OPTION_MOVE_ITEMS) if (sStorage->boxOption != OPTION_MOVE_ITEMS)
{ {
AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_SMALL, sStorage->displayMonItemName, 6, 43, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SMALL, sStorage->displayMonItemName, 6, 43, TEXT_SKIP_DRAW, NULL);
} }
else else
{ {
AddTextPrinterParameterized(0, FONT_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 28, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 28, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 42, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 42, TEXT_SKIP_DRAW, NULL);
} }
CopyWindowToVram(0, COPYWIN_GFX); CopyWindowToVram(WIN_DISPLAY_INFO, COPYWIN_GFX);
if (sStorage->displayMonSpecies != SPECIES_NONE) if (sStorage->displayMonSpecies != SPECIES_NONE)
{ {
UpdateMonMarkingTiles(sStorage->displayMonMarkings, sStorage->markingComboTilesPtr); UpdateMonMarkingTiles(sStorage->displayMonMarkings, sStorage->markingComboTilesPtr);
@ -4278,7 +4286,7 @@ static void UpdateBoxToSendMons(void)
static void InitPokeStorageBg0(void) static void InitPokeStorageBg0(void)
{ {
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29)); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29));
LoadUserWindowBorderGfx(1, 2, 208); LoadUserWindowBorderGfx(WIN_MESSAGE, 2, 208);
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(0);
} }
@ -4317,11 +4325,11 @@ static void PrintMessage(u8 id)
} }
DynamicPlaceholderTextUtil_ExpandPlaceholders(sStorage->messageText, sMessages[id].text); DynamicPlaceholderTextUtil_ExpandPlaceholders(sStorage->messageText, sMessages[id].text);
FillWindowPixelBuffer(1, PIXEL_FILL(1)); FillWindowPixelBuffer(WIN_MESSAGE, PIXEL_FILL(1));
AddTextPrinterParameterized(1, FONT_NORMAL, sStorage->messageText, 0, 1, TEXT_SKIP_DRAW, NULL); AddTextPrinterParameterized(WIN_MESSAGE, FONT_NORMAL, sStorage->messageText, 0, 1, TEXT_SKIP_DRAW, NULL);
DrawTextBorderOuter(1, 2, 14); DrawTextBorderOuter(WIN_MESSAGE, 2, 14);
PutWindowTilemap(1); PutWindowTilemap(WIN_MESSAGE);
CopyWindowToVram(1, COPYWIN_GFX); CopyWindowToVram(WIN_MESSAGE, COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(0); ScheduleBgCopyTilemapToVram(0);
} }
@ -4333,7 +4341,7 @@ static void ShowYesNoWindow(s8 cursorPos)
static void ClearBottomWindow(void) static void ClearBottomWindow(void)
{ {
ClearStdWindowAndFrameToTransparent(1, FALSE); ClearStdWindowAndFrameToTransparent(WIN_MESSAGE, FALSE);
ScheduleBgCopyTilemapToVram(0); ScheduleBgCopyTilemapToVram(0);
} }
@ -9201,8 +9209,8 @@ static void PrintItemDescription(void)
else else
description = ItemId_GetDescription(sStorage->displayMonItemId); description = ItemId_GetDescription(sStorage->displayMonItemId);
FillWindowPixelBuffer(2, PIXEL_FILL(1)); FillWindowPixelBuffer(WIN_ITEM_DESC, PIXEL_FILL(1));
AddTextPrinterParameterized5(2, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1); AddTextPrinterParameterized5(WIN_ITEM_DESC, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1);
} }
static void InitItemInfoWindow(void) static void InitItemInfoWindow(void)