mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Begin cleaning text.c
This commit is contained in:
parent
487a6c2b2c
commit
6d38431c33
@ -27,7 +27,7 @@ void sub_81973A4(void);
|
||||
void NewMenuHelpers_DrawDialogueFrame(u8, u8);
|
||||
void sub_819746C(u8 windowId, bool8 copyToVram);
|
||||
void NewMenuHelpers_DrawStdWindowFrame(u8, u8);
|
||||
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor);
|
||||
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor);
|
||||
void PrintPlayerNameOnWindow(u8, const u8*, u16, u16);
|
||||
void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
|
||||
void sub_8197434(u8 windowId, bool8 copyToVram);
|
||||
@ -35,7 +35,7 @@ void SetStandardWindowBorderStyle(u8 a0, u8 a1);
|
||||
void sub_8197930(void);
|
||||
u8 GetPlayerTextSpeed(void);
|
||||
void sub_81978B0(u16 arg0);
|
||||
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextSubPrinter *, u16));
|
||||
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);
|
||||
void sub_8198070(u8 windowId, bool8 copyToVram);
|
||||
void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
|
||||
@ -83,7 +83,7 @@ void sub_819A344(u8 a0, u8 *dest, u8 color);
|
||||
void RemoveMapNamePopUpWindow(void);
|
||||
u8 GetMapNamePopUpWindowId(void);
|
||||
u8 AddMapNamePopUpWindow(void);
|
||||
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing);
|
||||
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing);
|
||||
void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette);
|
||||
void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP);
|
||||
void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram);
|
||||
|
@ -122,18 +122,18 @@ enum {
|
||||
|
||||
struct TextPrinterSubStruct
|
||||
{
|
||||
u8 font_type:4; // 0x14
|
||||
u8 font_type_upper:1;
|
||||
u8 glyphId:4; // 0x14
|
||||
bool8 hasPrintBeenSpedUp:1;
|
||||
u8 font_type_5:3;
|
||||
u8 field_1:5;
|
||||
u8 field_1_upmid:2;
|
||||
u8 field_1_top:1;
|
||||
u8 downArrowDelay:5;
|
||||
u8 downArrowYPosIdx:2;
|
||||
bool8 hasGlyphIdBeenSet:1;
|
||||
u8 frames_visible_counter;
|
||||
};
|
||||
|
||||
struct TextSubPrinter // TODO: Better name
|
||||
struct TextPrinterTemplate
|
||||
{
|
||||
const u8* current_text_offset;
|
||||
const u8* currentChar;
|
||||
u8 windowId;
|
||||
u8 fontId;
|
||||
u8 x;
|
||||
@ -150,9 +150,9 @@ struct TextSubPrinter // TODO: Better name
|
||||
|
||||
struct TextPrinter
|
||||
{
|
||||
struct TextSubPrinter subPrinter;
|
||||
struct TextPrinterTemplate printerTemplate;
|
||||
|
||||
void (*callback)(struct TextSubPrinter *, u16); // 0x10
|
||||
void (*callback)(struct TextPrinterTemplate *, u16); // 0x10
|
||||
|
||||
union __attribute__((packed)) {
|
||||
struct TextPrinterSubStruct sub;
|
||||
@ -197,7 +197,7 @@ struct KeypadIcon
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u8 flag_0:1;
|
||||
u8 canABSpeedUpPrint:1;
|
||||
u8 flag_1:1;
|
||||
u8 flag_2:1;
|
||||
u8 flag_3:1;
|
||||
@ -225,8 +225,8 @@ extern struct Struct_03002F90 gUnknown_03002F90;
|
||||
|
||||
void SetFontsPointer(const struct FontInfo *fonts);
|
||||
void DeactivateAllTextPrinters(void);
|
||||
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16));
|
||||
bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*callback)(struct TextSubPrinter *, u16));
|
||||
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
|
||||
bool16 AddTextPrinter(struct TextPrinterTemplate *template, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
|
||||
void RunTextPrinters(void);
|
||||
bool16 IsTextPrinterActive(u8 id);
|
||||
u32 RenderFont(struct TextPrinter *textPrinter);
|
||||
|
@ -4720,7 +4720,7 @@ static u8 sub_819221C(u8 taskId)
|
||||
|
||||
static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
{
|
||||
struct TextSubPrinter textPrinter;
|
||||
struct TextPrinterTemplate textPrinter;
|
||||
s32 i, j, k;
|
||||
s32 trainerId = 0;
|
||||
u8 nature = 0;
|
||||
@ -4826,7 +4826,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
}
|
||||
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, gStringVar1, 0xD0, textPrinter.letterSpacing);
|
||||
textPrinter.current_text_offset = gStringVar1;
|
||||
textPrinter.currentChar = gStringVar1;
|
||||
textPrinter.windowId = windowId;
|
||||
PutWindowTilemap(windowId);
|
||||
CopyWindowToVram(windowId, 3);
|
||||
@ -4837,11 +4837,11 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
{
|
||||
textPrinter.currentY = gUnknown_0860D346[i];
|
||||
if (trainerId == TRAINER_PLAYER)
|
||||
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]];
|
||||
textPrinter.currentChar = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]];
|
||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
textPrinter.current_text_offset = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]];
|
||||
textPrinter.currentChar = gSpeciesNames[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]];
|
||||
else
|
||||
textPrinter.current_text_offset = gSpeciesNames[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].species];
|
||||
textPrinter.currentChar = gSpeciesNames[gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonId[trainerTournamentId][i]].species];
|
||||
|
||||
textPrinter.windowId = 1 + i + windowId;
|
||||
if (i == 1)
|
||||
@ -4857,9 +4857,9 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
PutWindowTilemap(windowId + 4);
|
||||
CopyWindowToVram(windowId + 4, 3);
|
||||
if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||
textPrinter.current_text_offset = gBattleDomePotentialPointers[16];
|
||||
textPrinter.currentChar = gBattleDomePotentialPointers[16];
|
||||
else
|
||||
textPrinter.current_text_offset = gBattleDomePotentialPointers[trainerTournamentId];
|
||||
textPrinter.currentChar = gBattleDomePotentialPointers[trainerTournamentId];
|
||||
|
||||
textPrinter.fontId = 1;
|
||||
textPrinter.windowId = windowId + 4;
|
||||
@ -4901,7 +4901,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
break;
|
||||
}
|
||||
|
||||
textPrinter.current_text_offset = gBattleDomeOpponentStylePointers[i];
|
||||
textPrinter.currentChar = gBattleDomeOpponentStylePointers[i];
|
||||
textPrinter.y = 20;
|
||||
textPrinter.currentY = 20;
|
||||
AddTextPrinter(&textPrinter, 0, NULL);
|
||||
@ -5073,7 +5073,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
|
||||
else
|
||||
i = 42;
|
||||
|
||||
textPrinter.current_text_offset = gBattleDomeOpponentStatsPointers[i];
|
||||
textPrinter.currentChar = gBattleDomeOpponentStatsPointers[i];
|
||||
textPrinter.y = 36;
|
||||
textPrinter.currentY = 36;
|
||||
AddTextPrinter(&textPrinter, 0, NULL);
|
||||
@ -5144,7 +5144,7 @@ static s32 sub_8192F08(u8 arg0, u8 *arg1)
|
||||
|
||||
static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
{
|
||||
struct TextSubPrinter textPrinter;
|
||||
struct TextPrinterTemplate textPrinter;
|
||||
s32 tournamentIds[2];
|
||||
s32 trainerIds[2];
|
||||
bool32 lost[2];
|
||||
@ -5297,7 +5297,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
textPrinter.bgColor = 0;
|
||||
textPrinter.shadowColor = 13;
|
||||
StringExpandPlaceholders(gStringVar4, gBattleDomeWinStringsPointers[winStringId]);
|
||||
textPrinter.current_text_offset = gStringVar4;
|
||||
textPrinter.currentChar = gStringVar4;
|
||||
textPrinter.windowId = windowId + 8;
|
||||
textPrinter.fontId = 1;
|
||||
PutWindowTilemap(windowId + 8);
|
||||
@ -5316,9 +5316,9 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
|
||||
textPrinter.fontId = 2;
|
||||
textPrinter.letterSpacing = 2;
|
||||
textPrinter.current_text_offset = gStringVar1;
|
||||
textPrinter.currentChar = gStringVar1;
|
||||
textPrinter.windowId = windowId + 6;
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0x40, textPrinter.letterSpacing);
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
|
||||
textPrinter.currentY = textPrinter.y = 2;
|
||||
PutWindowTilemap(windowId + 6);
|
||||
CopyWindowToVram(windowId + 6, 3);
|
||||
@ -5332,9 +5332,9 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
else
|
||||
CopyDomeTrainerName(gStringVar1, trainerIds[1]);
|
||||
|
||||
textPrinter.current_text_offset = gStringVar1;
|
||||
textPrinter.currentChar = gStringVar1;
|
||||
textPrinter.windowId = windowId + 7;
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0x40, textPrinter.letterSpacing);
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
|
||||
textPrinter.currentY = textPrinter.y = 2;
|
||||
PutWindowTilemap(windowId + 7);
|
||||
CopyWindowToVram(windowId + 7, 3);
|
||||
@ -5342,9 +5342,9 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
|
||||
|
||||
// Print match number.
|
||||
textPrinter.letterSpacing = 0;
|
||||
textPrinter.current_text_offset = gBattleDomeMatchNumberPointers[matchNo];
|
||||
textPrinter.currentChar = gBattleDomeMatchNumberPointers[matchNo];
|
||||
textPrinter.windowId = windowId + 5;
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0xA0, textPrinter.letterSpacing);
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0xA0, textPrinter.letterSpacing);
|
||||
textPrinter.currentY = textPrinter.y = 2;
|
||||
PutWindowTilemap(windowId + 5);
|
||||
CopyWindowToVram(windowId + 5, 3);
|
||||
@ -5663,7 +5663,7 @@ static u16 GetWinningMove(s32 winnerTournamentId, s32 loserTournamentId, u8 roun
|
||||
static void sub_8194220(u8 taskId)
|
||||
{
|
||||
s32 i;
|
||||
struct TextSubPrinter textPrinter;
|
||||
struct TextPrinterTemplate textPrinter;
|
||||
s32 r10 = gTasks[taskId].data[1];
|
||||
s32 r4 = gTasks[taskId].data[2];
|
||||
|
||||
@ -5740,13 +5740,13 @@ static void sub_8194220(u8 taskId)
|
||||
break;
|
||||
case 4:
|
||||
textPrinter.fontId = 2;
|
||||
textPrinter.current_text_offset = gText_BattleTourney;
|
||||
textPrinter.currentChar = gText_BattleTourney;
|
||||
textPrinter.windowId = 2;
|
||||
textPrinter.x = 0;
|
||||
textPrinter.y = 0;
|
||||
textPrinter.letterSpacing = 2;
|
||||
textPrinter.lineSpacing = 0;
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.current_text_offset, 0x70, textPrinter.letterSpacing);
|
||||
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x70, textPrinter.letterSpacing);
|
||||
textPrinter.currentY = 1;
|
||||
textPrinter.fontColor_l = 0;
|
||||
textPrinter.fgColor = 14;
|
||||
@ -5831,7 +5831,7 @@ static void sub_8194220(u8 taskId)
|
||||
textPrinter.currentX = GetStringWidthDifference(textPrinter.fontId, gDisplayedStringBattle, 0x3D, textPrinter.letterSpacing);
|
||||
else
|
||||
textPrinter.currentX = 3;
|
||||
textPrinter.current_text_offset = gDisplayedStringBattle;
|
||||
textPrinter.currentChar = gDisplayedStringBattle;
|
||||
textPrinter.windowId = gUnknown_0860D3F1[i][0];
|
||||
textPrinter.currentY = gUnknown_0860D3F1[i][1];
|
||||
AddTextPrinter(&textPrinter, 0, NULL);
|
||||
@ -5899,7 +5899,7 @@ static void sub_81948EC(u8 tournamentId, u8 arg1)
|
||||
static void sub_8194950(u8 taskId)
|
||||
{
|
||||
s32 i;
|
||||
struct TextSubPrinter textPrinter;
|
||||
struct TextPrinterTemplate textPrinter;
|
||||
|
||||
switch (gTasks[taskId].data[0])
|
||||
{
|
||||
@ -5932,7 +5932,7 @@ static void sub_8194950(u8 taskId)
|
||||
else
|
||||
textPrinter.currentX = 3;
|
||||
|
||||
textPrinter.current_text_offset = gDisplayedStringBattle;
|
||||
textPrinter.currentChar = gDisplayedStringBattle;
|
||||
textPrinter.windowId = gUnknown_0860D3F1[i][0];
|
||||
textPrinter.currentY = gUnknown_0860D3F1[i][1];
|
||||
AddTextPrinter(&textPrinter, 0, NULL);
|
||||
|
@ -2938,7 +2938,7 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
|
||||
{
|
||||
const struct BattleWindowText *textInfo = sBattleTextOnWindowsInfo[gBattleScripting.windowsType];
|
||||
bool32 copyToVram;
|
||||
struct TextSubPrinter textSubPrinter;
|
||||
struct TextPrinterTemplate printerTemplate;
|
||||
u8 speed;
|
||||
|
||||
if (windowId & 0x80)
|
||||
@ -2952,25 +2952,25 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
|
||||
copyToVram = TRUE;
|
||||
}
|
||||
|
||||
textSubPrinter.current_text_offset = text;
|
||||
textSubPrinter.windowId = windowId;
|
||||
textSubPrinter.fontId = textInfo[windowId].fontId;
|
||||
textSubPrinter.x = textInfo[windowId].x;
|
||||
textSubPrinter.y = textInfo[windowId].y;
|
||||
textSubPrinter.currentX = textSubPrinter.x;
|
||||
textSubPrinter.currentY = textSubPrinter.y;
|
||||
textSubPrinter.letterSpacing = textInfo[windowId].letterSpacing;
|
||||
textSubPrinter.lineSpacing = textInfo[windowId].lineSpacing;
|
||||
textSubPrinter.fontColor_l = 0;
|
||||
textSubPrinter.fgColor = textInfo[windowId].fgColor;
|
||||
textSubPrinter.bgColor = textInfo[windowId].bgColor;
|
||||
textSubPrinter.shadowColor = textInfo[windowId].shadowColor;
|
||||
printerTemplate.currentChar = text;
|
||||
printerTemplate.windowId = windowId;
|
||||
printerTemplate.fontId = textInfo[windowId].fontId;
|
||||
printerTemplate.x = textInfo[windowId].x;
|
||||
printerTemplate.y = textInfo[windowId].y;
|
||||
printerTemplate.currentX = printerTemplate.x;
|
||||
printerTemplate.currentY = printerTemplate.y;
|
||||
printerTemplate.letterSpacing = textInfo[windowId].letterSpacing;
|
||||
printerTemplate.lineSpacing = textInfo[windowId].lineSpacing;
|
||||
printerTemplate.fontColor_l = 0;
|
||||
printerTemplate.fgColor = textInfo[windowId].fgColor;
|
||||
printerTemplate.bgColor = textInfo[windowId].bgColor;
|
||||
printerTemplate.shadowColor = textInfo[windowId].shadowColor;
|
||||
|
||||
if (textSubPrinter.x == 0xFF)
|
||||
if (printerTemplate.x == 0xFF)
|
||||
{
|
||||
u32 width = sub_80397C4(gBattleScripting.windowsType, windowId);
|
||||
s32 alignX = GetStringCenterAlignXOffsetWithLetterSpacing(textSubPrinter.fontId, textSubPrinter.current_text_offset, width, textSubPrinter.letterSpacing);
|
||||
textSubPrinter.x = textSubPrinter.currentX = alignX;
|
||||
s32 alignX = GetStringCenterAlignXOffsetWithLetterSpacing(printerTemplate.fontId, printerTemplate.currentChar, width, printerTemplate.letterSpacing);
|
||||
printerTemplate.x = printerTemplate.currentX = alignX;
|
||||
}
|
||||
|
||||
if (windowId == 0x16)
|
||||
@ -2992,15 +2992,15 @@ void BattlePutTextOnWindow(const u8 *text, u8 windowId)
|
||||
else
|
||||
speed = GetPlayerTextSpeed();
|
||||
|
||||
gTextFlags.flag_0 = 1;
|
||||
gTextFlags.canABSpeedUpPrint = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
speed = textInfo[windowId].speed;
|
||||
gTextFlags.flag_0 = 0;
|
||||
gTextFlags.canABSpeedUpPrint = 0;
|
||||
}
|
||||
|
||||
AddTextPrinter(&textSubPrinter, speed, NULL);
|
||||
AddTextPrinter(&printerTemplate, speed, NULL);
|
||||
|
||||
if (copyToVram)
|
||||
{
|
||||
|
@ -6380,7 +6380,7 @@ static void PutLevelAndGenderOnLvlUpBox(void)
|
||||
{
|
||||
u16 monLevel;
|
||||
u8 monGender;
|
||||
struct TextSubPrinter subPrinter;
|
||||
struct TextPrinterTemplate printerTemplate;
|
||||
u8 *txtPtr;
|
||||
u32 var;
|
||||
|
||||
@ -6388,21 +6388,21 @@ static void PutLevelAndGenderOnLvlUpBox(void)
|
||||
monGender = GetMonGender(&gPlayerParty[gBattleStruct->expGetterMonId]);
|
||||
GetMonNickname(&gPlayerParty[gBattleStruct->expGetterMonId], gStringVar4);
|
||||
|
||||
subPrinter.current_text_offset = gStringVar4;
|
||||
subPrinter.windowId = 14;
|
||||
subPrinter.fontId = 0;
|
||||
subPrinter.x = 32;
|
||||
subPrinter.y = 0;
|
||||
subPrinter.currentX = 32;
|
||||
subPrinter.currentY = 0;
|
||||
subPrinter.letterSpacing = 0;
|
||||
subPrinter.lineSpacing = 0;
|
||||
subPrinter.fontColor_l = TEXT_COLOR_TRANSPARENT;
|
||||
subPrinter.fgColor = TEXT_COLOR_WHITE;
|
||||
subPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
subPrinter.shadowColor = TEXT_COLOR_DARK_GREY;
|
||||
printerTemplate.currentChar = gStringVar4;
|
||||
printerTemplate.windowId = 14;
|
||||
printerTemplate.fontId = 0;
|
||||
printerTemplate.x = 32;
|
||||
printerTemplate.y = 0;
|
||||
printerTemplate.currentX = 32;
|
||||
printerTemplate.currentY = 0;
|
||||
printerTemplate.letterSpacing = 0;
|
||||
printerTemplate.lineSpacing = 0;
|
||||
printerTemplate.fontColor_l = TEXT_COLOR_TRANSPARENT;
|
||||
printerTemplate.fgColor = TEXT_COLOR_WHITE;
|
||||
printerTemplate.bgColor = TEXT_COLOR_TRANSPARENT;
|
||||
printerTemplate.shadowColor = TEXT_COLOR_DARK_GREY;
|
||||
|
||||
AddTextPrinter(&subPrinter, 0xFF, NULL);
|
||||
AddTextPrinter(&printerTemplate, 0xFF, NULL);
|
||||
|
||||
txtPtr = gStringVar4;
|
||||
gStringVar4[0] = CHAR_SPECIAL_F9;
|
||||
@ -6432,9 +6432,9 @@ static void PutLevelAndGenderOnLvlUpBox(void)
|
||||
*(txtPtr++) = EOS;
|
||||
}
|
||||
|
||||
subPrinter.y = 10;
|
||||
subPrinter.currentY = 10;
|
||||
AddTextPrinter(&subPrinter, 0xFF, NULL);
|
||||
printerTemplate.y = 10;
|
||||
printerTemplate.currentY = 10;
|
||||
AddTextPrinter(&printerTemplate, 0xFF, NULL);
|
||||
|
||||
CopyWindowToVram(14, 2);
|
||||
}
|
||||
|
@ -316,11 +316,11 @@ void sub_80D77E4(void)
|
||||
DeactivateAllTextPrinters();
|
||||
if (gIsLinkContest & 1)
|
||||
{
|
||||
gTextFlags.flag_0 = FALSE;
|
||||
gTextFlags.canABSpeedUpPrint = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gTextFlags.flag_0 = TRUE;
|
||||
gTextFlags.canABSpeedUpPrint = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1206,9 +1206,9 @@ static void GetDaycareLevelMenuLevelText(struct DayCare *daycare, u8 *dest)
|
||||
|
||||
static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.current_text_offset = text;
|
||||
printer.currentChar = text;
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = 1;
|
||||
printer.x = x;
|
||||
|
@ -16,7 +16,7 @@ void textbox_auto_and_task_add(void);
|
||||
void sub_8098128(void)
|
||||
{
|
||||
gUnknown_020375BC = 0;
|
||||
gTextFlags.flag_0 = 0;
|
||||
gTextFlags.canABSpeedUpPrint = 0;
|
||||
gTextFlags.flag_1 = 0;
|
||||
gTextFlags.flag_2 = 0;
|
||||
gTextFlags.flag_3 = 0;
|
||||
|
@ -74,7 +74,7 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8, u8);
|
||||
static void NewGameBirchSpeech_ClearWindow(u8);
|
||||
static void Task_NewGameBirchSpeech_ThisIsAPokemon(u8);
|
||||
static void Task_NewGameBirchSpeech_MainSpeech(u8);
|
||||
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextSubPrinter *printer, u16 a);
|
||||
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextPrinterTemplate *printer, u16 a);
|
||||
static void Task_NewGameBirchSpeech_AndYouAre(u8);
|
||||
static void Task_NewGameBirchSpeechSub_WaitForLotad(u8);
|
||||
static void Task_NewGameBirchSpeech_StartBirchLotadPlatformFade(u8);
|
||||
@ -2126,9 +2126,9 @@ static void NewGameBirchSpeech_ClearWindow(u8 windowId)
|
||||
CopyWindowToVram(windowId, 2);
|
||||
}
|
||||
|
||||
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextSubPrinter *printer, u16 a)
|
||||
static void NewGameBirchSpeech_ShowPokeBallPrinterCallback(struct TextPrinterTemplate *printer, u16 a)
|
||||
{
|
||||
if (*(printer->current_text_offset - 2) == 8 && gUnknown_02022D04 == 0)
|
||||
if (*(printer->currentChar - 2) == 8 && gUnknown_02022D04 == 0)
|
||||
{
|
||||
gUnknown_02022D04 = 1;
|
||||
CreateTask(Task_NewGameBirchSpeechSub_InitPokeBall, 0);
|
||||
|
@ -430,7 +430,7 @@ static void sub_81206F0(void)
|
||||
gUnknown_03002F84 = FALSE;
|
||||
}
|
||||
|
||||
static void BardSong_TextSubPrinter(struct TextSubPrinter * printer, u16 a1)
|
||||
static void BardSong_TextSubPrinter(struct TextPrinterTemplate * printer, u16 a1)
|
||||
{
|
||||
gUnknown_03002F84 = TRUE;
|
||||
}
|
||||
|
56
src/menu.c
56
src/menu.c
@ -163,11 +163,11 @@ u16 RunTextPrintersAndIsPrinter0Active(void)
|
||||
return IsTextPrinterActive(0);
|
||||
}
|
||||
|
||||
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor)
|
||||
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.current_text_offset = str;
|
||||
printer.currentChar = str;
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = fontId;
|
||||
printer.x = 0;
|
||||
@ -187,20 +187,20 @@ u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed
|
||||
|
||||
void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress)
|
||||
{
|
||||
void (*callback)(struct TextSubPrinter *, u16) = NULL;
|
||||
gTextFlags.flag_0 = allowSkippingDelayWithButtonPress;
|
||||
void (*callback)(struct TextPrinterTemplate *, u16) = NULL;
|
||||
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3);
|
||||
}
|
||||
|
||||
void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress)
|
||||
{
|
||||
gTextFlags.flag_0 = allowSkippingDelayWithButtonPress;
|
||||
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3);
|
||||
}
|
||||
|
||||
void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed)
|
||||
{
|
||||
gTextFlags.flag_0 = allowSkippingDelayWithButtonPress;
|
||||
gTextFlags.canABSpeedUpPrint = allowSkippingDelayWithButtonPress;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, speed, NULL, 2, 1, 3);
|
||||
}
|
||||
|
||||
@ -536,9 +536,9 @@ void RemoveMapNamePopUpWindow(void)
|
||||
}
|
||||
}
|
||||
|
||||
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextSubPrinter *, u16))
|
||||
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||
{
|
||||
gTextFlags.flag_0 = a1;
|
||||
gTextFlags.canABSpeedUpPrint = a1;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3);
|
||||
}
|
||||
|
||||
@ -1116,7 +1116,7 @@ void sub_8198854(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const stru
|
||||
void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8)
|
||||
{
|
||||
u8 i;
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = fontId;
|
||||
@ -1131,7 +1131,7 @@ void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 l
|
||||
|
||||
for (i = 0; i < itemCount; i++)
|
||||
{
|
||||
printer.current_text_offset = strs[a8[i]].text;
|
||||
printer.currentChar = strs[a8[i]].text;
|
||||
printer.y = (lineHeight * i) + top;
|
||||
printer.currentY = printer.y;
|
||||
AddTextPrinter(&printer, 0xFF, NULL);
|
||||
@ -1172,12 +1172,12 @@ u16 sub_8198AA4(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16
|
||||
|
||||
void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
gUnknown_0203CD9F = AddWindow(window);
|
||||
SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum);
|
||||
|
||||
printer.current_text_offset = gText_YesNo;
|
||||
printer.currentChar = gText_YesNo;
|
||||
printer.windowId = gUnknown_0203CD9F;
|
||||
printer.fontId = fontId;
|
||||
printer.x = GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH) + left;
|
||||
@ -1238,7 +1238,7 @@ void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u
|
||||
{
|
||||
u8 i;
|
||||
u8 j;
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = fontId;
|
||||
@ -1253,7 +1253,7 @@ void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u
|
||||
{
|
||||
for (j = 0; j < itemCount; j++)
|
||||
{
|
||||
printer.current_text_offset = strs[a8[(itemCount * i) + j]].text;
|
||||
printer.currentChar = strs[a8[(itemCount * i) + j]].text;
|
||||
printer.x = (a4 * j) + left;
|
||||
printer.y = (GetFontAttribute(fontId, 1) * i) + top;
|
||||
printer.currentX = printer.x;
|
||||
@ -1611,7 +1611,7 @@ void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs)
|
||||
void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const u8 *a8)
|
||||
{
|
||||
u8 i;
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = 1;
|
||||
@ -1626,7 +1626,7 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const
|
||||
|
||||
for (i = 0; i < itemCount; i++)
|
||||
{
|
||||
printer.current_text_offset = strs[a8[i]].text;
|
||||
printer.currentChar = strs[a8[i]].text;
|
||||
printer.y = (i * 16) + 1;
|
||||
printer.currentY = (i * 16) + 1;
|
||||
AddTextPrinter(&printer, 0xFF, NULL);
|
||||
@ -1637,12 +1637,12 @@ void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const
|
||||
|
||||
void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
gUnknown_0203CD9F = AddWindow(window);
|
||||
SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum);
|
||||
|
||||
printer.current_text_offset = gText_YesNo;
|
||||
printer.currentChar = gText_YesNo;
|
||||
printer.windowId = gUnknown_0203CD9F;
|
||||
printer.fontId = 1;
|
||||
printer.x = 8;
|
||||
@ -1678,7 +1678,7 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
|
||||
{
|
||||
u8 i;
|
||||
u8 j;
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = 1;
|
||||
@ -1693,7 +1693,7 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M
|
||||
{
|
||||
for (j = 0; j < itemCount; j++)
|
||||
{
|
||||
printer.current_text_offset = strs[a8[(itemCount * i) + j]].text;
|
||||
printer.currentChar = strs[a8[(itemCount * i) + j]].text;
|
||||
printer.x = (a4 * j) + 8;
|
||||
printer.y = (16 * i) + 1;
|
||||
printer.currentX = printer.x;
|
||||
@ -1941,9 +1941,9 @@ void sub_8199DF0(u32 bg, u8 a1, int a2, int a3)
|
||||
|
||||
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.current_text_offset = str;
|
||||
printer.currentChar = str;
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = fontId;
|
||||
printer.x = left;
|
||||
@ -1962,9 +1962,9 @@ void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const
|
||||
|
||||
void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.current_text_offset = str;
|
||||
printer.currentChar = str;
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = fontId;
|
||||
printer.x = left;
|
||||
@ -1981,11 +1981,11 @@ void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 left, u8 top, u8 le
|
||||
AddTextPrinter(&printer, speed, NULL);
|
||||
}
|
||||
|
||||
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing)
|
||||
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
struct TextPrinterTemplate printer;
|
||||
|
||||
printer.current_text_offset = str;
|
||||
printer.currentChar = str;
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = fontId;
|
||||
printer.x = left;
|
||||
|
@ -134,7 +134,7 @@ void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8
|
||||
if (string != gStringVar4)
|
||||
StringExpandPlaceholders(gStringVar4, string);
|
||||
|
||||
gTextFlags.flag_0 = 1;
|
||||
gTextFlags.canABSpeedUpPrint = 1;
|
||||
AddTextPrinterParameterized2(windowId, fontId, gStringVar4, textSpeed, NULL, 2, 1, 3);
|
||||
gUnknown_0300117C = taskFunc;
|
||||
gTasks[taskId].func = Task_ContinueTaskAfterMessagePrints;
|
||||
|
@ -558,7 +558,7 @@ static void DisplaySentToPCMessage(void)
|
||||
|
||||
StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]);
|
||||
NewMenuHelpers_DrawDialogueFrame(0, 0);
|
||||
gTextFlags.flag_0 = TRUE;
|
||||
gTextFlags.canABSpeedUpPrint = TRUE;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), 0, 2, 1, 3);
|
||||
CopyWindowToVram(0, 3);
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ static void Task_HandleMonAtePokeblock(u8 taskId)
|
||||
else
|
||||
StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2);
|
||||
|
||||
gTextFlags.flag_0 = 1;
|
||||
gTextFlags.canABSpeedUpPrint = 1;
|
||||
AddTextPrinterParameterized2(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3);
|
||||
gTasks[taskId].func = Task_WaitForAtePokeblockText;
|
||||
}
|
||||
|
360
src/text.c
360
src/text.c
@ -140,27 +140,27 @@ void DeactivateAllTextPrinters(void)
|
||||
gTextPrinters[printer].active = 0;
|
||||
}
|
||||
|
||||
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16))
|
||||
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||
{
|
||||
struct TextSubPrinter subPrinter;
|
||||
struct TextPrinterTemplate printerTemplate;
|
||||
|
||||
subPrinter.current_text_offset = str;
|
||||
subPrinter.windowId = windowId;
|
||||
subPrinter.fontId = fontId;
|
||||
subPrinter.x = x;
|
||||
subPrinter.y = y;
|
||||
subPrinter.currentX = x;
|
||||
subPrinter.currentY = y;
|
||||
subPrinter.letterSpacing = gFonts[fontId].letterSpacing;
|
||||
subPrinter.lineSpacing = gFonts[fontId].lineSpacing;
|
||||
subPrinter.fontColor_l = gFonts[fontId].fontColor_l;
|
||||
subPrinter.fgColor = gFonts[fontId].fgColor;
|
||||
subPrinter.bgColor = gFonts[fontId].bgColor;
|
||||
subPrinter.shadowColor = gFonts[fontId].shadowColor;
|
||||
return AddTextPrinter(&subPrinter, speed, callback);
|
||||
printerTemplate.currentChar = str;
|
||||
printerTemplate.windowId = windowId;
|
||||
printerTemplate.fontId = fontId;
|
||||
printerTemplate.x = x;
|
||||
printerTemplate.y = y;
|
||||
printerTemplate.currentX = x;
|
||||
printerTemplate.currentY = y;
|
||||
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
|
||||
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
|
||||
printerTemplate.fontColor_l = gFonts[fontId].fontColor_l;
|
||||
printerTemplate.fgColor = gFonts[fontId].fgColor;
|
||||
printerTemplate.bgColor = gFonts[fontId].bgColor;
|
||||
printerTemplate.shadowColor = gFonts[fontId].shadowColor;
|
||||
return AddTextPrinter(&printerTemplate, speed, callback);
|
||||
}
|
||||
|
||||
bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*callback)(struct TextSubPrinter *, u16))
|
||||
bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||
{
|
||||
int i;
|
||||
u16 j;
|
||||
@ -180,16 +180,16 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca
|
||||
gTempTextPrinter.sub_union.sub_fields[i] = 0;
|
||||
}
|
||||
|
||||
gTempTextPrinter.subPrinter = *textSubPrinter;
|
||||
gTempTextPrinter.printerTemplate = *printerTemplate;
|
||||
gTempTextPrinter.callback = callback;
|
||||
gTempTextPrinter.minLetterSpacing = 0;
|
||||
gTempTextPrinter.japanese = 0;
|
||||
|
||||
GenerateFontHalfRowLookupTable(textSubPrinter->fgColor, textSubPrinter->bgColor, textSubPrinter->shadowColor);
|
||||
GenerateFontHalfRowLookupTable(printerTemplate->fgColor, printerTemplate->bgColor, printerTemplate->shadowColor);
|
||||
if (speed != TEXT_SPEED_FF && speed != 0x0)
|
||||
{
|
||||
--gTempTextPrinter.textSpeed;
|
||||
gTextPrinters[textSubPrinter->windowId] = gTempTextPrinter;
|
||||
gTextPrinters[printerTemplate->windowId] = gTempTextPrinter;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -201,8 +201,8 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca
|
||||
}
|
||||
|
||||
if (speed != TEXT_SPEED_FF)
|
||||
CopyWindowToVram(gTempTextPrinter.subPrinter.windowId, 2);
|
||||
gTextPrinters[textSubPrinter->windowId].active = 0;
|
||||
CopyWindowToVram(gTempTextPrinter.printerTemplate.windowId, 2);
|
||||
gTextPrinters[printerTemplate->windowId].active = 0;
|
||||
}
|
||||
gUnknown_03002F84 = 0;
|
||||
return TRUE;
|
||||
@ -222,10 +222,10 @@ void RunTextPrinters(void)
|
||||
temp = RenderFont(&gTextPrinters[i]);
|
||||
switch (temp) {
|
||||
case 0:
|
||||
CopyWindowToVram(gTextPrinters[i].subPrinter.windowId, 2);
|
||||
CopyWindowToVram(gTextPrinters[i].printerTemplate.windowId, 2);
|
||||
case 3:
|
||||
if (gTextPrinters[i].callback != 0)
|
||||
gTextPrinters[i].callback(&gTextPrinters[i].subPrinter, temp);
|
||||
gTextPrinters[i].callback(&gTextPrinters[i].printerTemplate, temp);
|
||||
break;
|
||||
case 1:
|
||||
gTextPrinters[i].active = 0;
|
||||
@ -246,7 +246,7 @@ u32 RenderFont(struct TextPrinter *textPrinter)
|
||||
u32 ret;
|
||||
while (TRUE)
|
||||
{
|
||||
ret = gFonts[textPrinter->subPrinter.fontId].fontFunction(textPrinter);
|
||||
ret = gFonts[textPrinter->printerTemplate.fontId].fontFunction(textPrinter);
|
||||
if (ret != 2)
|
||||
return ret;
|
||||
}
|
||||
@ -1759,7 +1759,7 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width)
|
||||
|
||||
if (gLastTextBgColor != 0)
|
||||
{
|
||||
window = &gWindows[textPrinter->subPrinter.windowId];
|
||||
window = &gWindows[textPrinter->printerTemplate.windowId];
|
||||
pixels_data.pixels = window->tileData;
|
||||
pixels_data.width = window->window.width << 3;
|
||||
pixels_data.height = window->window.height << 3;
|
||||
@ -1769,8 +1769,8 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width)
|
||||
|
||||
FillBitmapRect4Bit(
|
||||
&pixels_data,
|
||||
textPrinter->subPrinter.currentX,
|
||||
textPrinter->subPrinter.currentY,
|
||||
textPrinter->printerTemplate.currentX,
|
||||
textPrinter->printerTemplate.currentY,
|
||||
width,
|
||||
*glyphHeight,
|
||||
gLastTextBgColor);
|
||||
@ -1781,10 +1781,10 @@ u16 Font0Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 0;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 0;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1793,10 +1793,10 @@ u16 Font1Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 1;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 1;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1805,10 +1805,10 @@ u16 Font2Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 2;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 2;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1817,10 +1817,10 @@ u16 Font3Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 3;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 3;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1829,10 +1829,10 @@ u16 Font4Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 4;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 4;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1841,10 +1841,10 @@ u16 Font5Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 5;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 5;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1853,10 +1853,10 @@ u16 Font7Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 7;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 7;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1865,10 +1865,10 @@ u16 Font8Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub;
|
||||
|
||||
if (subStruct->field_1_top == 0)
|
||||
if (subStruct->hasGlyphIdBeenSet == FALSE)
|
||||
{
|
||||
textPrinter->sub_union.sub.font_type = 8;
|
||||
subStruct->field_1_top = 1;
|
||||
textPrinter->sub_union.sub.glyphId = 8;
|
||||
subStruct->hasGlyphIdBeenSet = TRUE;
|
||||
}
|
||||
return RenderText(textPrinter);
|
||||
}
|
||||
@ -1881,8 +1881,8 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
|
||||
subStruct->frames_visible_counter = 0;
|
||||
else
|
||||
{
|
||||
subStruct->field_1_upmid = 0;
|
||||
subStruct->field_1 = 0;
|
||||
subStruct->downArrowYPosIdx = 0;
|
||||
subStruct->downArrowDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1893,17 +1893,17 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
|
||||
|
||||
if (gTextFlags.flag_2 == 0)
|
||||
{
|
||||
if (subStruct->field_1 != 0)
|
||||
if (subStruct->downArrowDelay != 0)
|
||||
{
|
||||
subStruct->field_1 = ((*(u32*)&textPrinter->sub_union.sub) << 19 >> 27) - 1; // convoluted way of getting field_1, necessary to match
|
||||
subStruct->downArrowDelay = ((*(u32*)&textPrinter->sub_union.sub) << 19 >> 27) - 1; // convoluted way of getting downArrowDelay, necessary to match
|
||||
}
|
||||
else
|
||||
{
|
||||
FillWindowPixelRect(
|
||||
textPrinter->subPrinter.windowId,
|
||||
textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor,
|
||||
textPrinter->subPrinter.currentX,
|
||||
textPrinter->subPrinter.currentY,
|
||||
textPrinter->printerTemplate.windowId,
|
||||
textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor,
|
||||
textPrinter->printerTemplate.currentX,
|
||||
textPrinter->printerTemplate.currentY,
|
||||
0x8,
|
||||
0x10);
|
||||
|
||||
@ -1919,20 +1919,20 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
|
||||
}
|
||||
|
||||
BlitBitmapRectToWindow(
|
||||
textPrinter->subPrinter.windowId,
|
||||
textPrinter->printerTemplate.windowId,
|
||||
arrowTiles,
|
||||
0,
|
||||
gDownArrowYCoords[*(u32*)subStruct << 17 >> 30], // subStruct->field_1_upmid but again, stupidly retrieved
|
||||
gDownArrowYCoords[*(u32*)subStruct << 17 >> 30], // subStruct->downArrowYPosIdx but again, stupidly retrieved
|
||||
0x8,
|
||||
0x10,
|
||||
textPrinter->subPrinter.currentX,
|
||||
textPrinter->subPrinter.currentY,
|
||||
textPrinter->printerTemplate.currentX,
|
||||
textPrinter->printerTemplate.currentY,
|
||||
0x8,
|
||||
0x10);
|
||||
CopyWindowToVram(textPrinter->subPrinter.windowId, 0x2);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2);
|
||||
|
||||
subStruct->field_1 = 0x8;
|
||||
subStruct->field_1_upmid = (*(u32*)subStruct << 17 >> 30) + 1;
|
||||
subStruct->downArrowDelay = 0x8;
|
||||
subStruct->downArrowYPosIdx = (*(u32*)subStruct << 17 >> 30) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1940,13 +1940,13 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
|
||||
void TextPrinterClearDownArrow(struct TextPrinter *textPrinter)
|
||||
{
|
||||
FillWindowPixelRect(
|
||||
textPrinter->subPrinter.windowId,
|
||||
textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor,
|
||||
textPrinter->subPrinter.currentX,
|
||||
textPrinter->subPrinter.currentY,
|
||||
textPrinter->printerTemplate.windowId,
|
||||
textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor,
|
||||
textPrinter->printerTemplate.currentX,
|
||||
textPrinter->printerTemplate.currentY,
|
||||
0x8,
|
||||
0x10);
|
||||
CopyWindowToVram(textPrinter->subPrinter.windowId, 0x2);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2);
|
||||
}
|
||||
|
||||
bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
|
||||
@ -2053,15 +2053,15 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
switch (textPrinter->state)
|
||||
{
|
||||
case 0:
|
||||
if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && subStruct->font_type_upper)
|
||||
if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && subStruct->hasPrintBeenSpedUp)
|
||||
textPrinter->delayCounter = 0;
|
||||
|
||||
if (textPrinter->delayCounter && textPrinter->textSpeed)
|
||||
{
|
||||
textPrinter->delayCounter--;
|
||||
if (gTextFlags.flag_0 && (gMain.newKeys & (A_BUTTON | B_BUTTON)))
|
||||
if (gTextFlags.canABSpeedUpPrint && (gMain.newKeys & (A_BUTTON | B_BUTTON)))
|
||||
{
|
||||
subStruct->font_type_upper = 1;
|
||||
subStruct->hasPrintBeenSpedUp = TRUE;
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
return 3;
|
||||
@ -2072,141 +2072,141 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
else
|
||||
textPrinter->delayCounter = textPrinter->textSpeed;
|
||||
|
||||
currChar = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
currChar = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
|
||||
switch (currChar)
|
||||
{
|
||||
case CHAR_NEWLINE:
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.currentY += (gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing);
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY += (gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing);
|
||||
return 2;
|
||||
case PLACEHOLDER_BEGIN:
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_BEGIN:
|
||||
currChar = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
currChar = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
switch (currChar)
|
||||
{
|
||||
case 1: // _08005960
|
||||
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
case 1:
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 2: // _08005982
|
||||
textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
case 2:
|
||||
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 3: // _080059A6
|
||||
textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
case 3:
|
||||
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 4: // _080059C0
|
||||
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
case 4:
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 5: // _08005A0E
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 5:
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 6: //_08005A12
|
||||
subStruct->font_type = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 6:
|
||||
subStruct->glyphId = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 7: // _08005A0A
|
||||
case 7:
|
||||
return 2;
|
||||
case 8: // _08005A2A
|
||||
textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 8:
|
||||
textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
textPrinter->state = 6;
|
||||
return 2;
|
||||
case 9: // _08005A3A
|
||||
case 9:
|
||||
textPrinter->state = 1;
|
||||
if (gTextFlags.flag_2)
|
||||
subStruct->frames_visible_counter = 0;
|
||||
return 3;
|
||||
case 10: // _08005A58
|
||||
case 10:
|
||||
textPrinter->state = 5;
|
||||
return 3;
|
||||
case 11: // _08005A5C
|
||||
currChar = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
currChar |= *textPrinter->subPrinter.current_text_offset << 8;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 11:
|
||||
currChar = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
currChar |= *textPrinter->printerTemplate.currentChar << 8;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
PlayBGM(currChar);
|
||||
return 2;
|
||||
case 12: // _08005B5A
|
||||
currChar = *textPrinter->subPrinter.current_text_offset | 0x100;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 12:
|
||||
currChar = *textPrinter->printerTemplate.currentChar | 0x100;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
break;
|
||||
case 16: // _08005A76
|
||||
currChar = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
currChar |= (*textPrinter->subPrinter.current_text_offset << 8);
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 16:
|
||||
currChar = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
currChar |= (*textPrinter->printerTemplate.currentChar << 8);
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
PlaySE(currChar);
|
||||
return 2;
|
||||
case 13: // _08005A90
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 13:
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 14: // _08005A98
|
||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 14:
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 15: // _08005AA4
|
||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | textPrinter->subPrinter.bgColor << 4);
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y;
|
||||
case 15:
|
||||
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | textPrinter->printerTemplate.bgColor << 4);
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
|
||||
return 2;
|
||||
case 23: // _08005ABE
|
||||
case 23:
|
||||
m4aMPlayStop(&gMPlayInfo_BGM);
|
||||
return 2;
|
||||
case 24: // _08005ACC
|
||||
case 24:
|
||||
m4aMPlayContinue(&gMPlayInfo_BGM);
|
||||
return 2;
|
||||
case 17: // _08005AD8
|
||||
width = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 17:
|
||||
width = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
if (width > 0)
|
||||
{
|
||||
ClearTextSpan(textPrinter, width);
|
||||
textPrinter->subPrinter.currentX += width;
|
||||
textPrinter->printerTemplate.currentX += width;
|
||||
return 0;
|
||||
}
|
||||
return 2;
|
||||
case 18: // _08005AF2
|
||||
textPrinter->subPrinter.currentX = *textPrinter->subPrinter.current_text_offset + textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
case 18:
|
||||
textPrinter->printerTemplate.currentX = *textPrinter->printerTemplate.currentChar + textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 19: // _08005B02
|
||||
case 19:
|
||||
{
|
||||
widthHelper = *textPrinter->subPrinter.current_text_offset;
|
||||
widthHelper += textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
width = widthHelper - textPrinter->subPrinter.currentX;
|
||||
widthHelper = *textPrinter->printerTemplate.currentChar;
|
||||
widthHelper += textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
width = widthHelper - textPrinter->printerTemplate.currentX;
|
||||
if (width > 0)
|
||||
{
|
||||
ClearTextSpan(textPrinter, width);
|
||||
textPrinter->subPrinter.currentX += width;
|
||||
textPrinter->printerTemplate.currentX += width;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 2;
|
||||
case 20: // _08005B26
|
||||
textPrinter->minLetterSpacing = *textPrinter->subPrinter.current_text_offset++;
|
||||
case 20:
|
||||
textPrinter->minLetterSpacing = *textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 21: // _08005B36
|
||||
case 21:
|
||||
textPrinter->japanese = 1;
|
||||
return 2;
|
||||
case 22: // _08005B3E
|
||||
case 22:
|
||||
textPrinter->japanese = 0;
|
||||
return 2;
|
||||
}
|
||||
@ -2220,39 +2220,39 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return 3;
|
||||
case CHAR_SPECIAL_F9:
|
||||
currChar = *textPrinter->subPrinter.current_text_offset | 0x100;
|
||||
textPrinter->subPrinter.current_text_offset++;
|
||||
currChar = *textPrinter->printerTemplate.currentChar | 0x100;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
break;
|
||||
case CHAR_SPECIAL_F8:
|
||||
currChar = *textPrinter->subPrinter.current_text_offset++;
|
||||
gUnknown_03002F90.unk80 = DrawKeypadIcon(textPrinter->subPrinter.windowId, currChar, textPrinter->subPrinter.currentX, textPrinter->subPrinter.currentY);
|
||||
textPrinter->subPrinter.currentX += gUnknown_03002F90.unk80 + textPrinter->subPrinter.letterSpacing;
|
||||
currChar = *textPrinter->printerTemplate.currentChar++;
|
||||
gUnknown_03002F90.unk80 = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY);
|
||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing;
|
||||
return 0;
|
||||
case EOS:
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (subStruct->font_type)
|
||||
switch (subStruct->glyphId)
|
||||
{
|
||||
case 0: // _08005BCC
|
||||
case 0:
|
||||
DecompressGlyphFont0(currChar, textPrinter->japanese);
|
||||
break;
|
||||
case 1: // _08005BDA
|
||||
case 1:
|
||||
DecompressGlyphFont1(currChar, textPrinter->japanese);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5: // _08005BE8
|
||||
case 5:
|
||||
DecompressGlyphFont2(currChar, textPrinter->japanese);
|
||||
break;
|
||||
case 7: // _08005BF6
|
||||
case 7:
|
||||
DecompressGlyphFont7(currChar, textPrinter->japanese);
|
||||
break;
|
||||
case 8: // _08005C04
|
||||
case 8:
|
||||
DecompressGlyphFont8(currChar, textPrinter->japanese);
|
||||
break;
|
||||
case 6: // _08005C10
|
||||
case 6:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2260,20 +2260,20 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
|
||||
if (textPrinter->minLetterSpacing)
|
||||
{
|
||||
textPrinter->subPrinter.currentX += gUnknown_03002F90.unk80;
|
||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80;
|
||||
width = textPrinter->minLetterSpacing - gUnknown_03002F90.unk80;
|
||||
if (width > 0)
|
||||
{
|
||||
ClearTextSpan(textPrinter, width);
|
||||
textPrinter->subPrinter.currentX += width;
|
||||
textPrinter->printerTemplate.currentX += width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (textPrinter->japanese)
|
||||
textPrinter->subPrinter.currentX += (gUnknown_03002F90.unk80 + textPrinter->subPrinter.letterSpacing);
|
||||
textPrinter->printerTemplate.currentX += (gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing);
|
||||
else
|
||||
textPrinter->subPrinter.currentX += gUnknown_03002F90.unk80;
|
||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80;
|
||||
}
|
||||
return 0;
|
||||
case 1:
|
||||
@ -2283,9 +2283,9 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
case 2:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, (textPrinter->subPrinter.bgColor << 4) | textPrinter->subPrinter.bgColor);
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y;
|
||||
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, (textPrinter->printerTemplate.bgColor << 4) | textPrinter->printerTemplate.bgColor);
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
@ -2293,8 +2293,8 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
TextPrinterClearDownArrow(textPrinter);
|
||||
textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->state = 4;
|
||||
}
|
||||
return 3;
|
||||
@ -2305,15 +2305,15 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
int speed = gWindowVerticalScrollSpeeds[scrollSpeed];
|
||||
if (textPrinter->scrollDistance < speed)
|
||||
{
|
||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor);
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor);
|
||||
textPrinter->scrollDistance = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, speed, textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor);
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, speed, textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor);
|
||||
textPrinter->scrollDistance -= speed;
|
||||
}
|
||||
CopyWindowToVram(textPrinter->subPrinter.windowId, 2);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2324,7 +2324,7 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
||||
if (!IsSEPlaying())
|
||||
textPrinter->state = 0;
|
||||
return 3;
|
||||
case 6: // _08005D5A
|
||||
case 6:
|
||||
if (textPrinter->delayCounter != 0)
|
||||
textPrinter->delayCounter--;
|
||||
else
|
||||
|
@ -19,16 +19,16 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
switch (textPrinter->state)
|
||||
{
|
||||
case 0:
|
||||
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->font_type_upper)
|
||||
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp)
|
||||
{
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
if (textPrinter->delayCounter && textPrinter->textSpeed)
|
||||
{
|
||||
textPrinter->delayCounter --;
|
||||
if (gTextFlags.flag_0 && gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||
{
|
||||
sub->font_type_upper = TRUE;
|
||||
sub->hasPrintBeenSpedUp = TRUE;
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
return 3;
|
||||
@ -41,53 +41,53 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
textPrinter->delayCounter = textPrinter->textSpeed;
|
||||
}
|
||||
char_ = *textPrinter->subPrinter.current_text_offset ++;
|
||||
char_ = *textPrinter->printerTemplate.currentChar++;
|
||||
switch (char_)
|
||||
{
|
||||
case EOS:
|
||||
return 1;
|
||||
case CHAR_NEWLINE:
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.currentY += gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||
return 2;
|
||||
case PLACEHOLDER_BEGIN:
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_BEGIN:
|
||||
char_ = *textPrinter->subPrinter.current_text_offset ++;
|
||||
char_ = *textPrinter->printerTemplate.currentChar++;
|
||||
switch (char_)
|
||||
{
|
||||
case 1:
|
||||
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset ++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 2:
|
||||
textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset ++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 3:
|
||||
textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset ++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 4:
|
||||
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.bgColor = *++ textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.shadowColor = *++ textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.bgColor = *++textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.shadowColor = *++textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
|
||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case 5:
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 6:
|
||||
sub->font_type = *textPrinter->subPrinter.current_text_offset;
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
sub->glyphId = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 7:
|
||||
return 2;
|
||||
case 8:
|
||||
textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++;
|
||||
textPrinter->state = 6;
|
||||
return 2;
|
||||
case 9:
|
||||
@ -102,19 +102,19 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
return 3;
|
||||
case 11:
|
||||
case 16:
|
||||
textPrinter->subPrinter.current_text_offset += 2;
|
||||
textPrinter->printerTemplate.currentChar += 2;
|
||||
return 2;
|
||||
case 12:
|
||||
char_ = *++textPrinter->subPrinter.current_text_offset;
|
||||
char_ = *++textPrinter->printerTemplate.currentChar;
|
||||
break;
|
||||
case 13:
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 14:
|
||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case 15:
|
||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
@ -127,15 +127,15 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return 3;
|
||||
case 0xF9:
|
||||
char_ = *textPrinter->subPrinter.current_text_offset ++ | 0x100;
|
||||
char_ = *textPrinter->printerTemplate.currentChar++| 0x100;
|
||||
break;
|
||||
case 0xF8:
|
||||
textPrinter->subPrinter.current_text_offset ++;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 0;
|
||||
}
|
||||
DecompressGlyphFont6(char_);
|
||||
CopyGlyphToWindow(textPrinter);
|
||||
textPrinter->subPrinter.currentX += gUnknown_03002F90.unk80 + textPrinter->subPrinter.letterSpacing;
|
||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing;
|
||||
return 0;
|
||||
case 1:
|
||||
if (TextPrinterWait(textPrinter))
|
||||
@ -146,9 +146,9 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
case 2:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y;
|
||||
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
@ -156,8 +156,8 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
TextPrinterClearDownArrow(textPrinter);
|
||||
textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
|
||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
||||
textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->state = 4;
|
||||
}
|
||||
return 3;
|
||||
@ -166,15 +166,15 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
||||
{
|
||||
if (textPrinter->scrollDistance < sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed])
|
||||
{
|
||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
|
||||
textPrinter->scrollDistance = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4));
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4));
|
||||
textPrinter->scrollDistance -= sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed];
|
||||
}
|
||||
CopyWindowToVram(textPrinter->subPrinter.windowId, 2);
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user