Add DISPLAY_TILE_* constants

This commit is contained in:
GriffinR
2022-09-26 12:22:27 -04:00
parent b8bf9dea56
commit e515e52abb
18 changed files with 65 additions and 62 deletions

View File

@@ -1167,24 +1167,24 @@ static void TryCreateWirelessSprites(void)
static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
{
u16 windowId;
int origWidth;
int tileWidth;
int strWidth;
u8 *spriteTilePtrs[4];
u8 *dst;
struct WindowTemplate windowTemplate;
memset(&windowTemplate, 0, sizeof(windowTemplate));
windowTemplate.width = 30;
windowTemplate.width = DISPLAY_TILE_WIDTH;
windowTemplate.height = 2;
windowId = AddWindow(&windowTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
origWidth = GetStringWidth(FONT_NORMAL, text, 0);
strWidth = (origWidth + 9) / 8;
if (strWidth > 30)
strWidth = 30;
strWidth = GetStringWidth(FONT_NORMAL, text, 0);
tileWidth = (strWidth + 9) / 8;
if (tileWidth > DISPLAY_TILE_WIDTH)
tileWidth = DISPLAY_TILE_WIDTH;
AddTextPrinterParameterized3(windowId, FONT_NORMAL, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text);
AddTextPrinterParameterized3(windowId, FONT_NORMAL, (tileWidth * 8 - strWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text);
{
s32 i;
struct Sprite *sprite;
@@ -1207,7 +1207,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
CpuCopy32(src + 128, dst + 0x200, 0x20);
CpuCopy32(src + 64, dst + 0x300, 0x20);
for (i = 0; i < strWidth; i++)
for (i = 0; i < tileWidth; i++)
{
dst = &spriteTilePtrs[(i + 1) / 8][((i + 1) % 8) * 32];
CpuCopy32(src + 192, dst, 0x20);
@@ -1225,7 +1225,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
}
RemoveWindow(windowId);
return (DISPLAY_WIDTH - (strWidth + 2) * 8) / 2;
return (DISPLAY_WIDTH - (tileWidth + 2) * 8) / 2;
}
static void CreateResultsTextWindowSprites(void)