Finish cleaning up text.c

This commit is contained in:
Diegoisawesome 2018-11-06 11:30:21 -06:00
parent 6d38431c33
commit f8d337e491
23 changed files with 134 additions and 134 deletions

View File

@ -1180,7 +1180,7 @@ sub_81965D8: @ 81965D8
negs r0, r0
ands r0, r1
strb r0, [r2]
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24

View File

@ -6485,7 +6485,7 @@ _080DEC80:
b _080DEC9C
.pool
_080DEC94:
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
lsls r0, 24
lsrs r1, r0, 24
_080DEC9C:

View File

@ -6178,7 +6178,7 @@ sub_81B3300: @ 81B3300
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -10440,7 +10440,7 @@ sub_81CC158: @ 81CC158
adds r1, 0xF
bl sub_81CAF78
adds r5, r0, 0
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
lsls r0, 24
lsrs r0, 24
ldrb r2, [r4, 0x14]
@ -22957,7 +22957,7 @@ sub_81D2BF4: @ 81D2BF4
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl GetPlayerTextSpeed
bl GetPlayerTextSpeedDelay
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -33,7 +33,7 @@ void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
void sub_8197434(u8 windowId, bool8 copyToVram);
void SetStandardWindowBorderStyle(u8 a0, u8 a1);
void sub_8197930(void);
u8 GetPlayerTextSpeed(void);
u8 GetPlayerTextSpeedDelay(void);
void sub_81978B0(u16 arg0);
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16));
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str);

View File

@ -114,7 +114,7 @@ enum {
FONTATTR_MAX_LETTER_HEIGHT,
FONTATTR_LETTER_SPACING,
FONTATTR_LINE_SPACING,
FONTATTR_COLOR_LOWNIBBLE, // dunno what this is yet
FONTATTR_UNKNOWN, // dunno what this is yet
FONTATTR_COLOR_FOREGROUND,
FONTATTR_COLOR_BACKGROUND,
FONTATTR_COLOR_SHADOW
@ -124,11 +124,11 @@ struct TextPrinterSubStruct
{
u8 glyphId:4; // 0x14
bool8 hasPrintBeenSpedUp:1;
u8 font_type_5:3;
u8 unk:3;
u8 downArrowDelay:5;
u8 downArrowYPosIdx:2;
bool8 hasGlyphIdBeenSet:1;
u8 frames_visible_counter;
u8 autoScrollDelay;
};
struct TextPrinterTemplate
@ -142,7 +142,7 @@ struct TextPrinterTemplate
u8 currentY;
u8 letterSpacing;
u8 lineSpacing;
u8 fontColor_l:4; // 0xC
u8 unk:4; // 0xC
u8 fgColor:4;
u8 bgColor:4;
u8 shadowColor:4;
@ -156,8 +156,8 @@ struct TextPrinter
union __attribute__((packed)) {
struct TextPrinterSubStruct sub;
u8 sub_fields[7];
} sub_union;
u8 fields[7];
} subUnion;
u8 active;
u8 state; // 0x1C
@ -175,7 +175,7 @@ struct FontInfo
u8 maxLetterHeight;
u8 letterSpacing;
u8 lineSpacing;
u8 fontColor_l:4;
u8 unk:4;
u8 fgColor:4;
u8 bgColor:4;
u8 shadowColor:4;
@ -185,22 +185,22 @@ extern const struct FontInfo *gFonts;
struct GlyphWidthFunc
{
u32 font_id;
u32 fontId;
u32 (*func)(u16 glyphId, bool32 isJapanese);
};
struct KeypadIcon
{
u16 tile_offset;
u16 tileOffset;
u8 width;
u8 height;
};
typedef struct {
u8 canABSpeedUpPrint:1;
u8 flag_1:1;
u8 flag_2:1;
u8 flag_3:1;
bool8 canABSpeedUpPrint:1;
bool8 useAlternateDownArrow:1;
bool8 autoScroll:1;
bool8 forceMidTextSpeed:1;
} TextFlags;
struct Struct_03002F90

View File

@ -4792,7 +4792,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
textPrinter.currentY = textPrinter.y;
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
@ -5292,7 +5292,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
textPrinter.currentY = textPrinter.y;
textPrinter.letterSpacing = 0;
textPrinter.lineSpacing = 0;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
@ -5748,7 +5748,7 @@ static void sub_8194220(u8 taskId)
textPrinter.lineSpacing = 0;
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x70, textPrinter.letterSpacing);
textPrinter.currentY = 1;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
@ -5917,7 +5917,7 @@ static void sub_8194950(u8 taskId)
textPrinter.y = 0;
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
textPrinter.fontColor_l = 0;
textPrinter.unk = 0;
textPrinter.fgColor = 11;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;

View File

@ -2961,7 +2961,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
printerTemplate.currentY = printerTemplate.y;
printerTemplate.letterSpacing = textInfo[windowId].letterSpacing;
printerTemplate.lineSpacing = textInfo[windowId].lineSpacing;
printerTemplate.fontColor_l = 0;
printerTemplate.unk = 0;
printerTemplate.fgColor = textInfo[windowId].fgColor;
printerTemplate.bgColor = textInfo[windowId].bgColor;
printerTemplate.shadowColor = textInfo[windowId].shadowColor;
@ -2974,14 +2974,14 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
}
if (windowId == 0x16)
gTextFlags.flag_1 = 0;
gTextFlags.useAlternateDownArrow = 0;
else
gTextFlags.flag_1 = 1;
gTextFlags.useAlternateDownArrow = 1;
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED))
gTextFlags.flag_2 = 1;
gTextFlags.autoScroll = 1;
else
gTextFlags.flag_2 = 0;
gTextFlags.autoScroll = 0;
if (windowId == 0 || windowId == 0x16)
{
@ -2990,7 +2990,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
speed = sRecordedBattleTextSpeeds[GetTextSpeedInRecordedBattle()];
else
speed = GetPlayerTextSpeed();
speed = GetPlayerTextSpeedDelay();
gTextFlags.canABSpeedUpPrint = 1;
}

View File

@ -1457,7 +1457,7 @@ static void sub_81C6DAC(u8 taskId, const struct YesNoFuncTable *yesNoTable)
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId))
{
FillWindowPixelBuffer(2, 0x11);
DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeed(), str, callback);
DisplayMessageAndContinueTask(taskId, 2, 0xA, 0xD, 1, GetPlayerTextSpeedDelay(), str, callback);
schedule_bg_copy_tilemap_to_vram(1);
}

View File

@ -6397,7 +6397,7 @@ static void PutLevelAndGenderOnLvlUpBox(void)
printerTemplate.currentY = 0;
printerTemplate.letterSpacing = 0;
printerTemplate.lineSpacing = 0;
printerTemplate.fontColor_l = TEXT_COLOR_TRANSPARENT;
printerTemplate.unk = 0;
printerTemplate.fgColor = TEXT_COLOR_WHITE;
printerTemplate.bgColor = TEXT_COLOR_TRANSPARENT;
printerTemplate.shadowColor = TEXT_COLOR_DARK_GREY;

View File

@ -1031,7 +1031,7 @@ static void sub_807FAC8(void)
sBerryBlenderData->mainState++;
break;
case 4:
if (Blender_PrintText(&sBerryBlenderData->textState, sText_BerryBlenderStart, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sText_BerryBlenderStart, GetPlayerTextSpeedDelay()))
sBerryBlenderData->mainState++;
break;
case 5:
@ -2490,7 +2490,7 @@ static void CB2_HandleBlenderEndGame(void)
}
break;
case 7:
if (Blender_PrintText(&sBerryBlenderData->textState, sText_WouldLikeToBlendAnotherBerry, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sText_WouldLikeToBlendAnotherBerry, GetPlayerTextSpeedDelay()))
sBerryBlenderData->gameEndState++;
break;
case 9:
@ -2572,7 +2572,7 @@ static void CB2_HandleBlenderEndGame(void)
sBerryBlenderData->gameEndState++;
break;
case 13:
if (Blender_PrintText(&sBerryBlenderData->textState, sText_CommunicationStandby, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sText_CommunicationStandby, GetPlayerTextSpeedDelay()))
{
SetMainCallback2(CB2_HandlePlayerLinkPlayAgainChoice);
sBerryBlenderData->gameEndState = 0;
@ -2680,7 +2680,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void)
StringAppend(gStringVar4, sText_HasNoBerriesToPut);
break;
case 3:
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeedDelay()))
{
sBerryBlenderData->framesToWait = 0;
sBerryBlenderData->gameEndState++;
@ -2787,7 +2787,7 @@ static void CB2_HandlePlayerPlayAgainChoice(void)
StringCopy(gStringVar4, sText_RunOutOfBerriesForBlending);
break;
case 3:
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeedDelay()))
sBerryBlenderData->gameEndState = 9;
break;
case 9:
@ -3363,7 +3363,7 @@ static bool8 Blender_PrintBlendingResults(void)
sBerryBlenderData->mainState++;
break;
case 6:
if (Blender_PrintText(&sBerryBlenderData->textState, sBerryBlenderData->stringVar, GetPlayerTextSpeed()))
if (Blender_PrintText(&sBerryBlenderData->textState, sBerryBlenderData->stringVar, GetPlayerTextSpeedDelay()))
{
TryUpdateBerryBlenderRecord();
return TRUE;

View File

@ -1215,8 +1215,8 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
printer.y = y;
printer.currentX = x;
printer.currentY = y;
printer.fontColor_l = 0;
gTextFlags.flag_1 = 0;
printer.unk = 0;
gTextFlags.useAlternateDownArrow = 0;
printer.letterSpacing = 0;
printer.lineSpacing = 1;
printer.fgColor = 2;

View File

@ -531,7 +531,7 @@ void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpri
gBattle_BG3_X = 256;
gBattle_BG3_Y = 0;
gTextFlags.flag_1 = 1;
gTextFlags.useAlternateDownArrow = 1;
SetVBlankCallback(VBlankCB_TradeEvolutionScene);
SetMainCallback2(CB2_TradeEvolutionSceneUpdate);
@ -1135,7 +1135,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
DestroyTask(taskID);
Free(sEvoStructPtr);
sEvoStructPtr = NULL;
gTextFlags.flag_1 = 0;
gTextFlags.useAlternateDownArrow = 0;
SetMainCallback2(gCB2_AfterEvolution);
}
break;

View File

@ -17,9 +17,9 @@ void sub_8098128(void)
{
gUnknown_020375BC = 0;
gTextFlags.canABSpeedUpPrint = 0;
gTextFlags.flag_1 = 0;
gTextFlags.flag_2 = 0;
gTextFlags.flag_3 = 0;
gTextFlags.useAlternateDownArrow = 0;
gTextFlags.autoScroll = 0;
gTextFlags.forceMidTextSpeed = 0;
}
void sub_8098154(u8 taskId)

View File

@ -1029,7 +1029,7 @@ void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u
data[10] = AddItemMessageWindow(4);
FillWindowPixelBuffer(data[10], 17);
DisplayMessageAndContinueTask(taskId, data[10], 10, 13, fontId, GetPlayerTextSpeed(), str, callback);
DisplayMessageAndContinueTask(taskId, data[10], 10, 13, fontId, GetPlayerTextSpeedDelay(), str, callback);
schedule_bg_copy_tilemap_to_vram(1);
}

View File

@ -176,12 +176,12 @@ u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed
printer.currentY = 1;
printer.letterSpacing = 0;
printer.lineSpacing = 0;
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = fgColor;
printer.bgColor = bgColor;
printer.shadowColor = shadowColor;
gTextFlags.flag_1 = 0;
gTextFlags.useAlternateDownArrow = 0;
return AddTextPrinter(&printer, speed, callback);
}
@ -189,13 +189,13 @@ void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress)
{
void (*callback)(struct TextPrinterTemplate *, u16) = NULL;
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
}
void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress)
{
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3);
}
void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed)
@ -454,7 +454,7 @@ u16 sub_81978D0(u8 colorNum)
void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback)
{
sub_81973A4();
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, 1, GetPlayerTextSpeed(), string, callback);
DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, 1, GetPlayerTextSpeedDelay(), string, callback);
CopyWindowToVram(0, 3);
}
@ -468,19 +468,19 @@ void sub_8197948(u8 initialCursorPos)
CreateYesNoMenu(&gUnknown_0860F0A8, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, initialCursorPos);
}
u32 sub_8197964(void)
u32 GetPlayerTextSpeed(void)
{
if (gTextFlags.flag_3)
return 1;
if (gTextFlags.forceMidTextSpeed)
return OPTIONS_TEXT_SPEED_MID;
return gSaveBlock2Ptr->optionsTextSpeed;
}
u8 GetPlayerTextSpeed(void)
u8 GetPlayerTextSpeedDelay(void)
{
u32 speed;
if (gSaveBlock2Ptr->optionsTextSpeed > 2)
gSaveBlock2Ptr->optionsTextSpeed = 1;
speed = sub_8197964();
if (gSaveBlock2Ptr->optionsTextSpeed > OPTIONS_TEXT_SPEED_FAST)
gSaveBlock2Ptr->optionsTextSpeed = OPTIONS_TEXT_SPEED_MID;
speed = GetPlayerTextSpeed();
return gUnknown_0860F094[speed];
}
@ -539,7 +539,7 @@ void RemoveMapNamePopUpWindow(void)
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16))
{
gTextFlags.canABSpeedUpPrint = a1;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3);
}
void sub_8197AE8(bool8 copyToVram)
@ -1123,7 +1123,7 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
printer.fontColor_l = GetFontAttribute(fontId, FONTATTR_COLOR_LOWNIBBLE);
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
printer.letterSpacing = letterSpacing;
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
printer.x = left;
@ -1187,7 +1187,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
printer.fontColor_l = GetFontAttribute(fontId, FONTATTR_COLOR_LOWNIBBLE);
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
@ -1242,12 +1242,12 @@ void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u
printer.windowId = windowId;
printer.fontId = fontId;
printer.fgColor = GetFontAttribute(fontId, 5);
printer.bgColor = GetFontAttribute(fontId, 6);
printer.shadowColor = GetFontAttribute(fontId, 7);
printer.fontColor_l = GetFontAttribute(fontId, 4);
printer.letterSpacing = GetFontAttribute(fontId, 2);
printer.lineSpacing = GetFontAttribute(fontId, 3);
printer.fgColor = GetFontAttribute(fontId, FONTATTR_COLOR_FOREGROUND);
printer.bgColor = GetFontAttribute(fontId, FONTATTR_COLOR_BACKGROUND);
printer.shadowColor = GetFontAttribute(fontId, FONTATTR_COLOR_SHADOW);
printer.unk = GetFontAttribute(fontId, FONTATTR_UNKNOWN);
printer.letterSpacing = GetFontAttribute(fontId, FONTATTR_LETTER_SPACING);
printer.lineSpacing = GetFontAttribute(fontId, FONTATTR_LINE_SPACING);
for (i = 0; i < itemCount2; i++)
{
@ -1615,10 +1615,10 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const
printer.windowId = windowId;
printer.fontId = 1;
printer.fgColor = GetFontAttribute(1, 5);
printer.bgColor = GetFontAttribute(1, 6);
printer.shadowColor = GetFontAttribute(1, 7);
printer.fontColor_l = GetFontAttribute(1, 4);
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.letterSpacing = 0;
printer.lineSpacing = 0;
printer.x = 8;
@ -1649,10 +1649,10 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
printer.y = 1;
printer.currentX = printer.x;
printer.currentY = printer.y;
printer.fgColor = GetFontAttribute(1, 5);
printer.bgColor = GetFontAttribute(1, 6);
printer.shadowColor = GetFontAttribute(1, 7);
printer.fontColor_l = GetFontAttribute(1, 4);
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.letterSpacing = 0;
printer.lineSpacing = 0;
@ -1682,10 +1682,10 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
printer.windowId = windowId;
printer.fontId = 1;
printer.fgColor = GetFontAttribute(1, 5);
printer.bgColor = GetFontAttribute(1, 6);
printer.shadowColor = GetFontAttribute(1, 7);
printer.fontColor_l = GetFontAttribute(1, 4);
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.letterSpacing = 0;
printer.lineSpacing = 0;
@ -1952,7 +1952,7 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
printer.currentY = printer.y;
printer.letterSpacing = GetFontAttribute(fontId, 2);
printer.lineSpacing = GetFontAttribute(fontId, 3);
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
@ -1973,7 +1973,7 @@ void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 le
printer.currentY = printer.y;
printer.letterSpacing = letterSpacing;
printer.lineSpacing = lineSpacing;
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = color[1];
printer.bgColor = color[0];
printer.shadowColor = color[2];
@ -1994,7 +1994,7 @@ void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left
printer.currentY = top;
printer.letterSpacing = letterSpacing;
printer.lineSpacing = lineSpacing;
printer.fontColor_l = 0;
printer.unk = 0;
printer.fgColor = GetFontAttribute(fontId, 5);
printer.bgColor = GetFontAttribute(fontId, 6);

View File

@ -559,7 +559,7 @@ static void DisplaySentToPCMessage(void)
StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]);
NewMenuHelpers_DrawDialogueFrame(0, 0);
gTextFlags.canABSpeedUpPrint = TRUE;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), 0, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), 0, 2, 1, 3);
CopyWindowToVram(0, 3);
}

View File

@ -1179,7 +1179,7 @@ static void PokeblockAction_Toss(u8 taskId)
sub_8198070(data[1], FALSE);
StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]);
StringExpandPlaceholders(gStringVar4, gText_ThrowAwayVar1);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeed(), gStringVar4, CreateTossPokeblockYesNoMenu);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeedDelay(), gStringVar4, CreateTossPokeblockYesNoMenu);
}
static void CreateTossPokeblockYesNoMenu(u8 taskId)
@ -1190,7 +1190,7 @@ static void CreateTossPokeblockYesNoMenu(u8 taskId)
static void TossPokeblockChoice_Yes(u8 taskId)
{
StringExpandPlaceholders(gStringVar4, gText_Var1ThrownAway);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeed(), gStringVar4, HandleErasePokeblock);
DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeedDelay(), gStringVar4, HandleErasePokeblock);
}
static void HandleErasePokeblock(u8 taskId)

View File

@ -786,7 +786,7 @@ static void Task_HandleMonAtePokeblock(u8 taskId)
StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2);
gTextFlags.canABSpeedUpPrint = 1;
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3);
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeedDelay(), NULL, 2, 1, 3);
gTasks[taskId].func = Task_WaitForAtePokeblockText;
}

View File

@ -1290,8 +1290,8 @@ bool8 ScrCmd_messageautoscroll(struct ScriptContext *ctx)
if (msg == NULL)
msg = (const u8 *)ctx->data[0];
gTextFlags.flag_2 = TRUE;
gTextFlags.flag_3 = TRUE;
gTextFlags.autoScroll = TRUE;
gTextFlags.forceMidTextSpeed = TRUE;
ShowFieldAutoScrollMessage(msg);
return FALSE;
}

View File

@ -694,7 +694,7 @@ static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 c
static void BuyMenuDisplayMessage(u8 taskId, const u8 *text, TaskFunc callback)
{
DisplayMessageAndContinueTask(taskId, 5, 10, 14, 1, GetPlayerTextSpeed(), text, callback);
DisplayMessageAndContinueTask(taskId, 5, 10, 14, 1, GetPlayerTextSpeedDelay(), text, callback);
schedule_bg_copy_tilemap_to_vram(0);
}

View File

@ -14,7 +14,7 @@
extern u8 GetKeypadIconWidth(u8 keypadIconId);
extern u16 Font6Func(struct TextPrinter *textPrinter);
extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese);
extern int sub_8197964();
extern int GetPlayerTextSpeed();
EWRAM_DATA struct TextPrinter gTempTextPrinter = {0};
EWRAM_DATA struct TextPrinter gTextPrinters[NUM_TEXT_PRINTERS] = {0};
@ -153,7 +153,7 @@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8
printerTemplate.currentY = y;
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
printerTemplate.fontColor_l = gFonts[fontId].fontColor_l;
printerTemplate.unk = gFonts[fontId].unk;
printerTemplate.fgColor = gFonts[fontId].fgColor;
printerTemplate.bgColor = gFonts[fontId].bgColor;
printerTemplate.shadowColor = gFonts[fontId].shadowColor;
@ -177,7 +177,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
for (i = 0; i < 7; i++)
{
gTempTextPrinter.sub_union.sub_fields[i] = 0;
gTempTextPrinter.subUnion.fields[i] = 0;
}
gTempTextPrinter.printerTemplate = *printerTemplate;
@ -1779,11 +1779,11 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width)
u16 Font0Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 0;
textPrinter->subUnion.sub.glyphId = 0;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1791,11 +1791,11 @@ u16 Font0Func(struct TextPrinter *textPrinter)
u16 Font1Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 1;
textPrinter->subUnion.sub.glyphId = 1;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1803,11 +1803,11 @@ u16 Font1Func(struct TextPrinter *textPrinter)
u16 Font2Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 2;
textPrinter->subUnion.sub.glyphId = 2;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1815,11 +1815,11 @@ u16 Font2Func(struct TextPrinter *textPrinter)
u16 Font3Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 3;
textPrinter->subUnion.sub.glyphId = 3;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1827,11 +1827,11 @@ u16 Font3Func(struct TextPrinter *textPrinter)
u16 Font4Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 4;
textPrinter->subUnion.sub.glyphId = 4;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1839,11 +1839,11 @@ u16 Font4Func(struct TextPrinter *textPrinter)
u16 Font5Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 5;
textPrinter->subUnion.sub.glyphId = 5;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1851,11 +1851,11 @@ u16 Font5Func(struct TextPrinter *textPrinter)
u16 Font7Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 7;
textPrinter->subUnion.sub.glyphId = 7;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1863,11 +1863,11 @@ u16 Font7Func(struct TextPrinter *textPrinter)
u16 Font8Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->hasGlyphIdBeenSet == FALSE)
{
textPrinter->sub_union.sub.glyphId = 8;
textPrinter->subUnion.sub.glyphId = 8;
subStruct->hasGlyphIdBeenSet = TRUE;
}
return RenderText(textPrinter);
@ -1875,10 +1875,10 @@ u16 Font8Func(struct TextPrinter *textPrinter)
void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (gTextFlags.flag_2 == 1)
subStruct->frames_visible_counter = 0;
if (gTextFlags.autoScroll == 1)
subStruct->autoScrollDelay = 0;
else
{
subStruct->downArrowYPosIdx = 0;
@ -1888,14 +1888,14 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
const u8 *arrowTiles;
if (gTextFlags.flag_2 == 0)
if (gTextFlags.autoScroll == 0)
{
if (subStruct->downArrowDelay != 0)
{
subStruct->downArrowDelay = ((*(u32*)&textPrinter->sub_union.sub) << 19 >> 27) - 1; // convoluted way of getting downArrowDelay, necessary to match
subStruct->downArrowDelay = ((*(u32*)&textPrinter->subUnion.sub) << 19 >> 27) - 1; // convoluted way of getting downArrowDelay, necessary to match
}
else
{
@ -1907,7 +1907,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
0x8,
0x10);
switch (gTextFlags.flag_1)
switch (gTextFlags.useAlternateDownArrow)
{
case 0:
default:
@ -1951,15 +1951,15 @@ void TextPrinterClearDownArrow(struct TextPrinter *textPrinter)
bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
if (subStruct->frames_visible_counter == 49)
if (subStruct->autoScrollDelay == 49)
{
return TRUE;
}
else
{
++subStruct->frames_visible_counter;
++subStruct->autoScrollDelay;
return FALSE;
}
}
@ -1967,7 +1967,7 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
{
bool8 result = FALSE;
if (gTextFlags.flag_2 != 0)
if (gTextFlags.autoScroll != 0)
{
result = TextPrinterWaitAutoMode(textPrinter);
}
@ -1986,7 +1986,7 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
bool16 TextPrinterWait(struct TextPrinter *textPrinter)
{
bool16 result = FALSE;
if (gTextFlags.flag_2 != 0)
if (gTextFlags.autoScroll != 0)
{
result = TextPrinterWaitAutoMode(textPrinter);
}
@ -2014,7 +2014,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c
FillWindowPixelRect(windowId, (bgColor << 4) | bgColor, x, y, 0x8, 0x10);
if (drawArrow == 0)
{
switch (gTextFlags.flag_1)
switch (gTextFlags.useAlternateDownArrow)
{
case 0:
default:
@ -2045,7 +2045,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c
u16 RenderText(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub;
u16 currChar;
s32 width;
s32 widthHelper;
@ -2067,7 +2067,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
return 3;
}
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED) && gTextFlags.flag_2)
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED) && gTextFlags.autoScroll)
textPrinter->delayCounter = 3;
else
textPrinter->delayCounter = textPrinter->textSpeed;
@ -2129,8 +2129,8 @@ u16 RenderText(struct TextPrinter *textPrinter)
return 2;
case 9:
textPrinter->state = 1;
if (gTextFlags.flag_2)
subStruct->frames_visible_counter = 0;
if (gTextFlags.autoScroll)
subStruct->autoScrollDelay = 0;
return 3;
case 10:
textPrinter->state = 5;
@ -2301,7 +2301,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
case 4:
if (textPrinter->scrollDistance)
{
int scrollSpeed = sub_8197964();
int scrollSpeed = GetPlayerTextSpeed();
int speed = gWindowVerticalScrollSpeeds[scrollSpeed];
if (textPrinter->scrollDistance < speed)
{
@ -2432,7 +2432,7 @@ u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32)
for (i = 0; i < 9; ++i)
{
if (glyphId == gGlyphWidthFuncs[i].font_id)
if (glyphId == gGlyphWidthFuncs[i].fontId)
return gGlyphWidthFuncs[i].func;
}
@ -2725,7 +2725,7 @@ u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y)
{
BlitBitmapRectToWindow(
windowId,
gKeypadIconTiles + (gKeypadIcons[keypadIconId].tile_offset * 0x20),
gKeypadIconTiles + (gKeypadIcons[keypadIconId].tileOffset * 0x20),
0,
0,
0x80,
@ -2739,7 +2739,7 @@ u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y)
u8 GetKeypadIconTileOffset(u8 keypadIconId)
{
return gKeypadIcons[keypadIconId].tile_offset;
return gKeypadIcons[keypadIconId].tileOffset;
}
u8 GetKeypadIconWidth(u8 keypadIconId)
@ -2774,8 +2774,8 @@ u8 GetFontAttribute(u8 fontId, u8 attributeId)
case FONTATTR_LINE_SPACING:
result = gFontInfos[fontId].lineSpacing;
break;
case FONTATTR_COLOR_LOWNIBBLE:
result = gFontInfos[fontId].fontColor_l;
case FONTATTR_UNKNOWN:
result = gFontInfos[fontId].unk;
break;
case FONTATTR_COLOR_FOREGROUND:
result = gFontInfos[fontId].fgColor;

View File

@ -15,7 +15,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
u16 char_;
struct TextPrinterSubStruct *sub;
sub = &textPrinter->sub_union.sub;
sub = &textPrinter->subUnion.sub;
switch (textPrinter->state)
{
case 0:
@ -33,7 +33,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
}
return 3;
}
if (gTextFlags.flag_2)
if (gTextFlags.autoScroll)
{
textPrinter->delayCounter = 3;
}
@ -92,9 +92,9 @@ u16 Font6Func(struct TextPrinter *textPrinter)
return 2;
case 9:
textPrinter->state = 1;
if (gTextFlags.flag_2)
if (gTextFlags.autoScroll)
{
sub->frames_visible_counter = 0;
sub->autoScrollDelay = 0;
}
return 3;
case 10: