Merge pull request #1594 from GriffinRichards/pokestorage-clean

Misc pokemon_storage_system cleanup
This commit is contained in:
GriffinR 2022-01-11 12:26:02 -05:00 committed by GitHub
commit fa2d25d366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 73 deletions

View File

@ -0,0 +1 @@
LMNOpqrst\]^_<01><01>uvwxyz{|}<01>ŠŚŤ

View File

@ -0,0 +1 @@
CDDESTTUcdde

View File

@ -0,0 +1 @@
@AABPQQR`aab

View File

@ -0,0 +1 @@
!!!!!!!!!!!!!!!!

View File

@ -331,6 +331,13 @@ enum {
TILEMAPID_COUNT
};
// Window IDs for sWindowTemplates
enum {
WIN_DISPLAY_INFO,
WIN_MESSAGE,
WIN_ITEM_DESC,
};
struct Wallpaper
{
const u32 *tiles;
@ -939,49 +946,31 @@ static const union AffineAnimCmd *const sAffineAnims_ChooseBoxMenu[] =
static const u8 sChooseBoxMenu_TextColors[] = {TEXT_COLOR_RED, TEXT_DYNAMIC_COLOR_6, TEXT_DYNAMIC_COLOR_5};
static const u8 sText_OutOf30[] = _("/30");
static const u16 sChooseBoxMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/box_selection_popup.gbapal");
static const u8 sChooseBoxMenuCenter_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp");
static const u8 sChooseBoxMenuSides_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp");
static const u32 sScrollingBg_Gfx[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz");
static const u32 sScrollingBg_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz");
static const u16 sDisplayMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/display_menu.gbapal"); // Unused
static const u32 sDisplayMenu_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/display_menu.bin.lz");
static const u16 sPkmnData_Tilemap[] =
{
0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118,
0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118,
};
static const u16 sChooseBoxMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/box_selection_popup.gbapal");
static const u8 sChooseBoxMenuCenter_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp");
static const u8 sChooseBoxMenuSides_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp");
static const u32 sScrollingBg_Gfx[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz");
static const u32 sScrollingBg_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz");
static const u16 sDisplayMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/display_menu.gbapal"); // Unused
static const u32 sDisplayMenu_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/display_menu.bin.lz");
static const u16 sPkmnData_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/pkmn_data.bin");
// sInterface_Pal - parts of the display frame, "PkmnData"'s normal color, Close Box
static const u16 sInterface_Pal[] = INCBIN_U16("graphics/pokemon_storage/interface.gbapal");
static const u16 sPkmnDataGray_Pal[] = INCBIN_U16("graphics/pokemon_storage/pkmn_data_gray.gbapal");
static const u16 sBg_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg.gbapal");
static const u16 sBgMoveItems_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg_move_items.gbapal");
static const u16 sCloseBoxButton_Tilemap[] =
{
0x014c, 0x014d, 0x014e, 0x014f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x015c, 0x015d, 0x015e, 0x015f, 0x0180, 0x0181, 0x0182,
0x0183, 0x0184, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189,
0x018a, 0x018b, 0x018c, 0x018d
};
static const u16 sPartySlotFilled_Tilemap[] =
{
0x1140, 0x1141, 0x1141, 0x1142, 0x1150, 0x1151, 0x1151, 0x1152, 0x1160, 0x1161, 0x1161, 0x1162,
};
static const u16 sPartySlotEmpty_Tilemap[] =
{
0x1143, 0x1144, 0x1144, 0x1145, 0x1153, 0x1154, 0x1154, 0x1155, 0x1163, 0x1164, 0x1164, 0x1165,
};
static const u16 sWaveform_Pal[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal");
static const u32 sWaveform_Gfx[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp");
static const u16 sUnused_Pal[] = INCBIN_U16("graphics/pokemon_storage/unused.gbapal");
static const u16 sUnknown_Pal[] = INCBIN_U16("graphics/pokemon_storage/unknown.gbapal");
static const u16 sInterface_Pal[] = INCBIN_U16("graphics/pokemon_storage/interface.gbapal");
static const u16 sPkmnDataGray_Pal[] = INCBIN_U16("graphics/pokemon_storage/pkmn_data_gray.gbapal");
static const u16 sBg_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg.gbapal");
static const u16 sBgMoveItems_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg_move_items.gbapal");
static const u16 sCloseBoxButton_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/close_box_button.bin");
static const u16 sPartySlotFilled_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/party_slot_filled.bin");
static const u16 sPartySlotEmpty_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/party_slot_empty.bin");
static const u16 sWaveform_Pal[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal");
static const u32 sWaveform_Gfx[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp");
static const u16 sUnused_Pal[] = INCBIN_U16("graphics/pokemon_storage/unused.gbapal");
static const u16 sTextWindows_Pal[] = INCBIN_U16("graphics/pokemon_storage/text_windows.gbapal");
static const struct WindowTemplate sWindowTemplates[] =
{
{
// The panel below the currently displayed Pokémon
[WIN_DISPLAY_INFO] = {
.bg = 1,
.tilemapLeft = 0,
.tilemapTop = 11,
@ -990,7 +979,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 3,
.baseBlock = 0xC0,
},
{
[WIN_MESSAGE] = {
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 17,
@ -999,7 +988,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x14,
},
{
[WIN_ITEM_DESC] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
@ -1349,7 +1338,7 @@ void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero
windowId = AddWindow(&winTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(zero2));
tileData1 = (u8*) GetWindowAttribute(windowId, WINDOW_TILE_DATA);
tileData2 = (winTemplate.width * 32) + tileData1;
tileData2 = (winTemplate.width * TILE_SIZE_4BPP) + tileData1;
if (!zero1)
txtColor[0] = TEXT_COLOR_TRANSPARENT;
@ -1385,7 +1374,7 @@ void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero
// Unused
static void UnusedDrawTextWindow(const u8 *string, void *dst, u16 offset, u8 bgColor, u8 fgColor, u8 shadowColor)
{
u32 tileSize;
u32 tilesSize;
u8 windowId;
u8 txtColor[3];
u8 *tileData1, *tileData2;
@ -1393,17 +1382,17 @@ static void UnusedDrawTextWindow(const u8 *string, void *dst, u16 offset, u8 bgC
winTemplate.width = StringLength_Multibyte(string);
winTemplate.height = 2;
tileSize = winTemplate.width * 32;
tilesSize = winTemplate.width * TILE_SIZE_4BPP;
windowId = AddWindow(&winTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(bgColor));
tileData1 = (u8*) GetWindowAttribute(windowId, WINDOW_TILE_DATA);
tileData2 = (winTemplate.width * 32) + tileData1;
tileData2 = (winTemplate.width * TILE_SIZE_4BPP) + tileData1;
txtColor[0] = bgColor;
txtColor[1] = fgColor;
txtColor[2] = shadowColor;
AddTextPrinterParameterized4(windowId, FONT_NORMAL, 0, 2, 0, 0, txtColor, TEXT_SKIP_DRAW, string);
CpuCopy16(tileData1, dst, tileSize);
CpuCopy16(tileData2, dst + offset, tileSize);
CpuCopy16(tileData1, dst, tilesSize);
CpuCopy16(tileData2, dst + offset, tilesSize);
RemoveWindow(windowId);
}
@ -2136,10 +2125,10 @@ static void Task_InitPokeStorage(u8 taskId)
}
break;
case 2:
PutWindowTilemap(0);
ClearWindowTilemap(1);
PutWindowTilemap(WIN_DISPLAY_INFO);
ClearWindowTilemap(WIN_MESSAGE);
CpuFill32(0, (void *)VRAM, 0x200);
LoadUserWindowBorderGfx(1, 0xB, 0xE0);
LoadUserWindowBorderGfx(WIN_MESSAGE, 0xB, 0xE0);
break;
case 3:
ResetAllBgCoords();
@ -3862,7 +3851,7 @@ static void InitPalettesAndSprites(void)
{
LoadPalette(sInterface_Pal, 0, sizeof(sInterface_Pal));
LoadPalette(sPkmnDataGray_Pal, 0x20, sizeof(sPkmnDataGray_Pal));
LoadPalette(sUnknown_Pal, 0xF0, sizeof(sUnknown_Pal));
LoadPalette(sTextWindows_Pal, 0xF0, sizeof(sTextWindows_Pal));
if (sStorage->boxOption != OPTION_MOVE_ITEMS)
LoadPalette(sBg_Pal, 0x30, sizeof(sBg_Pal));
else
@ -3970,7 +3959,7 @@ static void CreateDisplayMonSprite(void)
sStorage->displayMonSprite = &gSprites[spriteId];
sStorage->displayMonPalOffset = palSlot * 16 + 0x100;
sStorage->displayMonTilePtr = (void*) OBJ_VRAM0 + tileStart * 32;
sStorage->displayMonTilePtr = (void*) OBJ_VRAM0 + tileStart * TILE_SIZE_4BPP;
} while (0);
if (sStorage->displayMonSprite == NULL)
@ -4001,23 +3990,23 @@ static void LoadDisplayMonGfx(u16 species, u32 pid)
static void PrintDisplayMonInfo(void)
{
FillWindowPixelBuffer(0, PIXEL_FILL(1));
FillWindowPixelBuffer(WIN_DISPLAY_INFO, PIXEL_FILL(1));
if (sStorage->boxOption != OPTION_MOVE_ITEMS)
{
AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, 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_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SMALL, sStorage->displayMonItemName, 6, 43, TEXT_SKIP_DRAW, NULL);
}
else
{
AddTextPrinterParameterized(0, FONT_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(0, 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_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL);
AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 28, 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)
{
UpdateMonMarkingTiles(sStorage->displayMonMarkings, sStorage->markingComboTilesPtr);
@ -4278,7 +4267,7 @@ static void UpdateBoxToSendMons(void)
static void InitPokeStorageBg0(void)
{
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);
CopyBgTilemapBufferToVram(0);
}
@ -4317,11 +4306,11 @@ static void PrintMessage(u8 id)
}
DynamicPlaceholderTextUtil_ExpandPlaceholders(sStorage->messageText, sMessages[id].text);
FillWindowPixelBuffer(1, PIXEL_FILL(1));
AddTextPrinterParameterized(1, FONT_NORMAL, sStorage->messageText, 0, 1, TEXT_SKIP_DRAW, NULL);
DrawTextBorderOuter(1, 2, 14);
PutWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_GFX);
FillWindowPixelBuffer(WIN_MESSAGE, PIXEL_FILL(1));
AddTextPrinterParameterized(WIN_MESSAGE, FONT_NORMAL, sStorage->messageText, 0, 1, TEXT_SKIP_DRAW, NULL);
DrawTextBorderOuter(WIN_MESSAGE, 2, 14);
PutWindowTilemap(WIN_MESSAGE);
CopyWindowToVram(WIN_MESSAGE, COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(0);
}
@ -4333,7 +4322,7 @@ static void ShowYesNoWindow(s8 cursorPos)
static void ClearBottomWindow(void)
{
ClearStdWindowAndFrameToTransparent(1, FALSE);
ClearStdWindowAndFrameToTransparent(WIN_MESSAGE, FALSE);
ScheduleBgCopyTilemapToVram(0);
}
@ -5130,7 +5119,7 @@ static u16 TryLoadMonIconTiles(u16 species)
sStorage->iconSpeciesList[i] = species;
sStorage->numIconsPerSpecies[i]++;
offset = 16 * i;
CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + offset * 32, 0x200);
CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + offset * TILE_SIZE_4BPP, 0x200);
return offset;
}
@ -8755,7 +8744,7 @@ static void CreateItemIconSprites(void)
{
spriteSheet.tag = GFXTAG_ITEM_ICON_0 + i;
LoadCompressedSpriteSheet(&spriteSheet);
sStorage->itemIcons[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * 32 + (void*)(OBJ_VRAM0);
sStorage->itemIcons[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * TILE_SIZE_4BPP + (void*)(OBJ_VRAM0);
sStorage->itemIcons[i].palIndex = AllocSpritePalette(PALTAG_ITEM_ICON_0 + i);
sStorage->itemIcons[i].palIndex *= 16;
sStorage->itemIcons[i].palIndex += 0x100;
@ -9201,8 +9190,8 @@ static void PrintItemDescription(void)
else
description = ItemId_GetDescription(sStorage->displayMonItemId);
FillWindowPixelBuffer(2, PIXEL_FILL(1));
AddTextPrinterParameterized5(2, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1);
FillWindowPixelBuffer(WIN_ITEM_DESC, PIXEL_FILL(1));
AddTextPrinterParameterized5(WIN_ITEM_DESC, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1);
}
static void InitItemInfoWindow(void)