Merge pull request #1536 from GriffinRichards/clean-braille
Add font id constants, better braille support
This commit is contained in:
66
src/menu.c
66
src/menu.c
@@ -193,19 +193,19 @@ void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress)
|
||||
{
|
||||
void (*callback)(struct TextPrinterTemplate *, u16) = NULL;
|
||||
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
|
||||
AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
|
||||
}
|
||||
|
||||
void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress)
|
||||
{
|
||||
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3);
|
||||
AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3);
|
||||
}
|
||||
|
||||
void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed)
|
||||
{
|
||||
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, speed, NULL, 2, 1, 3);
|
||||
AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, speed, NULL, 2, 1, 3);
|
||||
}
|
||||
|
||||
void LoadMessageBoxAndBorderGfx(void)
|
||||
@@ -460,7 +460,7 @@ static u16 Menu_GetStdPalColor(u8 colorNum)
|
||||
void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback)
|
||||
{
|
||||
LoadMessageBoxAndBorderGfx();
|
||||
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, 1, GetPlayerTextSpeedDelay(), string, callback);
|
||||
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, FONT_NORMAL, GetPlayerTextSpeedDelay(), string, callback);
|
||||
CopyWindowToVram(0, 3);
|
||||
}
|
||||
|
||||
@@ -547,7 +547,7 @@ void RemoveMapNamePopUpWindow(void)
|
||||
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||
{
|
||||
gTextFlags.canABSpeedUpPrint = a1;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
|
||||
AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
|
||||
}
|
||||
|
||||
void sub_8197AE8(bool8 copyToVram)
|
||||
@@ -823,9 +823,9 @@ void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram)
|
||||
{
|
||||
PutWindowTilemap(sWindowId);
|
||||
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
|
||||
width = GetStringWidth(0, string, 0);
|
||||
width = GetStringWidth(FONT_SMALL, string, 0);
|
||||
AddTextPrinterParameterized3(sWindowId,
|
||||
0,
|
||||
FONT_SMALL,
|
||||
0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a2 - width,
|
||||
1,
|
||||
sTextColors,
|
||||
@@ -859,16 +859,16 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo
|
||||
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(15));
|
||||
if (string2 != NULL)
|
||||
{
|
||||
width = GetStringWidth(0, string2, 0);
|
||||
width = GetStringWidth(FONT_SMALL, string2, 0);
|
||||
AddTextPrinterParameterized3(sWindowId,
|
||||
0,
|
||||
FONT_SMALL,
|
||||
0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a4 - width,
|
||||
1,
|
||||
color,
|
||||
0,
|
||||
string2);
|
||||
}
|
||||
AddTextPrinterParameterized4(sWindowId, 1, 4, 1, 0, 0, color, 0, string);
|
||||
AddTextPrinterParameterized4(sWindowId, FONT_NORMAL, 4, 1, 0, 0, color, 0, string);
|
||||
if (copyToVram)
|
||||
CopyWindowToVram(sWindowId, 3);
|
||||
}
|
||||
@@ -1202,7 +1202,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top
|
||||
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
|
||||
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
||||
|
||||
AddTextPrinter(&printer, 0xFF, NULL);
|
||||
AddTextPrinter(&printer, TEXT_SPEED_FF, NULL);
|
||||
|
||||
sub_81983AC(sYesNoWindowId, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos);
|
||||
}
|
||||
@@ -1580,7 +1580,7 @@ u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, boo
|
||||
sMenu.minCursorPos = 0;
|
||||
sMenu.maxCursorPos = itemCount - 1;
|
||||
sMenu.windowId = windowId;
|
||||
sMenu.fontId = 1;
|
||||
sMenu.fontId = FONT_NORMAL;
|
||||
sMenu.optionHeight = 16;
|
||||
sMenu.APressMuted = APressMuted;
|
||||
|
||||
@@ -1617,11 +1617,11 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *menuActions
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = 1;
|
||||
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
||||
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||
printer.fontId = FONT_NORMAL;
|
||||
printer.fgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_FOREGROUND);
|
||||
printer.bgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_SHADOW);
|
||||
printer.unk = GetFontAttribute(FONT_NORMAL, FONTATTR_UNKNOWN);
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 0;
|
||||
printer.x = 8;
|
||||
@@ -1647,15 +1647,15 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
|
||||
|
||||
printer.currentChar = gText_YesNo;
|
||||
printer.windowId = sYesNoWindowId;
|
||||
printer.fontId = 1;
|
||||
printer.fontId = FONT_NORMAL;
|
||||
printer.x = 8;
|
||||
printer.y = 1;
|
||||
printer.currentX = printer.x;
|
||||
printer.currentY = printer.y;
|
||||
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
||||
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||
printer.fgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_FOREGROUND);
|
||||
printer.bgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_SHADOW);
|
||||
printer.unk = GetFontAttribute(FONT_NORMAL, FONTATTR_UNKNOWN);
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 0;
|
||||
|
||||
@@ -1682,11 +1682,11 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = 1;
|
||||
printer.fgColor = GetFontAttribute(1, FONTATTR_COLOR_FOREGROUND);
|
||||
printer.bgColor = GetFontAttribute(1, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(1, FONTATTR_COLOR_SHADOW);
|
||||
printer.unk = GetFontAttribute(1, FONTATTR_UNKNOWN);
|
||||
printer.fontId = FONT_NORMAL;
|
||||
printer.fgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_FOREGROUND);
|
||||
printer.bgColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(FONT_NORMAL, FONTATTR_COLOR_SHADOW);
|
||||
printer.unk = GetFontAttribute(FONT_NORMAL, FONTATTR_UNKNOWN);
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 0;
|
||||
|
||||
@@ -1715,7 +1715,7 @@ u8 InitMenuActionGrid(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initi
|
||||
sMenu.minCursorPos = 0;
|
||||
sMenu.maxCursorPos = (columns * rows) - 1;
|
||||
sMenu.windowId = windowId;
|
||||
sMenu.fontId = 1;
|
||||
sMenu.fontId = FONT_NORMAL;
|
||||
sMenu.optionWidth = optionWidth;
|
||||
sMenu.optionHeight = 16;
|
||||
sMenu.columns = columns;
|
||||
@@ -1948,8 +1948,8 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
|
||||
printer.y = top;
|
||||
printer.currentX = printer.x;
|
||||
printer.currentY = printer.y;
|
||||
printer.letterSpacing = GetFontAttribute(fontId, 2);
|
||||
printer.lineSpacing = GetFontAttribute(fontId, 3);
|
||||
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
|
||||
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
|
||||
printer.unk = 0;
|
||||
printer.fgColor = color[1];
|
||||
printer.bgColor = color[0];
|
||||
@@ -1994,9 +1994,9 @@ void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left
|
||||
printer.lineSpacing = lineSpacing;
|
||||
printer.unk = 0;
|
||||
|
||||
printer.fgColor = GetFontAttribute(fontId, 5);
|
||||
printer.bgColor = GetFontAttribute(fontId, 6);
|
||||
printer.shadowColor = GetFontAttribute(fontId, 7);
|
||||
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
|
||||
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
|
||||
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
|
||||
|
||||
AddTextPrinter(&printer, speed, callback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user